Skip to content

Commit 0d9ae69

Browse files
committed
Renders tool descriptions as markdown in TRS imports
Improves readability by rendering tool descriptions as markdown with support for links opening in new tabs. Enhances the user interface by visually limiting description length in tables.
1 parent 66940ca commit 0d9ae69

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

client/src/components/Workflow/Import/TrsSearch.vue

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useRouter } from "vue-router/composables";
99
1010
import { getRedirectOnImportPath } from "@/components/Workflow/redirectPath";
1111
import { Services } from "@/components/Workflow/services";
12+
import { useMarkdown } from "@/composables/markdown";
1213
import { withPrefix } from "@/utils/redirect";
1314
1415
import type { TrsSelection } from "./types";
@@ -26,6 +27,8 @@ type TrsSearchData = {
2627
[key: string]: unknown;
2728
};
2829
30+
const { renderMarkdown } = useMarkdown({ openLinksInNewPage: true });
31+
2932
const fields = [
3033
{ key: "name", label: "Name" },
3134
{ key: "description", label: "Description" },
@@ -195,7 +198,22 @@ async function importVersion(trsId?: string, toolIdToImport?: string, version?:
195198
@onImport="(versionId) => importVersion(trsSelection?.id, row.item.data.id, versionId)" />
196199
</BCard>
197200
</template>
201+
202+
<template v-slot:cell(description)="row">
203+
<span class="trs-description" v-html="renderMarkdown(row.item.data.description)" />
204+
</template>
198205
</BTable>
199206
</div>
200207
</BCard>
201208
</template>
209+
210+
<style>
211+
.trs-description {
212+
position: relative;
213+
overflow: hidden;
214+
display: -webkit-box;
215+
-webkit-box-orient: vertical;
216+
-webkit-line-clamp: 3;
217+
line-clamp: 3;
218+
}
219+
</style>

client/src/components/Workflow/Import/TrsTool.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { faUpload } from "@fortawesome/free-solid-svg-icons";
44
import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome";
55
import { BButton } from "bootstrap-vue";
66
7+
import { useMarkdown } from "@/composables/markdown";
8+
79
import type { TrsTool, TrsToolVersion } from "./types";
810
911
library.add(faUpload);
@@ -18,6 +20,8 @@ const emit = defineEmits<{
1820
(e: "onImport", versionId: string): void;
1921
}>();
2022
23+
const { renderMarkdown } = useMarkdown({ openLinksInNewPage: true });
24+
2125
function importVersion(version: TrsToolVersion) {
2226
const version_id = version.id.includes(`:${version.name}`) ? version.name : version.id;
2327
emit("onImport", version_id);
@@ -34,7 +38,7 @@ function importVersion(version: TrsToolVersion) {
3438
<div>
3539
<b>Description:</b>
3640

37-
<span>{{ props.trsTool.description }}</span>
41+
<span v-html="renderMarkdown(props.trsTool.description)" />
3842
</div>
3943
<div>
4044
<b>Organization</b>

0 commit comments

Comments
 (0)