-
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 #16607 from itisAliRH/workflow-card
New Workflow List and Card View
- Loading branch information
Showing
46 changed files
with
2,369 additions
and
1,536 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
<script setup lang="ts"> | ||
import { library } from "@fortawesome/fontawesome-svg-core"; | ||
import { faAngleDown, faAngleUp, faBars, faGripVertical } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; | ||
import { BButton } from "bootstrap-vue"; | ||
import { computed, ref } from "vue"; | ||
import { useUserStore } from "@/stores/userStore"; | ||
library.add(faAngleDown, faAngleUp, faBars, faGripVertical); | ||
type ListView = "grid" | "list"; | ||
type SortBy = "create_time" | "update_time" | "name"; | ||
interface Props { | ||
showViewToggle?: boolean; | ||
} | ||
withDefaults(defineProps<Props>(), { | ||
showViewToggle: false, | ||
}); | ||
const userStore = useUserStore(); | ||
const sortDesc = ref(true); | ||
const sortBy = ref<SortBy>("update_time"); | ||
const listViewMode = computed<ListView>(() => (userStore.preferredListViewMode as ListView) || "grid"); | ||
function onSort(newSortBy: SortBy) { | ||
if (sortBy.value === newSortBy) { | ||
sortDesc.value = !sortDesc.value; | ||
} else { | ||
sortBy.value = newSortBy; | ||
} | ||
} | ||
function onToggleView(newView: ListView) { | ||
userStore.setPreferredListViewMode(newView); | ||
} | ||
defineExpose({ | ||
sortBy, | ||
sortDesc, | ||
listViewMode, | ||
}); | ||
</script> | ||
|
||
<template> | ||
<div class="list-header"> | ||
<div class="list-header-filters"> | ||
Sort by: | ||
<BButtonGroup> | ||
<BButton | ||
id="sortby-name" | ||
v-b-tooltip.hover | ||
size="sm" | ||
:title="sortDesc ? 'Sort by name ascending' : 'Sort by name descending'" | ||
:pressed="sortBy === 'name'" | ||
variant="outline-primary" | ||
@click="onSort('name')"> | ||
<FontAwesomeIcon v-show="sortBy === 'name'" :icon="sortDesc ? faAngleDown : faAngleUp" /> | ||
Name | ||
</BButton> | ||
|
||
<BButton | ||
id="sortby-update-time" | ||
v-b-tooltip.hover | ||
size="sm" | ||
:title="sortDesc ? 'Sort by update time ascending' : 'Sort by update time descending'" | ||
:pressed="sortBy === 'update_time'" | ||
variant="outline-primary" | ||
@click="onSort('update_time')"> | ||
<FontAwesomeIcon v-show="sortBy === 'update_time'" :icon="sortDesc ? faAngleDown : faAngleUp" /> | ||
Update time | ||
</BButton> | ||
</BButtonGroup> | ||
|
||
<slot name="extra-filter" /> | ||
</div> | ||
|
||
<div v-if="showViewToggle"> | ||
Display: | ||
<BButtonGroup> | ||
<BButton | ||
id="view-grid" | ||
v-b-tooltip | ||
title="Grid view" | ||
size="sm" | ||
:pressed="listViewMode === 'grid'" | ||
variant="outline-primary" | ||
@click="onToggleView('grid')"> | ||
<FontAwesomeIcon :icon="faGripVertical" /> | ||
</BButton> | ||
|
||
<BButton | ||
id="view-list" | ||
v-b-tooltip | ||
title="List view" | ||
size="sm" | ||
:pressed="listViewMode === 'list'" | ||
variant="outline-primary" | ||
@click="onToggleView('list')"> | ||
<FontAwesomeIcon :icon="faBars" /> | ||
</BButton> | ||
</BButtonGroup> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped lang="scss"> | ||
.list-header { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
.list-header-filters { | ||
display: flex; | ||
gap: 0.25rem; | ||
flex-wrap: wrap; | ||
align-items: center; | ||
} | ||
} | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<script setup lang="ts"> | ||
import { BPopover } from "bootstrap-vue"; | ||
import { useUserStore } from "@/stores/userStore"; | ||
import { withPrefix } from "@/utils/redirect"; | ||
defineProps<{ | ||
title: string; | ||
target: string; | ||
}>(); | ||
const userStore = useUserStore(); | ||
</script> | ||
|
||
<template> | ||
<BPopover v-if="userStore.isAnonymous" :target="target" triggers="hover focus" placement="bottom"> | ||
<template v-slot:title> {{ title }} </template> | ||
Please <a :href="withPrefix('/login')">log in or register</a> to use this feature. | ||
</BPopover> | ||
</template> |
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
Oops, something went wrong.