Skip to content

Commit

Permalink
append searchId as hash to export as csv menu link (#280)
Browse files Browse the repository at this point in the history
Fixes #279
  • Loading branch information
jxjj authored Dec 10, 2024
1 parent 5103ac4 commit f3bf8af
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/components/AppMenu/AdminNavSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@
<AppMenuItem :href="`${BASE_URL}/instances/customPages`">
Instance Pages
</AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/reports`"> Reports </AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/templates`"> Edit Templates </AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/reports`">Reports</AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/templates`">Edit Templates</AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/collectionManager`">
Edit Collections
</AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/assetManager/importFromCSV`">
Import from CSV
</AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/assetManager/exportCSV`">
Export to CSV
</AppMenuItem>
<AppMenuItem :href="exportToCSVUrl">Export to CSV</AppMenuItem>
<template v-if="currentUser.isSuperAdmin">
<Divider />
<AppMenuItem :href="`${BASE_URL}/admin`"> Super Admin 🦸‍♀️ </AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/admin/logs`"> Logs </AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/admin`">Super Admin 🦸‍♀️</AppMenuItem>
<AppMenuItem :href="`${BASE_URL}/admin/logs`">Logs</AppMenuItem>
</template>
</AppMenuGroup>
</template>
Expand All @@ -33,12 +31,28 @@ import AppMenuItem from "./AppMenuItem.vue";
import Divider from "./Divider.vue";
import config from "@/config";
import { ElevatorInstance, User } from "@/types";
import { useSearchStore } from "@/stores/searchStore";
import { computed } from "vue";
defineProps<{
instance: ElevatorInstance;
currentUser: User;
}>();
const BASE_URL = config.instance.base.url;
const searchStore = useSearchStore();
const exportToCSVUrl = computed(() => {
const url = new URL(
`${BASE_URL}/assetManager/exportCSV`,
window.location.origin
);
// append searchId as hash if it exists
if (searchStore.searchId) {
url.hash = searchStore.searchId;
}
return url.toString();
});
</script>
<style scoped></style>

0 comments on commit f3bf8af

Please sign in to comment.