-
Notifications
You must be signed in to change notification settings - Fork 1
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 #253 from PrefectHQ/horizontal-waterfall-layouts
Allow user to set the view to trace or dependency
- Loading branch information
Showing
10 changed files
with
257 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<template> | ||
<p-pop-over | ||
class="run-graph-settings" | ||
auto-close | ||
:placement="placement" | ||
> | ||
<template #target="{ toggle }"> | ||
<p-button | ||
aria-label="Run Graph Options" | ||
icon="CogIcon" | ||
flat | ||
@click="toggle" | ||
/> | ||
</template> | ||
|
||
<p-overflow-menu class="run-graph-settings__menu"> | ||
<p-label label="View"> | ||
<p-radio-group v-model="horizontal" :options="horizontalOptions"> | ||
<template #label="{ option }"> | ||
{{ option.label }} | ||
</template> | ||
</p-radio-group> | ||
</p-label> | ||
<p-label label="Layout"> | ||
<p-radio-group v-model="vertical" :options="verticalOptions" disabled> | ||
<template #label="{ option }"> | ||
{{ option.label }} | ||
</template> | ||
</p-radio-group> | ||
</p-label> | ||
</p-overflow-menu> | ||
</p-pop-over> | ||
</template> | ||
|
||
<script lang="ts" setup> | ||
import { PButton, positions, PPopOver } from '@prefecthq/prefect-design' | ||
import { computed } from 'vue' | ||
import { HorizontalMode, VerticalMode } from '@/models/layout' | ||
import { layout, setHorizontalMode, setVerticalMode } from '@/objects/layout' | ||
type Option<T extends string> = { | ||
value: T, | ||
label: string, | ||
} | ||
const placement = [positions.topRight, positions.bottomRight, positions.topLeft, positions.bottomLeft] | ||
const horizontalOptions: Option<HorizontalMode>[] = [ | ||
{ | ||
value: 'dependency', | ||
label: 'Dependency', | ||
}, | ||
{ | ||
value: 'trace', | ||
label: 'Trace', | ||
}, | ||
] | ||
const horizontal = computed({ | ||
get() { | ||
return layout.horizontal | ||
}, | ||
set(value) { | ||
setHorizontalMode(value) | ||
}, | ||
}) | ||
const verticalOptions: Option<VerticalMode>[] = [ | ||
{ | ||
value: 'waterfall', | ||
label: 'Waterfall', | ||
}, | ||
{ | ||
value: 'nearest-parent', | ||
label: 'Nearest Parent', | ||
}, | ||
] | ||
const vertical = computed({ | ||
get() { | ||
return layout.vertical | ||
}, | ||
set(value) { | ||
setVerticalMode(value) | ||
}, | ||
}) | ||
</script> | ||
|
||
<style> | ||
.run-graph-settings { | ||
display: inline-block; | ||
} | ||
.run-graph-settings__menu { | ||
display: grid; | ||
grid-template-columns: 1fr; | ||
gap: theme('spacing.4'); | ||
padding: theme('spacing.2'); | ||
} | ||
</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
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
Oops, something went wrong.