Skip to content

Commit

Permalink
chore(ui): make confirmation dialogs properly render markdown content (
Browse files Browse the repository at this point in the history
…#5986)

Co-authored-by: Miloš Paunović <[email protected]>
  • Loading branch information
pphy03 and MilosPaunovic authored Dec 4, 2024
1 parent f02cf1f commit 9cdaefc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 1 addition & 3 deletions ui/src/components/flows/TriggerFlow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@


<script>
import {h} from "vue";
import FlowRun from "./FlowRun.vue";
import {mapState} from "vuex";
import Flash from "vue-material-design-icons/Flash.vue";
Expand Down Expand Up @@ -114,7 +112,7 @@
return;
}
else if (this.checkForTrigger) {
this.$toast().confirm(h(FlowWarningDialog), () => (this.toggleModal()), true, null);
this.$toast().confirm(FlowWarningDialog, () => (this.toggleModal()), true, null);
}
else if (this.computedNamespace !== undefined && this.computedFlowId !== undefined) {
this.toggleModal()
Expand Down
11 changes: 8 additions & 3 deletions ui/src/utils/toast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import {ElNotification, ElMessageBox, ElTable, ElTableColumn} from "element-plus
import {h} from "vue"
import {useI18n} from "vue-i18n"

import Markdown from "../components/layout/Markdown.vue"

// eslint-disable-next-line no-unused-vars
const makeToast = (t: (t:string, options?: Record<string, string>) => string) => ({
_wrap: function(message) {
Expand All @@ -21,12 +23,15 @@ const makeToast = (t: (t:string, options?: Record<string, string>) => string) =>
]
)
} else {
return h("span", {innerHTML: message});
return h(Markdown, {source: message});
}
},
confirm: function(message, callback, renderVNode = false, type = "warning" as const) {
_MarkdownWrap: function(message) {
return h(Markdown, {source: message})
},
confirm: function(message, callback, type = "warning" as const) {
ElMessageBox
.confirm(renderVNode ? message : this._wrap(message || t("toast confirm")), t("confirmation"), {type})
.confirm(typeof message === "string" ? this._MarkdownWrap(message || t("toast confirm")) : h(message), t("confirmation"), {type})
.then(() => callback())
},
saved: function(name, title, options) {
Expand Down

0 comments on commit 9cdaefc

Please sign in to comment.