Skip to content

Commit

Permalink
ToolStd -> typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Dec 19, 2023
1 parent a8dbca0 commit 136aba2
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 26 deletions.
52 changes: 27 additions & 25 deletions client/src/components/Markdown/Elements/ToolStd.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
<script setup lang="ts">
import { computed } from "vue";
interface Job {
tool_stdout?: string;
tool_stderr?: string;
}
type JobsMap = {
[key: string]: Job;
};
interface ToolStdProps {
jobId: string;
name: "tool_stderr" | "tool_stdout";
jobs: JobsMap;
}
const props = defineProps<ToolStdProps>();
const jobContent = computed(() => {
const job = props.jobs[props.jobId];
return job && job[props.name];
});
</script>

<template>
<b-card nobody class="content-height">
<div :class="name" :job_id="args.job_id">
<div :class="name" :job_id="jobId">
<pre><code class="word-wrap-normal">{{ jobContent }}</code></pre>
</div>
</b-card>
</template>

<script>
export default {
props: {
args: {
type: Object,
required: true,
},
name: {
type: String,
required: true,
},
jobs: {
type: Object,
default: null,
},
},
computed: {
jobContent() {
const job = this.jobs[this.args.job_id];
return job && job[this.name];
},
},
};
</script>
<style scoped>
.content-height {
max-height: 15rem;
Expand Down
6 changes: 5 additions & 1 deletion client/src/components/Markdown/MarkdownContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,11 @@ function argToBoolean(args, name, booleanDefault) {
v-else-if="name == 'history_dataset_collection_display'"
:args="args"
:collections="collections" />
<ToolStd v-else-if="['tool_stdout', 'tool_stderr'].includes(name)" :args="args" :name="name" :jobs="jobs" />
<ToolStd
v-else-if="['tool_stdout', 'tool_stderr'].includes(name)"
:job-id="args.job_id"
:name="name"
:jobs="jobs" />
<HistoryDatasetDisplay
v-else-if="['history_dataset_embedded', 'history_dataset_display'].includes(name)"
:args="args"
Expand Down

0 comments on commit 136aba2

Please sign in to comment.