-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17931 from guerler/visualizations_activity
Revises visualizations activity
- Loading branch information
Showing
10 changed files
with
200 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,115 @@ | ||
<script setup lang="ts"> | ||
import { faEye } from "@fortawesome/free-solid-svg-icons"; | ||
import { storeToRefs } from "pinia"; | ||
import { computed, onMounted, type Ref, ref } from "vue"; | ||
import { useHistoryStore } from "@/stores/historyStore"; | ||
import { absPath } from "@/utils/redirect"; | ||
import { urlData } from "@/utils/url"; | ||
import DelayedInput from "@/components/Common/DelayedInput.vue"; | ||
import DataDialog from "@/components/DataDialog/DataDialog.vue"; | ||
import LoadingSpan from "@/components/LoadingSpan.vue"; | ||
import ActivityPanel from "@/components/Panels/ActivityPanel.vue"; | ||
import PluginList from "@/components/Visualizations/PluginList.vue"; | ||
interface Plugin { | ||
description: string; | ||
href: string; | ||
html: string; | ||
logo?: string; | ||
name: string; | ||
target?: string; | ||
} | ||
const { currentHistoryId } = storeToRefs(useHistoryStore()); | ||
const plugins: Ref<Array<Plugin>> = ref([]); | ||
const query = ref(""); | ||
const isLoading = ref(true); | ||
const currentPlugin: Ref<Plugin | null> = ref(null); | ||
const showDataDialog = ref(false); | ||
const filteredPlugins = computed(() => { | ||
const queryLower = query.value.toLowerCase(); | ||
return plugins.value.filter( | ||
(plugin) => | ||
!query.value || | ||
plugin.html.toLowerCase().includes(queryLower) || | ||
(plugin.description && plugin.description.toLowerCase().includes(queryLower)) | ||
); | ||
}); | ||
function createVisualization(dataset: any) { | ||
showDataDialog.value = false; | ||
if (currentPlugin.value) { | ||
const href = `${currentPlugin.value.href}?dataset_id=${dataset.id}`; | ||
if (currentPlugin.value.target == "_top") { | ||
window.location.href = href; | ||
} else { | ||
const galaxyMainElement = document.getElementById("galaxy_main"); | ||
if (galaxyMainElement) { | ||
galaxyMainElement.setAttribute("src", href); | ||
} | ||
} | ||
} | ||
} | ||
function selectVisualization(plugin: Plugin) { | ||
currentPlugin.value = plugin; | ||
showDataDialog.value = true; | ||
} | ||
async function getPlugins() { | ||
plugins.value = await urlData({ url: "/api/plugins" }); | ||
isLoading.value = false; | ||
} | ||
onMounted(() => { | ||
getPlugins(); | ||
}); | ||
</script> | ||
|
||
<template> | ||
<ActivityPanel title="Visualizations"> | ||
<PluginList /> | ||
<ActivityPanel title="Visualizations" go-to-all-title="Saved Visualizations" href="/visualizations/list"> | ||
<h3>Create Visualization</h3> | ||
<DelayedInput :delay="100" placeholder="Search visualizations" @change="query = $event" /> | ||
<div class="overflow-y mt-2"> | ||
<LoadingSpan v-if="isLoading" message="Loading visualizations" /> | ||
<div v-else-if="filteredPlugins.length > 0"> | ||
<div v-for="plugin in filteredPlugins" :key="plugin.name"> | ||
<button :data-plugin-name="plugin.name" @click="selectVisualization(plugin)"> | ||
<div class="d-flex"> | ||
<div class="plugin-thumbnail mr-2"> | ||
<img v-if="plugin.logo" alt="visualization" :src="absPath(plugin.logo)" /> | ||
<icon v-else :icon="faEye" class="plugin-icon" /> | ||
</div> | ||
<div class="text-break"> | ||
<div class="plugin-list-title font-weight-bold">{{ plugin.html }}</div> | ||
<div class="plugin-list-text text-muted">{{ plugin.description }}</div> | ||
</div> | ||
</div> | ||
</button> | ||
</div> | ||
</div> | ||
<BAlert v-else v-localize variant="info" show> No matching visualization found. </BAlert> | ||
</div> | ||
<DataDialog | ||
v-if="showDataDialog" | ||
format="" | ||
:history="currentHistoryId" | ||
@onOk="createVisualization" | ||
@onCancel="showDataDialog = false" /> | ||
</ActivityPanel> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.plugin-thumbnail { | ||
img { | ||
width: 2rem; | ||
} | ||
.plugin-icon { | ||
font-size: 1.3rem; | ||
padding: 0.3rem; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
.unified-panel { | ||
display: flex; | ||
flex-flow: column; | ||
background: $panel-bg-color; | ||
height: 100%; | ||
overflow: auto; | ||
} | ||
.unified-panel-header { | ||
@extend .unselectable; | ||
@extend .px-3; | ||
@extend .d-flex; | ||
height: $panel_header_height; | ||
font-size: 1rem; | ||
font-weight: bold; | ||
align-items: center; | ||
color: $panel-header-text-color; | ||
background: $panel-bg-header-color; | ||
a { | ||
color: $panel-header-text-color; | ||
} | ||
.unified-panel-header-inner { | ||
@extend .w-100; | ||
min-width: max-content; | ||
align-items: center; | ||
justify-content: space-between; | ||
display: flex; | ||
} | ||
.panel-header-buttons { | ||
order: 9999; | ||
@extend .d-flex; | ||
.panel-header-button { | ||
text-align: center; | ||
&:not(:last-child) { | ||
@extend .mr-2; | ||
} | ||
&:hover { | ||
color: $brand-info; | ||
} | ||
} | ||
.panel-header-button-toolbox { | ||
color: $brand-dark; | ||
flex: 1; | ||
@extend .p-1; | ||
text-align: center; | ||
font-size: $h4-font-size; | ||
align-items: center; | ||
&:hover { | ||
color: $brand-info; | ||
background-color: $brand-light; | ||
text-decoration: none !important; | ||
border-color: $brand-light; | ||
} | ||
} | ||
} | ||
} | ||
.unified-panel-controls { | ||
@extend .px-3; | ||
} | ||
.unified-panel-body { | ||
@extend .p-0; | ||
@extend .w-100; | ||
@extend .h-100; | ||
@extend .overflow-auto; | ||
flex: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters