Warn of unsaved changes (#338)
* Warn of unsaved changes on new or edited entries * Fixed message box options * Limit 'ng-dirty' to details DOM node
This commit is contained in:
parent
86360dd3cb
commit
f8a378b26d
|
@ -223,9 +223,21 @@ export class VaultComponent implements OnInit, OnDestroy {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
viewCipher(cipher: CipherView) {
|
async viewCipher(cipher: CipherView) {
|
||||||
if (this.action === 'view' && this.cipherId === cipher.id) {
|
if (this.action === 'view' && this.cipherId === cipher.id) {
|
||||||
return;
|
return;
|
||||||
|
} else if (
|
||||||
|
(this.action == 'add' || this.action === 'edit')
|
||||||
|
&& document.getElementById('details').getElementsByClassName('ng-dirty').length > 0
|
||||||
|
) {
|
||||||
|
const confirmed = await this.platformUtilsService.showDialog(
|
||||||
|
this.i18nService.t('unsavedChangesConfirmation'),
|
||||||
|
this.i18nService.t('unsavedChangesTitle'),
|
||||||
|
this.i18nService.t('yes'),
|
||||||
|
this.i18nService.t('no'),
|
||||||
|
'warning'
|
||||||
|
);
|
||||||
|
if (!confirmed) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cipherId = cipher.id;
|
this.cipherId = cipher.id;
|
||||||
|
|
|
@ -1267,5 +1267,11 @@
|
||||||
},
|
},
|
||||||
"privacyPolicy": {
|
"privacyPolicy": {
|
||||||
"message": "Privacy Policy"
|
"message": "Privacy Policy"
|
||||||
|
},
|
||||||
|
"unsavedChangesConfirmation": {
|
||||||
|
"message": "Are you sure you want to leave? If you leave now then your current information won't be saved"
|
||||||
|
},
|
||||||
|
"unsavedChangesTitle": {
|
||||||
|
"message": "There Are Unsaved Changes"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue