Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit 235be46

Browse files
author
Johannes Hötter
committed
adds ? to async elements
1 parent c815fd1 commit 235be46

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

src/app/base/components/header/header.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
</a>
8080
</div>
8181

82-
<div *ngIf="user.role == 'ENGINEER'" class="flex items-center justify-center">
82+
<div *ngIf="user?.role == 'ENGINEER'" class="flex items-center justify-center">
8383
<a [routerLink]="['/notification-center']" class="flex mr-6 tooltip tooltip-left"
8484
data-tip="Notification center">
8585
<svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-bell" width="24"
@@ -93,7 +93,7 @@
9393
</svg>
9494
</a>
9595
</div>
96-
<div *ngIf="user.role == 'ENGINEER'" class="flex items-center justify-center">
96+
<div *ngIf="user?.role == 'ENGINEER'" class="flex items-center justify-center">
9797
<div class="widget widget-lg"><a class="btnx" href="https://github.com/code-kern-ai/refinery"
9898
rel="noopener" target="_blank" aria-label="Star code-kern-ai/refinery on GitHub"><svg
9999
viewBox="0 0 16 16" width="16" height="16" class="octicon octicon-star" aria-hidden="true">

src/app/base/components/sidebar-pm/sidebar-pm.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<div>
3434
<div *ngIf="project$ | async as project">
3535
<div *ngIf="project.id !== null"
36-
[ngClass]="user.role == 'ENGINEER' ? 'visible' : 'invisible' ">
36+
[ngClass]="user?.role == 'ENGINEER' ? 'visible' : 'invisible' ">
3737
<div class="flex items-center justify-center overflow-visible mt-10 2xl:mt-12">
3838
<div data-tip="Overview" class="tooltip tooltip-right relative z-50"
3939
[ngClass]="project.numDataScaleUploaded == 0 ? 'opacity-50 cursor-not-allowed pointer-events-none' : 'opacity-100 cursor-pointer'">
@@ -119,7 +119,7 @@
119119
</div>
120120
</div>
121121
</div>
122-
<div [ngClass]="user.role == 'ENGINEER' ? 'visible' : 'invisible' ">
122+
<div [ngClass]="user?.role == 'ENGINEER' ? 'visible' : 'invisible' ">
123123
<div class="flex items-center justify-center overflow-visible mt-6">
124124
<div data-tip="Documentation" class="tooltip tooltip-right relative z-50">
125125
<a href="https://docs.kern.ai/" target="_blank" rel="noopener noreferrer"

src/app/labeling/components/labeling.component.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
name...</label>
2828
<div #labelSearchBlinker class="my-0.5 py-2 w-px"></div>
2929
</div>
30-
<div *ngIf="user.role == 'ENGINEER'" data-tip="Create label" class="tooltip tooltip-left">
30+
<div *ngIf="user?.role == 'ENGINEER'" data-tip="Create label" class="tooltip tooltip-left">
3131
<button class="ml-2 relative top-1" (mouseup)="createLabelFromSearchBox($event)"
3232
[disabled]="disableLabelAddButton()?true: null"
3333
[ngClass]="disableLabelAddButton() ? 'opacity-50 cursor-not-allowed' : 'opacity-100 cursor-pointer'">
@@ -276,7 +276,7 @@ <h1 class="text-lg text-gray-900 mb-2">Warning
276276
<ng-template
277277
[ngIf]="rla.sourceType == LabelSourceType.WEAK_SUPERVISION"
278278
[ngIfElse]="displayCallback">
279-
<div *ngIf="user.role == 'ENGINEER'"
279+
<div *ngIf="user?.role == 'ENGINEER'"
280280
class="text-sm font-medium mr-3 px-2 py-0.5 rounded-md border border-dotted mr-2 pr-0.5 cursor-default"
281281
[ngClass]="[getBackground(rla.labelingTaskLabel.color), getText(rla.labelingTaskLabel.color), getBorder(rla.labelingTaskLabel.color)]">
282282
<svg xmlns="http://www.w3.org/2000/svg"
@@ -304,7 +304,7 @@ <h1 class="text-lg text-gray-900 mb-2">Warning
304304

305305

306306
<ng-template #displayCallback>
307-
<div *ngIf="user.role == 'ENGINEER'"
307+
<div *ngIf="user?.role == 'ENGINEER'"
308308
class="inline-flex items-center text-sm font-medium mr-3 px-2 py-0.5 rounded-md border border-dashed mr-2 pr-2 cursor-default"
309309
[ngClass]="[getBackground(rla.labelingTaskLabel.color), getText(rla.labelingTaskLabel.color), getBorder(rla.labelingTaskLabel.color)]">
310310
<svg xmlns="http://www.w3.org/2000/svg"
@@ -366,7 +366,8 @@ <h1 class="text-lg text-gray-900 mb-2">Warning
366366
</div>
367367

368368
<!-- Information Source Div -->
369-
<ng-template [ngIf]="this.fullRecordData?.id && fullRecordData?.id != 'deleted' && user.role == 'ENGINEER'">
369+
<ng-template
370+
[ngIf]="this.fullRecordData?.id && fullRecordData?.id != 'deleted' && user?.role == 'ENGINEER'">
370371
<!-- Entities Table -->
371372
<ng-template [ngIf]="overviewDisplay.length > 0" [ngIfElse]="nothingToShow">
372373
<div class="flex flex-col p-4">
@@ -468,7 +469,7 @@ <h1 class="text-lg text-gray-900 mb-2">Warning
468469
<div class="flex flex-row flex-nowrap items-center">
469470
<ng-template [ngIf]="isBottom" [ngIfElse]="usersTop">
470471
<div class="flex justify-center overflow-visible">
471-
<div *ngIf="user.role == 'ENGINEER'" data-tip="Delete current record"
472+
<div *ngIf="user?.role == 'ENGINEER'" data-tip="Delete current record"
472473
class="tooltip tooltip-top normal-case font-normal"
473474
[ngClass]="!(this.fullRecordData?.id && this.fullRecordData.id != 'deleted') ? 'cursor-not-allowed': ''">
474475
<label [for]="'my-modal-recordDel'"
@@ -500,7 +501,7 @@ <h1 class="text-lg text-gray-900 mb-2">Delete record</h1>
500501
</div>
501502
</div>
502503
</div>
503-
<div *ngIf="user.role == 'ENGINEER'"
504+
<div *ngIf="user?.role == 'ENGINEER'"
504505
class="ml-20 flex justify-center overflow-visible items-center cursor-pointer"
505506
(click)="toggleInformationSourceSwitch()">
506507
<ng-template [ngIf]="isBottom && fullRecordData?.id != 'deleted'">
@@ -522,7 +523,7 @@ <h1 class="text-lg text-gray-900 mb-2">Delete record</h1>
522523
</div>
523524

524525
<div class="flex justify-center overflow-visible items-center cursor-pointer"
525-
[ngClass]="user.role == 'ENGINEER'?'ml-8':null" (click)="toggleAutoJumpNextRecord()">
526+
[ngClass]="user?.role == 'ENGINEER'?'ml-8':null" (click)="toggleAutoJumpNextRecord()">
526527
<ng-template [ngIf]="isBottom && fullRecordData?.id != 'deleted'">
527528
<label
528529
class="flex-shrink-0 group relative inline-flex items-center justify-center cursor-pointer focus:outline-none"
@@ -559,7 +560,7 @@ <h1 class="text-lg text-gray-900 mb-2">Delete record</h1>
559560
</ng-template>
560561
<div>
561562
<ng-template #usersTop>
562-
<div *ngIf="user.role != 'ENGINEER'" class="flex justify-center overflow-visible">
563+
<div *ngIf="user?.role != 'ENGINEER'" class="flex justify-center overflow-visible">
563564
<div data-tip="Find information about your task"
564565
class="tooltip tooltip-right normal-case font-normal">
565566
<label [for]="'my-modal-information'"
@@ -583,9 +584,9 @@ <h1 class="text-lg text-gray-900 mb-2">Delete record</h1>
583584
<div class="relative mx-auto max-w-lg divide-y-1 divide-gray-200 lg:max-w-7xl">
584585
<div>
585586
<h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
586-
About project "{{project.name}}"</h2>
587+
About project "{{project?.name}}"</h2>
587588
<p class="mt-3 text-xl text-gray-500 sm:mt-4">
588-
{{project.description}}
589+
{{project?.description}}
589590
</p>
590591
</div>
591592
<div class="mt-8 grid gap-16 pt-4 lg:grid-cols-2 lg:gap-x-5 lg:gap-y-12">
@@ -667,7 +668,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
667668
</div>
668669
</div>
669670

670-
<div *ngIf="user.role == 'ENGINEER'" class="flex justify-center overflow-visible">
671+
<div *ngIf="user?.role == 'ENGINEER'" class="flex justify-center overflow-visible">
671672
<div data-tip="Go to the browser" class="tooltip tooltip-bottom relative">
672673
<button [routerLink]="['../../data']"
673674
class="bg-white text-gray-700 text-xs font-semibold mr-3 px-4 py-2 rounded-md border border-gray-300 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
@@ -676,7 +677,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
676677
</div>
677678
</div>
678679

679-
<div *ngIf="user.role == 'ENGINEER'" class="flex justify-center overflow-visible">
680+
<div *ngIf="user?.role == 'ENGINEER'" class="flex justify-center overflow-visible">
680681
<div data-tip="See the programmatic view for your current record"
681682
class="tooltip tooltip-right relative">
682683
<button (click)="goToRecordIde()"
@@ -686,7 +687,7 @@ <h2 class="text-3xl font-bold tracking-tight text-gray-900 sm:text-4xl">
686687
</div>
687688
</div>
688689

689-
<div *ngIf="userIcons && user.role == 'ENGINEER'">
690+
<div *ngIf="userIcons && user?.role == 'ENGINEER'">
690691
<ng-template [ngIf]="userIcons.length <=5" [ngIfElse]="userDropdown">
691692
<div class="flex justify-center overflow-visible">
692693
<div *ngFor="let userIcon of userIcons" [attr.data-tip]="userIcon.name"

src/app/labeling/components/labeling.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ export class LabelingComponent implements OnInit, OnDestroy {
146146
// this.user$ = this.organizationService.getUserInfo();
147147
this.organizationService.getUserInfo().subscribe((user) => {
148148
this.user = user;
149-
console.log("user", user);
150149
});
151150

152151
const sessionId = this.activatedRoute.snapshot.paramMap.get("sessionId");

src/app/projects/components/projects/projects.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@
293293
</div>
294294

295295
<ng-template #buttonsProject>
296-
<div *ngIf="user.role == 'ENGINEER'">
296+
<div *ngIf="user?.role == 'ENGINEER'">
297297
<button [routerLink]="['/projects/new']"
298298
class="bg-blue-700 text-white text-xs font-semibold px-4 py-2.5 rounded-md mt-6 hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500">
299299
New project

src/app/projects/components/projects/projects.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ export class ProjectsComponent implements OnInit, OnDestroy {
286286
}
287287

288288
manageProject(projectId: string, recordsInProject: Number): void {
289-
if (this.user.role == 'ENGINEER') {
289+
if (this.user?.role == 'ENGINEER') {
290290
if (recordsInProject == 0) {
291291
this.router.navigate(['projects', projectId, 'settings']);
292292
} else {

0 commit comments

Comments
 (0)