mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix: Fix type errors in community nodes components (#9445)
This commit is contained in:
parent
b2c17034c2
commit
aac19d3285
|
@ -4,7 +4,7 @@
|
||||||
<n8n-loading :class="$style.loader" variant="p" :rows="1" />
|
<n8n-loading :class="$style.loader" variant="p" :rows="1" />
|
||||||
<n8n-loading :class="$style.loader" variant="p" :rows="1" />
|
<n8n-loading :class="$style.loader" variant="p" :rows="1" />
|
||||||
</div>
|
</div>
|
||||||
<div v-else :class="$style.packageCard">
|
<div v-else-if="communityPackage" :class="$style.packageCard">
|
||||||
<div :class="$style.cardInfoContainer">
|
<div :class="$style.cardInfoContainer">
|
||||||
<div :class="$style.cardTitle">
|
<div :class="$style.cardTitle">
|
||||||
<n8n-text :bold="true" size="large">{{ communityPackage.packageName }}</n8n-text>
|
<n8n-text :bold="true" size="large">{{ communityPackage.packageName }}</n8n-text>
|
||||||
|
@ -72,7 +72,9 @@ export default defineComponent({
|
||||||
name: 'CommunityPackageCard',
|
name: 'CommunityPackageCard',
|
||||||
props: {
|
props: {
|
||||||
communityPackage: {
|
communityPackage: {
|
||||||
type: Object as () => PublicInstalledPackage,
|
type: Object as () => PublicInstalledPackage | null,
|
||||||
|
required: false,
|
||||||
|
default: null,
|
||||||
},
|
},
|
||||||
loading: {
|
loading: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
|
@ -99,6 +101,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async onAction(value: string) {
|
async onAction(value: string) {
|
||||||
|
if (!this.communityPackage) return;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case COMMUNITY_PACKAGE_MANAGE_ACTIONS.VIEW_DOCS:
|
case COMMUNITY_PACKAGE_MANAGE_ACTIONS.VIEW_DOCS:
|
||||||
this.$telemetry.track('user clicked to browse the cnr package documentation', {
|
this.$telemetry.track('user clicked to browse the cnr package documentation', {
|
||||||
|
@ -115,6 +118,7 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onUpdateClick() {
|
onUpdateClick() {
|
||||||
|
if (!this.communityPackage) return;
|
||||||
this.uiStore.openCommunityPackageUpdateConfirmModal(this.communityPackage.packageName);
|
this.uiStore.openCommunityPackageUpdateConfirmModal(this.communityPackage.packageName);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -95,59 +95,6 @@ export default defineComponent({
|
||||||
loading: false,
|
loading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
beforeMount() {
|
|
||||||
this.pushConnection.initialize();
|
|
||||||
// The push connection is needed here to receive `reloadNodeType` and `removeNodeType` events when community nodes are installed, updated, or removed.
|
|
||||||
this.pushStore.pushConnect();
|
|
||||||
},
|
|
||||||
async mounted() {
|
|
||||||
try {
|
|
||||||
this.loading = true;
|
|
||||||
await this.communityNodesStore.fetchInstalledPackages();
|
|
||||||
|
|
||||||
const installedPackages: PublicInstalledPackage[] =
|
|
||||||
this.communityNodesStore.getInstalledPackages;
|
|
||||||
const packagesToUpdate: PublicInstalledPackage[] = installedPackages.filter(
|
|
||||||
(p) => p.updateAvailable,
|
|
||||||
);
|
|
||||||
this.$telemetry.track('user viewed cnr settings page', {
|
|
||||||
num_of_packages_installed: installedPackages.length,
|
|
||||||
installed_packages: installedPackages.map((p) => {
|
|
||||||
return {
|
|
||||||
package_name: p.packageName,
|
|
||||||
package_version: p.installedVersion,
|
|
||||||
package_nodes: p.installedNodes.map((node) => `${node.name}-v${node.latestVersion}`),
|
|
||||||
is_update_available: p.updateAvailable !== undefined,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
packages_to_update: packagesToUpdate.map((p) => {
|
|
||||||
return {
|
|
||||||
package_name: p.packageName,
|
|
||||||
package_version_current: p.installedVersion,
|
|
||||||
package_version_available: p.updateAvailable,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
number_of_updates_available: packagesToUpdate.length,
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
this.showError(
|
|
||||||
error,
|
|
||||||
this.$locale.baseText('settings.communityNodes.fetchError.title'),
|
|
||||||
this.$locale.baseText('settings.communityNodes.fetchError.message'),
|
|
||||||
);
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
await this.communityNodesStore.fetchAvailableCommunityPackageCount();
|
|
||||||
} finally {
|
|
||||||
this.loading = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeUnmount() {
|
|
||||||
this.pushStore.pushDisconnect();
|
|
||||||
this.pushConnection.terminate();
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
...mapStores(useCommunityNodesStore, useSettingsStore, useUIStore, usePushConnectionStore),
|
...mapStores(useCommunityNodesStore, useSettingsStore, useUIStore, usePushConnectionStore),
|
||||||
getEmptyStateDescription(): string {
|
getEmptyStateDescription(): string {
|
||||||
|
@ -214,6 +161,59 @@ export default defineComponent({
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
beforeMount() {
|
||||||
|
this.pushConnection.initialize();
|
||||||
|
// The push connection is needed here to receive `reloadNodeType` and `removeNodeType` events when community nodes are installed, updated, or removed.
|
||||||
|
this.pushStore.pushConnect();
|
||||||
|
},
|
||||||
|
async mounted() {
|
||||||
|
try {
|
||||||
|
this.loading = true;
|
||||||
|
await this.communityNodesStore.fetchInstalledPackages();
|
||||||
|
|
||||||
|
const installedPackages: PublicInstalledPackage[] =
|
||||||
|
this.communityNodesStore.getInstalledPackages;
|
||||||
|
const packagesToUpdate: PublicInstalledPackage[] = installedPackages.filter(
|
||||||
|
(p) => p.updateAvailable,
|
||||||
|
);
|
||||||
|
this.$telemetry.track('user viewed cnr settings page', {
|
||||||
|
num_of_packages_installed: installedPackages.length,
|
||||||
|
installed_packages: installedPackages.map((p) => {
|
||||||
|
return {
|
||||||
|
package_name: p.packageName,
|
||||||
|
package_version: p.installedVersion,
|
||||||
|
package_nodes: p.installedNodes.map((node) => `${node.name}-v${node.latestVersion}`),
|
||||||
|
is_update_available: p.updateAvailable !== undefined,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
packages_to_update: packagesToUpdate.map((p) => {
|
||||||
|
return {
|
||||||
|
package_name: p.packageName,
|
||||||
|
package_version_current: p.installedVersion,
|
||||||
|
package_version_available: p.updateAvailable,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
number_of_updates_available: packagesToUpdate.length,
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
this.showError(
|
||||||
|
error,
|
||||||
|
this.$locale.baseText('settings.communityNodes.fetchError.title'),
|
||||||
|
this.$locale.baseText('settings.communityNodes.fetchError.message'),
|
||||||
|
);
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await this.communityNodesStore.fetchAvailableCommunityPackageCount();
|
||||||
|
} finally {
|
||||||
|
this.loading = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
beforeUnmount() {
|
||||||
|
this.pushStore.pushDisconnect();
|
||||||
|
this.pushConnection.terminate();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
onClickEmptyStateButton(): void {
|
onClickEmptyStateButton(): void {
|
||||||
if (this.settingsStore.isDesktopDeployment) {
|
if (this.settingsStore.isDesktopDeployment) {
|
||||||
|
|
Loading…
Reference in a new issue