Skip to content
Snippets Groups Projects
Commit df210177 authored by Alex ORLUC's avatar Alex ORLUC
Browse files

FEAT #15301 TIME 0:10 fix get custom fields

parent 3dde1238
No related branches found
No related tags found
No related merge requests found
......@@ -416,38 +416,34 @@ export class IndexingFieldsService {
getCustomFields() {
return new Promise((resolve, reject) => {
if (this.customFields.length > 0) {
resolve(this.customFields);
} else {
this.http.get('../rest/customFields').pipe(
tap((data: any) => {
this.customFields = data.customFields.map((info: any) => {
info.identifier = 'indexingCustomField_' + info.id;
info.icon = 'fa-hashtag';
info.system = false;
info.enabled = true;
info.SQLMode = info.SQLMode;
if (['integer', 'string', 'date'].indexOf(info.type) > -1 && !this.functions.empty(info.values)) {
info.default_value = info.values[0].key;
} else {
info.default_value = info.type === 'banAutocomplete' ? [] : null;
}
info.values = info.values.length > 0 ? info.values.map((custVal: any) => {
return {
id: custVal.key,
label: custVal.label
};
}) : info.values;
return info;
});
}),
finalize(() => resolve(this.customFields)),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
}
this.http.get('../rest/customFields').pipe(
tap((data: any) => {
this.customFields = data.customFields.map((info: any) => {
info.identifier = 'indexingCustomField_' + info.id;
info.icon = 'fa-hashtag';
info.system = false;
info.enabled = true;
info.SQLMode = info.SQLMode;
if (['integer', 'string', 'date'].indexOf(info.type) > -1 && !this.functions.empty(info.values)) {
info.default_value = info.values[0].key;
} else {
info.default_value = info.type === 'banAutocomplete' ? [] : null;
}
info.values = info.values.length > 0 ? info.values.map((custVal: any) => {
return {
id: custVal.key,
label: custVal.label
};
}) : info.values;
return info;
});
}),
finalize(() => resolve(this.customFields)),
catchError((err: any) => {
this.notify.handleSoftErrors(err);
return of(false);
})
).subscribe();
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment