mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-25 08:00:59 +00:00
fix is_owner for groups/folders + unift summary for apps
This commit is contained in:
@@ -100,6 +100,7 @@
|
||||
placeholder="Summary of the group"
|
||||
/>
|
||||
<Button
|
||||
disabled={!can_write}
|
||||
size="xs"
|
||||
on:click={async () => {
|
||||
await GroupService.updateGroup({
|
||||
|
||||
@@ -13,20 +13,26 @@
|
||||
|
||||
let kind: Kind
|
||||
let initialPath: string = ''
|
||||
let path: string = ''
|
||||
let path: string | undefined = undefined
|
||||
let summary: undefined | string = undefined
|
||||
|
||||
let drawer: Drawer
|
||||
|
||||
let own = false
|
||||
export async function openDrawer(initialPath_l: string, kind_l: Kind) {
|
||||
export async function openDrawer(
|
||||
initialPath_l: string,
|
||||
summary_l: string | undefined,
|
||||
kind_l: Kind
|
||||
) {
|
||||
kind = kind_l
|
||||
initialPath = initialPath_l
|
||||
summary = summary_l
|
||||
await loadOwner()
|
||||
drawer.openDrawer()
|
||||
}
|
||||
|
||||
async function loadOwner() {
|
||||
own = await isOwner(path, $userStore!, $workspaceStore!)
|
||||
own = await isOwner(initialPath, $userStore!, $workspaceStore!)
|
||||
}
|
||||
|
||||
async function updatePath() {
|
||||
@@ -39,8 +45,8 @@
|
||||
workspace: $workspaceStore!,
|
||||
path: initialPath,
|
||||
requestBody: {
|
||||
path,
|
||||
summary: flow.summary,
|
||||
path: path ?? '',
|
||||
summary: summary ?? '',
|
||||
description: flow.description,
|
||||
value: flow.value
|
||||
}
|
||||
@@ -50,6 +56,7 @@
|
||||
workspace: $workspaceStore!,
|
||||
path: initialPath
|
||||
})
|
||||
script.summary = summary ?? ''
|
||||
await ScriptService.createScript({
|
||||
workspace: $workspaceStore!,
|
||||
requestBody: {
|
||||
@@ -57,7 +64,7 @@
|
||||
description: script.description ?? '',
|
||||
lock: script.lock?.split('\n'),
|
||||
parent_hash: script.hash,
|
||||
path
|
||||
path: path ?? ''
|
||||
}
|
||||
})
|
||||
} else if (kind == 'app') {
|
||||
@@ -65,7 +72,8 @@
|
||||
workspace: $workspaceStore!,
|
||||
path: initialPath,
|
||||
requestBody: {
|
||||
path
|
||||
path: path != initialPath ? path : undefined,
|
||||
summary
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -75,16 +83,27 @@
|
||||
</script>
|
||||
|
||||
<Drawer bind:this={drawer}>
|
||||
<DrawerContent title="Move {initialPath}" on:close={drawer.closeDrawer}>
|
||||
<div class="flex flex-col gap-6">
|
||||
<h1>Move {initialPath} to</h1>
|
||||
{#if !own}
|
||||
<Alert type="warning" title="Not owner"
|
||||
>Since you do not own this item, you cannot move this item (you can however fork it)</Alert
|
||||
>
|
||||
{/if}
|
||||
<DrawerContent title="Move/Rename {initialPath}" on:close={drawer.closeDrawer}>
|
||||
<h1 class="mb-2">Move/Rename {initialPath}</h1>
|
||||
|
||||
{#if !own}
|
||||
<Alert type="warning" title="Not owner"
|
||||
>Since you do not own this item, you cannot move this item (you can however fork it)</Alert
|
||||
>
|
||||
{/if}
|
||||
<h2 class="border-b pb-1 mt-8 mb-4">Summary</h2>
|
||||
<input
|
||||
type="text"
|
||||
bind:value={summary}
|
||||
placeholder="A short summary displayed when it is listed"
|
||||
rows="1"
|
||||
disabled={!own}
|
||||
/>
|
||||
|
||||
<h2 class="border-b pb-1 mt-8 mb-4">Path</h2>
|
||||
<div class="flex flex-col mb-2 gap-6">
|
||||
<Path disabled={!own} {kind} {initialPath} bind:path />
|
||||
<Button disabled={!own} on:click={updatePath}>Move</Button>
|
||||
<Button disabled={!own} on:click={updatePath}>Move/Rename</Button>
|
||||
<div />
|
||||
</div>
|
||||
</DrawerContent>
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
type="text"
|
||||
bind:this={summaryC}
|
||||
bind:value={script.summary}
|
||||
placeholder="A very short summary of the script displayed when the script is listed"
|
||||
placeholder="A short summary of the script displayed when the script is listed"
|
||||
rows="1"
|
||||
/>
|
||||
<h2 class="border-b pb-1 mt-8 mb-6">Language</h2>
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
export let path: string
|
||||
export let initialMode: EditorMode = 'dnd'
|
||||
export let policy: Policy
|
||||
export let summary: string
|
||||
|
||||
const appStore = writable<App>(app)
|
||||
const worldStore = writable<World | undefined>(undefined)
|
||||
@@ -44,7 +45,7 @@
|
||||
const selectedComponent = writable<string | undefined>(undefined)
|
||||
const mode = writable<EditorMode>(initialMode)
|
||||
const breakpoint = writable<EditorBreakpoint>('lg')
|
||||
|
||||
const summaryStore = writable(summary)
|
||||
const connectingInput = writable<ConnectingInput>({
|
||||
opened: false,
|
||||
input: undefined
|
||||
@@ -57,6 +58,7 @@
|
||||
staticOutputs,
|
||||
app: appStore,
|
||||
lazyGrid: writable([]),
|
||||
summary: summaryStore,
|
||||
selectedComponent,
|
||||
mode,
|
||||
connectingInput,
|
||||
@@ -95,11 +97,11 @@
|
||||
{#if !$userStore?.operator}
|
||||
<UnsavedConfirmationModal />
|
||||
{#if initialMode !== 'preview'}
|
||||
<AppEditorHeader bind:title={$appStore.title} bind:mode={$mode} bind:breakpoint={$breakpoint} />
|
||||
<AppEditorHeader />
|
||||
{/if}
|
||||
|
||||
{#if previewing}
|
||||
<AppPreview app={$appStore} appPath={path} {breakpoint} {policy} />
|
||||
<AppPreview {summary} app={$appStore} appPath={path} {breakpoint} {policy} />
|
||||
{:else}
|
||||
<SplitPanesWrapper class="max-w-full overflow-hidden">
|
||||
<Pane size={15} minSize={5} maxSize={33}>
|
||||
|
||||
@@ -17,10 +17,7 @@
|
||||
import type { AppEditorContext, EditorBreakpoint, EditorMode } from '../types'
|
||||
import AppExportButton from './AppExportButton.svelte'
|
||||
|
||||
const { app } = getContext<AppEditorContext>('AppEditorContext')
|
||||
export let title: string = $app.title || ''
|
||||
export let mode: EditorMode
|
||||
export let breakpoint: EditorBreakpoint
|
||||
const { app, summary, mode, breakpoint } = getContext<AppEditorContext>('AppEditorContext')
|
||||
const loading = {
|
||||
publish: false,
|
||||
save: false
|
||||
@@ -47,7 +44,7 @@
|
||||
requestBody: {
|
||||
value: $app,
|
||||
path,
|
||||
summary: 'App summary',
|
||||
summary: $summary,
|
||||
policy
|
||||
}
|
||||
})
|
||||
@@ -69,7 +66,7 @@
|
||||
path: $page.params.path,
|
||||
requestBody: {
|
||||
value: $app!,
|
||||
summary: title,
|
||||
summary: $summary,
|
||||
policy: {
|
||||
triggerables: {},
|
||||
execution_mode: Policy.execution_mode.PUBLISHER,
|
||||
@@ -110,10 +107,10 @@
|
||||
</Drawer>
|
||||
|
||||
<div class="border-b flex flex-row justify-between py-1 gap-1 gap-y-2 px-4 items-center flex-wrap">
|
||||
<input class="text-sm w-64" bind:value={title} />
|
||||
<input type="text" placeholder="App summary" class="text-sm w-64" bind:value={$summary} />
|
||||
<div class="flex gap-8 items-center">
|
||||
<div>
|
||||
<ToggleButtonGroup bind:selected={mode}>
|
||||
<ToggleButtonGroup bind:selected={$mode}>
|
||||
<ToggleButton position="left" value="dnd" size="xs">
|
||||
<div class="inline-flex gap-1 items-center">
|
||||
<Pencil size={14} />
|
||||
@@ -126,7 +123,7 @@
|
||||
</ToggleButtonGroup>
|
||||
</div>
|
||||
<div>
|
||||
<ToggleButtonGroup bind:selected={breakpoint}>
|
||||
<ToggleButtonGroup bind:selected={$breakpoint}>
|
||||
<ToggleButton position="left" value="sm" size="xs">
|
||||
<Smartphone size={14} />
|
||||
</ToggleButton>
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
export let appPath: string
|
||||
export let breakpoint: Writable<EditorBreakpoint>
|
||||
export let policy: Policy
|
||||
export let summary: string
|
||||
|
||||
const appStore = writable<App>(app)
|
||||
const worldStore = writable<World | undefined>(undefined)
|
||||
@@ -38,6 +39,7 @@
|
||||
staticOutputs,
|
||||
lazyGrid: writable(app.grid),
|
||||
app: appStore,
|
||||
summary: writable(summary),
|
||||
selectedComponent,
|
||||
mode,
|
||||
connectingInput,
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
connectingInput,
|
||||
staticOutputs,
|
||||
runnableComponents,
|
||||
lazyGrid
|
||||
lazyGrid,
|
||||
summary
|
||||
} = getContext<AppEditorContext>('AppEditorContext')
|
||||
|
||||
// The drag is disabled when the user is connecting an input
|
||||
@@ -102,7 +103,7 @@
|
||||
|
||||
<div class="bg-white px-2 relative">
|
||||
<div class="w-full flex justify-between border-b px-4 py-2 mb-4 items-center gap-4">
|
||||
<h2>{$app.title}</h2>
|
||||
<h2 class="truncate">{$summary}</h2>
|
||||
<RecomputeAllComponents />
|
||||
<div class="text-2xs text-gray-600"
|
||||
>{policy.on_behalf_of ? `on behalf of ${policy.on_behalf_of}` : ''}</div
|
||||
|
||||
@@ -111,7 +111,6 @@ export type InlineScript = {
|
||||
|
||||
export type App = {
|
||||
grid: GridItem[]
|
||||
title: string
|
||||
fullscreen: boolean
|
||||
unusedInlineScripts: Array<{
|
||||
name: string
|
||||
@@ -129,7 +128,8 @@ export type AppEditorContext = {
|
||||
worldStore: Writable<World | undefined>
|
||||
staticOutputs: Writable<Record<string, string[]>>,
|
||||
lazyGrid: Writable<GridItem[]>,
|
||||
app: Writable<App>
|
||||
app: Writable<App>,
|
||||
summary: Writable<string>,
|
||||
selectedComponent: Writable<string | undefined>
|
||||
mode: Writable<EditorMode>
|
||||
connectingInput: Writable<ConnectingInput>
|
||||
|
||||
@@ -85,10 +85,10 @@
|
||||
href: `/apps/edit/${path}?nodraft=true`
|
||||
},
|
||||
{
|
||||
displayName: 'Move',
|
||||
displayName: 'Move/Rename',
|
||||
icon: faFileExport,
|
||||
action: () => {
|
||||
moveDrawer.openDrawer(path, 'app')
|
||||
moveDrawer.openDrawer(path, summary, 'app')
|
||||
},
|
||||
disabled: !canWrite
|
||||
},
|
||||
|
||||
@@ -137,10 +137,10 @@
|
||||
href: `/runs/${path}`
|
||||
},
|
||||
{
|
||||
displayName: 'Move',
|
||||
displayName: 'Move/Rename',
|
||||
icon: faFileExport,
|
||||
action: () => {
|
||||
moveDrawer.openDrawer(path, 'flow')
|
||||
moveDrawer.openDrawer(path, summary, 'flow')
|
||||
},
|
||||
disabled: !canWrite
|
||||
},
|
||||
|
||||
@@ -157,10 +157,10 @@
|
||||
href: `/scripts/add?template=${path}`
|
||||
},
|
||||
{
|
||||
displayName: 'Move',
|
||||
displayName: 'Move/Rename',
|
||||
icon: faFileExport,
|
||||
action: () => {
|
||||
moveDrawer.openDrawer(path, 'script')
|
||||
moveDrawer.openDrawer(path, summary, 'script')
|
||||
},
|
||||
disabled: !canWrite
|
||||
},
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<input
|
||||
type="text"
|
||||
bind:value={$flowStore.summary}
|
||||
placeholder="A very short summary of the flow displayed when the flow is listed"
|
||||
placeholder="A short summary of the flow displayed when the flow is listed"
|
||||
rows="1"
|
||||
id="flow-summary"
|
||||
/>
|
||||
|
||||
@@ -296,7 +296,7 @@
|
||||
{:else}
|
||||
<div class="border rounded-md divide-y divide-gray-200 mb-80">
|
||||
<!-- <VirtualList {items} let:item bind:start bind:end> -->
|
||||
{#each items ?? [] as item, i (item.type + '/' + item.path)}
|
||||
{#each items ?? [] as item, i (item.type + '/' + item.path + (item.summary ?? ''))}
|
||||
{#if item.type == 'script'}
|
||||
<ScriptRow
|
||||
starred={item.starred ?? false}
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
{#if value}
|
||||
<div class="h-screen">
|
||||
<AppEditor
|
||||
summary={''}
|
||||
app={value}
|
||||
path={''}
|
||||
policy={{
|
||||
|
||||
@@ -42,6 +42,6 @@
|
||||
|
||||
{#if app}
|
||||
<div class="h-screen">
|
||||
<AppEditor app={app.value} path={app.path} policy={app.policy} />
|
||||
<AppEditor summary={app.summary} app={app.value} path={app.path} policy={app.policy} />
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -23,7 +23,13 @@
|
||||
|
||||
{#if app}
|
||||
<div class="border rounded-md p-2 w-full">
|
||||
<AppPreview app={app.value} appPath={app.path} {breakpoint} policy={app.policy} />
|
||||
<AppPreview
|
||||
summary={app.summary}
|
||||
app={app.value}
|
||||
appPath={app.path}
|
||||
{breakpoint}
|
||||
policy={app.policy}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
<Skeleton layout={[10]} />
|
||||
|
||||
Reference in New Issue
Block a user