n8n/packages/editor-ui/src/components/ContactPromptModal.vue
Mutasem Aldmour 49bf786e5b
Improve workflow activation (#2692)
* feat: activator disabled based on thiggers

* feat: tooltip over inactive switch

* feat: message for trigger types

* feat: deactivate on save if trigger is removed

* chore: refactor executions modal

* feat: calculate service name if possible

* feat: alert on activation

* chore: fix linting

* feat: always enable activator when active

* fix: adjust the alert

* feat: take disabled state into account

* feat: automatically save on activation

* feat: rely on nodes name and edit messages

* feat: isolate state for each activator instance

* feat: create activation modal component

* feat: activationModal checkbox and trigger message

* feat: add activation messages to node config

* chore: style activation modal

* chore: style fixes

* feat: refactor disabled state

* chore: refactor modal

* chore: refactor modal

* chore: tidy the node config

* chore: refactor and styling tweaks

* chore: minor fixes

* fix: check webhooks from ui nodes

* chore: remove saving prompt

* chore: explicit current workflow evaluation

* feat: add settings link to activation modal

* fix: immediately load executions on render

* feat: exclude error trigger from trigger nodes

* chore: add i18n keys

* fix: check localstorage more strictly

* fix: handle refresh in execution list

* remove unnessary event

* remove comment

* fix closing executions modal bugs

* update closing

* update translation key

* fix translation keys

* fix modal closing

* fix closing

* fix drawer closing

* close all modals when opening executions

* update key

* close all modals when opening workflow or new page

* delete unnessary comment

* clean up import

* clean up unnessary initial data

* clean up activator impl

* rewrite

* fix open modal bug

* simply remove error

* refactor activation logic

* fix i18n and such

* remove changes

* revert saving changes

* Revert "revert saving changes"

25c29d1055

* add translation

* fix new workflows saving

* clean up modal impl

* clean up impl

* refactor common code out

* remove active changes from saving

* refactor differently

* revert unnessary change

* set dirty false

* fix i18n bug

* avoid opening two modals

* fix tooltips

* add comment

* address other comments

* address comments

Co-authored-by: saintsebastian <tilitidam@gmail.com>
2022-01-21 18:00:00 +01:00

128 lines
3 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<Modal
:name="modalName"
:eventBus="modalBus"
:center="true"
:closeOnPressEscape="false"
:beforeClose="closeDialog"
customClass="contact-prompt-modal"
width="460px"
>
<template slot="header">
<n8n-heading tag="h2" size="xlarge" color="text-dark">{{ title }}</n8n-heading>
</template>
<template v-slot:content>
<div :class="$style.description">
<n8n-text size="medium" color="text-base">{{ description }}</n8n-text>
</div>
<div @keyup.enter="send">
<n8n-input v-model="email" placeholder="Your email address" />
</div>
<div :class="$style.disclaimer">
<n8n-text size="small" color="text-base"
>David from our product team will get in touch personally</n8n-text
>
</div>
</template>
<template v-slot:footer>
<div :class="$style.footer">
<n8n-button label="Send" float="right" @click="send" :disabled="!isEmailValid" />
</div>
</template>
</Modal>
</template>
<script lang="ts">
import Vue from 'vue';
import mixins from 'vue-typed-mixins';
import { mapGetters } from 'vuex';
import { IN8nPromptResponse } from '@/Interface';
import { VALID_EMAIL_REGEX } from '@/constants';
import { workflowHelpers } from '@/components/mixins/workflowHelpers';
import Modal from './Modal.vue';
export default mixins(workflowHelpers).extend({
components: { Modal },
name: 'ContactPromptModal',
props: ['modalName'],
data() {
return {
email: '',
modalBus: new Vue(),
};
},
computed: {
...mapGetters({
promptsData: 'settings/getPromptsData',
}),
title(): string {
if (this.promptsData && this.promptsData.title) {
return this.promptsData.title;
}
return 'Youre a power user 💪';
},
description(): string {
if (this.promptsData && this.promptsData.message) {
return this.promptsData.message;
}
return 'Your experience with n8n can help us improve — for you and our entire community.';
},
isEmailValid(): boolean {
return VALID_EMAIL_REGEX.test(String(this.email).toLowerCase());
},
},
methods: {
closeDialog(): void {
this.$telemetry.track('User closed email modal', {
instance_id: this.$store.getters.instanceId,
email: null,
});
},
async send() {
if (this.isEmailValid) {
const response: IN8nPromptResponse = await this.$store.dispatch(
'settings/submitContactInfo',
this.email,
);
if (response.updated) {
this.$telemetry.track('User closed email modal', {
instance_id: this.$store.getters.instanceId,
email: this.email,
});
this.$showMessage({
title: 'Thanks!',
message: "It's people like you that help make n8n better",
type: 'success',
});
}
this.modalBus.$emit('close');
}
},
},
});
</script>
<style lang="scss" module>
.description {
margin-bottom: var(--spacing-s);
}
.disclaimer {
margin-top: var(--spacing-4xs);
}
</style>
<style lang="scss">
.dialog-wrapper {
.contact-prompt-modal {
.el-dialog__body {
padding: 16px 24px 24px;
}
}
}
</style>