From a87b0b60aa15ef4bf4cb63d0578db6ab51d4417d Mon Sep 17 00:00:00 2001 From: ricardo Date: Tue, 2 May 2023 23:31:37 -0400 Subject: [PATCH 01/52] Add ExecutionsUsage component --- .../src/components/N8nMenu/Menu.vue | 1 + packages/editor-ui/src/Interface.ts | 33 ++++ .../src/components/ExecutionsUsage.vue | 184 ++++++++++++++++++ .../editor-ui/src/components/MainSidebar.vue | 4 + .../editor-ui/src/n8n-theme-variables.scss | 2 +- .../src/plugins/i18n/locales/en.json | 9 +- packages/editor-ui/src/plugins/icons/index.ts | 2 + 7 files changed, 233 insertions(+), 2 deletions(-) create mode 100644 packages/editor-ui/src/components/ExecutionsUsage.vue diff --git a/packages/design-system/src/components/N8nMenu/Menu.vue b/packages/design-system/src/components/N8nMenu/Menu.vue index 66e9d61bb46bd..6dafe805fcd4b 100644 --- a/packages/design-system/src/components/N8nMenu/Menu.vue +++ b/packages/design-system/src/components/N8nMenu/Menu.vue @@ -28,6 +28,7 @@
+ +
+
+ + + + +
+
+ + {{ locale.baseText('executionUsage.expired.text') }} + +
+
+ + {{ locale.baseText('executionUsage.ranOutOfExecutions.text') }} + +
+
+
+ +
+
+ + {{ currentExecutions }}/{{ maxExecutions }} + + {{ + locale.baseText('executionUsage.label.executions') + }} +
+
+ +
+ +
+
+ + + + + diff --git a/packages/editor-ui/src/components/MainSidebar.vue b/packages/editor-ui/src/components/MainSidebar.vue index 4f2c445659e5b..bb9f667ff4203 100644 --- a/packages/editor-ui/src/components/MainSidebar.vue +++ b/packages/editor-ui/src/components/MainSidebar.vue @@ -25,6 +25,8 @@ />
+ + diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 0981b0d5c93ee..c574dd85206a2 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1814,7 +1814,7 @@ "sso.login.button": "Continue with SSO", "executionUsage.currentUsage": "{text} {count}", "executionUsage.currentUsage.text": "You are in a free trial with limited executions. You have", - "executionUsage.currentUsage.count": "days left.", + "executionUsage.currentUsage.count": "{days} days left.", "executionUsage.label.executions": "Executions", "executionUsage.button.upgrade": "Upgrade plan", "executionUsage.expired.text": "You're trial is over. Upgrade now to keep your automation data", From f57d0851bda4a1be51966f0eda3131c7b8dea811 Mon Sep 17 00:00:00 2001 From: ricardo Date: Wed, 3 May 2023 18:43:41 -0400 Subject: [PATCH 04/52] Rename PlanData type to CloudPlanData --- packages/editor-ui/src/Interface.ts | 2 +- packages/editor-ui/src/components/ExecutionsUsage.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index 51a147af6c43c..91c3cff7f9bd4 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -1444,7 +1444,7 @@ export type VersionControlPreferences = { publicKey?: string; }; -export interface PlanData { +export interface CloudPlanData { planSpec: PlanSpec; instance: Instance; usage: Usage; diff --git a/packages/editor-ui/src/components/ExecutionsUsage.vue b/packages/editor-ui/src/components/ExecutionsUsage.vue index 690a1d5513e95..3e92700516934 100644 --- a/packages/editor-ui/src/components/ExecutionsUsage.vue +++ b/packages/editor-ui/src/components/ExecutionsUsage.vue @@ -64,10 +64,10 @@ diff --git a/packages/editor-ui/src/components/MainSidebar.vue b/packages/editor-ui/src/components/MainSidebar.vue index bb9f667ff4203..412a50e97c959 100644 --- a/packages/editor-ui/src/components/MainSidebar.vue +++ b/packages/editor-ui/src/components/MainSidebar.vue @@ -26,7 +26,9 @@ - + diff --git a/packages/editor-ui/src/constants.ts b/packages/editor-ui/src/constants.ts index 501fbbcdebb6f..0e88fe5698172 100644 --- a/packages/editor-ui/src/constants.ts +++ b/packages/editor-ui/src/constants.ts @@ -548,3 +548,7 @@ export const ALLOWED_HTML_TAGS = [ 'details', 'summary', ]; + +export const CHANGE_PLAN_PAGE_PRODUCTION = 'https://app.n8n.cloud/account/change-plan'; + +export const CHANGE_PLAN_PAGE_STAGING = 'https://stage-app.n8n.cloud/account/change-plan'; From 014883243c918ded8da0d2017093008bebbad19f Mon Sep 17 00:00:00 2001 From: ricardo Date: Thu, 4 May 2023 16:58:21 -0400 Subject: [PATCH 16/52] Remove computed properties --- packages/editor-ui/src/App.vue | 2 +- packages/editor-ui/src/Interface.ts | 4 +- packages/editor-ui/src/api/cloudPlans.ts | 2 +- .../src/components/ExecutionsUsage.vue | 55 ++++++++++--------- packages/editor-ui/src/stores/users.ts | 2 +- 5 files changed, 34 insertions(+), 31 deletions(-) diff --git a/packages/editor-ui/src/App.vue b/packages/editor-ui/src/App.vue index 1260032300e24..5edf8e2519d73 100644 --- a/packages/editor-ui/src/App.vue +++ b/packages/editor-ui/src/App.vue @@ -186,7 +186,7 @@ export default mixins(newVersions, showMessage, userHelpers).extend({ setInterval(async () => { try { const planData = await this.usersStore.getOwnerCurrentPLan(); - if (planData.planSpec.metadata.slug === 'trial-1') { + if (planData.plan.metadata.slug === 'trial-1') { planData.usage.executions += acc; acc += 20; this.usersStore.setCloudPLan(planData); diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index f569f71765a91..8ece46bbdc78a 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -1446,12 +1446,12 @@ export type VersionControlPreferences = { }; export interface CloudPlanData { - planSpec: PlanSpec; + plan: Plan; instance: Instance; usage: Usage; } -export interface PlanSpec { +export interface Plan { planId: number; monthlyExecutionsLimit: number; activeWorkflowsLimit: number; diff --git a/packages/editor-ui/src/api/cloudPlans.ts b/packages/editor-ui/src/api/cloudPlans.ts index 20217989a9e7e..9d194ea1c23f9 100644 --- a/packages/editor-ui/src/api/cloudPlans.ts +++ b/packages/editor-ui/src/api/cloudPlans.ts @@ -5,7 +5,7 @@ export function getCurrentPlan( cloudUserId: string, ): Promise { return Promise.resolve({ - planSpec: { + plan: { planId: 43039, monthlyExecutionsLimit: 200, activeWorkflowsLimit: 10, diff --git a/packages/editor-ui/src/components/ExecutionsUsage.vue b/packages/editor-ui/src/components/ExecutionsUsage.vue index 14278d8fefe91..38bd0ed80ba33 100644 --- a/packages/editor-ui/src/components/ExecutionsUsage.vue +++ b/packages/editor-ui/src/components/ExecutionsUsage.vue @@ -1,6 +1,6 @@