Skip to content

Commit

Permalink
add create button to activity panel
Browse files Browse the repository at this point in the history
  • Loading branch information
ElectronicBlueberry committed Dec 6, 2024
1 parent f37dddd commit ecb8820
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
6 changes: 4 additions & 2 deletions client/src/components/Panels/ActivityPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { BButton } from "bootstrap-vue";
import { BButton, BButtonGroup } from "bootstrap-vue";
import { computed } from "vue";
interface Props {
Expand All @@ -26,7 +26,9 @@ const hasGoToAll = computed(() => props.goToAllTitle && props.href);
<nav unselectable="on" class="activity-panel-header-top">
<h2 id="activity-panel-heading" v-localize class="activity-panel-heading h-sm">{{ props.title }}</h2>

<slot name="header-buttons" />
<BButtonGroup>
<slot name="header-buttons" />
</BButtonGroup>
</nav>

<slot name="header" class="activity-panel-header-description" />
Expand Down
24 changes: 24 additions & 0 deletions client/src/components/Panels/WorkflowPanel.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<script setup lang="ts">
import { faPlus } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
import { useMemoize, watchImmediate } from "@vueuse/core";
import { BButton } from "bootstrap-vue";
import { computed, ref, watch } from "vue";
import { loadWorkflows, type Workflow } from "@/components/Workflow/workflows.services";
Expand All @@ -19,6 +22,7 @@ const props = defineProps<{
const emit = defineEmits<{
(e: "insertWorkflow", id: string, name: string): void;
(e: "insertWorkflowSteps", id: string, stepCount: number): void;
(e: "createWorkflow"): void;
}>();
const scrollable = ref<HTMLDivElement | null>(null);
Expand Down Expand Up @@ -138,11 +142,26 @@ watch(
function scrollToTop() {
scrollable.value?.scrollTo({ top: 0, behavior: "smooth" });
}
function createNew(event: Event) {
event.preventDefault();
emit("createWorkflow");
}
</script>

<template>
<ActivityPanel title="Workflows">
<template v-slot:header-buttons>
<BButton
v-b-tooltip.hover.top.noninteractive
size="sm"
variant="link"
class="create-button"
title="Create new workflow"
href="/workflows/edit"
@click="createNew">
<FontAwesomeIcon :icon="faPlus" />
</BButton>
<FavoritesButton v-model="showFavorites" tooltip="Show bookmarked" />
</template>

Expand Down Expand Up @@ -189,4 +208,9 @@ function scrollToTop() {
color: $text-light;
margin: 0.5rem;
}
.create-button:hover {
background-color: #c8cfd6;
border-color: #c1c9d0;
}
</style>
3 changes: 2 additions & 1 deletion client/src/components/Workflow/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
v-else-if="isActiveSideBar('workflow-editor-workflows')"
:current-workflow-id="id"
@insertWorkflow="onInsertWorkflow"
@insertWorkflowSteps="onInsertWorkflowSteps" />
@insertWorkflowSteps="onInsertWorkflowSteps"
@createWorkflow="createNewWorkflow" />
<WorkflowAttributes
v-else-if="isActiveSideBar('workflow-editor-attributes')"
:id="id"
Expand Down

0 comments on commit ecb8820

Please sign in to comment.