[CORD-1538] Hiding id, backend-status and policy-status from forms, while displaying them in tables
Change-Id: If0412f76eb74a2c1274461781be4d3ce838e3258
diff --git a/src/app/core/services/helpers/config.helpers.ts b/src/app/core/services/helpers/config.helpers.ts
index 32e0b16..ed3f0c0 100644
--- a/src/app/core/services/helpers/config.helpers.ts
+++ b/src/app/core/services/helpers/config.helpers.ts
@@ -61,9 +61,16 @@
'validators',
'password',
'backend_need_delete',
- 'backend_need_reap'
+ 'backend_need_reap',
+ 'leaf_model_name'
];
+ public form_excluded_fields = this.excluded_fields.concat([
+ 'id',
+ 'policy_status',
+ 'backend_status',
+ ]);
+
constructor(
private $state: ng.ui.IStateService,
private toastr: ng.toastr.IToastrService,
@@ -165,19 +172,19 @@
};
}
- if (f.name === 'backend_status') {
+ if (f.name === 'backend_status' || f.name === 'policy_status') {
col.type = 'icon';
col.hover = (item) => {
return item[f.name];
};
col.formatter = (item) => {
- if (item.backend_status.indexOf('1') > -1) {
+ if (item[f.name].indexOf('1') > -1) {
return 'check';
}
- if (item.backend_status.indexOf('2') > -1) {
+ if (item[f.name].indexOf('2') > -1) {
return 'exclamation-circle';
}
- if (item.backend_status.indexOf('0') > -1) {
+ if (item[f.name].indexOf('0') > -1) {
return 'clock-o';
}
};
@@ -236,13 +243,13 @@
}
return input;
})
- .filter(f => this.excluded_fields.indexOf(f.name) === -1);
+ .filter(f => this.form_excluded_fields.indexOf(f.name) === -1);
}
public modelToFormCfg(model: IXosModeldef): IXosFormCfg {
const formCfg: IXosFormCfg = {
formName: `${model.name}Form`,
- exclude: ['backend_status', 'creator', 'id'],
+ exclude: this.form_excluded_fields,
actions: [{
label: 'Save',
class: 'success',