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

Commit 72ce2c1

Browse files
JWittmeyerlumburovskalinaFelixKirschKern
authored
release updates (#130)
* Change version number * Prevent links on sidebar from opening in another tab * Fixed link for gates in settings page opening in new tab * Removes unnecessary config handler local storage logic * Asume Export fix, adds delete for crowd & annotator race condition fix * Added icon for hiding admin messages * Switch color on text and subtext on users page * Project redirection fix * Tooltip for input attribute next to dropdown * Scroll x on zero-shot removed * Button see installed libraries now fully visible * Added column for zero-shot on downloaded models page * Added auto next record if selected * Adds config check * Added notification for zero-shot on heuristics page * fixes tooltip on min confidence, zero shot run 10 --------- Co-authored-by: Lina <lina.lumburovska@kern.ai> Co-authored-by: FelixKirschKern <felix.kirsch@kern.ai>
1 parent 097b7d0 commit 72ce2c1

File tree

21 files changed

+132
-87
lines changed

21 files changed

+132
-87
lines changed

src/app/app.component.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@
8383
[ngClass]="isOnLabelingPage ? 'bottom-8' : 'bottom-0'">
8484
<div *ngFor="let activeMessage of activeAdminMessages"
8585
class="pointer-events-auto items-center justify-between gap-x-6 py-2.5 mt-2 border px-6 sm:rounded-xl sm:py-3 sm:pr-3.5 sm:pl-4 max-width-message"
86-
[ngClass]="[activeMessage.borderColor, activeMessage.backgroundColor]">
87-
<p class="text-sm leading-6 flex items-center" [ngClass]="activeMessage.textColor">
86+
[ngClass]="[activeMessage.borderColor, activeMessage.backgroundColor, activeMessage.visible ? 'flex': 'hidden']">
87+
<p class="text-sm leading-6 flex flex-row items-center" [ngClass]="activeMessage.textColor">
8888
<svg *ngIf="activeMessage.level == AdminMessageLevel.INFO" xmlns="http://www.w3.org/2000/svg"
8989
class="icon icon-tabler icon-tabler-info-square text-blue-700 inline-block" width="20" height="20"
9090
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
@@ -111,6 +111,15 @@
111111
class="mx-2 inline h-0.5 w-0.5 fill-current" aria-hidden="true">
112112
<circle cx="1" cy="1" r="1" />
113113
</svg>Scheduled for {{activeMessage.displayDate}}
114+
<button type="button" class="-m-1.5 flex-none p-1.5" (click)="closeMessage(activeMessage.id)">
115+
<svg xmlns="http://www.w3.org/2000/svg" [ngClass]="activeMessage.textColor"
116+
class="icon icon-tabler icon-tabler-x" width="20" height="20" viewBox="0 0 24 24" stroke-width="1.5"
117+
stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
118+
<path stroke="none" d="M0 0h24v24H0z" fill="none" />
119+
<line x1="18" y1="6" x2="6" y2="18" />
120+
<line x1="6" y1="6" x2="18" y2="18" />
121+
</svg>
122+
</button>
114123
</p>
115124
</div>
116125
</div>

src/app/app.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewInit {
7777
message.textColor = 'text-' + color + '-700';
7878
message.backgroundColor = 'bg-' + color + '-100';
7979
message.borderColor = 'border-' + color + '-400';
80+
message.visible = true;
8081
return message;
8182
});
8283
}));
@@ -93,7 +94,7 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewInit {
9394
initialRequests() {
9495
CommentDataManager.initManager(this.organizationService);
9596
RouteManager.initRouteManager(this.router, this.organizationService);
96-
this.configService.isManaged().pipe(first()).subscribe((v) => ConfigManager.initConfigManager(this.http, this.configService, v));
97+
this.configService.isManaged().pipe(first()).subscribe((v) => ConfigManager.initConfigManager(this.http, v));
9798
this.configService.isDemo().pipe(first()).subscribe((v) => ConfigManager.setIsDemo(v));
9899
this.configService.isAdmin().pipe(first()).subscribe((v) => ConfigManager.setIsAdmin(v));
99100
this.configService.getBlackWhiteDemo().pipe(first()).subscribe((v) => ConfigManager.setBlackWhiteListDemo(v));
@@ -207,4 +208,8 @@ export class AppComponent implements OnDestroy, OnInit, AfterViewInit {
207208
onNotificationClick(notification) {
208209
NotificationCenterComponent.outlineSelectedNotification(notification.id);
209210
}
211+
212+
closeMessage(id) {
213+
this.activeAdminMessages.find((message) => message.id == id).visible = false;
214+
}
210215
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, Input, OnInit } from '@angular/core';
22
import { Router } from '@angular/router';
3-
import { Project } from 'aws-sdk/clients/codebuild';
43
import { Subscription, timer } from 'rxjs';
4+
import { Project } from '../../entities/project';
55
import { AuthApiService } from '../../services/auth-api.service';
66
import { ConfigManager } from '../../services/config-service';
77
import { createDefaultHeaderModals, HeaderModals } from './header-helper';

src/app/base/components/notification-center/notification-center.component.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,15 @@ export class NotificationCenterComponent implements OnInit, OnDestroy {
144144
}
145145

146146
navigateToProjectPage(notification): void {
147-
this.router.navigate(['projects', notification.projectId, notification.page]);
147+
this.redirectTo('projects/' + notification.projectId + '/' + notification.page);
148148
this.linkClicked.emit(false);
149149
}
150150

151+
redirectTo(uri: string) {
152+
this.router.navigateByUrl('/', { skipLocationChange: true }).then(() =>
153+
this.router.navigate([uri]));
154+
}
155+
151156
switchExpandedState(notification) {
152157
if (this.expandedNotifications.has(notification.id)) {
153158
this.expandedNotifications.delete(notification.id)

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
<label data-tip="Version overview"
226226
(click)="requestVersionOverview(); sideBarPmModals.versionOverview.open = true;"
227227
class="z-50 tooltip tooltip-right cursor-pointer select-none text-white flex items-center"
228-
id="refineryVersion">v1.8.0
228+
id="refineryVersion">v1.9.0
229229
<svg *ngIf="hasUpdates" xmlns="http://www.w3.org/2000/svg" data-tip="Newer version available"
230230
class="icon icon-tabler icon-tabler-alert-circle inline-block text-yellow-700 tooltip tooltip-right align-top ml-1"
231231
width="16" height="16" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor"
@@ -243,20 +243,19 @@
243243
</div>
244244
<div class="fixed left-20 font-dmMono rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 py-2"
245245
style="bottom:60px;z-index:100" id="KernNav" [ngClass]="navHidden?'hidden':null">
246-
<a class="flex flex-col px-4 py-2 hover:bg-gray-100" target="_blank" href="/welcome" rel="noopener noreferrer">
246+
<a class="flex flex-col px-4 py-2 hover:bg-gray-100" href="/welcome">
247247
<div class="flex flex-row flex-nowrap">
248248
<img class="h-6 w-6 tooltip tooltip-right" data-tip="Kern AI" src="assets/platform/kern-icon.png">
249249
<span class="ml-2">cockpit</span>
250250
</div>
251251
</a>
252-
<a class="flex flex-col px-4 py-2 hover:bg-gray-100" target="_blank" href="/gates" rel="noopener noreferrer">
252+
<a class="flex flex-col px-4 py-2 hover:bg-gray-100" href="/gates">
253253
<div class="flex flex-row flex-nowrap">
254254
<img class="h-6 w-6 tooltip tooltip-right" data-tip="Kern AI" src="assets/platform/gates-icon.png">
255255
<span class="ml-2">gates</span>
256256
</div>
257257
</a>
258-
<a class="flex flex-col px-4 py-2 hover:bg-gray-100" target="_blank" href="/workflow/workflows"
259-
rel="noopener noreferrer">
258+
<a class="flex flex-col px-4 py-2 hover:bg-gray-100" href="/workflow/workflows">
260259
<div class="flex flex-row flex-nowrap">
261260
<img class="h-6 w-6 tooltip tooltip-right" data-tip="Kern AI" src="assets/platform/workflow-icon.png">
262261
<span class="ml-2">workflow</span>

src/app/base/services/config-service.ts

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,59 +8,26 @@ export class ConfigManager {
88

99
private static config = null;
1010
private static http: HttpClient;
11-
private static configApolloService: ConfigApolloService;
12-
private static isManaged: boolean = true;//differentation between propriatary or not
11+
private static isManaged: boolean = true;
1312
private static isAdmin: boolean = false;
1413
private static isDemo: boolean = false;
1514
private static blackWhiteListDemo: any;
1615
private static registeredUpdateListeners: Map<Object, () => void> = new Map<Object, () => void>();
17-
private static justUpdated = false;
1816

1917
//needs to be called once from app (because of the http injection)
20-
public static initConfigManager(httpClient: HttpClient, configApolloService: ConfigApolloService, isManaged: boolean) {
18+
public static initConfigManager(httpClient: HttpClient, isManaged: boolean) {
2119
ConfigManager.isManaged = isManaged;
2220
ConfigManager.http = httpClient;
23-
ConfigManager.configApolloService = configApolloService;
2421
ConfigManager.refreshConfig();
2522
}
2623

2724
public static refreshConfig() {
2825
ConfigManager.http.get('/config/base_config').pipe(first()).subscribe((c: string) => {
2926
ConfigManager.config = jsonCopy(c);
30-
ConfigManager.checkAndUpdateLocalStorage(c);
3127
ConfigManager.registeredUpdateListeners.forEach((func, key) => func.call(key));
3228
});
3329
}
3430

35-
private static checkAndUpdateLocalStorage(currentConfig: string) {
36-
//only open source / local can update these values
37-
if (ConfigManager.isManaged) return;
38-
let parsed = currentConfig;
39-
delete parsed["KERN_S3_ENDPOINT"]
40-
currentConfig = JSON.stringify(parsed)
41-
let localStorageConfig = localStorage.getItem("base_config");
42-
if (localStorageConfig) {
43-
parsed = JSON.parse(localStorageConfig);
44-
delete parsed["KERN_S3_ENDPOINT"]
45-
localStorageConfig = JSON.stringify(parsed)
46-
}
47-
let newConfig = true;
48-
if (localStorageConfig && localStorageConfig != currentConfig && !ConfigManager.justUpdated) {
49-
const update = window.confirm("Your local storage has a different set of config values.\nThis can happen if the config service was reinitialized\n\nDo you want to update to the previous version?\n\nNew keys won't be affected.");
50-
if (update) {
51-
ConfigManager.configApolloService.updateConfig(localStorageConfig).pipe(first()).subscribe(o => {
52-
if (!o?.data?.updateConfig) window.alert('something went wrong with the update');
53-
else ConfigManager.justUpdated = true;
54-
});
55-
newConfig = false;
56-
}
57-
}
58-
if (newConfig) {
59-
localStorage.setItem('base_config', currentConfig);
60-
ConfigManager.justUpdated = false;
61-
}
62-
}
63-
6431
public static getConfigValue(key: string, subkey: string = null): string | any {
6532
if (!ConfigManager.config) ConfigManager.refreshConfig();
6633
const value = ConfigManager.config[key];

src/app/config/components/config.component.html

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,40 @@ <h3 class="text-lg leading-6 font-medium text-gray-900">Configuration</h3>
1414
style="grid-template-columns: max-content min-content;">
1515

1616
<div class="text-sm">
17-
<label for="candidates" class="font-medium text-gray-700">Allow data tracking</label>
17+
<label class="font-medium text-gray-700">Allow data tracking</label>
1818
<p class="text-gray-500">We collect few usage statistics to improve the user experience and product.
1919
</p>
2020
</div>
21-
<input #allowTracking class="h-5 w-5" type="checkbox" [checked]='localConfigCopy.allowDataTracking'
21+
<input #allowTracking class="h-5 w-5 cursor-pointer" type="checkbox"
22+
[checked]='localConfigCopy.allowDataTracking'
2223
(click)="checkAndSaveValue(allowTracking.checked,'allow_data_tracking')">
2324
<div class="text-sm">
24-
<label for="candidates" class="font-medium text-gray-700">Max rows</label>
25+
<label class="font-medium text-gray-700">Max rows</label>
2526
<p class="text-gray-500">Maximum number of records per project.</p>
2627
</div>
2728
<input #maxRows tabindex="0" type="number"
2829
class="bg-white text-gray-700 text-xs font-semibold mr-3 px-4 py-2 rounded-md border border-gray-300 w-20 input input-sm"
29-
[value]="organization.maxRows" (focus)="$event.target.select()"
30+
[value]="organization? organization.maxRows:-1" (focus)="$event.target.select()"
3031
(keydown.enter)="checkAndSaveValue(maxRows.value,'limit_checks','max_rows')"
3132
(blur)="checkAndSaveValue(maxRows.value,'limit_checks','max_rows')">
3233

3334
<div class="text-sm">
34-
<label for="candidates" class="font-medium text-gray-700">Max attributes</label>
35+
<label class="font-medium text-gray-700">Max attributes</label>
3536
<p class="text-gray-500">Maximum number of attributes per project.</p>
3637
</div>
3738
<input #maxCols tabindex="0" type="number"
3839
class="bg-white text-gray-700 text-xs font-semibold mr-3 px-4 py-2 rounded-md border border-gray-300 w-20 input input-sm"
39-
[value]="organization.maxCols" (focus)="$event.target.select()"
40+
[value]="organization?organization.maxCols:-1" (focus)="$event.target.select()"
4041
(keydown.enter)="checkAndSaveValue(maxRows.value,'limit_checks','max_cols')"
4142
(blur)="checkAndSaveValue(maxCols.value,'limit_checks','max_cols')">
4243

4344
<div class="text-sm">
44-
<label for="candidates" class="font-medium text-gray-700">Max characters</label>
45+
<label class="font-medium text-gray-700">Max characters</label>
4546
<p class="text-gray-500">Maximum number of characters per record.</p>
4647
</div>
4748
<input #maxChar tabindex="0" type="number"
4849
class="bg-white text-gray-700 text-xs font-semibold mr-3 px-4 py-2 rounded-md border border-gray-300 w-20 input input-sm"
49-
[value]="organization.maxCharCount" (focus)="$event.target.select()"
50+
[value]="organization?organization.maxCharCount:-1" (focus)="$event.target.select()"
5051
(keydown.enter)="checkAndSaveValue(maxRows.value,'limit_checks','max_char_count')"
5152
(blur)="checkAndSaveValue(maxChar.value,'limit_checks','max_char_count')">
5253
<div class="h-full text-sm">

src/app/config/components/config.component.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { first } from 'rxjs/operators';
88
import { OrganizationApolloService } from 'src/app/base/services/organization/organization-apollo.service';
99
import { ProjectApolloService } from 'src/app/base/services/project/project-apollo.service';
1010
import { UserManager } from 'src/app/util/user-manager';
11-
import { getUserAvatarUri } from 'src/app/util/helper-functions';
11+
import { getUserAvatarUri, snakeCaseToCamelCase } from 'src/app/util/helper-functions';
1212

1313
@Component({
1414
selector: 'kern-config',
@@ -75,7 +75,9 @@ export class ConfigComponent implements OnInit, OnDestroy {
7575
}
7676
}
7777
checkAndSaveValue(value: any, key: string, subkey: string = null) {
78-
if (ConfigManager.getConfigValue(key, subkey) == value) return;
78+
if (key == "limit_checks") {
79+
if(Number(value) == this.organization[snakeCaseToCamelCase(subkey)]) return;
80+
} else if (ConfigManager.getConfigValue(key, subkey) == value) return;
7981

8082
const updateDict: any = {};
8183
if (subkey) {

src/app/labeling-suite/helper/manager/task.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { timer } from "rxjs";
12
import { first } from "rxjs/operators";
23
import { UserRole } from "src/app/base/enum/graphql-enums";
34
import { NotificationService } from "src/app/base/services/notification.service";
@@ -52,12 +53,22 @@ export class LabelingSuiteTaskManager implements DoBeforeDestroy {
5253
private fetchLabelingTasks() {
5354
let q, vc;
5455
[q, vc] = this.projectApolloService.getLabelingTasksByProjectId(this.projectId);
55-
vc.pipe(first()).subscribe(lt => {
56-
this.labelingTasks = this.prepareTasksForRole(jsonCopy(lt));
57-
this.filterTasksForAttributeVisibility(false);
58-
this.rebuildLabelButtonAmount();
59-
this.baseManager.runUpdateListeners(UpdateType.LABELING_TASKS);
60-
});
56+
vc.pipe(first()).subscribe(lt => this.prepareTaskData(jsonCopy(lt)));
57+
}
58+
59+
private prepareTaskData(taskData: any[], i = 0) {
60+
this.labelingTasks = this.prepareTasksForRole(taskData);
61+
if (this.labelingTasks == null) {
62+
if (i > 50) {
63+
console.log("error: could not load labeling tasks");
64+
return;
65+
}
66+
timer(100).subscribe(() => this.prepareTaskData(taskData, ++i));
67+
return;
68+
}
69+
this.filterTasksForAttributeVisibility(false);
70+
this.rebuildLabelButtonAmount();
71+
this.baseManager.runUpdateListeners(UpdateType.LABELING_TASKS);
6172
}
6273

6374
public filterTasksForAttributeVisibility(runListener: boolean = true) {
@@ -84,7 +95,7 @@ export class LabelingSuiteTaskManager implements DoBeforeDestroy {
8495
if (this.baseManager.userManager.currentRole != UserRole.ANNOTATOR) return taskData;
8596

8697
const taskId = this.baseManager.sessionManager.getAllowedTaskId();
87-
if (!taskId) return [];
98+
if (!taskId) return null;
8899
else return taskData.filter(t => t.id == taskId);
89100
}
90101

src/app/labeling-suite/sub-components/labeling/labeling.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@
124124
<!-- Classification labels -->
125125
<ng-template [ngIf]="task.task.taskType == 'MULTICLASS_CLASSIFICATION'">
126126
<!--show label buttons-->
127-
<ng-template [ngIf]="canEditLabels || lsm.userManager.currentRole == 'ANNOTATOR'">
127+
<ng-template
128+
[ngIf]="canEditLabels || lsm.userManager.currentRole == 'ANNOTATOR' || lsm.userManager.currentRole == 'EXPERT'">
128129
<div class="flex flex-row flex-wrap gap-2">
129130
<div #labelDiv *ngFor="let label of task.task.displayLabels; let i = index"
130131
class="text-sm font-medium px-2 py-0.5 rounded-md border focus:outline-none cursor-pointer"

src/app/labeling-suite/sub-components/labeling/labeling.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,9 @@ export class LabelingSuiteLabelingComponent implements OnInit, OnChanges, OnDest
563563
if (existingLabels.length == 1) return;
564564
const sourceId = this.lsm.sessionManager.getSourceId();
565565
this.lsm.recordManager.addClassificationLabelToRecord(labelingTaskId, labelId, sourceId);
566+
if (this.lsm.settingManager.settings.main.autoNextRecord) {
567+
this.lsm.nextRecord();
568+
}
566569
}
567570

568571
public deleteRecordLabelAssociation(rlaLabel: any) {

0 commit comments

Comments
 (0)