Files
speckle-server/packages/frontend-2/components/automate/function/page/Header.vue
T
Chuck Driesler 272c136a17 WEB-2466 fix(automate): include workspace in function breadcrumb (#3926)
* fix(automate): repair workspace function breadcrumb

* fix(automate): use route helper correctly
2025-02-04 09:58:45 +00:00

84 lines
2.0 KiB
Vue

<template>
<div class="pt-4 flex gap-4 flex-col sm:flex-row sm:items-center sm:justify-between">
<Portal to="navigation">
<template v-if="fnWorkspace">
<HeaderNavLink
:to="workspaceRoute(fnWorkspace.slug)"
:separator="false"
:name="fnWorkspace.name"
/>
<HeaderNavLink
:to="workspaceFunctionsRoute(fnWorkspace.slug)"
name="Functions"
/>
<HeaderNavLink :to="automateFunctionRoute(fn.id)" :name="fn.name" />
</template>
<template v-else>
<HeaderNavLink
:to="publicAutomateFunctionsRoute"
:separator="false"
name="Functions"
/>
<HeaderNavLink :to="automateFunctionRoute(fn.id)" :name="fn.name" />
</template>
</Portal>
<div class="flex items-center gap-4">
<AutomateFunctionLogo :logo="fn.logo" />
<h1 class="text-heading-lg">{{ fn.name }}</h1>
</div>
<div class="flex items-center align-center gap-2">
<FormButton v-if="isOwner" color="outline" @click="$emit('edit')">
Edit
</FormButton>
</div>
</div>
</template>
<script setup lang="ts">
import { graphql } from '~/lib/common/generated/gql'
import type {
AutomateFunctionPageHeader_FunctionFragment,
AutomateFunctionPageHeader_WorkspaceFragment
} from '~/lib/common/generated/gql/graphql'
import {
automateFunctionRoute,
publicAutomateFunctionsRoute,
workspaceFunctionsRoute,
workspaceRoute
} from '~/lib/common/helpers/route'
graphql(`
fragment AutomateFunctionPageHeader_Function on AutomateFunction {
id
name
logo
repo {
id
url
owner
name
}
releases(limit: 1) {
totalCount
}
workspaceIds
}
fragment AutomateFunctionPageHeader_Workspace on Workspace {
id
name
slug
}
`)
defineProps<{
fn: AutomateFunctionPageHeader_FunctionFragment
fnWorkspace?: AutomateFunctionPageHeader_WorkspaceFragment
isOwner: boolean
}>()
defineEmits<{
createAutomation: []
edit: []
}>()
</script>