TSK-483-508 make lookup configurable and refactored environment file
This commit is contained in:
parent
74d632eddd
commit
ce490f17ce
|
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"EN": {
|
||||||
|
"workbaskets": {
|
||||||
|
"information": {
|
||||||
|
"lookupField": {
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
"custom1": {
|
||||||
|
"field": "Customized field 1 title",
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
"custom3": {
|
||||||
|
"field": "",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"access-items": {
|
||||||
|
"lookupField": {
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,53 +1,3 @@
|
||||||
{
|
{
|
||||||
"taskanaRestUrl": "https://taskana-rest.mybluemix.net",
|
"taskanaRestUrl": "https://taskana-rest.mybluemix.net"
|
||||||
"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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -42,12 +42,21 @@
|
||||||
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td class="input-group text-align text-width taskana-type-ahead" [ngClass]="{
|
<td *ngIf="lookupField.visible else accessIdInput" class="input-group text-align text-width taskana-type-ahead" [ngClass]="{
|
||||||
'has-warning': (accessItemsClone[index].accessId !== accessItem.accessId),
|
'has-warning': (accessItemsClone[index].accessId !== accessItem.accessId),
|
||||||
'has-error': !accessItem.accessId } ">
|
'has-error': !accessItem.accessId } ">
|
||||||
<taskana-type-ahead required #accessItemName="ngModel" [(ngModel)]="accessItem.accessId" name="accessItem.accessId-{{index}}"
|
<taskana-type-ahead required #accessItemName="ngModel" [(ngModel)]="accessItem.accessId" name="accessItem.accessId-{{index}}"
|
||||||
[(ngModel)]="accessItem.accessId" placeHolderMessage="Access id is required"></taskana-type-ahead>
|
[(ngModel)]="accessItem.accessId" placeHolderMessage="Access id is required"></taskana-type-ahead>
|
||||||
</td>
|
</td>
|
||||||
|
<ng-template #accessIdInput>
|
||||||
|
<td class="input-group text-align text-width ">
|
||||||
|
<div [ngClass]="{ 'has-warning': (accessItemsClone[index].accessId !== accessItem.accessId),
|
||||||
|
'has-error': !accessItem.accessId }">
|
||||||
|
<input type="text" required #accessItemName="ngModel" class="form-control" name="accessItem.accessId-{{index}}" [(ngModel)]="accessItem.accessId"
|
||||||
|
placeholder="{{accessItemName.invalid? 'Access id is required': ''}}">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</ng-template>
|
||||||
<td>
|
<td>
|
||||||
<input id="checkbox-{{index}}-00" type="checkbox" (click)="checkAll(index)">
|
<input id="checkbox-{{index}}-00" type="checkbox" (click)="checkAll(index)">
|
||||||
<label for="checkbox-{{index}}-00"></label>
|
<label for="checkbox-{{index}}-00"></label>
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ export class AccessItemsComponent implements OnChanges, OnDestroy {
|
||||||
active: string;
|
active: string;
|
||||||
badgeMessage = '';
|
badgeMessage = '';
|
||||||
|
|
||||||
|
lookupField = this.customFieldService.getCustomField('Owner', 'workbaskets.access-items.lookupField');
|
||||||
custom1Field = this.customFieldService.getCustomField('Custom 1', 'workbaskets.access-items.custom1');
|
custom1Field = this.customFieldService.getCustomField('Custom 1', 'workbaskets.access-items.custom1');
|
||||||
custom2Field = this.customFieldService.getCustomField('Custom 2', 'workbaskets.access-items.custom2');
|
custom2Field = this.customFieldService.getCustomField('Custom 2', 'workbaskets.access-items.custom2');
|
||||||
custom3Field = this.customFieldService.getCustomField('Custom 3', 'workbaskets.access-items.custom3');
|
custom3Field = this.customFieldService.getCustomField('Custom 3', 'workbaskets.access-items.custom3');
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,12 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group required">
|
<div class="form-group required">
|
||||||
<label for="wb-owner" class="control-label">Owner</label>
|
<label for="wb-owner" class="control-label">Owner</label>
|
||||||
<taskana-type-ahead required #owner="ngModel" name="owner" [(ngModel)]="workbasket.owner" placeHolderMessage="Owner is required"></taskana-type-ahead>
|
<taskana-type-ahead *ngIf="lookupField.visible else ownerInput" required #owner="ngModel" name="owner" [(ngModel)]="workbasket.owner"
|
||||||
|
placeHolderMessage="Owner is required"></taskana-type-ahead>
|
||||||
|
<ng-template #ownerInput>
|
||||||
|
<input type="text" required #owner="ngModel" class="form-control" id="wb-owner" placeholder="Owner" [(ngModel)]="workbasket.owner"
|
||||||
|
name="workbasket.owner">
|
||||||
|
</ng-template>
|
||||||
<div *ngIf="!owner?.valid" class="required-text">
|
<div *ngIf="!owner?.valid" class="required-text">
|
||||||
* Owner is required
|
* Owner is required
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@ export class WorkbasketInformationComponent implements OnInit, OnChanges, OnDest
|
||||||
requestInProgress = false;
|
requestInProgress = false;
|
||||||
badgeMessage = '';
|
badgeMessage = '';
|
||||||
|
|
||||||
|
lookupField = this.customFieldsService.getCustomField('Owner', 'workbaskets.information.lookupField');
|
||||||
custom1Field = this.customFieldsService.getCustomField('Custom 1', 'workbaskets.information.custom1');
|
custom1Field = this.customFieldsService.getCustomField('Custom 1', 'workbaskets.information.custom1');
|
||||||
custom2Field = this.customFieldsService.getCustomField('Custom 2', 'workbaskets.information.custom2');
|
custom2Field = this.customFieldsService.getCustomField('Custom 2', 'workbaskets.information.custom2');
|
||||||
custom3Field = this.customFieldsService.getCustomField('Custom 3', 'workbaskets.information.custom3');
|
custom3Field = this.customFieldsService.getCustomField('Custom 3', 'workbaskets.information.custom3');
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<ul class="dropdown-menu dropdown-menu" aria-labelledby="dropdownMenu">
|
<ul class="dropdown-menu dropdown-menu" aria-labelledby="dropdownMenu">
|
||||||
<li>
|
<li>
|
||||||
<a *ngFor="let domain of domains" (click)="switchDomain(domain)">
|
<a *ngFor="let domain of domains" (click)="switchDomain(domain)">
|
||||||
{{domain}}
|
<label>{{domain}}</label>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ export class CustomFieldsService {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
initCustomFields(language: string = 'EN', jsonFile: any) {
|
initCustomFields(language: string = 'EN', jsonFile: any) {
|
||||||
this.customizedFields = jsonFile.customizedFields[language];
|
this.customizedFields = jsonFile[language];
|
||||||
}
|
}
|
||||||
|
|
||||||
getCustomField(fallbacktext: string, customPath: string = undefined): CustomField {
|
getCustomField(fallbacktext: string, customPath: string = undefined): CustomField {
|
||||||
|
|
@ -19,7 +19,7 @@ export class CustomFieldsService {
|
||||||
|
|
||||||
private jsonPath(path: string, fallbacktext: string): CustomField {
|
private jsonPath(path: string, fallbacktext: string): CustomField {
|
||||||
if (!this.customizedFields) {
|
if (!this.customizedFields) {
|
||||||
return undefined;
|
return new CustomField(true, fallbacktext);
|
||||||
};
|
};
|
||||||
const paths = path.split('.');
|
const paths = path.split('.');
|
||||||
let value = this.customizedFields;
|
let value = this.customizedFields;
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,13 @@ export class StartupService {
|
||||||
return this.loadEnvironment();
|
return this.loadEnvironment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private loadEnvironment() {
|
private loadEnvironment() {
|
||||||
|
return this.getEnvironmentFilePromise().then(
|
||||||
|
() => this.geCustomizedFieldsFilePromise()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
getEnvironmentFilePromise() {
|
||||||
return this.httpClient.get<any>('environments/data-sources/environment-information.json').map(jsonFile => {
|
return this.httpClient.get<any>('environments/data-sources/environment-information.json').map(jsonFile => {
|
||||||
if (jsonFile) {
|
if (jsonFile) {
|
||||||
environment.taskanaRestUrl = jsonFile.taskanaRestUrl === '' ?
|
environment.taskanaRestUrl = jsonFile.taskanaRestUrl === '' ?
|
||||||
|
|
@ -29,6 +34,17 @@ export class StartupService {
|
||||||
}).toPromise()
|
}).toPromise()
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
return Observable.of(true)
|
return Observable.of(true)
|
||||||
})
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
geCustomizedFieldsFilePromise() {
|
||||||
|
return this.httpClient.get<any>('environments/data-sources/customized-fields.json').map(jsonFile => {
|
||||||
|
if (jsonFile) {
|
||||||
|
this.customFieldsService.initCustomFields('EN', jsonFile);
|
||||||
|
}
|
||||||
|
}).toPromise()
|
||||||
|
.catch(() => {
|
||||||
|
return Observable.of(true)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ export class TitlesService {
|
||||||
constructor() { }
|
constructor() { }
|
||||||
|
|
||||||
initTitles(language: string = 'EN', jsonFile: any) {
|
initTitles(language: string = 'EN', jsonFile: any) {
|
||||||
this.titles = jsonFile.titles[language];
|
this.titles = jsonFile[language];
|
||||||
}
|
}
|
||||||
|
|
||||||
getTitle(id: number, fallBacktext: string, customPath: string = undefined) {
|
getTitle(id: number, fallBacktext: string, customPath: string = undefined) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,56 @@
|
||||||
|
{
|
||||||
|
"EN": {
|
||||||
|
"workbaskets": {
|
||||||
|
"information": {
|
||||||
|
"lookupField": {
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
"custom1": {
|
||||||
|
"field": "Customized field 1 title",
|
||||||
|
"visible": true
|
||||||
|
},
|
||||||
|
"custom3": {
|
||||||
|
"field": "",
|
||||||
|
"visible": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"access-items": {
|
||||||
|
"lookupField": {
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
"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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,53 +1,3 @@
|
||||||
{
|
{
|
||||||
"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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +1,16 @@
|
||||||
{
|
{
|
||||||
"titles": {
|
"EN": {
|
||||||
"EN": {
|
"0": "Administration",
|
||||||
"0": "Administration",
|
"1": "Custom 1",
|
||||||
"1": "Custom 1",
|
"2": "Custom 2",
|
||||||
"2": "Custom 2",
|
"3": "Custom 3",
|
||||||
"3": "Custom 3",
|
"4": "Custom 4"
|
||||||
"4": "Custom 4"
|
},
|
||||||
},
|
"DE": {
|
||||||
"DE": {
|
"0": "Administration",
|
||||||
"0": "Verwaltung",
|
"1": "Zusatzfeld 1",
|
||||||
"1": "Gewohnheit 1",
|
"2": "Zusatzfeld 2",
|
||||||
"2": "Gewohnheit 2",
|
"3": "Zusatzfeld 3",
|
||||||
"3": "Gewohnheit 3",
|
"4": "Zusatzfeld 4"
|
||||||
"4": "Gewohnheit 4"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue