-
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.
improve performance of workflow card
make workflow card mostly stateless move modals outside of workflow card
- Loading branch information
1 parent
af522d0
commit c0f98fa
Showing
4 changed files
with
146 additions
and
87 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
128 changes: 128 additions & 0 deletions
128
client/src/components/Workflow/List/WorkflowCardList.vue
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,128 @@ | ||
<script setup lang="ts"> | ||
import { BModal } from "bootstrap-vue"; | ||
import { reactive, ref } from "vue"; | ||
import type { Workflow } from "@/components/Workflow/workflows.services"; | ||
import WorkflowCard from "./WorkflowCard.vue"; | ||
import WorkflowRename from "./WorkflowRename.vue"; | ||
import WorkflowPublished from "@/components/Workflow/Published/WorkflowPublished.vue"; | ||
interface Props { | ||
workflows: Workflow[]; | ||
gridView?: boolean; | ||
hideRuns?: boolean; | ||
filterable?: boolean; | ||
publishedView?: boolean; | ||
} | ||
const props = defineProps<Props>(); | ||
const emit = defineEmits<{ | ||
(e: "tagClick", tag: string): void; | ||
(e: "refreshList", overlayLoading?: boolean, silent?: boolean): void; | ||
(e: "updateFilter", key: string, value: any): void; | ||
}>(); | ||
const modalOptions = reactive({ | ||
rename: { | ||
id: "", | ||
name: "", | ||
}, | ||
preview: { | ||
id: "", | ||
}, | ||
}); | ||
const showRename = ref(false); | ||
function onRenameClose() { | ||
showRename.value = false; | ||
emit("refreshList", true); | ||
} | ||
function onRename(id: string, name: string) { | ||
modalOptions.rename.id = id; | ||
modalOptions.rename.name = name; | ||
showRename.value = true; | ||
} | ||
const showPreview = ref(false); | ||
function onPreview(id: string) { | ||
modalOptions.preview.id = id; | ||
showPreview.value = true; | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="workflow-card-list" :class="{ grid: props.gridView }"> | ||
<WorkflowCard | ||
v-for="workflow in props.workflows" | ||
:key="workflow.id" | ||
:workflow="workflow" | ||
:grid-view="props.gridView" | ||
:hide-runs="props.hideRuns" | ||
:filterable="props.filterable" | ||
:published-view="props.publishedView" | ||
class="workflow-card" | ||
@tagClick="(...args) => emit('tagClick', ...args)" | ||
@refreshList="(...args) => emit('refreshList', ...args)" | ||
@updateFilter="(...args) => emit('updateFilter', ...args)" | ||
@rename="onRename" | ||
@preview="onPreview"> | ||
</WorkflowCard> | ||
|
||
<WorkflowRename | ||
:id="modalOptions.rename.id" | ||
:show="showRename" | ||
:name="modalOptions.rename.name" | ||
@close="onRenameClose" /> | ||
|
||
<BModal | ||
v-model="showPreview" | ||
ok-only | ||
size="xl" | ||
hide-header | ||
dialog-class="workflow-card-preview-modal w-auto" | ||
centered> | ||
<WorkflowPublished v-if="showPreview" :id="modalOptions.preview.id" quick-view /> | ||
</BModal> | ||
</div> | ||
</template> | ||
|
||
<style lang="scss"> | ||
.workflow-card-preview-modal { | ||
max-width: min(1400px, calc(100% - 200px)); | ||
.modal-content { | ||
height: min(800px, calc(100vh - 80px)); | ||
} | ||
} | ||
</style> | ||
|
||
<style scoped lang="scss"> | ||
@import "breakpoints.scss"; | ||
.workflow-card-list { | ||
container: card-list / inline-size; | ||
display: flex; | ||
flex-wrap: wrap; | ||
.workflow-card { | ||
width: 100%; | ||
} | ||
&.grid .workflow-card { | ||
width: calc(100% / 3); | ||
@container card-list (max-width: #{$breakpoint-xl}) { | ||
width: calc(100% / 2); | ||
} | ||
@container card-list (max-width: #{$breakpoint-sm}) { | ||
width: 100%; | ||
} | ||
} | ||
} | ||
</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