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

Commit f88d513

Browse files
Release updates (#147)
* Version number to 1.11.0 * Opacity-50 on see downloaded models button * Linebreaks configuration as part of the labeling page * Removed progress bar on active learners * Small check on labeling suite manager * Embedding granularity cleaned correctly when switching between platforms * Close modal after bad password * Improvement on placeholders for password protected files * View button opens the modal * Formatting on embedding creation improvement * Added message for bad password and fixed showing deleted projects * Removed last execution section for active learners * Message for wrong password is removed after correct pass * Linebreaks configuration on labeling suite * Updated text in configuration in data browser
1 parent be47fec commit f88d513

File tree

24 files changed

+144
-41
lines changed

24 files changed

+144
-41
lines changed

src/app/base/components/crypted-field/crypted-field.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<div class="relative">
66
<input #pw [type]="show || key.length == 0 ? 'text':'password'" autocomplete="new-password" [value]="key"
77
(input)="setKey($event.target.value)" name="something"
8-
class="input input-sm input-bordered w-full placeholder-italic" placeholder="Enter some key here..."
8+
class="input input-sm input-bordered w-full placeholder-italic" [placeholder]="placeholder"
99
(click)="show?null:pw.type='password'" />
1010
<button (click)="toggleKey()" [disabled]="!key">
1111
<ng-template [ngIf]="!show" [ngIfElse]="eyeOff">

src/app/base/components/crypted-field/crypted-field.component.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { Component, ElementRef, EventEmitter, Input, OnDestroy, Output, ViewChil
88
})
99
export class CryptedFieldComponent implements OnDestroy {
1010
@Input() label: string = 'Password';
11-
@Input() displayOptionalAsText: boolean = false;
11+
@Input() placeholder: string = 'Enter some password here...';
12+
@Input() displayOptionalAsText: boolean = true;
1213
@Output() keyChange = new EventEmitter<string>();
1314

1415
@ViewChild('inputElement') inputElement: ElementRef;

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@
151151
</div>
152152
</ng-template>
153153

154-
<kern-crypted-field (keyChange)="setKey($event)" label="Encrypt zip file with password"
155-
displayOptionalAsText="true"></kern-crypted-field>
154+
<kern-crypted-field (keyChange)="setKey($event)" label="Encrypt zip file with password"></kern-crypted-field>
156155

157156
<div class="mt-2 flex flex-row justify-between">
158157
<div class="h-9">

src/app/base/components/record-display/record-display.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
</ng-template>
1414
<ng-template #noHighlight>
1515
<span
16-
[ngClass]="recordDisplayOptions.dataBrowserModals.configuration.lineBreaks != LineBreaksType.NORMAL ?
16+
[ngClass]="recordDisplayOptions.dataBrowserModals && recordDisplayOptions.dataBrowserModals.configuration.lineBreaks != LineBreaksType.NORMAL ?
1717
(recordDisplayOptions.dataBrowserModals.configuration.lineBreaks == LineBreaksType.IS_PRE_WRAP ? 'whitespace-pre-wrap' : 'whitespace-pre-line') : '' "
1818
*ngIf="record.data[attributes[attribute.key].name] != null && record.data[attributes[attribute.key].name] !== ''; else notPresent">
1919
<span>{{record.data[attributes[attribute.key].name]}}</span>

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

Lines changed: 1 addition & 1 deletion
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.10.0
228+
id="refineryVersion">v1.11.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"

src/app/base/services/record/record-apollo.service.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { map } from 'rxjs/operators';
55
import { queries } from './record-queries';
66
import { mutations } from './record-mutations';
77
import { queries as projectQueries } from '../project/project-queries';
8-
import { labelSourceToString } from '../../enum/graphql-enums';
98
import { ApolloChecker } from '../base/apollo-checker';
109
import { countOccurrences } from 'submodules/javascript-functions/general';
1110

src/app/data/components/data-browser/data-browser.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@ <h1 class="text-lg text-gray-900 mb-2 text-center">Info</h1>
10821082
</div>
10831083
<div class="ml-3 text-sm cursor-pointer" (click)="toggleLineBreaks()">
10841084
<label class="font-medium text-gray-700 cursor-pointer">Visible line breaks</label>
1085-
<p class="text-gray-500">If checked, the attributes in the data-browser
1085+
<p class="text-gray-500">If checked, the attributes in the data-browser and labeling page
10861086
will be shown with line breaks</p>
10871087
</div>
10881088
</div>

src/app/import/components/helpers/upload-types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type UploadOptions = {
2626
* @closeModalOnClick {boolean, optional} - If true, the modal will be closed after the upload is finished
2727
* @tokenizer {string, optional} - Tokenizer used for the upload
2828
* @navigateToProject {boolean, optional} - If true, the user will be redirected to the project after the upload is finished
29+
* @showBadPasswordMsg {boolean, optional} - If true, the user will be shown a message that the password is incorrect
2930
*/
3031
deleteProjectOnFail?: boolean;
3132
reloadOnFinish?: boolean;
@@ -37,6 +38,7 @@ export type UploadOptions = {
3738
closeModalOnClick?: boolean;
3839
tokenizer?: string;
3940
navigateToProject: boolean;
41+
showBadPasswordMsg?: boolean;
4042
};
4143

4244
export type UploadTask = {

src/app/import/components/modal-upload/modal-upload.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ <h1 class="flex flex-grow justify-center text-lg text-gray-900 font-bold">{{titl
1313
reloadOnFinish: uploadOptions.reloadOnFinish,
1414
knowledgeBaseId: uploadFileType == UploadFileType.KNOWLEDGE_BASE ? uploadOptions.knowledgeBaseId : null,
1515
isModal: uploadOptions.isModal,
16-
tokenizer: uploadOptions.tokenizer
17-
}" (fileAttached)="setFile($event)"></kern-upload>
16+
tokenizer: uploadOptions.tokenizer,
17+
showBadPasswordMsg: uploadOptions.showBadPasswordMsg
18+
}" (fileAttached)="setFile($event)" (badPasswordMsg)="setBadPasswordMsg($event)"></kern-upload>
1819
</kern-modal>

src/app/import/components/modal-upload/modal-upload.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export class ModalUploadComponent implements OnInit, OnChanges {
1919

2020
@Output() closeModalEvent = new EventEmitter();
2121
@Output() fileAttached = new EventEmitter<File>();
22+
@Output() badPasswordMsg = new EventEmitter<boolean>();
2223

2324
get UploadFileType(): typeof UploadFileType {
2425
return UploadFileType;
@@ -80,4 +81,8 @@ export class ModalUploadComponent implements OnInit, OnChanges {
8081
}
8182
}
8283
}
84+
85+
setBadPasswordMsg(showBadPassMgs: boolean): void {
86+
this.badPasswordMsg.emit(showBadPassMgs);
87+
}
8388
}

src/app/import/components/upload/upload.component.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
<ng-template [ngIf]="uploadFileType == UploadFileType.PROJECT">
5252
<ng-container *ngTemplateOutlet="upload"></ng-container>
5353
<ng-template *ngTemplateOutlet="cryptedField"></ng-template>
54+
<div *ngIf="uploadOptions.showBadPasswordMsg" class="text-red-700 text-xs mt-2 text-center">Wrong password</div>
5455
</ng-template>
5556

5657
<ng-template [ngIf]="uploadFileType == UploadFileType.KNOWLEDGE_BASE">
@@ -272,6 +273,6 @@ <h3 class="text-sm font-medium text-yellow-800">File required</h3>
272273
</ng-template>
273274

274275
<ng-template #cryptedField>
275-
<kern-crypted-field *ngIf="file && (file.type == zipType || fileEndsWithZip)"
276-
(keyChange)="setKey($event)"></kern-crypted-field>
276+
<kern-crypted-field *ngIf="file && (file.type == zipType || fileEndsWithZip)" (keyChange)="setKey($event)"
277+
placeholder="Enter password if zip file is protected..."></kern-crypted-field>
277278
</ng-template>

src/app/import/components/upload/upload.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class UploadComponent implements OnInit, OnChanges, OnDestroy {
2828

2929
@Output() fileAttached = new EventEmitter<File>();
3030
@Output() refetchProjects = new EventEmitter<boolean>();
31+
@Output() badPasswordMsg = new EventEmitter<boolean>();
3132

3233
get UploadFileType(): typeof UploadFileType {
3334
return UploadFileType;
@@ -135,6 +136,8 @@ export class UploadComponent implements OnInit, OnChanges, OnDestroy {
135136
this.file = files.length > 0 ? files[0] : null;
136137
this.fileEndsWithZip = this.file?.name.endsWith('.zip');
137138
this.fileAttached.emit(this.file);
139+
this.badPasswordMsg.emit(false);
140+
138141
}
139142

140143
onFileInput(event: any): void {

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { LabelSource } from "src/app/base/enum/graphql-enums";
2+
import { LineBreaksType } from "src/app/data/components/data-browser/helper-classes/modals-helper";
23
import { DoBeforeDestroy } from "src/app/util/interfaces";
34
import { enumToArray, transferNestedDict } from "submodules/javascript-functions/general";
45

@@ -19,6 +20,8 @@ export type LabelingSuiteMainSettings = {
1920
autoNextRecord: boolean;
2021
hoverGroupBackgroundColor: string;
2122
hoverGroupBackgroundColorClass: string;
23+
// Special case - line breaks get synchronized with the data browser
24+
lineBreaks: LineBreaksType;
2225
}
2326
export type LabelingSuiteLabelingSettings = {
2427
showNLabelButton: number;
@@ -110,11 +113,20 @@ export class LabelingSuiteSettingManager implements DoBeforeDestroy {
110113
}
111114
}
112115
if (!this.settings.task[this.projectId]) this.settings.task[this.projectId] = {};
116+
this.settings.main.lineBreaks = this.getLineBreakValue();
113117
this.runSettingListeners(ComponentType.ALL);
114118
}
115119

120+
private getLineBreakValue(): LineBreaksType {
121+
// Special case - line breaks get synchronized with the data browser
122+
let lineBreaks = localStorage.getItem("lineBreaks");
123+
if (lineBreaks) return JSON.parse(lineBreaks);
124+
else return LineBreaksType.NORMAL;
125+
}
126+
116127
public saveSettings() {
117128
localStorage.setItem(LabelingSuiteSettingManager.localStorageKey, JSON.stringify(this.settings));
129+
localStorage.setItem("lineBreaks", JSON.stringify(this.settings.main.lineBreaks));
118130
}
119131

120132
public setDefaultSettings() {
@@ -173,6 +185,7 @@ export class LabelingSuiteSettingManager implements DoBeforeDestroy {
173185
autoNextRecord: false,
174186
hoverGroupBackgroundColor: "green",
175187
hoverGroupBackgroundColorClass: "bg-green-100",
188+
lineBreaks: this.getLineBreakValue()
176189
},
177190
overviewTable: {
178191
show: true,

src/app/labeling-suite/main-component/labeling-suite.component.html

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,36 @@ <h1 class="text-lg text-gray-900 mb-2 text-center">Warning</h1>
327327
<ng-container [ngTemplateOutlet]="settingInfo"
328328
[ngTemplateOutletContext]="{dataTip:'Choose a color for the hover effects of the tables'}">
329329
</ng-container>
330+
<span class="" (click)="toggleLineBreaks()">Visible line breaks</span>
331+
<div class="flex items-center h-5">
332+
<input type="checkbox"
333+
class="focus:ring-indigo-500 h-4 w-4 text-indigo-600 border-gray-300 rounded cursor-pointer"
334+
(change)="toggleLineBreaks()"
335+
[checked]="lsm.settingManager.settings.main.lineBreaks != LineBreaksType.NORMAL">
336+
</div>
337+
<ng-container [ngTemplateOutlet]="settingInfo"
338+
[ngTemplateOutletContext]="{dataTip:'If checked, the attributes in the data-browser and labeling page will be shown with line breaks'}">
339+
</ng-container>
340+
<ng-template [ngIf]="lsm.settingManager.settings.main.lineBreaks != LineBreaksType.NORMAL">
341+
<label for="preWrap"
342+
class="ml-3 block text-sm font-medium text-gray-700 cursor-pointer italic">Pre-wrap</label>
343+
<input type="radio"
344+
[checked]="lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_WRAP"
345+
(change)="toggleLineBreaksPreWrap(LineBreaksType.IS_PRE_LINE)" name="lineBreaks" id="preWrap"
346+
class="focus:ring-blue-500 h-6 w-4 text-blue-600 border-gray-200 cursor-pointer">
347+
<ng-container [ngTemplateOutlet]="settingInfo"
348+
[ngTemplateOutletContext]="{dataTip:'Preserves whitespace and line breaks'}">
349+
</ng-container>
350+
<label for="preLine"
351+
class="ml-3 block text-sm font-medium text-gray-700 cursor-pointer italic">Pre-line</label>
352+
<input type="radio"
353+
[checked]="lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_LINE"
354+
(change)="toggleLineBreaksPreWrap(LineBreaksType.IS_PRE_WRAP)" name="lineBreaks" id="preLine"
355+
class="focus:ring-blue-500 h-6 w-4 text-blue-600 border-gray-200 cursor-pointer">
356+
<ng-container [ngTemplateOutlet]="settingInfo"
357+
[ngTemplateOutletContext]="{dataTip:'Collapses multiple whitespaces and line breaks into a single space'}">
358+
</ng-container>
359+
</ng-template>
330360
</div>
331361
</div>
332362
<!--Page TASK_HEADER-->

src/app/labeling-suite/main-component/labeling-suite.component.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { findProjectIdFromRoute } from 'src/app/util/helper-functions';
1111
import { LabelingSuiteManager } from '../helper/manager/manager';
1212
import { ComponentType } from '../helper/manager/settings';
1313
import { UserType } from '../helper/manager/user';
14+
import { LineBreaksType } from 'src/app/data/components/data-browser/helper-classes/modals-helper';
1415

1516
@Component({
1617
selector: 'kern-labeling-suite',
@@ -29,6 +30,9 @@ export class LabelingSuiteComponent implements OnInit, OnDestroy {
2930
//manager
3031
lsm: LabelingSuiteManager;
3132

33+
get LineBreaksType(): typeof LineBreaksType {
34+
return LineBreaksType;
35+
}
3236

3337
constructor(
3438
private router: Router,
@@ -51,6 +55,14 @@ export class LabelingSuiteComponent implements OnInit, OnDestroy {
5155
}
5256
this.lsm = new LabelingSuiteManager(projectId, this, this.activatedRoute, this.router, this.projectApolloService, this.recordApolloService);
5357
this.setUpCommentRequests(projectId);
58+
const checkIfLineBreaks = JSON.parse(localStorage.getItem('lineBreaks'));
59+
if (this.lsm.settingManager) {
60+
if (checkIfLineBreaks) {
61+
this.lsm.settingManager.settings.main.lineBreaks = checkIfLineBreaks;
62+
} else {
63+
localStorage.setItem('lineBreaks', JSON.stringify(this.lsm.settingManager.settings.main.lineBreaks));
64+
}
65+
}
5466
}
5567

5668

@@ -112,5 +124,23 @@ export class LabelingSuiteComponent implements OnInit, OnDestroy {
112124

113125
}
114126

127+
toggleLineBreaks() {
128+
if (this.lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_WRAP || this.lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_LINE) {
129+
this.lsm.settingManager.settings.main.lineBreaks = LineBreaksType.NORMAL;
130+
} else {
131+
this.lsm.settingManager.settings.main.lineBreaks = LineBreaksType.IS_PRE_WRAP;
132+
}
133+
localStorage.setItem('lineBreaks', JSON.stringify(this.lsm.settingManager.settings.main.lineBreaks));
134+
}
135+
136+
toggleLineBreaksPreWrap() {
137+
if (this.lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_WRAP) {
138+
this.lsm.settingManager.settings.main.lineBreaks = LineBreaksType.IS_PRE_LINE;
139+
} else if (this.lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_LINE) {
140+
this.lsm.settingManager.settings.main.lineBreaks = LineBreaksType.IS_PRE_WRAP;
141+
}
142+
localStorage.setItem('lineBreaks', JSON.stringify(this.lsm.settingManager.settings.main.lineBreaks));
143+
}
144+
115145

116146
}

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,8 @@
115115
<div
116116
*ngVar="lsm.recordManager.recordData.baseRecord.data[lVars.taskLookup[attribute.id].attribute.name] as attributeTextData">
117117
<p class="break-words text-sm leading-5 font-normal text-gray-500"
118-
[ngClass]="lineBreaks != LineBreaksType.NORMAL ?
119-
(lineBreaks == LineBreaksType.IS_PRE_WRAP ? 'whitespace-pre-wrap' : 'whitespace-pre-line') : '' "
118+
[ngClass]="lsm.settingManager.settings.main.lineBreaks != LineBreaksType.NORMAL ?
119+
(lsm.settingManager.settings.main.lineBreaks == LineBreaksType.IS_PRE_WRAP ? 'whitespace-pre-wrap' : 'whitespace-pre-line') : '' "
120120
*ngIf="attributeTextData != null && attributeTextData !== '';else notPresentInRecord">
121121
{{attributeTextData}}
122122
</p>
@@ -289,7 +289,7 @@
289289
<div *ngFor="let token of tokenLookup[attributeId].token" class="relative z-10" attr.tokenIdx="{{token.idx}}"
290290
attr.attributeId="{{attributeId}}"
291291
style.margin-bottom="{{tokenLookup[attributeId][token.idx]?.tokenMarginBottom}}"
292-
[ngClass]="[token.countLineBreaks > 0 ?'w-full':'']">
292+
[ngClass]="[token.countLineBreaks > 0 && lsm.settingManager.settings.main.lineBreaks != LineBreaksType.NORMAL ?'w-full':'']">
293293
<ng-template [ngIf]="token.countLineBreaks == 0" [ngIfElse]="newLinesBlock">
294294
<ng-template [ngIf]="token.type" [ngIfElse]="tokenValue">
295295
<div [attr.data-tip]="'spaCy type: ' + token.type" class="tooltip">
@@ -344,14 +344,22 @@
344344
</ng-template>
345345
</ng-template>
346346
<ng-template #newLinesBlock>
347-
<ng-container *ngFor="let item of token.countLineBreaksArray">
348-
<ng-container *ngTemplateOutlet="dummyElementNewLine"></ng-container>
349-
</ng-container>
347+
<ng-template [ngIf]="lsm.settingManager.settings.main.lineBreaks != LineBreaksType.NORMAL"
348+
[ngIfElse]="spaceBlock">
349+
<ng-container *ngFor="let item of token.countLineBreaksArray">
350+
<ng-container *ngTemplateOutlet="dummyElementNewLine"></ng-container>
351+
</ng-container>
352+
</ng-template>
353+
350354
</ng-template>
351355
</div>
352356
</div>
353357
</ng-template>
354358

355359
<ng-template #dummyElementNewLine>
356360
<div><br></div>
361+
</ng-template>
362+
363+
<ng-template #spaceBlock>
364+
&nbsp;
357365
</ng-template>

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component, ElementRef, HostListener, Input, OnChanges, OnDestroy, OnInit, SimpleChanges, ViewChild } from '@angular/core';
1+
import { Component, ElementRef, HostListener, Input, OnChanges, OnDestroy, SimpleChanges, ViewChild } from '@angular/core';
22
import { getLabelSourceOrder, getTaskTypeOrder, InformationSourceReturnType, LabelingTask, LabelSource, UserRole } from 'src/app/base/enum/graphql-enums';
33
import { LabelingSuiteManager, UpdateType } from '../../helper/manager/manager';
44
import { LabelingSuiteRlaPreparator } from '../../helper/manager/recordRla';
@@ -14,7 +14,7 @@ const SWIM_LANE_SIZE_PX = 12;
1414
templateUrl: './labeling.component.html',
1515
styleUrls: ['./labeling.component.scss', '../../main-component/labeling-suite.component.scss'],
1616
})
17-
export class LabelingSuiteLabelingComponent implements OnInit, OnChanges, OnDestroy {
17+
export class LabelingSuiteLabelingComponent implements OnChanges, OnDestroy {
1818

1919
@Input() lsm: LabelingSuiteManager;
2020
userRoleEnum: typeof UserRole = UserRole;
@@ -45,7 +45,6 @@ export class LabelingSuiteLabelingComponent implements OnInit, OnChanges, OnDest
4545
labelAddButtonDisabled: boolean = true;
4646

4747
labelHotkeys: HotkeyLookup;
48-
lineBreaks: LineBreaksType;
4948

5049
//list of prepared rla entries
5150
private fullRlaData: any[];
@@ -82,10 +81,6 @@ export class LabelingSuiteLabelingComponent implements OnInit, OnChanges, OnDest
8281
}
8382
}
8483

85-
ngOnInit(): void {
86-
this.lineBreaks = JSON.parse(localStorage.getItem('lineBreaks'));
87-
}
88-
8984
private displayUserChanged() {
9085
this.canEditLabels = this.lsm.userManager.canEditManualRlas;
9186
this.filterRlaDataForCurrent();

0 commit comments

Comments
 (0)