mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(editor): Add cloud ExecutionsUsage and API blocking using licenses (#6159)
* Add ExecutionsUsage component * set $sidebar-expanded-width back to 200px * add days using interpolation * Rename PlanData type to CloudPlanData * Rename Metadata type to PlanMetadata * Make prop block in the update button * Use variable in line-height * Remove progressBarSection class * fix trial expiration calculation * mock expirationDate and fix issue with days left * Remove unnecesary property from class .container * inject component data via props * Check for plan data during app mounting and keep data in the store * Remove mounted hook * redirect when upgrade plan is clicked * Remove computed properties * Remove instance property as it's not needed anymore * Flatten plan object * remove console.log * Add all cloud types within its own namespace * keep redirection inside component * get computed properties back * Improve polling logic * Move cloudData to its own store * Remove commented interfaces * remove cloudPlan from user store * fix imports * update logic for userIsTrialing method * centralize userIsTrialing method * redirect to production change plan page always * Call staging or production cloud api depending on base URL * remove setting store form ExecutionUsage.vue * fix linting issue * Add trial group to PlanMetadata group * Move helpers into the store * make staging url check more specific * make cloud state nullable * fix linting issue * swap mockup date for endpoint * Make getCurrentPlan async * asas * Improvements * small improvements * chore: resolve conflicts * make sure there is data before calculating trial expiration * Fix issue with component not loading on first page load * type safety improvements * apply component ui feedback * fix linting issue * chore: clean up unnecessary change from merge conflict * feat: Block api feature using licenses, show notice page for trial cloud 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> * add pluralization to days left text --------- Co-authored-by: Mutasem <mutdmour@gmail.com> Co-authored-by: Mutasem Aldmour <4711238+mutdmour@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,12 @@
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template #beforeLowerMenu>
|
||||
<ExecutionsUsage
|
||||
:cloud-plan-data="currentPlanAndUsageData"
|
||||
v-if="!isCollapsed && userIsTrialing"
|
||||
/></template>
|
||||
<template #menuSuffix>
|
||||
<div v-if="hasVersionUpdates || versionControlStore.state.currentBranch">
|
||||
<div v-if="hasVersionUpdates" :class="$style.updates" @click="openUpdatesPanel">
|
||||
@@ -110,7 +116,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import type { IExecutionResponse, IMenuItem, IVersion } from '@/Interface';
|
||||
import type { CloudPlanAndUsageData, IExecutionResponse, IMenuItem, IVersion } from '@/Interface';
|
||||
import type { MessageBoxInputData } from 'element-ui/types/message-box';
|
||||
import GiftNotificationIcon from './GiftNotificationIcon.vue';
|
||||
|
||||
@@ -132,11 +138,14 @@ import { useRootStore } from '@/stores/n8nRoot.store';
|
||||
import { useVersionsStore } from '@/stores/versions.store';
|
||||
import { isNavigationFailure } from 'vue-router';
|
||||
import { useVersionControlStore } from '@/stores/versionControl.store';
|
||||
import ExecutionsUsage from '@/components/ExecutionsUsage.vue';
|
||||
import { useCloudPlanStore } from '@/stores/cloudPlan.store';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'MainSidebar',
|
||||
components: {
|
||||
GiftNotificationIcon,
|
||||
ExecutionsUsage,
|
||||
},
|
||||
mixins: [genericHelpers, workflowHelpers, workflowRun, userHelpers, debounceHelper],
|
||||
setup(props) {
|
||||
@@ -147,7 +156,6 @@ export default defineComponent({
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// @ts-ignore
|
||||
basePath: '',
|
||||
fullyExpanded: false,
|
||||
};
|
||||
@@ -161,6 +169,7 @@ export default defineComponent({
|
||||
useVersionsStore,
|
||||
useWorkflowsStore,
|
||||
useVersionControlStore,
|
||||
useCloudPlanStore,
|
||||
),
|
||||
currentBranch(): string {
|
||||
return this.versionControlStore.state.currentBranch;
|
||||
@@ -323,6 +332,18 @@ export default defineComponent({
|
||||
];
|
||||
return [...items, ...regularItems];
|
||||
},
|
||||
userIsTrialing(): boolean {
|
||||
return this.cloudPlanStore.userIsTrialing;
|
||||
},
|
||||
currentPlanAndUsageData(): CloudPlanAndUsageData | null {
|
||||
const planData = this.cloudPlanStore.currentPlanData;
|
||||
const usage = this.cloudPlanStore.currentUsageData;
|
||||
if (!planData || !usage) return null;
|
||||
return {
|
||||
...planData,
|
||||
usage,
|
||||
};
|
||||
},
|
||||
},
|
||||
async mounted() {
|
||||
this.basePath = this.rootStore.baseUrl;
|
||||
|
||||
Reference in New Issue
Block a user