diff --git a/web/src/app/administration/workbasket/details/access-items/access-items.component.html b/web/src/app/administration/workbasket/details/access-items/access-items.component.html index 127545c40..5b5338ed9 100644 --- a/web/src/app/administration/workbasket/details/access-items/access-items.component.html +++ b/web/src/app/administration/workbasket/details/access-items/access-items.component.html @@ -1,8 +1,8 @@
- - - +
+ '* Access id is required': ''}}" + [@validation]="toogleValidationAccessIdMap.get(index)">
diff --git a/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts b/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts index 7e357a5dc..236b87e10 100644 --- a/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts +++ b/web/src/app/administration/workbasket/details/access-items/access-items.component.spec.ts @@ -49,19 +49,19 @@ describe('AccessItemsComponent', () => { spyOn(workbasketService, 'getWorkBasketAccessItems').and.returnValue(of(new WorkbasketAccessItemsResource( { 'accessItems': new Array( - new WorkbasketAccessItems('id1', '1', 'accessID1', false, false, false, false, false, false, false, false, + new WorkbasketAccessItems('id1', '1', 'accessID1', '', false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false), new WorkbasketAccessItems('id2', '1', 'accessID2')) }, new Links({ 'href': 'someurl' }) ))); spyOn(workbasketService, 'updateWorkBasketAccessItem').and.returnValue(of(true)), spyOn(alertService, 'triggerAlert').and.returnValue(of(true)), - debugElement = fixture.debugElement.nativeElement; - accessIdsService = TestBed.get(AccessIdsService); - spyOn(accessIdsService, 'getAccessItemsInformation').and.returnValue(of(new Array( - 'accessID1', 'accessID2' - ))); - formsValidatorService = TestBed.get(FormsValidatorService); + debugElement = fixture.debugElement.nativeElement; + accessIdsService = TestBed.get(AccessIdsService); + spyOn(accessIdsService, 'getAccessItemsInformation').and.returnValue(of(new Array( + 'accessID1', 'accessID2' + ))); + formsValidatorService = TestBed.get(FormsValidatorService); component.ngOnChanges({ active: new SimpleChange(undefined, 'accessItems', true) }); @@ -96,17 +96,17 @@ describe('AccessItemsComponent', () => { }); it('should show alert successfull after saving', async(() => { - fixture.detectChanges(); - spyOn(formsValidatorService, 'validateFormAccess').and.returnValue(Promise.resolve(true)); - component.onSubmit(); + fixture.detectChanges(); + spyOn(formsValidatorService, 'validateFormAccess').and.returnValue(Promise.resolve(true)); + component.onSubmit(); - fixture.whenStable().then(() => { - fixture.detectChanges(); - expect(alertService.triggerAlert).toHaveBeenCalledWith( - new AlertModel(AlertType.SUCCESS, `Workbasket ${component.workbasket.key} Access items were saved successfully`)); - }) - fixture.detectChanges(); - })); + fixture.whenStable().then(() => { + fixture.detectChanges(); + expect(alertService.triggerAlert).toHaveBeenCalledWith( + new AlertModel(AlertType.SUCCESS, `Workbasket ${component.workbasket.key} Access items were saved successfully`)); + }) + fixture.detectChanges(); + })); it('should keep accessItemsClone length to previous value after clearing the form.', () => { expect(component.accessItemsClone.length).toBe(2); diff --git a/web/src/app/administration/workbasket/details/access-items/access-items.component.ts b/web/src/app/administration/workbasket/details/access-items/access-items.component.ts index 3eb775db5..a073b6641 100644 --- a/web/src/app/administration/workbasket/details/access-items/access-items.component.ts +++ b/web/src/app/administration/workbasket/details/access-items/access-items.component.ts @@ -17,8 +17,8 @@ import { RequestInProgressService } from 'app/services/requestInProgress/request import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service'; import { highlight } from 'app/shared/animations/validation.animation'; import { FormsValidatorService } from 'app/shared/services/forms/forms-validator.service'; +import { AccessIdDefinition } from 'app/models/access-id'; -declare const $: any; @Component({ selector: 'taskana-workbasket-access-items', templateUrl: './access-items.component.html', @@ -67,7 +67,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { setAccessItemsGroups(accessItems: Array) { const AccessItemsFormGroups = accessItems.map(accessItem => this.formBuilder.group(accessItem)); AccessItemsFormGroups.map(accessItemGroup => { - accessItemGroup.controls['accessId'].setValidators(Validators.required); + accessItemGroup.controls['accessId'].setValidators(Validators.required); }); const AccessItemsFormArray = this.formBuilder.array(AccessItemsFormGroups); this.AccessItemsForm.setControl('accessItemsGroups', AccessItemsFormArray); @@ -85,7 +85,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { private requestInProgressService: RequestInProgressService, private customFieldsService: CustomFieldsService, private formBuilder: FormBuilder, - private formsValidatorService: FormsValidatorService) { + private formsValidatorService: FormsValidatorService) { } ngOnChanges(changes: SimpleChanges): void { @@ -124,10 +124,10 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { addAccessItem() { const newForm = this.formBuilder.group( - new WorkbasketAccessItems(undefined, this.workbasket.workbasketId, '', true)); + new WorkbasketAccessItems(undefined, this.workbasket.workbasketId, '', '', true)); newForm.controls['accessId'].setValidators(Validators.required); this.accessItemsGroups.push(newForm); - this.accessItemsClone.push(new WorkbasketAccessItems(undefined, this.workbasket.workbasketId, '', true)); + this.accessItemsClone.push(new WorkbasketAccessItems(undefined, this.workbasket.workbasketId, '', '', true)); } clear() { @@ -148,12 +148,12 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { } onSubmit() { - this.formsValidatorService.formSubmitAttempt = true; - this.formsValidatorService.validateFormAccess(this.accessItemsGroups, this.toogleValidationAccessIdMap).then(value => { - if (value) { - this.onSave(); - } - }); + this.formsValidatorService.formSubmitAttempt = true; + this.formsValidatorService.validateFormAccess(this.accessItemsGroups, this.toogleValidationAccessIdMap).then(value => { + if (value) { + this.onSave(); + } + }); } checkAll(row: number, value: any) { @@ -166,6 +166,11 @@ export class AccessItemsComponent implements OnChanges, OnDestroy { } } + accessItemSelected(accessItem: AccessIdDefinition, row: number) { + this.accessItemsGroups.controls[row].get('accessId').setValue(accessItem.accessId); + this.accessItemsGroups.controls[row].get('accessName').setValue(accessItem.name); + } + private onSave() { this.requestInProgressService.setRequestInProgress(true); this.workbasketService.updateWorkBasketAccessItem(this.accessItemsResource._links.self.href, this.AccessItemsForm.value.accessItemsGroups) diff --git a/web/src/app/administration/workbasket/details/information/workbasket-information.component.html b/web/src/app/administration/workbasket/details/information/workbasket-information.component.html index 4aabd8da3..3f8cee95a 100644 --- a/web/src/app/administration/workbasket/details/information/workbasket-information.component.html +++ b/web/src/app/administration/workbasket/details/information/workbasket-information.component.html @@ -8,7 +8,8 @@ -
-
+
\ No newline at end of file diff --git a/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts b/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts index fdf465415..4766eee49 100644 --- a/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts +++ b/web/src/app/administration/workbasket/details/information/workbasket-information.component.ts @@ -273,15 +273,18 @@ export class WorkbasketInformationComponent private onRemoveConfirmed() { this.requestInProgressService.setRequestInProgress(true); this.workbasketService - .markWorkbasketForDeletion( - this.workbasket._links.self.href - ) + .markWorkbasketForDeletion(this.workbasket._links.self.href) .subscribe( response => { this.requestInProgressService.setRequestInProgress(false); this.workbasketService.triggerWorkBasketSaved(); this.alertService.triggerAlert( - new AlertModel(AlertType.SUCCESS, 'The Workbasket ' + this.workbasket.workbasketId + ' has been marked for deletion') + new AlertModel( + AlertType.SUCCESS, + 'The Workbasket ' + + this.workbasket.workbasketId + + ' has been marked for deletion' + ) ); this.router.navigate(['administration/workbaskets']); }, diff --git a/web/src/app/models/workbasket-access-items.ts b/web/src/app/models/workbasket-access-items.ts index 92b94c586..edc1ca5e9 100644 --- a/web/src/app/models/workbasket-access-items.ts +++ b/web/src/app/models/workbasket-access-items.ts @@ -5,6 +5,7 @@ export class WorkbasketAccessItems { public accessItemId: string = '', public workbasketId: string = '', public accessId: string = '', + public accessName: string = '', public permRead: boolean = false, public permOpen: boolean = false, public permAppend: boolean = false, diff --git a/web/src/app/shared/spinner/spinner.component.scss b/web/src/app/shared/spinner/spinner.component.scss index 472dff29d..489ce83d2 100644 --- a/web/src/app/shared/spinner/spinner.component.scss +++ b/web/src/app/shared/spinner/spinner.component.scss @@ -18,7 +18,7 @@ margin: 0 auto; width: 15%; height: 15%; - background-color: #33b784; + background-color: #36bcee; border-radius: 100%; -webkit-animation: sk-circleBounceDelay 1.2s infinite ease-in-out both; animation: sk-circleBounceDelay 1.2s infinite ease-in-out both; @@ -68,36 +68,47 @@ -ms-transform: rotate(330deg); transform: rotate(330deg); } .sk-circle .sk-circle2:before { + background-color: #35b9ea; -webkit-animation-delay: -1.1s; animation-delay: -1.1s; } .sk-circle .sk-circle3:before { + background-color: #33b0df; -webkit-animation-delay: -1s; animation-delay: -1s; } .sk-circle .sk-circle4:before { + background-color: #36bbed; -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } .sk-circle .sk-circle5:before { + background-color: #46b9cc; -webkit-animation-delay: -0.8s; animation-delay: -0.8s; } .sk-circle .sk-circle6:before { + background-color: #4fbbbd; -webkit-animation-delay: -0.7s; animation-delay: -0.7s; } .sk-circle .sk-circle7:before { + background-color: #51b9b5; -webkit-animation-delay: -0.6s; animation-delay: -0.6s; } .sk-circle .sk-circle8:before { + background-color: #5fbca1; -webkit-animation-delay: -0.5s; animation-delay: -0.5s; } .sk-circle .sk-circle9:before { + background-color: #5db99e; -webkit-animation-delay: -0.4s; animation-delay: -0.4s; } .sk-circle .sk-circle10:before { + background-color: #5ebba0; -webkit-animation-delay: -0.3s; animation-delay: -0.3s; } .sk-circle .sk-circle11:before { + background-color: #5db99e; -webkit-animation-delay: -0.2s; animation-delay: -0.2s; } .sk-circle .sk-circle12:before { + background-color: #5fbba0; -webkit-animation-delay: -0.1s; animation-delay: -0.1s; } diff --git a/web/src/app/shared/type-ahead/type-ahead.component.html b/web/src/app/shared/type-ahead/type-ahead.component.html index 7236f4388..984deabba 100644 --- a/web/src/app/shared/type-ahead/type-ahead.component.html +++ b/web/src/app/shared/type-ahead/type-ahead.component.html @@ -15,14 +15,11 @@ 'disable': disable}" class="wrapper-text" (click)="setTyping(true)">
-
{{dataSource.selected?.name}}
- +
{{dataSource.selected?.accessId}}
@@ -31,13 +28,12 @@ {{dataSource.selected?.name}} -
+ placeholder="{{displayError? placeHolderMessage: ''}}" [@validation]="validationValue" > diff --git a/web/src/app/shared/type-ahead/type-ahead.component.scss b/web/src/app/shared/type-ahead/type-ahead.component.scss index 1404e2351..c46dad7e4 100644 --- a/web/src/app/shared/type-ahead/type-ahead.component.scss +++ b/web/src/app/shared/type-ahead/type-ahead.component.scss @@ -5,14 +5,14 @@ height: 47px; & label { margin-bottom: 0px; - padding-left: 12px; + padding: 0px 12px; font-style: italic; overflow: hidden; } &> div{ &> div { border-bottom: 1px solid $light-grey; - margin-top:6px; + margin-top:3px; padding-left: 12px; min-width: 175px; } @@ -21,7 +21,7 @@ text-overflow: ellipsis; overflow: hidden; white-space: nowrap; - padding-right: 35px; + margin-right: 35px; } } diff --git a/web/src/app/shared/type-ahead/type-ahead.component.ts b/web/src/app/shared/type-ahead/type-ahead.component.ts index 20f76ec62..31e86e019 100644 --- a/web/src/app/shared/type-ahead/type-ahead.component.ts +++ b/web/src/app/shared/type-ahead/type-ahead.component.ts @@ -103,7 +103,7 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor { }).pipe(mergeMap((token: string) => this.getUsersAsObservable(token))); this.accessIdsService.getAccessItemsInformation(this.value).subscribe(items => { if (items.length > 0) { - this.dataSource.selected = items.find(item => item.accessId === this.value); + this.dataSource.selected = items.find(item => item.accessId.toLowerCase() === this.value.toLowerCase()); } }); } @@ -139,12 +139,4 @@ export class TypeAheadComponent implements OnInit, ControlValueAccessor { join(text: string, str: string) { return text.toLocaleLowerCase().split(str).join(`${str}`); } - - clear() { - this.value = null; - this.innerValue = null; - this.dataSource.selected = null - this.onSelect.emit(this.dataSource.selected) - } - }