diff --git a/frontend/src/routes/scripts/get/[...hash].svelte b/frontend/src/routes/scripts/get/[...hash].svelte
index 0309bf3ccf..532368535e 100644
--- a/frontend/src/routes/scripts/get/[...hash].svelte
+++ b/frontend/src/routes/scripts/get/[...hash].svelte
@@ -42,7 +42,7 @@
import CenteredPage from '$lib/components/CenteredPage.svelte'
import { onDestroy } from 'svelte'
import HighlightCode from '$lib/components/HighlightCode.svelte'
- import { Badge, Tabs, Tab, TabContent, Button, ActionRow } from '$lib/components/common'
+ import { Badge, Tabs, Tab, TabContent, Button, ActionRow, Alert } from '$lib/components/common'
import Skeleton from '../../../lib/components/common/skeleton/Skeleton.svelte'
import UserSettings from '$lib/components/UserSettings.svelte'
import Icon from 'svelte-awesome'
@@ -336,22 +336,13 @@
-
Not HEAD
-
- This hash is not HEAD (latest non-archived version at this path) :
- Go to the HEAD of this path
-
-
-
Archived
-
This version was archived
-
diff --git a/frontend/src/routes/scripts/run/[...hash].svelte b/frontend/src/routes/scripts/run/[...hash].svelte
index fc92ea6cf6..b8dd1494f8 100644
--- a/frontend/src/routes/scripts/run/[...hash].svelte
+++ b/frontend/src/routes/scripts/run/[...hash].svelte
@@ -23,16 +23,17 @@
import { inferArgs } from '$lib/infer'
import CenteredPage from '$lib/components/CenteredPage.svelte'
import RunForm from '$lib/components/RunForm.svelte'
- import { Badge, Button } from '$lib/components/common'
+ import { Alert, Badge, Button } from '$lib/components/common'
import SharedBadge from '$lib/components/SharedBadge.svelte'
import SvelteMarkdown from 'svelte-markdown'
import { faPlay, faScroll } from '@fortawesome/free-solid-svg-icons'
- const hash = $page.params.hash
+ $: hash = $page.params.hash
let script: Script | undefined
let runForm: RunForm | undefined
let isValid = true
let can_write = false
+ let topHash: string | undefined
async function loadScript() {
if (hash) {
@@ -42,6 +43,15 @@
inferArgs(script.language, script.content, script.schema)
script = script
}
+ if (script.path && script.archived) {
+ const script_by_path = await ScriptService.getScriptByPath({
+ workspace: $workspaceStore!,
+ path: script.path
+ }).catch((_) => console.error('this script has no non-archived version'))
+ topHash = script_by_path?.hash
+ } else {
+ topHash = undefined
+ }
can_write =
script.workspace_id == $workspaceStore &&
canWrite(script.path, script.extra_perms!, $userStore)
@@ -67,7 +77,7 @@
}
$: {
- if ($workspaceStore) {
+ if ($workspaceStore && hash) {
loadScript()
}
}
@@ -92,19 +102,19 @@
{#if script}
-
+
+ {#if topHash}
+
+ This hash is not HEAD (latest non-archived version at this path) :
+ Go to the HEAD of this path
+
+ {/if}
-
-
- {defaultIfEmptyString(script.summary, script.path)}
-
- {#if !emptyString(script.summary)}
- {script.path}
- {/if}
-
-
+
+
+
+
-
+
+
+
+ {defaultIfEmptyString(script.summary, script.path)}
+
+ {#if !emptyString(script.summary)}
+ {script.path}
+ {/if}
+
+
{#if script}