feat(editor): Add lead enrichment suggestions to workflow list (#8042)

## Summary
We want to show lead enrichment template suggestions to cloud users that
agreed to this. This PR introduces the front-end part of this feature
- Handoff document
- Figma Hi-fi
- [How to
test](https://linear.app/n8n/issue/ADO-1549/[n8n-fe]-update-workflows-list-page-to-show-fake-door-templates#comment-b6644c99)

Tests are being worked on in a separate PR

## Related tickets and issues
Fixes ADO-1546
Fixes ADO-1549
Fixes ADO-1604

## Review / Merge checklist
- [ ] PR title and summary are descriptive. **Remember, the title
automatically goes into the changelog. Use `(no-changelog)` otherwise.**
([conventions](https://github.com/n8n-io/n8n/blob/master/.github/pull_request_title_conventions.md))
- [ ] [Docs updated](https://github.com/n8n-io/n8n-docs) or follow-up
ticket created.
- [ ] Tests included.
> A bug is not considered fixed, unless a test is added to prevent it
from happening again.
   > A feature is not complete without tests.

---------

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
Milorad FIlipović
2023-12-19 15:10:03 +01:00
committed by GitHub
parent c170dd1da3
commit 36a923cf7b
26 changed files with 1387 additions and 87 deletions

View File

@@ -60,6 +60,7 @@
:isProductionExecutionPreview="isProductionExecutionPreview"
:workflow="currentWorkflowObject"
:disablePointerEvents="!canOpenNDV"
:hideNodeIssues="hideNodeIssues"
>
<template #custom-tooltip>
<span
@@ -746,6 +747,7 @@ export default defineComponent({
eventsAttached: false,
unloadTimeout: undefined as undefined | ReturnType<typeof setTimeout>,
canOpenNDV: true,
hideNodeIssues: false,
};
},
methods: {
@@ -1028,7 +1030,6 @@ export default defineComponent({
if (data.workflow.pinData) {
this.workflowsStore.setWorkflowPinData(data.workflow.pinData);
}
await this.$nextTick();
this.canvasStore.zoomToFit();
},
@@ -3304,6 +3305,9 @@ export default defineComponent({
window.addEventListener('beforeunload', this.onBeforeUnload);
window.addEventListener('unload', this.onUnload);
// Once view is initialized, pick up all toast notifications
// waiting in the store and display them
this.showNotificationForViews([VIEWS.WORKFLOW, VIEWS.NEW_WORKFLOW]);
},
getOutputEndpointUUID(
nodeName: string,
@@ -4356,6 +4360,7 @@ export default defineComponent({
try {
await this.importWorkflowExact(json);
this.canOpenNDV = json.canOpenNDV ?? true;
this.hideNodeIssues = json.hideNodeIssues ?? false;
this.isExecutionPreview = false;
} catch (e) {
if (window.top) {
@@ -4381,6 +4386,7 @@ export default defineComponent({
await this.openExecution(json.executionId);
this.canOpenNDV = json.canOpenNDV ?? true;
this.hideNodeIssues = json.hideNodeIssues ?? false;
this.isExecutionPreview = true;
} catch (e) {
if (window.top) {

View File

@@ -41,40 +41,55 @@
:readOnly="readOnlyEnv"
/>
</template>
<template #postListContent>
<suggested-templates-section
v-for="(section, key) in suggestedTemplates?.sections"
:key="key"
:section="section"
:title="
$locale.baseText('suggestedTemplates.sectionTitle', {
interpolate: { sectionName: section.name.toLocaleLowerCase() },
})
"
/>
</template>
<template #empty>
<div class="text-center mt-s">
<n8n-heading tag="h2" size="xlarge" class="mb-2xs">
{{
$locale.baseText(
currentUser.firstName
? 'workflows.empty.heading'
: 'workflows.empty.heading.userNotSetup',
{ interpolate: { name: currentUser.firstName } },
)
}}
</n8n-heading>
<n8n-text size="large" color="text-base">
{{
$locale.baseText(
readOnlyEnv
? 'workflows.empty.description.readOnlyEnv'
: 'workflows.empty.description',
)
}}
</n8n-text>
</div>
<div v-if="!readOnlyEnv" :class="['text-center', 'mt-2xl', $style.actionsContainer]">
<n8n-card
:class="$style.emptyStateCard"
hoverable
@click="addWorkflow"
data-test-id="new-workflow-card"
>
<n8n-icon :class="$style.emptyStateCardIcon" icon="file" />
<n8n-text size="large" class="mt-xs" color="text-base">
{{ $locale.baseText('workflows.empty.startFromScratch') }}
<suggested-templates-page v-if="suggestedTemplates" />
<div v-else>
<div class="text-center mt-s">
<n8n-heading tag="h2" size="xlarge" class="mb-2xs">
{{
$locale.baseText(
currentUser.firstName
? 'workflows.empty.heading'
: 'workflows.empty.heading.userNotSetup',
{ interpolate: { name: currentUser.firstName } },
)
}}
</n8n-heading>
<n8n-text size="large" color="text-base">
{{
$locale.baseText(
readOnlyEnv
? 'workflows.empty.description.readOnlyEnv'
: 'workflows.empty.description',
)
}}
</n8n-text>
</n8n-card>
</div>
<div v-if="!readOnlyEnv" :class="['text-center', 'mt-2xl', $style.actionsContainer]">
<n8n-card
:class="$style.emptyStateCard"
hoverable
@click="addWorkflow"
data-test-id="new-workflow-card"
>
<n8n-icon :class="$style.emptyStateCardIcon" icon="file" />
<n8n-text size="large" class="mt-xs" color="text-base">
{{ $locale.baseText('workflows.empty.startFromScratch') }}
</n8n-text>
</n8n-card>
</div>
</div>
</template>
<template #filters="{ setKeyValue }">
@@ -127,6 +142,8 @@ import WorkflowCard from '@/components/WorkflowCard.vue';
import { EnterpriseEditionFeature, VIEWS } from '@/constants';
import type { ITag, IUser, IWorkflowDb } from '@/Interface';
import TagsDropdown from '@/components/TagsDropdown.vue';
import SuggestedTemplatesPage from '@/components/SuggestedTemplates/SuggestedTemplatesPage.vue';
import SuggestedTemplatesSection from '@/components/SuggestedTemplates/SuggestedTemplatesSection.vue';
import { mapStores } from 'pinia';
import { useUIStore } from '@/stores/ui.store';
import { useSettingsStore } from '@/stores/settings.store';
@@ -152,6 +169,8 @@ const WorkflowsView = defineComponent({
ResourcesListLayout,
WorkflowCard,
TagsDropdown,
SuggestedTemplatesPage,
SuggestedTemplatesSection,
},
data() {
return {
@@ -200,6 +219,9 @@ const WorkflowsView = defineComponent({
},
];
},
suggestedTemplates() {
return this.uiStore.suggestedTemplates;
},
},
methods: {
addWorkflow() {