[Linked fields] Reset linkedIds if cipher type changes (#535)
* Reset linkedIds if cipher type changes * Only reset linkedId if !editmode
This commit is contained in:
parent
e2c72a75f9
commit
2db9e1ce0d
|
@ -102,5 +102,11 @@ export class AddEditCustomFieldsComponent implements OnChanges {
|
||||||
this.cipher.linkedFieldOptions.forEach((linkedFieldOption, id) =>
|
this.cipher.linkedFieldOptions.forEach((linkedFieldOption, id) =>
|
||||||
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id }));
|
options.push({ name: this.i18nService.t(linkedFieldOption.i18nKey), value: id }));
|
||||||
this.linkedFieldOptions = options.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
this.linkedFieldOptions = options.sort(Utils.getSortFunction(this.i18nService, 'name'));
|
||||||
|
|
||||||
|
if (!this.editMode) {
|
||||||
|
this.cipher.fields
|
||||||
|
.filter(f => f.type = FieldType.Linked)
|
||||||
|
.forEach(f => f.linkedId = this.linkedFieldOptions[0].value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue