Skip to content

Commit

Permalink
Merge pull request #173 from DependencyTrack/port-confirmation-prompt…
Browse files Browse the repository at this point in the history
…-for-project-deletion
  • Loading branch information
nscuro authored Oct 18, 2024
2 parents 8cbd90b + 553a2ae commit 90021f7
Show file tree
Hide file tree
Showing 16 changed files with 84 additions and 13 deletions.
8 changes: 8 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,14 @@ export default {
const linkTarget = target.getAttribute('target');
if (/\b_blank\b/i.test(linkTarget)) return;
}
// don't handle if `href="#"`
if (target && target.getAttribute) {
const linkHref = target.getAttribute('href');
if ('#' === linkHref) {
event.preventDefault();
return;
}
}
// don't handle same page links/anchors
const url = new URL(target.href);
const to = url.pathname;
Expand Down
31 changes: 30 additions & 1 deletion src/containers/DefaultContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="app">
<DefaultHeader />
<div class="app-body">
<AppSidebar fixed>
<AppSidebar ref="sidebar" fixed>
<SidebarHeader />
<SidebarForm />
<SidebarNav :navItems="permissibleNav"></SidebarNav>
Expand Down Expand Up @@ -60,6 +60,7 @@ export default {
},
data() {
return {
isSidebarMinimized: true,
breadcrumbs: [],
nav: [
{
Expand Down Expand Up @@ -168,6 +169,12 @@ export default {
};
},
methods: {
handleMinimizedUpdate() {
this.isSidebarMinimized = !this.isSidebarMinimized;
if (localStorage) {
localStorage.setItem('isSidebarMinimized', this.isSidebarMinimized);
}
},
generateBreadcrumbs: function generateBreadcrumbs(
crumbName,
subSectionName,
Expand Down Expand Up @@ -204,6 +211,28 @@ export default {
mounted() {
if (this.$dtrack && this.$dtrack.version.includes('SNAPSHOT')) {
this.$root.$emit('bv::show::modal', 'snapshotModal');
this.isSidebarMinimized =
localStorage && localStorage.getItem('isSidebarMinimized') !== null
? localStorage.getItem('isSidebarMinimized') === 'true'
: false;
const sidebar = document.body;
if (sidebar) {
if (this.isSidebarMinimized) {
sidebar.classList.add('sidebar-minimized');
} else {
sidebar.classList.remove('sidebar-minimized');
}
}
this.$nextTick(() => {
const sidebarMinimizer = this.$el.querySelector('.sidebar-minimizer');
if (sidebarMinimizer) {
sidebarMinimizer.addEventListener(
'click',
this.handleMinimizedUpdate,
);
}
});
}
},
computed: {
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Profil aktualisiert",
"project_cloning_in_progress": "Das Projekt wird mit den angegebenen Klonoptionen erstellt",
"project_created": "Projekt erstellt",
"project_delete_message": "Durch das Löschen dieses Projekts werden auch alle zugehörigen untergeordneten Projekte dauerhaft gelöscht. \nDiese Aktion kann nicht rückgängig gemacht werden. \nSind Sie sicher, dass Sie fortfahren möchten?",
"project_delete_title": "Bestätigen Sie die Projektlöschung",
"project_deleted": "Projekt gelöscht",
"project_details": "Projekt Details",
"project_is_latest": "Ist aktuellste Version",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Profile updated",
"project_cloning_in_progress": "The project is being created with the cloning options specified",
"project_created": "Project created",
"project_delete_message": "Deleting this project will also permanently delete all associated child projects. This action cannot be undone. Are you sure you want to proceed?",
"project_delete_title": "Confirm Project Deletion",
"project_deleted": "Project deleted",
"project_details": "Project Details",
"project_is_latest": "Is latest version",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Perfil actualizado",
"project_cloning_in_progress": "El proyecto se está creando con las opciones de clonación especificadas.",
"project_created": "Proyecto creado",
"project_delete_message": "Al eliminar este proyecto, también se eliminarán permanentemente todos los proyectos secundarios asociados. \nEsta acción no se puede deshacer. \n¿Estás seguro de que quieres continuar?",
"project_delete_title": "Confirmar la eliminación del proyecto",
"project_deleted": "Proyecto eliminado",
"project_details": "detalles del proyecto",
"project_is_latest": "es la ultima version",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Profil mis à jour",
"project_cloning_in_progress": "Le projet est en cours de création avec les options de clonage spécifiées",
"project_created": "Projet créé",
"project_delete_message": "La suppression de ce projet supprimera également définitivement tous les projets enfants associés. \nCette action ne peut pas être annulée. \nÊtes-vous sûr de vouloir continuer ?",
"project_delete_title": "Confirmer la suppression du projet",
"project_deleted": "Projet supprimé",
"project_details": "Détails du projet",
"project_is_latest": "Est la dernière version",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "प्रोफाइल अद्यतन किया गया",
"project_cloning_in_progress": "परियोजना को निर्दिष्ट क्लोनिंग विकल्पों के साथ बनाया जा रहा है",
"project_created": "प्रोजेक्ट बनाया गया",
"project_delete_message": "इस प्रोजेक्ट को हटाने से सभी संबद्ध चाइल्ड प्रोजेक्ट भी स्थायी रूप से हटा दिए जाएंगे। \nइस एक्शन को वापस नहीं किया जा सकता। \nक्या आप सुनिश्चित रूप से आगे बढ़ना चाहते हैं?",
"project_delete_title": "प्रोजेक्ट विलोपन की पुष्टि करें",
"project_deleted": "परियोजना हटा दी गई",
"project_details": "परियोजना विवरण",
"project_is_latest": "नवीनतम संस्करण है",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "profilo aggiornato",
"project_cloning_in_progress": "Il progetto viene creato con le opzioni di clonazione specificate",
"project_created": "Progetto creato",
"project_delete_message": "L'eliminazione di questo progetto eliminerà definitivamente anche tutti i progetti secondari associati. \nQuesta azione non può essere annullata. \nSei sicuro di voler procedere?",
"project_delete_title": "Conferma l'eliminazione del progetto",
"project_deleted": "Progetto eliminato",
"project_details": "Dettagli del progetto",
"project_is_latest": "È l'ultima versione",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "プロフィール更新",
"project_cloning_in_progress": "プロジェクトは指定されたクローンオプションで作成されています",
"project_created": "プロジェクトが作成されました",
"project_delete_message": "このプロジェクトを削除すると、関連するすべての子プロジェクトも完全に削除されます。\nこの操作は元に戻すことができません。\n続行してもよろしいですか?",
"project_delete_title": "プロジェクトの削除の確認",
"project_deleted": "プロジェクトが削除されました",
"project_details": "プロジェクトの詳細",
"project_is_latest": "最新バージョンです",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Profil zaktualizowany",
"project_cloning_in_progress": "Projekt jest tworzony z określonymi opcjami klonowania",
"project_created": "Projekt stworzony",
"project_delete_message": "Usunięcie tego projektu spowoduje również trwałe usunięcie wszystkich powiązanych projektów podrzędnych. \nTej akcji nie można cofnąć. \nCzy na pewno chcesz kontynuować?",
"project_delete_title": "Potwierdź usunięcie projektu",
"project_deleted": "Projekt usunięty",
"project_details": "Szczegóły Projektu",
"project_is_latest": "Jest najnowszą wersją",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "perfil atualizado",
"project_cloning_in_progress": "O projeto está sendo criado com as opções de clonagem especificadas",
"project_created": "Projeto criado",
"project_delete_message": "A exclusão deste projeto também excluirá permanentemente todos os projetos secundários associados. \nEsta ação não pode ser desfeita. \nTem certeza de que deseja prosseguir?",
"project_delete_title": "Confirmar exclusão do projeto",
"project_deleted": "Projeto excluído",
"project_details": "Detalhes do Projeto",
"project_is_latest": "É a versão mais recente",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "perfil atualizado",
"project_cloning_in_progress": "O projeto está sendo criado com as opções de clonagem especificadas",
"project_created": "Projeto criado",
"project_delete_message": "A exclusão deste projeto também excluirá permanentemente todos os projetos secundários associados. \nEsta ação não pode ser desfeita. \nTem certeza de que deseja prosseguir?",
"project_delete_title": "Confirmar exclusão do projeto",
"project_deleted": "Projeto excluído",
"project_details": "Detalhes do Projeto",
"project_is_latest": "É a versão mais recente",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Профиль обновлен",
"project_cloning_in_progress": "Проект создается с указанными параметрами клонирования.",
"project_created": "Проект создан",
"project_delete_message": "Удаление этого проекта также приведет к безвозвратному удалению всех связанных с ним дочерних проектов. \nЭто действие невозможно отменить. \nВы уверены, что хотите продолжить?",
"project_delete_title": "Подтвердить удаление проекта",
"project_deleted": "Проект удален",
"project_details": "Детали проекта",
"project_is_latest": "Последняя версия",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/uk-UA.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "Профіль оновлено",
"project_cloning_in_progress": "Проект створюється із зазначеними параметрами клонування",
"project_created": "Проект створено",
"project_delete_message": "Видалення цього проекту призведе до остаточного видалення всіх пов’язаних дочірніх проектів. \nЦю дію не можна скасувати. \nВи впевнені, що бажаєте продовжити?",
"project_delete_title": "Підтвердити видалення проекту",
"project_deleted": "Проект видалено",
"project_details": "Деталі проекту",
"project_is_latest": "Остання версія",
Expand Down
2 changes: 2 additions & 0 deletions src/i18n/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,8 @@
"profile_updated": "个人资料已更新",
"project_cloning_in_progress": "正在使用指定的克隆选项创建项目",
"project_created": "项目已创建",
"project_delete_message": "删除此项目还将永久删除所有关联的子项目。\n此操作无法撤消。\n您确定要继续吗?",
"project_delete_title": "确认项目删除",
"project_deleted": "项目已删除",
"project_details": "项目细节",
"project_is_latest": "是最新版本",
Expand Down
32 changes: 20 additions & 12 deletions src/views/portfolio/projects/ProjectDetailsModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -776,19 +776,27 @@ export default {
this.$root.$emit('bv::hide::modal', 'projectDetailsModal');
});
},
deleteProject: function () {
deleteProject: async function () {
this.$root.$emit('bv::hide::modal', 'projectDetailsModal');
let url =
`${this.$api.BASE_URL}/${this.$api.URL_PROJECT}/` + this.project.uuid;
this.axios
.delete(url)
.then((response) => {
this.$toastr.s(this.$t('message.project_deleted'));
this.$router.replace({ name: 'Projects' });
})
.catch((error) => {
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
let confirmed = await this.$bvModal.msgBoxConfirm(
this.$t('message.project_delete_message'),
{
title: this.$t('message.project_delete_title'),
},
);
if (confirmed) {
let url =
`${this.$api.BASE_URL}/${this.$api.URL_PROJECT}/` + this.project.uuid;
this.axios
.delete(url)
.then((response) => {
this.$toastr.s(this.$t('message.project_deleted'));
this.$router.replace({ name: 'Projects' });
})
.catch((error) => {
this.$toastr.w(this.$t('condition.unsuccessful_action'));
});
}
},
hasActiveChild: function (project) {
return (
Expand Down

0 comments on commit 90021f7

Please sign in to comment.