This is an automated email from the ASF dual-hosted git repository. yasithdev pushed a commit to branch feat/generic-experiment-launcher in repository https://gitbox.apache.org/repos/asf/airavata-portals.git
commit 939c109c3bc332f48993a7356ad6d8955c539dc8 Author: yasithdev <[email protected]> AuthorDate: Fri Apr 24 22:56:37 2026 -0400 feat(launcher): ScriptPreview + InvocationCommand presentational components --- .../js/components/launch/InvocationCommand.vue | 9 +++++++++ .../js/components/launch/ScriptPreview.vue | 7 +++++++ .../unit/components/launch/ScriptPreview.spec.ts | 23 ++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/launch/InvocationCommand.vue b/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/launch/InvocationCommand.vue new file mode 100644 index 000000000..abb857fc4 --- /dev/null +++ b/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/launch/InvocationCommand.vue @@ -0,0 +1,9 @@ +<template> + <div class="text-muted small mb-2"> + Invocation: <code>{{ command }}</code> + </div> +</template> + +<script setup lang="ts"> +defineProps<{ command: string }>(); +</script> diff --git a/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/launch/ScriptPreview.vue b/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/launch/ScriptPreview.vue new file mode 100644 index 000000000..9c8bbeff2 --- /dev/null +++ b/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/launch/ScriptPreview.vue @@ -0,0 +1,7 @@ +<template> + <pre class="bg-dark text-light p-3 rounded small mb-0" style="overflow-x: auto;"><code>{{ script }}</code></pre> +</template> + +<script setup lang="ts"> +defineProps<{ script: string }>(); +</script> diff --git a/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/tests/unit/components/launch/ScriptPreview.spec.ts b/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/tests/unit/components/launch/ScriptPreview.spec.ts new file mode 100644 index 000000000..c5bdf0bc6 --- /dev/null +++ b/airavata-django-portal/django_airavata/apps/workspace/static/django_airavata_workspace/tests/unit/components/launch/ScriptPreview.spec.ts @@ -0,0 +1,23 @@ +import { mount } from "@vue/test-utils"; +import { describe, expect, it } from "vitest"; +import ScriptPreview from "../../../../js/components/launch/ScriptPreview.vue"; +import InvocationCommand from "../../../../js/components/launch/InvocationCommand.vue"; + +describe("ScriptPreview", () => { + it("renders the script in a code block", () => { + const w = mount(ScriptPreview, { props: { script: "#!/bin/bash\necho hi\n" } }); + expect(w.find("pre code").text()).toContain("echo hi"); + }); + + it("is read-only (no contenteditable)", () => { + const w = mount(ScriptPreview, { props: { script: "x" } }); + expect(w.find("pre").attributes("contenteditable")).toBeUndefined(); + }); +}); + +describe("InvocationCommand", () => { + it("renders the command", () => { + const w = mount(InvocationCommand, { props: { command: "sbatch /tmp/run.sh" } }); + expect(w.text()).toContain("sbatch /tmp/run.sh"); + }); +});
