1
0
Fork 0
VaultUI/src/pages/KeyValue/KeyValueDelete.js

48 lines
1.3 KiB
JavaScript
Raw Normal View History

2021-04-17 10:45:42 +01:00
import { Page } from "../../types/Page.js";
2021-05-03 09:25:42 +01:00
import { changePage, setPageContent, setTitleElement } from "../../pageUtils.js";
2021-04-17 10:45:42 +01:00
import { deleteSecret } from "../../api.js";
import { makeElement } from "../../htmlUtils.js";
import i18next from 'i18next';
2021-04-15 13:01:58 +01:00
export class KeyValueDeletePage extends Page {
constructor() {
super();
}
goBack() {
if (pageState.currentSecretVersion != null) {
pageState.currentSecretVersion = null;
changePage("KEY_VALUE_SECRET");
2021-04-15 13:01:58 +01:00
} else {
pageState.currentSecret = "";
2021-04-17 11:24:43 +01:00
changePage("KEY_VALUE_VIEW");
2021-04-15 13:01:58 +01:00
}
}
render() {
setTitleElement(pageState);
setPageContent(makeElement({
tag: "div",
children: [
makeElement({
tag: "h5",
text: i18next.t("kv_delete_text")
2021-04-15 13:01:58 +01:00
}),
makeElement({
tag: "button",
class: ["uk-button", "uk-button-danger"],
text: i18next.t("kv_delete_btn"),
2021-04-15 13:01:58 +01:00
onclick: _ => {
deleteSecret(pageState.currentBaseMount, pageState.currentSecretPath, pageState.currentSecret, pageState.currentSecretVersion).then(() => {
this.goBack();
});
}
}),
]
}));
}
get titleSuffix() {
return i18next.t("kv_delete_suffix");
}
2021-04-15 13:01:58 +01:00
get name() {
return i18next.t("kv_delete_title");
2021-04-15 13:01:58 +01:00
}
}