TSK-464 Make custom fields configurable via .json file
This commit is contained in:
parent
19447510d1
commit
44ec413d94
|
@ -1221,10 +1221,7 @@
|
|||
"boom": {
|
||||
"version": "2.10.1",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz",
|
||||
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=",
|
||||
"requires": {
|
||||
"hoek": "2.16.3"
|
||||
}
|
||||
"integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8="
|
||||
},
|
||||
"bootstrap": {
|
||||
"version": "3.3.7",
|
||||
|
@ -5171,7 +5168,6 @@
|
|||
"requires": {
|
||||
"boom": "2.10.1",
|
||||
"cryptiles": "2.0.5",
|
||||
"hoek": "2.16.3",
|
||||
"sntp": "1.0.9"
|
||||
}
|
||||
},
|
||||
|
@ -5204,9 +5200,10 @@
|
|||
}
|
||||
},
|
||||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz",
|
||||
"integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0="
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-5.0.3.tgz",
|
||||
"integrity": "sha512-Bmr56pxML1c9kU+NS51SMFkiVQAb+9uFfXwyqR2tn4w2FPvmPt65eZ9aCcEfRXd9G74HkZnILC6p967pED4aiw==",
|
||||
"dev": true
|
||||
},
|
||||
"homedir-polyfill": {
|
||||
"version": "1.0.1",
|
||||
|
@ -10007,10 +10004,7 @@
|
|||
"sntp": {
|
||||
"version": "1.0.9",
|
||||
"resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz",
|
||||
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=",
|
||||
"requires": {
|
||||
"hoek": "2.16.3"
|
||||
}
|
||||
"integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg="
|
||||
},
|
||||
"socket.io": {
|
||||
"version": "2.0.4",
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
"karma-jasmine-html-reporter": "0.2.2",
|
||||
"karma-phantomjs-launcher": "1.0.4",
|
||||
"moment": "2.22.1",
|
||||
"hoek": "5.0.3",
|
||||
"ng2-mock-component": "^0.1.1",
|
||||
"protractor": "5.2.2",
|
||||
"ts-mockito": "^2.3.0",
|
||||
|
|
|
@ -102,44 +102,44 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-1" class="control-label">Custom 1</label>
|
||||
<input type="text" class="form-control" id="classification-custom-1" placeholder="Custom 1" [(ngModel)]="classification.custom1"
|
||||
<div *ngIf="custom1Field.visible" class="form-group">
|
||||
<label for="classification-custom-1" class="control-label">{{custom1Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-1" placeholder="{{custom1Field.field}}" [(ngModel)]="classification.custom1"
|
||||
name="classification.custom1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-2" class="control-label">Custom 2</label>
|
||||
<input type="text" class="form-control" id="classification-custom-2" placeholder="Custom 2" [(ngModel)]="classification.custom2"
|
||||
<div *ngIf="custom2Field.visible" class="form-group">
|
||||
<label for="classification-custom-2" class="control-label">{{custom2Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-2" placeholder="{{custom2Field.field}}" [(ngModel)]="classification.custom2"
|
||||
name="classification.custom2">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-3" class="control-label">Custom 3</label>
|
||||
<input type="text" class="form-control" id="classification-custom-3" placeholder="Custom 3" [(ngModel)]="classification.custom3"
|
||||
<div *ngIf="custom3Field.visible" class="form-group">
|
||||
<label for="classification-custom-3" class="control-label">{{custom3Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-3" placeholder="{{custom3Field.field}}" [(ngModel)]="classification.custom3"
|
||||
name="classification.custom3">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-4" class="control-label">Custom 4</label>
|
||||
<input type="text" class="form-control" id="classification-custom-4" placeholder="Custom 4" [(ngModel)]="classification.custom4"
|
||||
<div *ngIf="custom4Field.visible" class="form-group">
|
||||
<label for="classification-custom-4" class="control-label">{{custom4Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-4" placeholder="{{custom4Field.field}}" [(ngModel)]="classification.custom4"
|
||||
name="classification.custom4">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-5" class="control-label">Custom 5</label>
|
||||
<input type="text" class="form-control" id="classification-custom-5" placeholder="Custom 5" [(ngModel)]="classification.custom5"
|
||||
<div *ngIf="custom5Field.visible" class="form-group">
|
||||
<label for="classification-custom-5" class="control-label">{{custom5Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-5" placeholder="{{custom5Field.field}}" [(ngModel)]="classification.custom5"
|
||||
name="classification.custom5">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-6" class="control-label">Custom 6</label>
|
||||
<input type="text" class="form-control" id="classification-custom-6" placeholder="Custom 6" [(ngModel)]="classification.custom6"
|
||||
<div *ngIf="custom6Field.visible" class="form-group">
|
||||
<label for="classification-custom-6" class="control-label">{{custom6Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-6" placeholder="{{custom6Field.field}}" [(ngModel)]="classification.custom6"
|
||||
name="classification.custom6">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-7" class="control-label">Custom 7</label>
|
||||
<input type="text" class="form-control" id="classification-custom-7" placeholder="Custom 7" [(ngModel)]="classification.custom7"
|
||||
<div *ngIf="custom7Field.visible" class="form-group">
|
||||
<label for="classification-custom-7" class="control-label">{{custom7Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-7" placeholder="{{custom7Field.field}}" [(ngModel)]="classification.custom7"
|
||||
name="classification.custom7">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="classification-custom-8" class="control-label">Custom 8</label>
|
||||
<input type="text" class="form-control" id="classification-custom-8" placeholder="Custom 8" [(ngModel)]="classification.custom8"
|
||||
<div *ngIf="custom8Field.visible" class="form-group">
|
||||
<label for="classification-custom-8" class="control-label">{{custom8Field.field}}</label>
|
||||
<input type="text" class="form-control" id="classification-custom-8" placeholder="{{custom8Field.field}}" [(ngModel)]="classification.custom8"
|
||||
name="classification.custom8">
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
box-shadow: none;
|
||||
margin-bottom: 0px;
|
||||
&> .panel-body {
|
||||
height: 80vh;
|
||||
max-height: 80vh;
|
||||
height: 87vh;
|
||||
max-height: 87vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
|||
import { Component } from '@angular/core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { AngularSvgIconModule } from 'angular-svg-icon';
|
||||
import { AppModule } from 'app/app.module'
|
||||
|
||||
import { ClassificationDetailsComponent } from './classification-details.component';
|
||||
import { SpinnerComponent } from 'app/shared/spinner/spinner.component';
|
||||
|
@ -25,7 +26,7 @@ import { ClassificationCategoriesService } from 'app/administration/services/cla
|
|||
// tslint:enable:max-line-length
|
||||
import { DomainServiceMock } from 'app/services/domain/domain.service.mock';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -55,7 +56,8 @@ describe('ClassificationDetailsComponent', () => {
|
|||
TreeService, ClassificationTypesService, ClassificationCategoriesService, {
|
||||
provide: DomainService,
|
||||
useClass: DomainServiceMock
|
||||
}]
|
||||
},
|
||||
CustomFieldsService]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -21,6 +21,7 @@ import { ClassificationTypesService } from 'app/administration/services/classifi
|
|||
import { ClassificationCategoriesService } from 'app/administration/services/classification-categories-service/classification-categories.service';
|
||||
// tslint:enable:max-line-length
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { CustomFieldsService } from '../../../services/custom-fields/custom-fields.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-classification-details',
|
||||
|
@ -38,6 +39,15 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
requestInProgress = false;
|
||||
categories: Array<string> = [];
|
||||
categorySelected: string;
|
||||
custom1Field = this.customFieldsService.getCustomField('Custom 1', 'classifications.information.custom1');
|
||||
custom2Field = this.customFieldsService.getCustomField('Custom 2', 'classifications.information.custom2');
|
||||
custom3Field = this.customFieldsService.getCustomField('Custom 3', 'classifications.information.custom3');
|
||||
custom4Field = this.customFieldsService.getCustomField('Custom 4', 'classifications.information.custom4');
|
||||
custom5Field = this.customFieldsService.getCustomField('Custom 5', 'classifications.information.custom5');
|
||||
custom6Field = this.customFieldsService.getCustomField('Custom 6', 'classifications.information.custom6');
|
||||
custom7Field = this.customFieldsService.getCustomField('Custom 7', 'classifications.information.custom7');
|
||||
custom8Field = this.customFieldsService.getCustomField('Custom 8', 'classifications.information.custom8');
|
||||
|
||||
private action: any;
|
||||
private classificationServiceSubscription: Subscription;
|
||||
private classificationSelectedSubscription: Subscription;
|
||||
|
@ -59,7 +69,8 @@ export class ClassificationDetailsComponent implements OnInit, OnDestroy {
|
|||
private treeService: TreeService,
|
||||
private classificationTypeService: ClassificationTypesService,
|
||||
private categoryService: ClassificationCategoriesService,
|
||||
private domainService: DomainService) { }
|
||||
private domainService: DomainService,
|
||||
private customFieldsService: CustomFieldsService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.classificationTypeService.getClassificationTypes().subscribe((classificationTypes: Array<string>) => {
|
||||
|
|
|
@ -20,18 +20,18 @@
|
|||
<th>Append</th>
|
||||
<th>Transfer</th>
|
||||
<th>Distribute</th>
|
||||
<th>Custom1</th>
|
||||
<th>Custom2</th>
|
||||
<th>Custom3</th>
|
||||
<th>Custom4</th>
|
||||
<th>Custom5</th>
|
||||
<th>Custom6</th>
|
||||
<th>Custom7</th>
|
||||
<th>Custom8</th>
|
||||
<th>Custom9</th>
|
||||
<th>Custom10</th>
|
||||
<th>Custom11</th>
|
||||
<th>Custom12</th>
|
||||
<th *ngIf="custom1Field.visible">{{custom1Field.field}}</th>
|
||||
<th *ngIf="custom2Field.visible">{{custom2Field.field}}</th>
|
||||
<th *ngIf="custom3Field.visible">{{custom3Field.field}}</th>
|
||||
<th *ngIf="custom4Field.visible">{{custom4Field.field}}</th>
|
||||
<th *ngIf="custom5Field.visible">{{custom5Field.field}}</th>
|
||||
<th *ngIf="custom6Field.visible">{{custom6Field.field}}</th>
|
||||
<th *ngIf="custom7Field.visible">{{custom7Field.field}}</th>
|
||||
<th *ngIf="custom8Field.visible">{{custom8Field.field}}</th>
|
||||
<th *ngIf="custom9Field.visible">{{custom9Field.field}}</th>
|
||||
<th *ngIf="custom10Field.visible">{{custom10Field.field}}</th>
|
||||
<th *ngIf="custom11Field.visible">{{custom11Field.field}}</th>
|
||||
<th *ngIf="custom12Field.visible">{{custom12Field.field}}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -64,40 +64,40 @@
|
|||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permDistribute !== accessItem.permDistribute)}">
|
||||
<input type="checkbox" name="accessItem.permDistribute-{{index}}" [(ngModel)]="accessItem.permDistribute">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom1 !== accessItem.permCustom1)}">
|
||||
<td *ngIf="custom1Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom1 !== accessItem.permCustom1)}">
|
||||
<input type="checkbox" name="accessItem.permCustom1-{{index}}" [(ngModel)]="accessItem.permCustom1">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom2 !== accessItem.permCustom2)}">
|
||||
<td *ngIf="custom2Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom2 !== accessItem.permCustom2)}">
|
||||
<input type="checkbox" name="accessItem.permCustom2-{{index}}" [(ngModel)]="accessItem.permCustom2">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom3 !== accessItem.permCustom3)}">
|
||||
<td *ngIf="custom3Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom3 !== accessItem.permCustom3)}">
|
||||
<input type="checkbox" name="accessItem.permCustom3-{{index}}" [(ngModel)]="accessItem.permCustom3">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom4 !== accessItem.permCustom4)}">
|
||||
<td *ngIf="custom4Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom4 !== accessItem.permCustom4)}">
|
||||
<input type="checkbox" name="accessItem.permCustom4-{{index}}" [(ngModel)]="accessItem.permCustom4">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom5 !== accessItem.permCustom5)}">
|
||||
<td *ngIf="custom5Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom5 !== accessItem.permCustom5)}">
|
||||
<input type="checkbox" name="accessItem.permCustom5-{{index}}" [(ngModel)]="accessItem.permCustom5">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom6 !== accessItem.permCustom6)}">
|
||||
<td *ngIf="custom6Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom6 !== accessItem.permCustom6)}">
|
||||
<input type="checkbox" name="accessItem.permCustom6-{{index}}" [(ngModel)]="accessItem.permCustom6">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom7 !== accessItem.permCustom7)}">
|
||||
<td *ngIf="custom7Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom7 !== accessItem.permCustom7)}">
|
||||
<input type="checkbox" name="accessItem.permCustom7-{{index}}" [(ngModel)]="accessItem.permCustom7">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom8 !== accessItem.permCustom8)}">
|
||||
<td *ngIf="custom8Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom8 !== accessItem.permCustom8)}">
|
||||
<input type="checkbox" name="accessItem.permCustom8-{{index}}" [(ngModel)]="accessItem.permCustom8">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom9 !== accessItem.permCustom9)}">
|
||||
<td *ngIf="custom9Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom9 !== accessItem.permCustom9)}">
|
||||
<input type="checkbox" name="accessItem.permCustom9-{{index}}" [(ngModel)]="accessItem.permCustom9">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom10 !== accessItem.permCustom10)}">
|
||||
<td *ngIf="custom10Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom10 !== accessItem.permCustom10)}">
|
||||
<input type="checkbox" name="accessItem.permCustom10-{{index}}" [(ngModel)]="accessItem.permCustom10">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom11 !== accessItem.permCustom11)}">
|
||||
<td *ngIf="custom11Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom11 !== accessItem.permCustom11)}">
|
||||
<input type="checkbox" name="accessItem.permCustom11-{{index}}" [(ngModel)]="accessItem.permCustom11">
|
||||
</td>
|
||||
<td [ngClass]="{'has-changes': (accessItemsClone[index].permCustom12 !== accessItem.permCustom12)}">
|
||||
<td *ngIf="custom12Field.visible" [ngClass]="{'has-changes': (accessItemsClone[index].permCustom12 !== accessItem.permCustom12)}">
|
||||
<input type="checkbox" name="accessItem.permCustom12-{{index}}" [(ngModel)]="accessItem.permCustom12">
|
||||
</td>
|
||||
</tr>
|
||||
|
@ -112,5 +112,5 @@
|
|||
Add new access
|
||||
</button>
|
||||
<taskana-spinner [isRunning]="requestInProgress" [positionClass]=""></taskana-spinner>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -24,6 +24,7 @@ import { AlertService } from 'app/services/alert/alert.service';
|
|||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { DomainServiceMock } from 'app/services/domain/domain.service.mock';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
||||
describe('AccessItemsComponent', () => {
|
||||
let component: AccessItemsComponent;
|
||||
|
@ -38,7 +39,8 @@ describe('AccessItemsComponent', () => {
|
|||
{
|
||||
provide: DomainService,
|
||||
useClass: DomainServiceMock
|
||||
}]
|
||||
},
|
||||
CustomFieldsService]
|
||||
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -13,6 +13,8 @@ import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
|||
import { WorkbasketService } from 'app/administration/services/workbasket/workbasket.service';
|
||||
import { AlertService } from 'app/services/alert/alert.service';
|
||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { TitlesService } from 'app/services/titles/titles.service';
|
||||
import { CustomFieldsService } from '../../../../services/custom-fields/custom-fields.service';
|
||||
|
||||
declare var $: any;
|
||||
|
||||
|
@ -32,6 +34,19 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
active: string;
|
||||
badgeMessage = '';
|
||||
|
||||
custom1Field = this.customFieldService.getCustomField('Custom 1', 'workbaskets.access-items.custom1');
|
||||
custom2Field = this.customFieldService.getCustomField('Custom 2', 'workbaskets.access-items.custom2');
|
||||
custom3Field = this.customFieldService.getCustomField('Custom 3', 'workbaskets.access-items.custom3');
|
||||
custom4Field = this.customFieldService.getCustomField('Custom 4', 'workbaskets.access-items.custom4');
|
||||
custom5Field = this.customFieldService.getCustomField('Custom 5', 'workbaskets.access-items.custom5');
|
||||
custom6Field = this.customFieldService.getCustomField('Custom 6', 'workbaskets.access-items.custom6');
|
||||
custom7Field = this.customFieldService.getCustomField('Custom 7', 'workbaskets.access-items.custom7');
|
||||
custom8Field = this.customFieldService.getCustomField('Custom 8', 'workbaskets.access-items.custom8');
|
||||
custom9Field = this.customFieldService.getCustomField('Custom 9', 'workbaskets.access-items.custom9');
|
||||
custom10Field = this.customFieldService.getCustomField('Custom 10', 'workbaskets.access-items.custom10');
|
||||
custom11Field = this.customFieldService.getCustomField('Custom 11', 'workbaskets.access-items.custom11');
|
||||
custom12Field = this.customFieldService.getCustomField('Custom 12', 'workbaskets.access-items.custom12');
|
||||
|
||||
accessItemsResource: WorkbasketAccessItemsResource;
|
||||
accessItems: Array<WorkbasketAccessItems>;
|
||||
accessItemsClone: Array<WorkbasketAccessItems>;
|
||||
|
@ -49,7 +64,8 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
private alertService: AlertService,
|
||||
private errorModalService: ErrorModalService,
|
||||
private savingWorkbaskets: SavingWorkbasketService,
|
||||
private requestInProgressService: RequestInProgressService) { }
|
||||
private requestInProgressService: RequestInProgressService,
|
||||
private customFieldService: CustomFieldsService) { }
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
if (!this.initialized && changes.active && changes.active.currentValue === 'accessItems') {
|
||||
|
@ -108,7 +124,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
|||
this.accessItemsResetClone = this.cloneAccessItems(this.accessItems);
|
||||
this.alertService.triggerAlert(new AlertModel(
|
||||
AlertType.SUCCESS, `Workbasket ${this.workbasket.name} Access items were saved successfully`));
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
this.requestInProgressService.setRequestInProgress(false);
|
||||
return true;
|
||||
}, error => {
|
||||
this.errorModalService.triggerError(new ErrorModel(`There was error while saving your workbasket's access items`, error))
|
||||
|
|
|
@ -88,21 +88,22 @@
|
|||
<label for="wb-org-level-4" class="control-label">OrgLevel 4</label>
|
||||
<input type="text" class="form-control" id="wb-org-level-4" placeholder="OrgLevel 4" [(ngModel)]="workbasket.orgLevel4" name="workbasket.orgLevel4">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wb-custom-1" class="control-label">Custom 1</label>
|
||||
<input type="text" class="form-control" id="wb-custom-1" placeholder="Custom 1" [(ngModel)]="workbasket.custom1" name="workbasket.custom1">
|
||||
<div *ngIf="custom1Field.visible" class="form-group">
|
||||
<label for="wb-custom-1" class="control-label">{{custom1Field.field}}</label>
|
||||
<input type="text" class="form-control" id="wb-custom-1" [placeholder]="custom1Field.field" [(ngModel)]="workbasket.custom1"
|
||||
name="workbasket.custom1">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wb-custom-2" class="control-label">Custom 2</label>
|
||||
<input type="text" class="form-control" id="wb-custom-2" placeholder="Custom 2" [(ngModel)]="workbasket.custom2" name="workbasket.custom2">
|
||||
<div *ngIf="custom2Field.visible" class="form-group">
|
||||
<label for="wb-custom-2" class="control-label">{{custom2Field.field}}</label>
|
||||
<input type="text" class="form-control" id="wb-custom-2" [placeholder]="custom2Field.field" [(ngModel)]="workbasket.custom2" name="workbasket.custom2">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wb-custom-3" class="control-label">Custom 3</label>
|
||||
<input type="text" class="form-control" id="wb-custom-3" placeholder="Custom 3" [(ngModel)]="workbasket.custom3" name="workbasket.custom3">
|
||||
<div *ngIf="custom3Field.visible" class="form-group">
|
||||
<label for="wb-custom-3" class="control-label">{{custom3Field.field}}</label>
|
||||
<input type="text" class="form-control" id="wb-custom-3" [placeholder]="custom3Field.field" [(ngModel)]="workbasket.custom3" name="workbasket.custom3">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="wb-custom-4" class="control-label">Custom 4</label>
|
||||
<input type="text" class="form-control" id="wb-custom-4" placeholder="Custom 4" [(ngModel)]="workbasket.custom4" name="workbasket.custom4">
|
||||
<div *ngIf="custom4Field.visible" class="form-group">
|
||||
<label for="wb-custom-4" class="control-label">{{custom4Field.field}}</label>
|
||||
<input type="text" class="form-control" id="wb-custom-4" [placeholder]="custom4Field.field" [(ngModel)]="workbasket.custom4" name="workbasket.custom4">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -9,6 +9,7 @@ import { RouterTestingModule } from '@angular/router/testing';
|
|||
import { Observable } from 'rxjs/Observable';
|
||||
import { Component } from '@angular/core';
|
||||
import { Routes } from '@angular/router';
|
||||
import { AppModule } from 'app/app.module'
|
||||
|
||||
import { Workbasket } from 'app/models/workbasket';
|
||||
import { ICONTYPES } from 'app/models/type';
|
||||
|
@ -27,6 +28,7 @@ import { AlertService } from 'app/services/alert/alert.service';
|
|||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { DomainServiceMock } from 'app/services/domain/domain.service.mock';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-dummy-detail',
|
||||
|
@ -49,12 +51,17 @@ describe('InformationComponent', () => {
|
|||
TestBed.configureTestingModule({
|
||||
declarations: [WorkbasketInformationComponent, IconTypeComponent, MapValuesPipe,
|
||||
RemoveNoneTypePipe, SpinnerComponent, GeneralMessageModalComponent, DummyDetailComponent],
|
||||
imports: [FormsModule, AngularSvgIconModule, HttpClientModule, HttpModule, RouterTestingModule.withRoutes(routes)],
|
||||
imports: [FormsModule,
|
||||
AngularSvgIconModule,
|
||||
HttpClientModule,
|
||||
HttpModule,
|
||||
RouterTestingModule.withRoutes(routes)],
|
||||
providers: [WorkbasketService, AlertService, SavingWorkbasketService, ErrorModalService, RequestInProgressService,
|
||||
{
|
||||
provide: DomainService,
|
||||
useClass: DomainServiceMock
|
||||
}]
|
||||
},
|
||||
CustomFieldsService]
|
||||
|
||||
})
|
||||
.compileComponents();
|
||||
|
|
|
@ -16,13 +16,16 @@ import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
|||
import { SavingWorkbasketService, SavingInformation } from 'app/administration/services/saving-workbaskets/saving-workbaskets.service';
|
||||
import { WorkbasketService } from 'app/administration/services/workbasket/workbasket.service';
|
||||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { TitlesService } from 'app/services/titles/titles.service';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
||||
@Component({
|
||||
selector: 'taskana-workbasket-information',
|
||||
templateUrl: './workbasket-information.component.html',
|
||||
styleUrls: ['./workbasket-information.component.scss']
|
||||
})
|
||||
export class WorkbasketInformationComponent implements OnChanges, OnDestroy {
|
||||
export class WorkbasketInformationComponent implements OnInit, OnChanges, OnDestroy {
|
||||
|
||||
|
||||
@Input()
|
||||
workbasket: Workbasket;
|
||||
|
@ -34,6 +37,11 @@ export class WorkbasketInformationComponent implements OnChanges, OnDestroy {
|
|||
requestInProgress = false;
|
||||
badgeMessage = '';
|
||||
|
||||
custom1Field = this.customFieldsService.getCustomField('Custom 1', 'workbaskets.information.custom1');
|
||||
custom2Field = this.customFieldsService.getCustomField('Custom 2', 'workbaskets.information.custom2');
|
||||
custom3Field = this.customFieldsService.getCustomField('Custom 3', 'workbaskets.information.custom3');
|
||||
custom4Field = this.customFieldsService.getCustomField('Custom 4', 'workbaskets.information.custom4');
|
||||
|
||||
|
||||
private workbasketSubscription: Subscription;
|
||||
private routeSubscription: Subscription;
|
||||
|
@ -44,10 +52,15 @@ export class WorkbasketInformationComponent implements OnChanges, OnDestroy {
|
|||
private router: Router,
|
||||
private errorModalService: ErrorModalService,
|
||||
private savingWorkbasket: SavingWorkbasketService,
|
||||
private requestInProgressService: RequestInProgressService) {
|
||||
private requestInProgressService: RequestInProgressService,
|
||||
private customFieldsService: CustomFieldsService) {
|
||||
this.allTypes = IconTypeComponent.allTypes;
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
this.workbasketClone = { ...this.workbasket };
|
||||
if (this.action === ACTION.CREATE) {
|
||||
|
@ -55,7 +68,6 @@ export class WorkbasketInformationComponent implements OnChanges, OnDestroy {
|
|||
} else if (this.action === ACTION.COPY) {
|
||||
this.badgeMessage = `Copying workbasket: ${this.workbasket.key}`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
selectType(type: ICONTYPES) {
|
||||
|
|
|
@ -41,7 +41,7 @@ import { ErrorModalService } from 'app/services/errorModal/error-modal.service';
|
|||
import { RequestInProgressService } from 'app/services/requestInProgress/request-in-progress.service';
|
||||
import { DomainService } from 'app/services/domain/domain.service';
|
||||
import { DomainServiceMock } from 'app/services/domain/domain.service.mock';
|
||||
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
@Component({
|
||||
selector: 'taskana-filter',
|
||||
template: ''
|
||||
|
@ -83,7 +83,8 @@ describe('WorkbasketDetailsComponent', () => {
|
|||
AlertService, SavingWorkbasketService, {
|
||||
provide: DomainService,
|
||||
useClass: DomainServiceMock
|
||||
}]
|
||||
},
|
||||
CustomFieldsService]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
|
|
@ -30,6 +30,8 @@ import { StartupService } from 'app/services/startup-service/startup.service';
|
|||
import { AlertService } from 'app/services/alert/alert.service';
|
||||
import { MasterAndDetailService } from 'app/services/masterAndDetail/master-and-detail.service';
|
||||
import { TreeService } from 'app/services/tree/tree.service';
|
||||
import { TitlesService } from 'app/services/titles/titles.service';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
||||
|
||||
/**
|
||||
|
@ -95,7 +97,9 @@ export function startupServiceFactory(startupService: StartupService): Function
|
|||
AlertService,
|
||||
PermissionService,
|
||||
MasterAndDetailService,
|
||||
TreeService
|
||||
TreeService,
|
||||
TitlesService,
|
||||
CustomFieldsService
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
|
||||
export class CustomField {
|
||||
constructor(
|
||||
public visible: boolean,
|
||||
public field: string) {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { CustomFieldsService } from './custom-fields.service';
|
||||
|
||||
describe('CustomFieldsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [CustomFieldsService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([CustomFieldsService], (service: CustomFieldsService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
|
@ -0,0 +1,37 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
import { CustomField } from '../../models/customField';
|
||||
|
||||
@Injectable()
|
||||
export class CustomFieldsService {
|
||||
private customizedFields: any = {};
|
||||
constructor() { }
|
||||
|
||||
initCustomFields(language: string = 'EN', jsonFile: any) {
|
||||
this.customizedFields = jsonFile.customizedFields[language];
|
||||
}
|
||||
|
||||
getCustomField(fallbacktext: string, customPath: string = undefined): CustomField {
|
||||
if (!customPath) {
|
||||
return new CustomField(true, fallbacktext)
|
||||
}
|
||||
return this.jsonPath(customPath, fallbacktext);
|
||||
}
|
||||
|
||||
private jsonPath(path: string, fallbacktext: string): CustomField {
|
||||
if (!this.customizedFields) {
|
||||
return undefined;
|
||||
};
|
||||
const paths = path.split('.');
|
||||
let value = this.customizedFields;
|
||||
paths.every(element => {
|
||||
value = value[element];
|
||||
if (!value) {
|
||||
value = new CustomField(true, fallbacktext);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
|
@ -3,21 +3,25 @@ import { HttpClient } from '@angular/common/http';
|
|||
import { CanActivate } from '@angular/router';
|
||||
import { environment } from 'app/../environments/environment';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { TitlesService } from 'app/services/titles/titles.service';
|
||||
import { CustomFieldsService } from 'app/services/custom-fields/custom-fields.service';
|
||||
|
||||
@Injectable()
|
||||
export class StartupService {
|
||||
constructor(private httpClient: HttpClient) { }
|
||||
constructor(
|
||||
private httpClient: HttpClient,
|
||||
private titlesService: TitlesService,
|
||||
private customFieldsService: CustomFieldsService) { }
|
||||
load(): Promise<any> {
|
||||
return this.loadEnvironment();
|
||||
}
|
||||
|
||||
private loadEnvironment() {
|
||||
return this.httpClient.get<any>('environments/data-sources/environment-information.json').map(jsonFile => {
|
||||
if (jsonFile) {
|
||||
environment.taskanaWorkplaceUrl = jsonFile.taskanaWorkplaceUrl === '' ?
|
||||
environment.taskanaWorkplaceUrl : jsonFile.taskanaWorkplaceUrl;
|
||||
environment.taskanaAdminUrl = jsonFile.taskanaAdminUrl === '' ?
|
||||
environment.taskanaAdminUrl : jsonFile.taskanaAdminUrl;
|
||||
environment.taskanaMonitorUrl = jsonFile.taskanaMonitorUrl === '' ?
|
||||
environment.taskanaMonitorUrl : jsonFile.taskanaMonitorUrl;
|
||||
environment.taskanaRestUrl = jsonFile.taskanaRestUrl === '' ?
|
||||
environment.taskanaRestUrl : jsonFile.taskanaRestUrl;
|
||||
this.customFieldsService.initCustomFields('EN', jsonFile);
|
||||
}
|
||||
}).toPromise()
|
||||
.catch(() => {
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
import { TestBed, inject } from '@angular/core/testing';
|
||||
|
||||
import { TitlesService } from './titles.service';
|
||||
|
||||
describe('TitlesService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [TitlesService]
|
||||
});
|
||||
});
|
||||
|
||||
it('should be created', inject([TitlesService], (service: TitlesService) => {
|
||||
expect(service).toBeTruthy();
|
||||
}));
|
||||
});
|
|
@ -0,0 +1,18 @@
|
|||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class TitlesService {
|
||||
|
||||
titles = new Map<number, string>();
|
||||
customizedTitles: any = {};
|
||||
constructor() { }
|
||||
|
||||
initTitles(language: string = 'EN', jsonFile: any) {
|
||||
this.titles = jsonFile.titles[language];
|
||||
}
|
||||
|
||||
getTitle(id: number, fallBacktext: string, customPath: string = undefined) {
|
||||
|
||||
return this.titles[id] ? this.titles[id] : fallBacktext
|
||||
}
|
||||
}
|
|
@ -23,6 +23,7 @@ import { SpreadNumberPipe } from './pipes/spreadNumber/spread-number';
|
|||
import { OrderBy } from './pipes/orderBy/orderBy';
|
||||
import { MapToIterable } from './pipes/mapToIterable/mapToIterable';
|
||||
|
||||
|
||||
const MODULES = [
|
||||
CommonModule,
|
||||
FormsModule,
|
||||
|
|
|
@ -1,6 +1,53 @@
|
|||
{
|
||||
"taskanaAdminUrl": "",
|
||||
"taskanaWorkplaceUrl": "",
|
||||
"taskanaMonitorUrl": "",
|
||||
"taskanaRestUrl": ""
|
||||
}
|
||||
"taskanaRestUrl": "",
|
||||
"customizedFields": {
|
||||
"EN": {
|
||||
"workbaskets": {
|
||||
"information": {
|
||||
"custom1": {
|
||||
"field": "Customized field 1 title",
|
||||
"visible": true
|
||||
},
|
||||
"custom3": {
|
||||
"field": "",
|
||||
"visible": false
|
||||
}
|
||||
},
|
||||
"access-items": {
|
||||
"custom3": {
|
||||
"field": "",
|
||||
"visible": false
|
||||
},
|
||||
"custom9": {
|
||||
"field": "Some custom field",
|
||||
"visible": true
|
||||
},
|
||||
"custom10": {
|
||||
"field": "",
|
||||
"visible": false
|
||||
},
|
||||
"custom11": {
|
||||
"field": "",
|
||||
"visible": false
|
||||
},
|
||||
"custom12": {
|
||||
"field": "",
|
||||
"visible": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"classifications": {
|
||||
"information": {
|
||||
"custom1": {
|
||||
"field": "Classification custom 1",
|
||||
"visible": true
|
||||
},
|
||||
"custom3": {
|
||||
"field": "",
|
||||
"visible": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"titles": {
|
||||
"EN": {
|
||||
"0": "Administration",
|
||||
"1": "Custom 1",
|
||||
"2": "Custom 2",
|
||||
"3": "Custom 3",
|
||||
"4": "Custom 4"
|
||||
},
|
||||
"DE": {
|
||||
"0": "Verwaltung",
|
||||
"1": "Gewohnheit 1",
|
||||
"2": "Gewohnheit 2",
|
||||
"3": "Gewohnheit 3",
|
||||
"4": "Gewohnheit 4"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +1,4 @@
|
|||
export const environment = {
|
||||
production: true,
|
||||
taskanaAdminUrl: 'http://taskana-admin.mybluemix.net',
|
||||
taskanaWorkplaceUrl: 'http://taskana-workplace.mybluemix.net',
|
||||
taskanaMonitorUrl: 'http://taskana-monitor.mybluemix.net',
|
||||
taskanaRestUrl: 'http://taskana-rest.mybluemix.net'
|
||||
};
|
||||
|
|
|
@ -5,8 +5,5 @@
|
|||
|
||||
export const environment = {
|
||||
production: false,
|
||||
taskanaWorkplaceUrl: 'http://localhost:4200',
|
||||
taskanaAdminUrl: 'http://localhost:4201',
|
||||
taskanaMonitorUrl: 'http://localhost:4202',
|
||||
taskanaRestUrl: 'http://localhost:8080'
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue