{#if menuOpen} goto('/schedules')} bind:this={scheduleEditor} /> {/if} {#if lock_error_logs} Deployment failed {/if} {#if archived} archived {/if} {#if !$userStore?.operator} {#if canWrite && !archived} Edit {:else if !draft_only} Fork {/if} {/if} { let owner = isOwner(path, $userStore, $workspaceStore) if (draft_only) { return [ { displayName: 'View code', icon: Code, action: () => { showCode(script.path, script.summary) } }, { displayName: 'Delete', icon: Trash, action: (event) => { // TODO // @ts-ignore if (event?.shiftKey) { deleteScript(path) } else { deleteConfirmedCallback = () => { deleteScript(path) } } }, type: dlt, disabled: !canWrite } ] } return [ { displayName: 'View code', icon: Code, action: () => { showCode(script.path, script.summary) } }, { displayName: 'Duplicate/Fork', icon: GitFork, href: `/scripts/add?template=${path}` }, { displayName: 'Move/Rename', icon: FileUp, action: () => { moveDrawer.openDrawer(path, summary, 'script') }, disabled: !owner || archived }, { displayName: 'Deploy to staging/prod', icon: FileUp, action: () => { deploymentDrawer.openDrawer(path, 'script') }, disabled: archived }, { displayName: 'View runs', icon: List, href: `/runs/${path}` }, { displayName: 'Schedule', icon: Calendar, action: () => { scheduleEditor.openNew(false, path) }, disabled: archived }, { displayName: owner ? 'Share' : 'See Permissions', icon: Share, action: () => { shareModal.openDrawer && shareModal.openDrawer(path, 'script') }, disabled: archived }, { displayName: 'Copy path', icon: Copy, action: () => { copyToClipboard(path) } }, { displayName: archived ? 'Unarchive' : 'Archive', icon: Archive, action: () => { archived ? path && unarchiveScript(path) : path && archiveScript(path) }, type: 'delete', disabled: !owner }, ...(has_draft ? [ { displayName: 'Delete Draft', icon: Trash, action: async () => { await DraftService.deleteDraft({ workspace: $workspaceStore ?? '', path, kind: 'script' }) dispatch('change') }, type: DELETE, disabled: !owner } ] : []), ...($userStore?.is_admin || $userStore?.is_super_admin ? [ { displayName: 'Delete', icon: Trash, action: (event) => { if (event?.shiftKey) { deleteScript(path) } else { deleteConfirmedCallback = () => { deleteScript(path) } } }, type: dlt, disabled: !canWrite } ] : []) ] }} on:open={() => { menuOpen = true }} />