feat: Migrate integer primary keys to nanoids (#6345)
* first commit for postgres migration * (not working) * sqlite migration * quicksave * fix tests * fix pg test * fix postgres * fix variables import * fix execution saving * add user settings fix * change migration to single lines * patch preferences endpoint * cleanup * improve variable import * cleanup unusued code * Update packages/cli/src/PublicApi/v1/handlers/workflows/workflows.handler.ts Co-authored-by: Omar Ajoue <krynble@gmail.com> * address review notes * fix var update/import * refactor: Separate execution data to its own table (#6323) * wip: Temporary migration process * refactor: Create boilerplate repository methods for executions * fix: Lint issues * refactor: Added search endpoint to repository * refactor: Make the execution list work again * wip: Updating how we create and update executions everywhere * fix: Lint issues and remove most of the direct access to execution model * refactor: Remove includeWorkflowData flag and fix more tests * fix: Lint issues * fix: Fixed ordering of executions for FE, removed transaction when saving execution and removed unnecessary update * refactor: Add comment about missing feature * refactor: Refactor counting executions * refactor: Add migration for other dbms and fix issues found * refactor: Fix lint issues * refactor: Remove unnecessary comment and auto inject repo to internal hooks * refactor: remove type assertion * fix: Fix broken tests * fix: Remove unnecessary import * Remove unnecessary toString() call Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * fix: Address comments after review * refactor: Remove unused import * fix: Lint issues * fix: Add correct migration files --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * remove null values from credential export * fix: Fix an issue with queue mode where all running execution would be returned * fix: Update n8n node to allow for workflow ids with letters * set upstream on set branch * remove typo * add nodeAccess to credentials * fix unsaved run check for undefined id * fix(core): Rename version control feature to source control (#6480) * rename versionControl to sourceControl * fix source control tooltip wording --------- Co-authored-by: Romain Minaud <romain.minaud@gmail.com> * fix(editor): Pay 548 hide the set up version control button (#6485) * feat(DebugHelper Node): Fix and include in main app (#6406) * improve node a bit * fixing continueOnFail() ton contain error in json * improve pairedItem * fix random data returning object results * fix nanoId length typo * update pnpm-lock file --------- Co-authored-by: Marcus <marcus@n8n.io> * fix(editor): Remove setup source control CTA button * fix(editor): Remove setup source control CTA button --------- Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com> Co-authored-by: Marcus <marcus@n8n.io> * fix(editor): Update source control docs links (#6488) * feat(DebugHelper Node): Fix and include in main app (#6406) * improve node a bit * fixing continueOnFail() ton contain error in json * improve pairedItem * fix random data returning object results * fix nanoId length typo * update pnpm-lock file --------- Co-authored-by: Marcus <marcus@n8n.io> * feat(editor): Replace root events with event bus events (no-changelog) (#6454) * feat: replace root events with event bus events * fix: prevent cypress from replacing global with globalThis in import path * feat: remove emitter mixin * fix: replace component events with event bus * fix: fix linting issue * fix: fix breaking expression switch * chore: prettify ndv e2e suite code * fix(editor): Update source control docs links --------- Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com> Co-authored-by: Marcus <marcus@n8n.io> Co-authored-by: Alex Grozav <alex@grozav.com> * fix tag endpoint regex --------- Co-authored-by: Omar Ajoue <krynble@gmail.com> Co-authored-by: Iván Ovejero <ivov.src@gmail.com> Co-authored-by: Romain Minaud <romain.minaud@gmail.com> Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Marcus <marcus@n8n.io> Co-authored-by: Alex Grozav <alex@grozav.com>
This commit is contained in:
committed by
GitHub
parent
da330f0648
commit
c3ba0123ad
@@ -57,7 +57,7 @@ import { useUIStore } from '@/stores/ui.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { useNodeTypesStore } from '@/stores/nodeTypes.store';
|
||||
import { useCredentialsStore } from '@/stores/credentials.store';
|
||||
import { useVersionControlStore } from '@/stores/versionControl.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
|
||||
type IResourcesListLayoutInstance = Vue & { sendFiltersTelemetry: (source: string) => void };
|
||||
|
||||
@@ -75,7 +75,7 @@ export default defineComponent({
|
||||
sharedWith: '',
|
||||
type: '',
|
||||
},
|
||||
versionControlStoreUnsubscribe: () => {},
|
||||
sourceControlStoreUnsubscribe: () => {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -84,7 +84,7 @@ export default defineComponent({
|
||||
useNodeTypesStore,
|
||||
useUIStore,
|
||||
useUsersStore,
|
||||
useVersionControlStore,
|
||||
useSourceControlStore,
|
||||
),
|
||||
allCredentials(): ICredentialsResponse[] {
|
||||
return this.credentialsStore.allCredentials;
|
||||
@@ -150,7 +150,7 @@ export default defineComponent({
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.versionControlStoreUnsubscribe = this.versionControlStore.$onAction(({ name, after }) => {
|
||||
this.sourceControlStoreUnsubscribe = this.sourceControlStore.$onAction(({ name, after }) => {
|
||||
if (name === 'pullWorkfolder' && after) {
|
||||
after(() => {
|
||||
void this.initialize();
|
||||
@@ -159,7 +159,7 @@ export default defineComponent({
|
||||
});
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.versionControlStoreUnsubscribe();
|
||||
this.sourceControlStoreUnsubscribe();
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -281,7 +281,7 @@ import {
|
||||
useSettingsStore,
|
||||
useUIStore,
|
||||
useHistoryStore,
|
||||
useVersionControlStore,
|
||||
useSourceControlStore,
|
||||
} from '@/stores';
|
||||
import * as NodeViewUtils from '@/utils/nodeViewUtils';
|
||||
import { getAccountAge, getConnectionInfo, getNodeViewTab } from '@/utils';
|
||||
@@ -483,10 +483,10 @@ export default defineComponent({
|
||||
useEnvironmentsStore,
|
||||
useWorkflowsEEStore,
|
||||
useHistoryStore,
|
||||
useVersionControlStore,
|
||||
useSourceControlStore,
|
||||
),
|
||||
readOnlyEnv(): boolean {
|
||||
return this.versionControlStore.preferences.branchReadOnly;
|
||||
return this.sourceControlStore.preferences.branchReadOnly;
|
||||
},
|
||||
nativelyNumberSuffixedDefaults(): string[] {
|
||||
return this.rootStore.nativelyNumberSuffixedDefaults;
|
||||
|
||||
@@ -2,39 +2,39 @@
|
||||
import { computed, reactive, onBeforeMount, ref } from 'vue';
|
||||
import type { Rule, RuleGroup } from 'n8n-design-system/types';
|
||||
import { MODAL_CONFIRM, VALID_EMAIL_REGEX } from '@/constants';
|
||||
import { useUIStore, useVersionControlStore } from '@/stores';
|
||||
import { useUIStore, useSourceControlStore } from '@/stores';
|
||||
import { useToast, useMessage, useLoadingService, useI18n } from '@/composables';
|
||||
import CopyInput from '@/components/CopyInput.vue';
|
||||
|
||||
const { i18n: locale } = useI18n();
|
||||
const versionControlStore = useVersionControlStore();
|
||||
const sourceControlStore = useSourceControlStore();
|
||||
const uiStore = useUIStore();
|
||||
const toast = useToast();
|
||||
const message = useMessage();
|
||||
const loadingService = useLoadingService();
|
||||
|
||||
const versionControlDocsSetupUrl = computed(() =>
|
||||
locale.baseText('settings.versionControl.docs.setup.url'),
|
||||
const sourceControlDocsSetupUrl = computed(() =>
|
||||
locale.baseText('settings.sourceControl.docs.setup.url'),
|
||||
);
|
||||
const isConnected = ref(false);
|
||||
|
||||
const onConnect = async () => {
|
||||
loadingService.startLoading();
|
||||
try {
|
||||
await versionControlStore.savePreferences({
|
||||
authorName: versionControlStore.preferences.authorName,
|
||||
authorEmail: versionControlStore.preferences.authorEmail,
|
||||
repositoryUrl: versionControlStore.preferences.repositoryUrl,
|
||||
await sourceControlStore.savePreferences({
|
||||
authorName: sourceControlStore.preferences.authorName,
|
||||
authorEmail: sourceControlStore.preferences.authorEmail,
|
||||
repositoryUrl: sourceControlStore.preferences.repositoryUrl,
|
||||
});
|
||||
await versionControlStore.getBranches();
|
||||
await sourceControlStore.getBranches();
|
||||
isConnected.value = true;
|
||||
toast.showMessage({
|
||||
title: locale.baseText('settings.versionControl.toast.connected.title'),
|
||||
message: locale.baseText('settings.versionControl.toast.connected.message'),
|
||||
title: locale.baseText('settings.sourceControl.toast.connected.title'),
|
||||
message: locale.baseText('settings.sourceControl.toast.connected.message'),
|
||||
type: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
toast.showError(error, locale.baseText('settings.versionControl.toast.connected.error'));
|
||||
toast.showError(error, locale.baseText('settings.sourceControl.toast.connected.error'));
|
||||
}
|
||||
loadingService.stopLoading();
|
||||
};
|
||||
@@ -42,26 +42,26 @@ const onConnect = async () => {
|
||||
const onDisconnect = async () => {
|
||||
try {
|
||||
const confirmation = await message.confirm(
|
||||
locale.baseText('settings.versionControl.modals.disconnect.message'),
|
||||
locale.baseText('settings.versionControl.modals.disconnect.title'),
|
||||
locale.baseText('settings.sourceControl.modals.disconnect.message'),
|
||||
locale.baseText('settings.sourceControl.modals.disconnect.title'),
|
||||
{
|
||||
confirmButtonText: locale.baseText('settings.versionControl.modals.disconnect.confirm'),
|
||||
cancelButtonText: locale.baseText('settings.versionControl.modals.disconnect.cancel'),
|
||||
confirmButtonText: locale.baseText('settings.sourceControl.modals.disconnect.confirm'),
|
||||
cancelButtonText: locale.baseText('settings.sourceControl.modals.disconnect.cancel'),
|
||||
},
|
||||
);
|
||||
|
||||
if (confirmation === MODAL_CONFIRM) {
|
||||
loadingService.startLoading();
|
||||
await versionControlStore.disconnect(true);
|
||||
await sourceControlStore.disconnect(true);
|
||||
isConnected.value = false;
|
||||
toast.showMessage({
|
||||
title: locale.baseText('settings.versionControl.toast.disconnected.title'),
|
||||
message: locale.baseText('settings.versionControl.toast.disconnected.message'),
|
||||
title: locale.baseText('settings.sourceControl.toast.disconnected.title'),
|
||||
message: locale.baseText('settings.sourceControl.toast.disconnected.message'),
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
toast.showError(error, locale.baseText('settings.versionControl.toast.disconnected.error'));
|
||||
toast.showError(error, locale.baseText('settings.sourceControl.toast.disconnected.error'));
|
||||
}
|
||||
loadingService.stopLoading();
|
||||
};
|
||||
@@ -69,13 +69,13 @@ const onDisconnect = async () => {
|
||||
const onSave = async () => {
|
||||
loadingService.startLoading();
|
||||
try {
|
||||
await versionControlStore.updatePreferences({
|
||||
branchName: versionControlStore.preferences.branchName,
|
||||
branchReadOnly: versionControlStore.preferences.branchReadOnly,
|
||||
branchColor: versionControlStore.preferences.branchColor,
|
||||
await sourceControlStore.updatePreferences({
|
||||
branchName: sourceControlStore.preferences.branchName,
|
||||
branchReadOnly: sourceControlStore.preferences.branchReadOnly,
|
||||
branchColor: sourceControlStore.preferences.branchColor,
|
||||
});
|
||||
toast.showMessage({
|
||||
title: locale.baseText('settings.versionControl.saved.title'),
|
||||
title: locale.baseText('settings.sourceControl.saved.title'),
|
||||
type: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -85,20 +85,20 @@ const onSave = async () => {
|
||||
};
|
||||
|
||||
const onSelect = async (b: string) => {
|
||||
if (b === versionControlStore.preferences.branchName) {
|
||||
if (b === sourceControlStore.preferences.branchName) {
|
||||
return;
|
||||
}
|
||||
versionControlStore.preferences.branchName = b;
|
||||
sourceControlStore.preferences.branchName = b;
|
||||
};
|
||||
|
||||
const goToUpgrade = () => {
|
||||
uiStore.goToUpgrade('version-control', 'upgrade-version-control');
|
||||
uiStore.goToUpgrade('source-control', 'upgrade-source-control');
|
||||
};
|
||||
|
||||
onBeforeMount(() => {
|
||||
if (versionControlStore.preferences.connected) {
|
||||
if (sourceControlStore.preferences.connected) {
|
||||
isConnected.value = true;
|
||||
void versionControlStore.getBranches();
|
||||
void sourceControlStore.getBranches();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,7 +118,7 @@ const repoUrlValidationRules: Array<Rule | RuleGroup> = [
|
||||
name: 'MATCH_REGEX',
|
||||
config: {
|
||||
regex: /^(?!https?:\/\/)(?:git|ssh|git@[-\w.]+):(\/\/)?(.*?)(\.git)(\/?|\#[-\d\w._]+?)$/,
|
||||
message: locale.baseText('settings.versionControl.repoUrlInvalid'),
|
||||
message: locale.baseText('settings.sourceControl.repoUrlInvalid'),
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -131,7 +131,7 @@ const authorEmailValidationRules: Array<Rule | RuleGroup> = [
|
||||
name: 'MATCH_REGEX',
|
||||
config: {
|
||||
regex: VALID_EMAIL_REGEX,
|
||||
message: locale.baseText('settings.versionControl.authorEmailInvalid'),
|
||||
message: locale.baseText('settings.sourceControl.authorEmailInvalid'),
|
||||
},
|
||||
},
|
||||
];
|
||||
@@ -146,35 +146,35 @@ const validForConnection = computed(
|
||||
async function refreshSshKey() {
|
||||
try {
|
||||
const confirmation = await message.confirm(
|
||||
locale.baseText('settings.versionControl.modals.refreshSshKey.message'),
|
||||
locale.baseText('settings.versionControl.modals.refreshSshKey.title'),
|
||||
locale.baseText('settings.sourceControl.modals.refreshSshKey.message'),
|
||||
locale.baseText('settings.sourceControl.modals.refreshSshKey.title'),
|
||||
{
|
||||
confirmButtonText: locale.baseText('settings.versionControl.modals.refreshSshKey.confirm'),
|
||||
cancelButtonText: locale.baseText('settings.versionControl.modals.refreshSshKey.cancel'),
|
||||
confirmButtonText: locale.baseText('settings.sourceControl.modals.refreshSshKey.confirm'),
|
||||
cancelButtonText: locale.baseText('settings.sourceControl.modals.refreshSshKey.cancel'),
|
||||
},
|
||||
);
|
||||
|
||||
if (confirmation === MODAL_CONFIRM) {
|
||||
await versionControlStore.generateKeyPair();
|
||||
await sourceControlStore.generateKeyPair();
|
||||
toast.showMessage({
|
||||
title: locale.baseText('settings.versionControl.refreshSshKey.successful.title'),
|
||||
title: locale.baseText('settings.sourceControl.refreshSshKey.successful.title'),
|
||||
type: 'success',
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
toast.showError(error, locale.baseText('settings.versionControl.refreshSshKey.error.title'));
|
||||
toast.showError(error, locale.baseText('settings.sourceControl.refreshSshKey.error.title'));
|
||||
}
|
||||
}
|
||||
|
||||
const refreshBranches = async () => {
|
||||
try {
|
||||
await versionControlStore.getBranches();
|
||||
await sourceControlStore.getBranches();
|
||||
toast.showMessage({
|
||||
title: locale.baseText('settings.versionControl.refreshBranches.success'),
|
||||
title: locale.baseText('settings.sourceControl.refreshBranches.success'),
|
||||
type: 'success',
|
||||
});
|
||||
} catch (error) {
|
||||
toast.showError(error, locale.baseText('settings.versionControl.refreshBranches.error'));
|
||||
toast.showError(error, locale.baseText('settings.sourceControl.refreshBranches.error'));
|
||||
}
|
||||
};
|
||||
</script>
|
||||
@@ -182,26 +182,26 @@ const refreshBranches = async () => {
|
||||
<template>
|
||||
<div>
|
||||
<n8n-heading size="2xlarge" tag="h1">{{
|
||||
locale.baseText('settings.versionControl.title')
|
||||
locale.baseText('settings.sourceControl.title')
|
||||
}}</n8n-heading>
|
||||
<div
|
||||
v-if="versionControlStore.isEnterpriseVersionControlEnabled"
|
||||
data-test-id="version-control-content-licensed"
|
||||
v-if="sourceControlStore.isEnterpriseSourceControlEnabled"
|
||||
data-test-id="source-control-content-licensed"
|
||||
>
|
||||
<n8n-callout theme="secondary" icon="info-circle" class="mt-2xl mb-l">
|
||||
<i18n path="settings.versionControl.description">
|
||||
<i18n path="settings.sourceControl.description">
|
||||
<template #link>
|
||||
<a :href="versionControlDocsSetupUrl" target="_blank">
|
||||
{{ locale.baseText('settings.versionControl.description.link') }}
|
||||
<a :href="sourceControlDocsSetupUrl" target="_blank">
|
||||
{{ locale.baseText('settings.sourceControl.description.link') }}
|
||||
</a>
|
||||
</template>
|
||||
</i18n>
|
||||
</n8n-callout>
|
||||
<n8n-heading size="xlarge" tag="h2" class="mb-s">{{
|
||||
locale.baseText('settings.versionControl.gitConfig')
|
||||
locale.baseText('settings.sourceControl.gitConfig')
|
||||
}}</n8n-heading>
|
||||
<div :class="$style.group">
|
||||
<label for="repoUrl">{{ locale.baseText('settings.versionControl.repoUrl') }}</label>
|
||||
<label for="repoUrl">{{ locale.baseText('settings.sourceControl.repoUrl') }}</label>
|
||||
<div :class="$style.groupFlex">
|
||||
<n8n-form-input
|
||||
label
|
||||
@@ -211,8 +211,8 @@ const refreshBranches = async () => {
|
||||
validateOnBlur
|
||||
:validationRules="repoUrlValidationRules"
|
||||
:disabled="isConnected"
|
||||
:placeholder="locale.baseText('settings.versionControl.repoUrlPlaceholder')"
|
||||
v-model="versionControlStore.preferences.repositoryUrl"
|
||||
:placeholder="locale.baseText('settings.sourceControl.repoUrlPlaceholder')"
|
||||
v-model="sourceControlStore.preferences.repositoryUrl"
|
||||
@validate="(value) => onValidate('repoUrl', value)"
|
||||
/>
|
||||
<n8n-button
|
||||
@@ -222,30 +222,28 @@ const refreshBranches = async () => {
|
||||
@click="onDisconnect"
|
||||
size="large"
|
||||
icon="trash"
|
||||
data-test-id="version-control-disconnect-button"
|
||||
>{{ locale.baseText('settings.versionControl.button.disconnect') }}</n8n-button
|
||||
data-test-id="source-control-disconnect-button"
|
||||
>{{ locale.baseText('settings.sourceControl.button.disconnect') }}</n8n-button
|
||||
>
|
||||
</div>
|
||||
<small>{{ locale.baseText('settings.versionControl.repoUrlDescription') }}</small>
|
||||
<small>{{ locale.baseText('settings.sourceControl.repoUrlDescription') }}</small>
|
||||
</div>
|
||||
<div :class="[$style.group, $style.groupFlex]">
|
||||
<div>
|
||||
<label for="authorName">{{
|
||||
locale.baseText('settings.versionControl.authorName')
|
||||
}}</label>
|
||||
<label for="authorName">{{ locale.baseText('settings.sourceControl.authorName') }}</label>
|
||||
<n8n-form-input
|
||||
label
|
||||
id="authorName"
|
||||
name="authorName"
|
||||
validateOnBlur
|
||||
:validationRules="authorNameValidationRules"
|
||||
v-model="versionControlStore.preferences.authorName"
|
||||
v-model="sourceControlStore.preferences.authorName"
|
||||
@validate="(value) => onValidate('authorName', value)"
|
||||
/>
|
||||
</div>
|
||||
<div>
|
||||
<label for="authorEmail">{{
|
||||
locale.baseText('settings.versionControl.authorEmail')
|
||||
locale.baseText('settings.sourceControl.authorEmail')
|
||||
}}</label>
|
||||
<n8n-form-input
|
||||
label
|
||||
@@ -254,18 +252,18 @@ const refreshBranches = async () => {
|
||||
name="authorEmail"
|
||||
validateOnBlur
|
||||
:validationRules="authorEmailValidationRules"
|
||||
v-model="versionControlStore.preferences.authorEmail"
|
||||
v-model="sourceControlStore.preferences.authorEmail"
|
||||
@validate="(value) => onValidate('authorEmail', value)"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="versionControlStore.preferences.publicKey" :class="$style.group">
|
||||
<label>{{ locale.baseText('settings.versionControl.sshKey') }}</label>
|
||||
<div v-if="sourceControlStore.preferences.publicKey" :class="$style.group">
|
||||
<label>{{ locale.baseText('settings.sourceControl.sshKey') }}</label>
|
||||
<div :class="{ [$style.sshInput]: !isConnected }">
|
||||
<CopyInput
|
||||
collapse
|
||||
size="medium"
|
||||
:value="versionControlStore.preferences.publicKey"
|
||||
:value="sourceControlStore.preferences.publicKey"
|
||||
:copy-button-text="locale.baseText('generic.clickToCopy')"
|
||||
/>
|
||||
<n8n-button
|
||||
@@ -276,14 +274,14 @@ const refreshBranches = async () => {
|
||||
class="ml-s"
|
||||
@click="refreshSshKey"
|
||||
>
|
||||
{{ locale.baseText('settings.versionControl.refreshSshKey') }}
|
||||
{{ locale.baseText('settings.sourceControl.refreshSshKey') }}
|
||||
</n8n-button>
|
||||
</div>
|
||||
<n8n-notice type="info" class="mt-s">
|
||||
<i18n path="settings.versionControl.sshKeyDescription">
|
||||
<i18n path="settings.sourceControl.sshKeyDescription">
|
||||
<template #link>
|
||||
<a :href="versionControlDocsSetupUrl" target="_blank">{{
|
||||
locale.baseText('settings.versionControl.sshKeyDescriptionLink')
|
||||
<a :href="sourceControlDocsSetupUrl" target="_blank">{{
|
||||
locale.baseText('settings.sourceControl.sshKeyDescriptionLink')
|
||||
}}</a>
|
||||
</template>
|
||||
</i18n>
|
||||
@@ -295,27 +293,27 @@ const refreshBranches = async () => {
|
||||
size="large"
|
||||
:disabled="!validForConnection"
|
||||
:class="$style.connect"
|
||||
data-test-id="version-control-connect-button"
|
||||
>{{ locale.baseText('settings.versionControl.button.connect') }}</n8n-button
|
||||
data-test-id="source-control-connect-button"
|
||||
>{{ locale.baseText('settings.sourceControl.button.connect') }}</n8n-button
|
||||
>
|
||||
<div v-if="isConnected" data-test-id="version-control-connected-content">
|
||||
<div v-if="isConnected" data-test-id="source-control-connected-content">
|
||||
<div :class="$style.group">
|
||||
<hr />
|
||||
<n8n-heading size="xlarge" tag="h2" class="mb-s">{{
|
||||
locale.baseText('settings.versionControl.instanceSettings')
|
||||
locale.baseText('settings.sourceControl.instanceSettings')
|
||||
}}</n8n-heading>
|
||||
<label>{{ locale.baseText('settings.versionControl.branches') }}</label>
|
||||
<label>{{ locale.baseText('settings.sourceControl.branches') }}</label>
|
||||
<div :class="$style.branchSelection">
|
||||
<n8n-select
|
||||
:value="versionControlStore.preferences.branchName"
|
||||
:value="sourceControlStore.preferences.branchName"
|
||||
class="mb-s"
|
||||
size="medium"
|
||||
filterable
|
||||
@input="onSelect"
|
||||
data-test-id="version-control-branch-select"
|
||||
data-test-id="source-control-branch-select"
|
||||
>
|
||||
<n8n-option
|
||||
v-for="b in versionControlStore.preferences.branches"
|
||||
v-for="b in sourceControlStore.preferences.branches"
|
||||
:key="b"
|
||||
:value="b"
|
||||
:label="b"
|
||||
@@ -324,7 +322,7 @@ const refreshBranches = async () => {
|
||||
<n8n-tooltip placement="top">
|
||||
<template #content>
|
||||
<span>
|
||||
{{ locale.baseText('settings.versionControl.refreshBranches.tooltip') }}
|
||||
{{ locale.baseText('settings.sourceControl.refreshBranches.tooltip') }}
|
||||
</span>
|
||||
</template>
|
||||
<n8n-button
|
||||
@@ -334,53 +332,53 @@ const refreshBranches = async () => {
|
||||
square
|
||||
:class="$style.refreshBranches"
|
||||
@click="refreshBranches"
|
||||
data-test-id="version-control-refresh-branches-button"
|
||||
data-test-id="source-control-refresh-branches-button"
|
||||
/>
|
||||
</n8n-tooltip>
|
||||
</div>
|
||||
<n8n-checkbox
|
||||
v-model="versionControlStore.preferences.branchReadOnly"
|
||||
v-model="sourceControlStore.preferences.branchReadOnly"
|
||||
:class="$style.readOnly"
|
||||
>
|
||||
<i18n path="settings.versionControl.readonly">
|
||||
<i18n path="settings.sourceControl.readonly">
|
||||
<template #bold>
|
||||
<strong>{{ locale.baseText('settings.versionControl.readonly.bold') }}</strong>
|
||||
<strong>{{ locale.baseText('settings.sourceControl.readonly.bold') }}</strong>
|
||||
</template>
|
||||
<template #link>
|
||||
<a :href="versionControlDocsSetupUrl" target="_blank">
|
||||
{{ locale.baseText('settings.versionControl.readonly.link') }}
|
||||
<a :href="sourceControlDocsSetupUrl" target="_blank">
|
||||
{{ locale.baseText('settings.sourceControl.readonly.link') }}
|
||||
</a>
|
||||
</template>
|
||||
</i18n>
|
||||
</n8n-checkbox>
|
||||
</div>
|
||||
<div :class="$style.group">
|
||||
<label>{{ locale.baseText('settings.versionControl.color') }}</label>
|
||||
<label>{{ locale.baseText('settings.sourceControl.color') }}</label>
|
||||
<div>
|
||||
<n8n-color-picker size="small" v-model="versionControlStore.preferences.branchColor" />
|
||||
<n8n-color-picker size="small" v-model="sourceControlStore.preferences.branchColor" />
|
||||
</div>
|
||||
</div>
|
||||
<div :class="[$style.group, 'pt-s']">
|
||||
<n8n-button
|
||||
@click="onSave"
|
||||
size="large"
|
||||
:disabled="!versionControlStore.preferences.branchName"
|
||||
data-test-id="version-control-save-settings-button"
|
||||
>{{ locale.baseText('settings.versionControl.button.save') }}</n8n-button
|
||||
:disabled="!sourceControlStore.preferences.branchName"
|
||||
data-test-id="source-control-save-settings-button"
|
||||
>{{ locale.baseText('settings.sourceControl.button.save') }}</n8n-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<n8n-action-box
|
||||
v-else
|
||||
data-test-id="version-control-content-unlicensed"
|
||||
data-test-id="source-control-content-unlicensed"
|
||||
:class="$style.actionBox"
|
||||
:description="locale.baseText('settings.versionControl.actionBox.description')"
|
||||
:buttonText="locale.baseText('settings.versionControl.actionBox.buttonText')"
|
||||
:description="locale.baseText('settings.sourceControl.actionBox.description')"
|
||||
:buttonText="locale.baseText('settings.sourceControl.actionBox.buttonText')"
|
||||
@click="goToUpgrade"
|
||||
>
|
||||
<template #heading>
|
||||
<span>{{ locale.baseText('settings.versionControl.actionBox.title') }}</span>
|
||||
<span>{{ locale.baseText('settings.sourceControl.actionBox.title') }}</span>
|
||||
</template>
|
||||
</n8n-action-box>
|
||||
</div>
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
useUIStore,
|
||||
useSettingsStore,
|
||||
useUsersStore,
|
||||
useVersionControlStore,
|
||||
useSourceControlStore,
|
||||
} from '@/stores';
|
||||
import { useI18n, useTelemetry, useToast, useMessage } from '@/composables';
|
||||
|
||||
@@ -28,8 +28,8 @@ const uiStore = useUIStore();
|
||||
const telemetry = useTelemetry();
|
||||
const { i18n } = useI18n();
|
||||
const message = useMessage();
|
||||
const versionControlStore = useVersionControlStore();
|
||||
let versionControlStoreUnsubscribe = () => {};
|
||||
const sourceControlStore = useSourceControlStore();
|
||||
let sourceControlStoreUnsubscribe = () => {};
|
||||
|
||||
const layoutRef = ref<InstanceType<typeof ResourcesListLayout> | null>(null);
|
||||
|
||||
@@ -157,9 +157,8 @@ async function saveVariable(data: EnvironmentVariable | TemporaryEnvironmentVari
|
||||
newlyAddedVariableIds.value.unshift(updatedVariable.id);
|
||||
} else {
|
||||
updatedVariable = await environmentsStore.updateVariable(data as EnvironmentVariable);
|
||||
allVariables.value = allVariables.value.map((variable) =>
|
||||
variable.id === data.id ? updatedVariable : variable,
|
||||
);
|
||||
allVariables.value = allVariables.value.filter((variable) => variable.id !== data.id);
|
||||
allVariables.value.push(updatedVariable);
|
||||
toggleEditing(updatedVariable);
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -213,7 +212,7 @@ function displayName(resource: EnvironmentVariable) {
|
||||
}
|
||||
|
||||
onBeforeMount(() => {
|
||||
versionControlStoreUnsubscribe = versionControlStore.$onAction(({ name, after }) => {
|
||||
sourceControlStoreUnsubscribe = sourceControlStore.$onAction(({ name, after }) => {
|
||||
if (name === 'pullWorkfolder' && after) {
|
||||
after(() => {
|
||||
void initialize();
|
||||
@@ -223,7 +222,7 @@ onBeforeMount(() => {
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
versionControlStoreUnsubscribe();
|
||||
sourceControlStoreUnsubscribe();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ import { useSettingsStore } from '@/stores/settings.store';
|
||||
import { useUsersStore } from '@/stores/users.store';
|
||||
import { useWorkflowsStore } from '@/stores/workflows.store';
|
||||
import { useCredentialsStore } from '@/stores/credentials.store';
|
||||
import { useVersionControlStore } from '@/stores/versionControl.store';
|
||||
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
||||
|
||||
type IResourcesListLayoutInstance = Vue & { sendFiltersTelemetry: (source: string) => void };
|
||||
|
||||
@@ -131,7 +131,7 @@ const WorkflowsView = defineComponent({
|
||||
status: StatusFilter.ALL,
|
||||
tags: [] as string[],
|
||||
},
|
||||
versionControlStoreUnsubscribe: () => {},
|
||||
sourceControlStoreUnsubscribe: () => {},
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -141,7 +141,7 @@ const WorkflowsView = defineComponent({
|
||||
useUsersStore,
|
||||
useWorkflowsStore,
|
||||
useCredentialsStore,
|
||||
useVersionControlStore,
|
||||
useSourceControlStore,
|
||||
),
|
||||
currentUser(): IUser {
|
||||
return this.usersStore.currentUser || ({} as IUser);
|
||||
@@ -169,7 +169,7 @@ const WorkflowsView = defineComponent({
|
||||
];
|
||||
},
|
||||
readOnlyEnv(): boolean {
|
||||
return this.versionControlStore.preferences.branchReadOnly;
|
||||
return this.sourceControlStore.preferences.branchReadOnly;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
@@ -229,7 +229,7 @@ const WorkflowsView = defineComponent({
|
||||
mounted() {
|
||||
void this.usersStore.showPersonalizationSurvey();
|
||||
|
||||
this.versionControlStoreUnsubscribe = this.versionControlStore.$onAction(({ name, after }) => {
|
||||
this.sourceControlStoreUnsubscribe = this.sourceControlStore.$onAction(({ name, after }) => {
|
||||
if (name === 'pullWorkfolder' && after) {
|
||||
after(() => {
|
||||
void this.initialize();
|
||||
@@ -238,7 +238,7 @@ const WorkflowsView = defineComponent({
|
||||
});
|
||||
},
|
||||
beforeUnmount() {
|
||||
this.versionControlStoreUnsubscribe();
|
||||
this.sourceControlStoreUnsubscribe();
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -5,17 +5,17 @@ import { createPinia, setActivePinia, PiniaVuePlugin } from 'pinia';
|
||||
import { merge } from 'lodash-es';
|
||||
import { setupServer } from '@/__tests__/server';
|
||||
import { i18nInstance } from '@/plugins/i18n';
|
||||
import { useSettingsStore, useVersionControlStore } from '@/stores';
|
||||
import SettingsVersionControl from '@/views/SettingsVersionControl.vue';
|
||||
import { useSettingsStore, useSourceControlStore } from '@/stores';
|
||||
import SettingsSourceControl from '@/views/SettingsSourceControl.vue';
|
||||
|
||||
let pinia: ReturnType<typeof createPinia>;
|
||||
let server: ReturnType<typeof setupServer>;
|
||||
let settingsStore: ReturnType<typeof useSettingsStore>;
|
||||
let versionControlStore: ReturnType<typeof useVersionControlStore>;
|
||||
let sourceControlStore: ReturnType<typeof useSourceControlStore>;
|
||||
|
||||
const renderComponent = (renderOptions: Parameters<typeof render>[1] = {}) =>
|
||||
render(
|
||||
SettingsVersionControl,
|
||||
SettingsSourceControl,
|
||||
merge(
|
||||
{
|
||||
pinia,
|
||||
@@ -28,7 +28,7 @@ const renderComponent = (renderOptions: Parameters<typeof render>[1] = {}) =>
|
||||
},
|
||||
);
|
||||
|
||||
describe('SettingsVersionControl', () => {
|
||||
describe('SettingsSourceControl', () => {
|
||||
beforeAll(() => {
|
||||
server = setupServer();
|
||||
});
|
||||
@@ -37,7 +37,7 @@ describe('SettingsVersionControl', () => {
|
||||
pinia = createPinia();
|
||||
setActivePinia(pinia);
|
||||
settingsStore = useSettingsStore();
|
||||
versionControlStore = useVersionControlStore();
|
||||
sourceControlStore = useSourceControlStore();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -53,8 +53,8 @@ describe('SettingsVersionControl', () => {
|
||||
|
||||
const { getByTestId, queryByTestId } = renderComponent();
|
||||
|
||||
expect(queryByTestId('version-control-content-licensed')).not.toBeInTheDocument();
|
||||
expect(getByTestId('version-control-content-unlicensed')).toBeInTheDocument();
|
||||
expect(queryByTestId('source-control-content-licensed')).not.toBeInTheDocument();
|
||||
expect(getByTestId('source-control-content-unlicensed')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render licensed content', () => {
|
||||
@@ -62,18 +62,18 @@ describe('SettingsVersionControl', () => {
|
||||
|
||||
const { getByTestId, queryByTestId } = renderComponent();
|
||||
|
||||
expect(getByTestId('version-control-content-licensed')).toBeInTheDocument();
|
||||
expect(queryByTestId('version-control-content-unlicensed')).not.toBeInTheDocument();
|
||||
expect(queryByTestId('version-control-connected-content')).not.toBeInTheDocument();
|
||||
expect(getByTestId('source-control-content-licensed')).toBeInTheDocument();
|
||||
expect(queryByTestId('source-control-content-unlicensed')).not.toBeInTheDocument();
|
||||
expect(queryByTestId('source-control-connected-content')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should render user flow happy path', async () => {
|
||||
vi.spyOn(settingsStore, 'isEnterpriseFeatureEnabled').mockReturnValue(true);
|
||||
const updatePreferencesSpy = vi.spyOn(versionControlStore, 'updatePreferences');
|
||||
const updatePreferencesSpy = vi.spyOn(sourceControlStore, 'updatePreferences');
|
||||
|
||||
const { container, getByTestId, queryByTestId, getByRole } = renderComponent();
|
||||
|
||||
const connectButton = getByTestId('version-control-connect-button');
|
||||
const connectButton = getByTestId('source-control-connect-button');
|
||||
expect(connectButton).toBeDisabled();
|
||||
|
||||
const repoUrlInput = container.querySelector('input[name="repoUrl"]')!;
|
||||
@@ -105,16 +105,16 @@ describe('SettingsVersionControl', () => {
|
||||
await userEvent.tab();
|
||||
|
||||
expect(connectButton).toBeEnabled();
|
||||
expect(queryByTestId('version-control-save-settings-button')).not.toBeInTheDocument();
|
||||
expect(queryByTestId('source-control-save-settings-button')).not.toBeInTheDocument();
|
||||
|
||||
await userEvent.click(connectButton);
|
||||
await waitFor(() => expect(getByTestId('version-control-connected-content')).toBeVisible());
|
||||
await waitFor(() => expect(getByTestId('source-control-connected-content')).toBeVisible());
|
||||
|
||||
const saveSettingsButton = getByTestId('version-control-save-settings-button');
|
||||
const saveSettingsButton = getByTestId('source-control-save-settings-button');
|
||||
expect(saveSettingsButton).toBeInTheDocument();
|
||||
expect(saveSettingsButton).toBeDisabled();
|
||||
|
||||
const branchSelect = getByTestId('version-control-branch-select');
|
||||
const branchSelect = getByTestId('source-control-branch-select');
|
||||
await userEvent.click(within(branchSelect).getByRole('textbox'));
|
||||
|
||||
await waitFor(() => expect(within(branchSelect).getByText('main')).toBeVisible());
|
||||
@@ -130,14 +130,14 @@ describe('SettingsVersionControl', () => {
|
||||
});
|
||||
await waitFor(() => expect(screen.getByText('Settings successfully saved')).toBeVisible());
|
||||
|
||||
await userEvent.click(getByTestId('version-control-disconnect-button'));
|
||||
await userEvent.click(getByTestId('source-control-disconnect-button'));
|
||||
const disconnectDialog = getByRole('dialog');
|
||||
await waitFor(() => expect(disconnectDialog).toBeVisible());
|
||||
|
||||
await userEvent.click(within(disconnectDialog).getAllByRole('button')[1]);
|
||||
await waitFor(() => expect(disconnectDialog).not.toBeVisible());
|
||||
await waitFor(() =>
|
||||
expect(queryByTestId('version-control-connected-content')).not.toBeInTheDocument(),
|
||||
expect(queryByTestId('source-control-connected-content')).not.toBeInTheDocument(),
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user