mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-26 20:01:02 +00:00
Add confirm for secret deletion (#1604)
Closes https://github.com/woodpecker-ci/woodpecker/issues/1483 PR adds a confirmation dialog that warns user before deleting a secret. https://user-images.githubusercontent.com/426437/222985225-9e14ddac-6c5a-4aed-ac89-cc6562180ac6.mov Using just basic [window.Confirm](https://developer.mozilla.org/en-US/docs/Web/API/Window/confirm) since it is used in [other](https://github.com/search?q=repo%3Awoodpecker-ci%2Fwoodpecker+confirm%28&type=code) places. Any objections to switch to proper dialog component in a separate PR? Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
This commit is contained in:
parent
73c47bd2ff
commit
d35ab57f80
2 changed files with 9 additions and 0 deletions
|
@ -125,6 +125,7 @@
|
|||
"show": "Show secrets",
|
||||
"name": "Name",
|
||||
"value": "Value",
|
||||
"delete_confirm": "Do you really want to delete this secret?",
|
||||
"deleted": "Secret deleted",
|
||||
"created": "Secret created",
|
||||
"saved": "Secret saved",
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { toRef } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
|
||||
import IconButton from '~/components/atomic/IconButton.vue';
|
||||
import ListItem from '~/components/atomic/ListItem.vue';
|
||||
|
@ -48,6 +49,8 @@ const emit = defineEmits<{
|
|||
(event: 'delete', secret: Secret): void;
|
||||
}>();
|
||||
|
||||
const i18n = useI18n();
|
||||
|
||||
const secrets = toRef(props, 'modelValue');
|
||||
|
||||
function editSecret(secret: Secret) {
|
||||
|
@ -55,6 +58,11 @@ function editSecret(secret: Secret) {
|
|||
}
|
||||
|
||||
function deleteSecret(secret: Secret) {
|
||||
// TODO use proper dialog
|
||||
// eslint-disable-next-line no-alert, no-restricted-globals
|
||||
if (!confirm(i18n.t('repo.settings.secrets.delete_confirm'))) {
|
||||
return;
|
||||
}
|
||||
emit('delete', secret);
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue