Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui):All popup windows now use markdown — some confirmation dialogs need adjustments #5986

Merged
merged 3 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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