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