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

feat(editor): Add cloud ExecutionsUsage and API blocking using licenses #6159

Merged
merged 57 commits into from
May 15, 2023

Conversation

RicardoE105
Copy link
Contributor

Github issue / Community forum post (link here to close automatically):

@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Great PR! Please pay attention to the following items before merging:

Files matching packages/**:

  • If fixing bug, added test to cover scenario.
  • If addressing forum or Github issue, added link to description.

Files matching packages/**/*.ts:

  • Added unit tests to cover new or updated functionality.

Files matching **/*.vue:

  • Used composition API for all new components.
  • Added component or unit tests to cover functionality.

Files matching packages/editor-ui/**/*.vue:

  • Added E2E if adding new features.
  • Used design system tokens (colors, spacings...) where possible.

Files matching packages/design-system/**/*.vue:

  • Used design system tokens (colors, spacings...) where possible.
  • Updated Storybook with new component or updated functionality.

Make sure to check off this list before asking for review.

@RicardoE105 RicardoE105 changed the title Add ExecutionsUsage component feat(editor): Add ExecutionsUsage component May 3, 2023
@RicardoE105 RicardoE105 requested a review from mutdmour May 3, 2023 03:17
@RicardoE105 RicardoE105 force-pushed the ado-638-in-app-build-ui-for-upgrade-path branch from 6647913 to c2c7ed8 Compare May 3, 2023 03:18
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels May 3, 2023
@RicardoE105 RicardoE105 force-pushed the ado-638-in-app-build-ui-for-upgrade-path branch from c2c7ed8 to a87b0b6 Compare May 3, 2023 03:32
@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Patch coverage: 70.80% and project coverage change: +0.11 🎉

Comparison is base (51fb913) 27.39% compared to head (9c8f61e) 27.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6159      +/-   ##
==========================================
+ Coverage   27.39%   27.50%   +0.11%     
==========================================
  Files        2937     2940       +3     
  Lines      180177   180626     +449     
  Branches    19557    19563       +6     
==========================================
+ Hits        49362    49685     +323     
- Misses     130082   130206     +124     
- Partials      733      735       +2     
Impacted Files Coverage Δ
packages/cli/src/License.ts 56.17% <0.00%> (-1.30%) ⬇️
packages/cli/src/Server.ts 0.00% <0.00%> (ø)
...ages/design-system/src/components/N8nMenu/Menu.vue 0.00% <0.00%> (ø)
packages/editor-ui/src/App.vue 0.00% <0.00%> (ø)
packages/editor-ui/src/stores/cloudPlan.store.ts 20.48% <20.48%> (ø)
packages/editor-ui/src/api/cloudPlans.ts 30.76% <30.76%> (ø)
packages/cli/src/PublicApi/index.ts 73.68% <33.33%> (-4.75%) ⬇️
packages/editor-ui/src/components/MainSidebar.vue 45.48% <47.82%> (+0.06%) ⬆️
packages/editor-ui/src/views/SettingsApiView.vue 61.73% <55.00%> (-1.00%) ⬇️
packages/editor-ui/src/constants.ts 97.86% <80.00%> (-0.33%) ⬇️
... and 9 more

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

packages/editor-ui/src/n8n-theme-variables.scss Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/Interface.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/Interface.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
@RicardoE105 RicardoE105 requested a review from mutdmour May 4, 2023 13:57
packages/editor-ui/src/stores/users.ts Outdated Show resolved Hide resolved
Comment on lines 70 to 102
export interface CloudPlanData {
planSpec: PlanSpec;
instance: Instance;
usage: Usage;
}

export interface PlanSpec {
planId: number;
monthlyExecutionsLimit: number;
activeWorkflowsLimit: number;
credentialsLimit: number;
isActive: boolean;
displayName: string;
expirationDate: string;
metadata: PlanMetadata;
}
export interface PlanMetadata {
version: 'v1';
group: 'opt-out' | 'opt-in';
slug: 'pro-1' | 'pro-2' | 'starter' | 'trial-1';
trial?: Trial;
}
export interface Trial {
length: number;
gracePeriod: number;
}
export interface Instance {
createdAt: string;
}
export interface Usage {
executions: number;
activeWorkflows: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you duplicating the types here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not possible to use an external type for the defineProps method. See vuejs/core#4294. It can be done with a plugin, but I guess we can do that later on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn did not know this.. maybe we can just extend the original types then so we are not duplicating the types completely.. @OlegIvaniv can you take a look here?

interface CloudPlanLocal extends CloudPlan {}

packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
packages/editor-ui/src/api/cloudPlans.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/api/cloudPlans.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/components/MainSidebar.vue Outdated Show resolved Hide resolved
@RicardoE105 RicardoE105 requested a review from mutdmour May 4, 2023 21:30
packages/editor-ui/src/App.vue Outdated Show resolved Hide resolved
// TODO: remove before releasing
plan.usage.executions += acc;
acc += 20;
this.usersStore.setCloudPLan(plan);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be done as part of the store action..

packages/editor-ui/src/App.vue Outdated Show resolved Hide resolved
Comment on lines 70 to 102
export interface CloudPlanData {
planSpec: PlanSpec;
instance: Instance;
usage: Usage;
}

export interface PlanSpec {
planId: number;
monthlyExecutionsLimit: number;
activeWorkflowsLimit: number;
credentialsLimit: number;
isActive: boolean;
displayName: string;
expirationDate: string;
metadata: PlanMetadata;
}
export interface PlanMetadata {
version: 'v1';
group: 'opt-out' | 'opt-in';
slug: 'pro-1' | 'pro-2' | 'starter' | 'trial-1';
trial?: Trial;
}
export interface Trial {
length: number;
gracePeriod: number;
}
export interface Instance {
createdAt: string;
}
export interface Usage {
executions: number;
activeWorkflows: number;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn did not know this.. maybe we can just extend the original types then so we are not duplicating the types completely.. @OlegIvaniv can you take a look here?

interface CloudPlanLocal extends CloudPlan {}

packages/editor-ui/src/components/ExecutionsUsage.vue Outdated Show resolved Hide resolved
@mutdmour
Copy link
Contributor

mutdmour commented May 5, 2023

Looks good overall.. 🙂 just needs tests now

mutdmour
mutdmour previously approved these changes May 12, 2023
Copy link
Contributor

@mutdmour mutdmour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.. couple of minor questions and nitpicks..

packages/editor-ui/src/utils/apiUtils.ts Show resolved Hide resolved
packages/editor-ui/src/stores/cloudPlan.store.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/stores/cloudPlan.store.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/constants.ts Outdated Show resolved Hide resolved
RicardoE105 and others added 8 commits May 13, 2023 16:32
…oud users (#6187)

* rename planSpec to plan

* Remove instance property as it's not needed anymore

* Flatten plan object

* remove console.log

* feat: disable api using license

* feat: add api page

* chore: resolve conflicts

* chore: resolve conflicts

* feat: update and refactor a bit

* fix: update endpoints

* fix: update endpoints

* fix: use host

* feat: update copy

* fix linting issues

---------

Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
@mutdmour mutdmour changed the title feat(editor): Add ExecutionsUsage component feat(editor): Add ExecutionsUsage and cloud API component May 15, 2023
@mutdmour mutdmour changed the title feat(editor): Add ExecutionsUsage and cloud API component feat(editor): Add cloud ExecutionsUsage and API blocking using licenses May 15, 2023
mutdmour
mutdmour previously approved these changes May 15, 2023
Copy link
Contributor

@mutdmour mutdmour left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@RicardoE105 RicardoE105 requested a review from mutdmour May 15, 2023 18:25
@github-actions
Copy link
Contributor

✅ All Cypress E2E specs passed

@RicardoE105 RicardoE105 merged commit cd7c312 into master May 15, 2023
@RicardoE105 RicardoE105 deleted the ado-638-in-app-build-ui-for-upgrade-path branch May 15, 2023 21:16
MiloradFilipovic added a commit that referenced this pull request May 16, 2023
* master: (22 commits)
  fix: Remove workflow execution credential error message when instance owner (#6116)
  refactor(editor): Drop vue-typed-mixins (no-changelog) (#6257)
  feat(core): Return OAuth2 error body if available (#5794)
  fix: Add itemSize config to workflows view recycle scroller (no-changelog) (#6238)
  fix(editor): Fix close and cancel operations on useMessage (no-changelog) (#6260)
  feat(editor): Add cloud ExecutionsUsage and API blocking using licenses (#6159)
  refactor(editor): Turn showMessage mixin to composable (#6081) (#6244)
  feat(core): Add experimental proxy support to License-SDK (no-changelog) (#6253)
  feat(core): Reduce the number of events sent to Sentry (#6235)
  feat(editor): Drop support for legacy browsers that do not have native ESM support (#6239)
  refactor(editor): Add missing interface IUserListAction (no-changelog) (#6241)
  ci: Debug e2e pipeline (no-changelog) (#6240)
  Revert "refactor(editor): Turn showMessage mixin to composable" (#6243)
  feat(editor): Updating node reference pattern in expression editor (#6228)
  refactor(editor): Remove unused dependencies (no-changelog) (#6223)
  refactor(editor): Turn showMessage mixin to composable (#6081)
  feat(editor): Version Control settings update (WIP) (#6233)
  ci: Fix linting issue on master (no-changelog) (#6232)
  fix: Prevent type error messages for manual executions (no-changelog) (#6229)
  fix(Code Node): Restore help text (#6231)
  ...
@janober
Copy link
Member

janober commented May 25, 2023

Got released with n8n@0.230.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants