n8n/packages/editor-ui/src/components/PageAlert.vue
Csaba Tuncsik b95fcd7323
refactor(editor): Turn showMessage mixin to composable (#6081)
* refactor(editor): move $getExecutionError from showMessages mixin to pushConnection (it is used there only)

* refactor(editor): resolve showMessage mixin methods

* fix(editor): use composable instead of mixin

* fix(editor): resolve conflicts

* fix(editor): replace clearAllStickyNotifications

* fix(editor): replace confirmMessage

* fix(editor): replace confirmMessage

* fix(editor): replace confirmMessage

* fix(editor): remove last confirmMessage usage

* fix(editor): remove $prompt usage

* fix(editor): remove $show methods

* fix(editor): lint fix

* fix(editor): lint fix

* fix(editor): fixes after review
2023-05-12 10:13:42 +02:00

50 lines
877 B
Vue

<template>
<fragment></fragment>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
import type { ElNotificationComponent } from 'element-ui/types/notification';
import { sanitizeHtml } from '@/utils';
import { useToast } from '@/composables';
export default defineComponent({
name: 'PageAlert',
props: {
message: {
type: String,
required: true,
},
popupClass: {
type: String,
},
},
setup() {
return {
...useToast(),
};
},
data() {
return {
alert: null as null | ElNotificationComponent,
};
},
mounted() {
this.alert = this.showAlert({
title: '',
message: sanitizeHtml(this.message),
type: 'warning',
duration: 0,
showClose: true,
dangerouslyUseHTMLString: true,
customClass: this.popupClass || '',
});
},
beforeDestroy() {
if (this.alert) {
this.alert.close();
}
},
});
</script>