Skip to content

Commit

Permalink
Add modal confirmation before restoring ab defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
guerler committed Jun 29, 2024
1 parent 9306448 commit fa581de
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 46 deletions.
25 changes: 25 additions & 0 deletions client/src/components/Panels/SettingsPanel.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
<script setup lang="ts">
import { faUndo } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { BButton, BModal } from "bootstrap-vue";
import { ref } from "vue";
import { useActivityStore } from "@/stores/activityStore";
import ActivitySettings from "@/components/ActivityBar/ActivitySettings.vue";
import DelayedInput from "@/components/Common/DelayedInput.vue";
import ActivityPanel from "@/components/Panels/ActivityPanel.vue";
const query = ref("");
const confirmRestore = ref(false);
const activityStore = useActivityStore();
function onQuery(newQuery: string) {
query.value = newQuery;
Expand All @@ -17,6 +24,24 @@ function onQuery(newQuery: string) {
<template v-slot:header>
<DelayedInput :delay="100" placeholder="Search activities" @change="onQuery" />
</template>
<template v-slot:header-buttons>
<BButton
v-b-tooltip.bottom.hover
data-description="restore factory settings"
size="sm"
variant="link"
title="Restore default"
@click="confirmRestore = true">
<FontAwesomeIcon :icon="faUndo" fixed-width />
</BButton>
</template>
<ActivitySettings :query="query" />
<BModal
v-model="confirmRestore"
title="Restore Activity Bar Defaults"
title-tag="h2"
@ok="activityStore.restore()">
<p v-localize>Are you sure you want to reset the activity bar to its default settings?</p>
</BModal>
</ActivityPanel>
</template>
92 changes: 46 additions & 46 deletions client/src/stores/activitySetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,43 +44,17 @@ export const Activities = [
tooltip: "Search and run tools",
visible: true,
},
{
anonymous: true,
description: "Displays a panel to search and access workflows.",
icon: "sitemap",
id: "workflows",
mutable: false,
optional: true,
panel: false,
title: "Workflows",
to: "/workflows/list",
tooltip: "Search and run workflows",
visible: true,
},
{
anonymous: false,
description: "Displays all workflow runs.",
icon: "fa-list",
id: "invocation",
mutable: false,
optional: true,
panel: true,
title: "Workflow Invocations",
tooltip: "Show all workflow runs",
to: null,
visible: true,
},
{
anonymous: true,
description: "Displays the list of available visualizations.",
icon: "chart-bar",
id: "visualizations",
description: "Displays all of your datasets across all histories.",
icon: "fa-folder",
id: "datasets",
mutable: false,
optional: true,
panel: true,
title: "Visualization",
to: null,
tooltip: "Visualize datasets",
panel: false,
title: "Datasets",
tooltip: "Show all datasets",
to: "/datasets/list",
visible: true,
},
{
Expand Down Expand Up @@ -111,15 +85,15 @@ export const Activities = [
},
{
anonymous: false,
description: "Displays all of your datasets across all histories.",
icon: "fa-folder",
id: "datasets",
description: "Display Data Libraries with datasets available to all users.",
icon: "fa-database",
id: "libraries",
mutable: false,
optional: true,
panel: false,
title: "Datasets",
tooltip: "Show all datasets",
to: "/datasets/list",
title: "Libraries",
tooltip: "Access data libraries",
to: "/libraries",
visible: true,
},
{
Expand All @@ -136,16 +110,42 @@ export const Activities = [
visible: true,
},
{
anonymous: false,
description: "Display Data Libraries with datasets available to all users.",
icon: "fa-database",
id: "libraries",
anonymous: true,
description: "Displays the list of available visualizations.",
icon: "chart-bar",
id: "visualizations",
mutable: false,
optional: true,
panel: true,
title: "Visualization",
to: null,
tooltip: "Visualize datasets",
visible: true,
},
{
anonymous: true,
description: "Displays a panel to search and access workflows.",
icon: "sitemap",
id: "workflows",
mutable: false,
optional: true,
panel: false,
title: "Libraries",
tooltip: "Access Data Libraries",
to: "/libraries",
title: "Workflows",
to: "/workflows/list",
tooltip: "Search and run workflows",
visible: true,
},
{
anonymous: false,
description: "Displays all workflow runs.",
icon: "fa-list",
id: "invocation",
mutable: false,
optional: true,
panel: true,
title: "Workflow Invocations",
tooltip: "Show all workflow runs",
to: null,
visible: true,
},
];
Expand Down
8 changes: 8 additions & 0 deletions client/src/stores/activityStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ export interface Activity {
export const useActivityStore = defineStore("activityStore", () => {
const activities: Ref<Array<Activity>> = useUserLocalStorage("activity-store-activities", []);

/**
* Restores the default activity bar items
*/
function restore() {
activities.value = Activities.slice();
}

/**
* The set of built-in activities is defined in activitySetup.js.
* This helper function applies changes of the built-in activities,
Expand Down Expand Up @@ -100,6 +107,7 @@ export const useActivityStore = defineStore("activityStore", () => {
getAll,
remove,
setAll,
restore,
sync,
};
});

0 comments on commit fa581de

Please sign in to comment.