Remove old values when they're no longer in the schema

pull/4444/head
Oliver Günther 9 years ago
parent 159a7f0007
commit 2b02d50af5
  1. 19
      frontend/app/components/work-packages/wp-display-attr/wp-display-attr.directive.ts

@ -105,11 +105,7 @@ export class WorkPackageDisplayAttributeController {
// Show a link to the work package for the ID
this.displayType = 'SelfLink';
this.displayLink = this.PathHelper.workPackagePath(this.workPackage.id);
}
else if (!this.schema[this.attribute]) {
this.displayType = 'Text';
}
else {
} else {
this.displayType = this.schema[this.attribute].type;
}
}
@ -117,6 +113,7 @@ export class WorkPackageDisplayAttributeController {
protected updateAttribute(wp) {
this.workPackage = wp;
this.schema.$load().then(() => {
var text;
const wpAttr:any = wp[this.attribute];
if (this.workPackage.isNew && this.attribute === 'id') {
@ -124,11 +121,15 @@ export class WorkPackageDisplayAttributeController {
return;
}
this.setDisplayType();
var text = this.WorkPackagesHelper.formatValue(this.getValue(), this.displayType);
if (!this.schema[this.attribute]) {
this.displayType = 'Text';
text = this.placeholder;
} else {
this.setDisplayType();
var formatted = this.WorkPackagesHelper.formatValue(this.getValue(), this.displayType);
text = formatted || this.placeholder;
}
text = this.WorkPackagesHelper.formatValue(text, this.displayType);
if (this.displayText !== text) {
this.$scope.$evalAsync(() => {
this.displayText = text || this.placeholder;

Loading…
Cancel
Save