mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
refactor(editor): Usage and plans page on Desktop (#5051)
* refactor(editor): Usage and plans page on Desktop apply Ivan's review * fix(editor): Usage and plans page on Desktop apply Ivan's review
This commit is contained in:
parent
f405327885
commit
2e28f13a55
|
@ -73,6 +73,7 @@ export const COMMUNITY_NODES_RISKS_DOCS_URL = `https://${DOCS_DOMAIN}/integratio
|
||||||
export const COMMUNITY_NODES_BLOCKLIST_DOCS_URL = `https://${DOCS_DOMAIN}/integrations/community-nodes/blocklist/`;
|
export const COMMUNITY_NODES_BLOCKLIST_DOCS_URL = `https://${DOCS_DOMAIN}/integrations/community-nodes/blocklist/`;
|
||||||
export const CUSTOM_NODES_DOCS_URL = `https://${DOCS_DOMAIN}/integrations/creating-nodes/code/create-n8n-nodes-module/`;
|
export const CUSTOM_NODES_DOCS_URL = `https://${DOCS_DOMAIN}/integrations/creating-nodes/code/create-n8n-nodes-module/`;
|
||||||
export const EXPRESSIONS_DOCS_URL = `https://${DOCS_DOMAIN}/code-examples/expressions/`;
|
export const EXPRESSIONS_DOCS_URL = `https://${DOCS_DOMAIN}/code-examples/expressions/`;
|
||||||
|
export const N8N_PRICING_PAGE_URL = `https://n8n.io/pricing`;
|
||||||
|
|
||||||
// node types
|
// node types
|
||||||
export const BAMBOO_HR_NODE_TYPE = 'n8n-nodes-base.bambooHr';
|
export const BAMBOO_HR_NODE_TYPE = 'n8n-nodes-base.bambooHr';
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { Notification } from 'element-ui';
|
||||||
import { UsageTelemetry, useUsageStore } from '@/stores/usage';
|
import { UsageTelemetry, useUsageStore } from '@/stores/usage';
|
||||||
import { telemetry } from '@/plugins/telemetry';
|
import { telemetry } from '@/plugins/telemetry';
|
||||||
import { i18n as locale } from '@/plugins/i18n';
|
import { i18n as locale } from '@/plugins/i18n';
|
||||||
|
import { N8N_PRICING_PAGE_URL } from '@/constants';
|
||||||
|
|
||||||
const usageStore = useUsageStore();
|
const usageStore = useUsageStore();
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
|
@ -53,37 +54,39 @@ const onLicenseActivation = async () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
if (!usageStore.isDesktop) {
|
if (usageStore.isDesktop) {
|
||||||
usageStore.setLoading(true);
|
return;
|
||||||
if (route.query.key) {
|
}
|
||||||
try {
|
|
||||||
await usageStore.activateLicense(route.query.key as string);
|
usageStore.setLoading(true);
|
||||||
await router.replace({ query: {} });
|
if (route.query.key) {
|
||||||
showActivationSuccess();
|
|
||||||
usageStore.setLoading(false);
|
|
||||||
return;
|
|
||||||
} catch (error) {
|
|
||||||
showActivationError(error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (!route.query.key && usageStore.canUserActivateLicense) {
|
await usageStore.activateLicense(route.query.key as string);
|
||||||
await usageStore.refreshLicenseManagementToken();
|
await router.replace({ query: {} });
|
||||||
} else {
|
showActivationSuccess();
|
||||||
await usageStore.getLicenseInfo();
|
|
||||||
}
|
|
||||||
usageStore.setLoading(false);
|
usageStore.setLoading(false);
|
||||||
|
return;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (!error.name) {
|
showActivationError(error);
|
||||||
error.name = locale.baseText('settings.usageAndPlan.error');
|
|
||||||
}
|
|
||||||
Notification.error({
|
|
||||||
title: error.name,
|
|
||||||
message: error.message,
|
|
||||||
position: 'bottom-right',
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
if (!route.query.key && usageStore.canUserActivateLicense) {
|
||||||
|
await usageStore.refreshLicenseManagementToken();
|
||||||
|
} else {
|
||||||
|
await usageStore.getLicenseInfo();
|
||||||
|
}
|
||||||
|
usageStore.setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
if (!error.name) {
|
||||||
|
error.name = locale.baseText('settings.usageAndPlan.error');
|
||||||
|
}
|
||||||
|
Notification.error({
|
||||||
|
title: error.name,
|
||||||
|
message: error.message,
|
||||||
|
position: 'bottom-right',
|
||||||
|
});
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const sendUsageTelemetry = (action: UsageTelemetry['action']) => {
|
const sendUsageTelemetry = (action: UsageTelemetry['action']) => {
|
||||||
|
@ -115,7 +118,7 @@ const onDialogOpened = () => {
|
||||||
|
|
||||||
const openPricingPage = () => {
|
const openPricingPage = () => {
|
||||||
sendUsageTelemetry('desktop_view_plans');
|
sendUsageTelemetry('desktop_view_plans');
|
||||||
window.open('https://n8n.io/pricing', '_blank');
|
window.open(N8N_PRICING_PAGE_URL, '_blank');
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue