2023-04-19 07:01:32 -07:00
|
|
|
<script lang="ts" setup>
|
2023-07-10 03:35:36 -07:00
|
|
|
import { computed, reactive, ref, onMounted } from 'vue';
|
2023-05-31 06:01:57 -07:00
|
|
|
import type { Rule, RuleGroup } from 'n8n-design-system/types';
|
|
|
|
import { MODAL_CONFIRM, VALID_EMAIL_REGEX } from '@/constants';
|
2023-06-20 10:13:18 -07:00
|
|
|
import { useUIStore, useSourceControlStore } from '@/stores';
|
2023-05-31 06:01:57 -07:00
|
|
|
import { useToast, useMessage, useLoadingService, useI18n } from '@/composables';
|
2023-05-12 00:26:41 -07:00
|
|
|
import CopyInput from '@/components/CopyInput.vue';
|
2023-04-21 02:25:39 -07:00
|
|
|
|
2023-05-31 06:01:57 -07:00
|
|
|
const { i18n: locale } = useI18n();
|
2023-06-20 10:13:18 -07:00
|
|
|
const sourceControlStore = useSourceControlStore();
|
2023-04-21 02:25:39 -07:00
|
|
|
const uiStore = useUIStore();
|
2023-05-31 06:01:57 -07:00
|
|
|
const toast = useToast();
|
2023-04-26 08:52:53 -07:00
|
|
|
const message = useMessage();
|
2023-05-31 06:01:57 -07:00
|
|
|
const loadingService = useLoadingService();
|
2023-04-26 08:52:53 -07:00
|
|
|
|
2023-06-20 10:13:18 -07:00
|
|
|
const sourceControlDocsSetupUrl = computed(() =>
|
|
|
|
locale.baseText('settings.sourceControl.docs.setup.url'),
|
2023-06-15 23:34:14 -07:00
|
|
|
);
|
2023-05-31 06:01:57 -07:00
|
|
|
const isConnected = ref(false);
|
2023-07-07 02:48:44 -07:00
|
|
|
const branchNameOptions = computed(() =>
|
|
|
|
sourceControlStore.preferences.branches.map((branch) => ({
|
|
|
|
value: branch,
|
|
|
|
label: branch,
|
|
|
|
})),
|
|
|
|
);
|
2023-05-31 06:01:57 -07:00
|
|
|
|
|
|
|
const onConnect = async () => {
|
|
|
|
loadingService.startLoading();
|
|
|
|
try {
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.savePreferences({
|
|
|
|
authorName: sourceControlStore.preferences.authorName,
|
|
|
|
authorEmail: sourceControlStore.preferences.authorEmail,
|
|
|
|
repositoryUrl: sourceControlStore.preferences.repositoryUrl,
|
2023-05-31 06:01:57 -07:00
|
|
|
});
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.getBranches();
|
2023-05-31 06:01:57 -07:00
|
|
|
isConnected.value = true;
|
|
|
|
toast.showMessage({
|
2023-06-20 10:13:18 -07:00
|
|
|
title: locale.baseText('settings.sourceControl.toast.connected.title'),
|
|
|
|
message: locale.baseText('settings.sourceControl.toast.connected.message'),
|
2023-05-31 06:01:57 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
} catch (error) {
|
2023-06-20 10:13:18 -07:00
|
|
|
toast.showError(error, locale.baseText('settings.sourceControl.toast.connected.error'));
|
2023-05-31 06:01:57 -07:00
|
|
|
}
|
|
|
|
loadingService.stopLoading();
|
2023-04-26 08:52:53 -07:00
|
|
|
};
|
|
|
|
|
2023-05-31 06:01:57 -07:00
|
|
|
const onDisconnect = async () => {
|
|
|
|
try {
|
|
|
|
const confirmation = await message.confirm(
|
2023-06-20 10:13:18 -07:00
|
|
|
locale.baseText('settings.sourceControl.modals.disconnect.message'),
|
|
|
|
locale.baseText('settings.sourceControl.modals.disconnect.title'),
|
2023-05-31 06:01:57 -07:00
|
|
|
{
|
2023-06-20 10:13:18 -07:00
|
|
|
confirmButtonText: locale.baseText('settings.sourceControl.modals.disconnect.confirm'),
|
|
|
|
cancelButtonText: locale.baseText('settings.sourceControl.modals.disconnect.cancel'),
|
2023-05-31 06:01:57 -07:00
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
if (confirmation === MODAL_CONFIRM) {
|
|
|
|
loadingService.startLoading();
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.disconnect(true);
|
2023-05-31 06:01:57 -07:00
|
|
|
isConnected.value = false;
|
|
|
|
toast.showMessage({
|
2023-06-20 10:13:18 -07:00
|
|
|
title: locale.baseText('settings.sourceControl.toast.disconnected.title'),
|
|
|
|
message: locale.baseText('settings.sourceControl.toast.disconnected.message'),
|
2023-05-31 06:01:57 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (error) {
|
2023-06-20 10:13:18 -07:00
|
|
|
toast.showError(error, locale.baseText('settings.sourceControl.toast.disconnected.error'));
|
2023-05-31 06:01:57 -07:00
|
|
|
}
|
|
|
|
loadingService.stopLoading();
|
2023-04-26 08:52:53 -07:00
|
|
|
};
|
|
|
|
|
2023-05-31 06:01:57 -07:00
|
|
|
const onSave = async () => {
|
|
|
|
loadingService.startLoading();
|
|
|
|
try {
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.updatePreferences({
|
|
|
|
branchName: sourceControlStore.preferences.branchName,
|
|
|
|
branchReadOnly: sourceControlStore.preferences.branchReadOnly,
|
|
|
|
branchColor: sourceControlStore.preferences.branchColor,
|
2023-06-06 02:23:53 -07:00
|
|
|
});
|
2023-05-31 06:01:57 -07:00
|
|
|
toast.showMessage({
|
2023-06-20 10:13:18 -07:00
|
|
|
title: locale.baseText('settings.sourceControl.saved.title'),
|
2023-05-31 06:01:57 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
} catch (error) {
|
|
|
|
toast.showError(error, 'Error setting branch');
|
|
|
|
}
|
|
|
|
loadingService.stopLoading();
|
2023-05-12 00:26:41 -07:00
|
|
|
};
|
|
|
|
|
2023-04-26 08:52:53 -07:00
|
|
|
const onSelect = async (b: string) => {
|
2023-06-20 10:13:18 -07:00
|
|
|
if (b === sourceControlStore.preferences.branchName) {
|
2023-04-26 08:52:53 -07:00
|
|
|
return;
|
|
|
|
}
|
2023-06-20 10:13:18 -07:00
|
|
|
sourceControlStore.preferences.branchName = b;
|
2023-04-26 08:52:53 -07:00
|
|
|
};
|
2023-04-21 02:25:39 -07:00
|
|
|
|
|
|
|
const goToUpgrade = () => {
|
2023-06-20 10:13:18 -07:00
|
|
|
uiStore.goToUpgrade('source-control', 'upgrade-source-control');
|
2023-04-21 02:25:39 -07:00
|
|
|
};
|
2023-05-31 06:01:57 -07:00
|
|
|
|
2023-07-10 03:35:36 -07:00
|
|
|
const initialize = async () => {
|
|
|
|
await sourceControlStore.getPreferences();
|
2023-06-20 10:13:18 -07:00
|
|
|
if (sourceControlStore.preferences.connected) {
|
2023-05-31 06:01:57 -07:00
|
|
|
isConnected.value = true;
|
2023-06-20 10:13:18 -07:00
|
|
|
void sourceControlStore.getBranches();
|
2023-05-31 06:01:57 -07:00
|
|
|
}
|
2023-07-10 03:35:36 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
await initialize();
|
2023-05-31 06:01:57 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
const formValidationStatus = reactive<Record<string, boolean>>({
|
|
|
|
repoUrl: false,
|
|
|
|
authorName: false,
|
|
|
|
authorEmail: false,
|
2023-07-07 02:48:44 -07:00
|
|
|
branchName: false,
|
2023-05-31 06:01:57 -07:00
|
|
|
});
|
|
|
|
|
|
|
|
function onValidate(key: string, value: boolean) {
|
|
|
|
formValidationStatus[key] = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
const repoUrlValidationRules: Array<Rule | RuleGroup> = [
|
|
|
|
{ name: 'REQUIRED' },
|
|
|
|
{
|
|
|
|
name: 'MATCH_REGEX',
|
|
|
|
config: {
|
2023-06-19 03:17:45 -07:00
|
|
|
regex: /^(?!https?:\/\/)(?:git|ssh|git@[-\w.]+):(\/\/)?(.*?)(\.git)(\/?|\#[-\d\w._]+?)$/,
|
2023-06-20 10:13:18 -07:00
|
|
|
message: locale.baseText('settings.sourceControl.repoUrlInvalid'),
|
2023-05-31 06:01:57 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
|
|
|
const authorNameValidationRules: Array<Rule | RuleGroup> = [{ name: 'REQUIRED' }];
|
|
|
|
|
|
|
|
const authorEmailValidationRules: Array<Rule | RuleGroup> = [
|
|
|
|
{ name: 'REQUIRED' },
|
|
|
|
{
|
|
|
|
name: 'MATCH_REGEX',
|
|
|
|
config: {
|
|
|
|
regex: VALID_EMAIL_REGEX,
|
2023-06-20 10:13:18 -07:00
|
|
|
message: locale.baseText('settings.sourceControl.authorEmailInvalid'),
|
2023-05-31 06:01:57 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2023-07-07 02:48:44 -07:00
|
|
|
const branchNameValidationRules: Array<Rule | RuleGroup> = [{ name: 'REQUIRED' }];
|
|
|
|
|
2023-05-31 06:01:57 -07:00
|
|
|
const validForConnection = computed(
|
|
|
|
() =>
|
|
|
|
formValidationStatus.repoUrl &&
|
|
|
|
formValidationStatus.authorName &&
|
|
|
|
formValidationStatus.authorEmail,
|
|
|
|
);
|
|
|
|
|
|
|
|
async function refreshSshKey() {
|
|
|
|
try {
|
|
|
|
const confirmation = await message.confirm(
|
2023-06-20 10:13:18 -07:00
|
|
|
locale.baseText('settings.sourceControl.modals.refreshSshKey.message'),
|
|
|
|
locale.baseText('settings.sourceControl.modals.refreshSshKey.title'),
|
2023-05-31 06:01:57 -07:00
|
|
|
{
|
2023-06-20 10:13:18 -07:00
|
|
|
confirmButtonText: locale.baseText('settings.sourceControl.modals.refreshSshKey.confirm'),
|
|
|
|
cancelButtonText: locale.baseText('settings.sourceControl.modals.refreshSshKey.cancel'),
|
2023-05-31 06:01:57 -07:00
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
if (confirmation === MODAL_CONFIRM) {
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.generateKeyPair();
|
2023-05-31 06:01:57 -07:00
|
|
|
toast.showMessage({
|
2023-06-20 10:13:18 -07:00
|
|
|
title: locale.baseText('settings.sourceControl.refreshSshKey.successful.title'),
|
2023-05-31 06:01:57 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} catch (error) {
|
2023-06-20 10:13:18 -07:00
|
|
|
toast.showError(error, locale.baseText('settings.sourceControl.refreshSshKey.error.title'));
|
2023-05-31 06:01:57 -07:00
|
|
|
}
|
|
|
|
}
|
2023-06-06 05:31:55 -07:00
|
|
|
|
|
|
|
const refreshBranches = async () => {
|
|
|
|
try {
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.getBranches();
|
2023-06-06 05:31:55 -07:00
|
|
|
toast.showMessage({
|
2023-06-20 10:13:18 -07:00
|
|
|
title: locale.baseText('settings.sourceControl.refreshBranches.success'),
|
2023-06-06 05:31:55 -07:00
|
|
|
type: 'success',
|
|
|
|
});
|
|
|
|
} catch (error) {
|
2023-06-20 10:13:18 -07:00
|
|
|
toast.showError(error, locale.baseText('settings.sourceControl.refreshBranches.error'));
|
2023-06-06 05:31:55 -07:00
|
|
|
}
|
|
|
|
};
|
2023-04-19 07:01:32 -07:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div>
|
2023-05-12 00:26:41 -07:00
|
|
|
<n8n-heading size="2xlarge" tag="h1">{{
|
2023-06-20 10:13:18 -07:00
|
|
|
locale.baseText('settings.sourceControl.title')
|
2023-05-12 00:26:41 -07:00
|
|
|
}}</n8n-heading>
|
2023-04-21 02:25:39 -07:00
|
|
|
<div
|
2023-06-20 10:13:18 -07:00
|
|
|
v-if="sourceControlStore.isEnterpriseSourceControlEnabled"
|
|
|
|
data-test-id="source-control-content-licensed"
|
2023-04-26 08:52:53 -07:00
|
|
|
>
|
2023-05-12 00:26:41 -07:00
|
|
|
<n8n-callout theme="secondary" icon="info-circle" class="mt-2xl mb-l">
|
2023-06-20 10:13:18 -07:00
|
|
|
<i18n path="settings.sourceControl.description">
|
2023-05-12 00:26:41 -07:00
|
|
|
<template #link>
|
2023-06-20 10:13:18 -07:00
|
|
|
<a :href="sourceControlDocsSetupUrl" target="_blank">
|
|
|
|
{{ locale.baseText('settings.sourceControl.description.link') }}
|
2023-05-12 00:26:41 -07:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</i18n>
|
|
|
|
</n8n-callout>
|
|
|
|
<n8n-heading size="xlarge" tag="h2" class="mb-s">{{
|
2023-06-20 10:13:18 -07:00
|
|
|
locale.baseText('settings.sourceControl.gitConfig')
|
2023-05-12 00:26:41 -07:00
|
|
|
}}</n8n-heading>
|
2023-04-26 08:52:53 -07:00
|
|
|
<div :class="$style.group">
|
2023-06-20 10:13:18 -07:00
|
|
|
<label for="repoUrl">{{ locale.baseText('settings.sourceControl.repoUrl') }}</label>
|
2023-05-31 06:01:57 -07:00
|
|
|
<div :class="$style.groupFlex">
|
|
|
|
<n8n-form-input
|
|
|
|
label
|
|
|
|
class="ml-0"
|
|
|
|
id="repoUrl"
|
|
|
|
name="repoUrl"
|
|
|
|
validateOnBlur
|
|
|
|
:validationRules="repoUrlValidationRules"
|
|
|
|
:disabled="isConnected"
|
2023-06-20 10:13:18 -07:00
|
|
|
:placeholder="locale.baseText('settings.sourceControl.repoUrlPlaceholder')"
|
|
|
|
v-model="sourceControlStore.preferences.repositoryUrl"
|
2023-05-31 06:01:57 -07:00
|
|
|
@validate="(value) => onValidate('repoUrl', value)"
|
|
|
|
/>
|
|
|
|
<n8n-button
|
2023-07-07 02:48:44 -07:00
|
|
|
:class="$style.disconnectButton"
|
2023-05-31 06:01:57 -07:00
|
|
|
type="tertiary"
|
|
|
|
v-if="isConnected"
|
|
|
|
@click="onDisconnect"
|
|
|
|
size="large"
|
|
|
|
icon="trash"
|
2023-06-20 10:13:18 -07:00
|
|
|
data-test-id="source-control-disconnect-button"
|
|
|
|
>{{ locale.baseText('settings.sourceControl.button.disconnect') }}</n8n-button
|
2023-05-31 06:01:57 -07:00
|
|
|
>
|
|
|
|
</div>
|
2023-04-26 08:52:53 -07:00
|
|
|
</div>
|
2023-05-12 00:26:41 -07:00
|
|
|
<div :class="[$style.group, $style.groupFlex]">
|
|
|
|
<div>
|
2023-06-20 10:13:18 -07:00
|
|
|
<label for="authorName">{{ locale.baseText('settings.sourceControl.authorName') }}</label>
|
2023-05-31 06:01:57 -07:00
|
|
|
<n8n-form-input
|
|
|
|
label
|
|
|
|
id="authorName"
|
|
|
|
name="authorName"
|
|
|
|
validateOnBlur
|
|
|
|
:validationRules="authorNameValidationRules"
|
2023-06-20 10:13:18 -07:00
|
|
|
v-model="sourceControlStore.preferences.authorName"
|
2023-05-31 06:01:57 -07:00
|
|
|
@validate="(value) => onValidate('authorName', value)"
|
|
|
|
/>
|
2023-05-12 00:26:41 -07:00
|
|
|
</div>
|
|
|
|
<div>
|
|
|
|
<label for="authorEmail">{{
|
2023-06-20 10:13:18 -07:00
|
|
|
locale.baseText('settings.sourceControl.authorEmail')
|
2023-05-12 00:26:41 -07:00
|
|
|
}}</label>
|
2023-05-31 06:01:57 -07:00
|
|
|
<n8n-form-input
|
|
|
|
label
|
|
|
|
type="email"
|
|
|
|
id="authorEmail"
|
|
|
|
name="authorEmail"
|
|
|
|
validateOnBlur
|
|
|
|
:validationRules="authorEmailValidationRules"
|
2023-06-20 10:13:18 -07:00
|
|
|
v-model="sourceControlStore.preferences.authorEmail"
|
2023-05-31 06:01:57 -07:00
|
|
|
@validate="(value) => onValidate('authorEmail', value)"
|
|
|
|
/>
|
2023-05-12 00:26:41 -07:00
|
|
|
</div>
|
2023-04-26 08:52:53 -07:00
|
|
|
</div>
|
2023-06-20 10:13:18 -07:00
|
|
|
<div v-if="sourceControlStore.preferences.publicKey" :class="$style.group">
|
|
|
|
<label>{{ locale.baseText('settings.sourceControl.sshKey') }}</label>
|
2023-05-31 06:01:57 -07:00
|
|
|
<div :class="{ [$style.sshInput]: !isConnected }">
|
|
|
|
<CopyInput
|
|
|
|
collapse
|
|
|
|
size="medium"
|
2023-06-20 10:13:18 -07:00
|
|
|
:value="sourceControlStore.preferences.publicKey"
|
2023-05-31 06:01:57 -07:00
|
|
|
:copy-button-text="locale.baseText('generic.clickToCopy')"
|
|
|
|
/>
|
|
|
|
<n8n-button
|
|
|
|
v-if="!isConnected"
|
|
|
|
size="large"
|
|
|
|
type="tertiary"
|
|
|
|
icon="sync"
|
|
|
|
class="ml-s"
|
|
|
|
@click="refreshSshKey"
|
|
|
|
>
|
2023-06-20 10:13:18 -07:00
|
|
|
{{ locale.baseText('settings.sourceControl.refreshSshKey') }}
|
2023-05-31 06:01:57 -07:00
|
|
|
</n8n-button>
|
|
|
|
</div>
|
2023-04-26 08:52:53 -07:00
|
|
|
<n8n-notice type="info" class="mt-s">
|
2023-06-20 10:13:18 -07:00
|
|
|
<i18n path="settings.sourceControl.sshKeyDescription">
|
2023-04-26 08:52:53 -07:00
|
|
|
<template #link>
|
2023-06-20 10:13:18 -07:00
|
|
|
<a :href="sourceControlDocsSetupUrl" target="_blank">{{
|
|
|
|
locale.baseText('settings.sourceControl.sshKeyDescriptionLink')
|
2023-05-31 06:01:57 -07:00
|
|
|
}}</a>
|
2023-04-26 08:52:53 -07:00
|
|
|
</template>
|
|
|
|
</i18n>
|
|
|
|
</n8n-notice>
|
|
|
|
</div>
|
2023-05-12 00:26:41 -07:00
|
|
|
<n8n-button
|
2023-05-31 06:01:57 -07:00
|
|
|
v-if="!isConnected"
|
2023-05-12 00:26:41 -07:00
|
|
|
@click="onConnect"
|
|
|
|
size="large"
|
2023-05-31 06:01:57 -07:00
|
|
|
:disabled="!validForConnection"
|
2023-05-12 00:26:41 -07:00
|
|
|
:class="$style.connect"
|
2023-06-20 10:13:18 -07:00
|
|
|
data-test-id="source-control-connect-button"
|
|
|
|
>{{ locale.baseText('settings.sourceControl.button.connect') }}</n8n-button
|
2023-05-12 00:26:41 -07:00
|
|
|
>
|
2023-06-20 10:13:18 -07:00
|
|
|
<div v-if="isConnected" data-test-id="source-control-connected-content">
|
2023-05-12 00:26:41 -07:00
|
|
|
<div :class="$style.group">
|
|
|
|
<hr />
|
|
|
|
<n8n-heading size="xlarge" tag="h2" class="mb-s">{{
|
2023-06-20 10:13:18 -07:00
|
|
|
locale.baseText('settings.sourceControl.instanceSettings')
|
2023-05-12 00:26:41 -07:00
|
|
|
}}</n8n-heading>
|
2023-06-20 10:13:18 -07:00
|
|
|
<label>{{ locale.baseText('settings.sourceControl.branches') }}</label>
|
2023-06-06 05:31:55 -07:00
|
|
|
<div :class="$style.branchSelection">
|
2023-07-07 02:48:44 -07:00
|
|
|
<n8n-form-input
|
|
|
|
label
|
|
|
|
type="select"
|
|
|
|
id="branchName"
|
|
|
|
name="branchName"
|
2023-06-06 05:31:55 -07:00
|
|
|
class="mb-s"
|
2023-06-20 10:13:18 -07:00
|
|
|
data-test-id="source-control-branch-select"
|
2023-07-07 02:48:44 -07:00
|
|
|
validateOnBlur
|
|
|
|
:validationRules="branchNameValidationRules"
|
|
|
|
:options="branchNameOptions"
|
|
|
|
:value="sourceControlStore.preferences.branchName"
|
|
|
|
@validate="(value) => onValidate('branchName', value)"
|
|
|
|
@input="onSelect"
|
|
|
|
/>
|
2023-06-06 05:31:55 -07:00
|
|
|
<n8n-tooltip placement="top">
|
|
|
|
<template #content>
|
|
|
|
<span>
|
2023-06-20 10:13:18 -07:00
|
|
|
{{ locale.baseText('settings.sourceControl.refreshBranches.tooltip') }}
|
2023-06-06 05:31:55 -07:00
|
|
|
</span>
|
|
|
|
</template>
|
|
|
|
<n8n-button
|
|
|
|
size="small"
|
|
|
|
type="tertiary"
|
|
|
|
icon="sync"
|
|
|
|
square
|
|
|
|
:class="$style.refreshBranches"
|
|
|
|
@click="refreshBranches"
|
2023-06-20 10:13:18 -07:00
|
|
|
data-test-id="source-control-refresh-branches-button"
|
2023-06-06 05:31:55 -07:00
|
|
|
/>
|
|
|
|
</n8n-tooltip>
|
|
|
|
</div>
|
2023-05-12 00:26:41 -07:00
|
|
|
<n8n-checkbox
|
2023-06-20 10:13:18 -07:00
|
|
|
v-model="sourceControlStore.preferences.branchReadOnly"
|
2023-05-12 00:26:41 -07:00
|
|
|
:class="$style.readOnly"
|
|
|
|
>
|
2023-06-20 10:13:18 -07:00
|
|
|
<i18n path="settings.sourceControl.readonly">
|
2023-05-12 00:26:41 -07:00
|
|
|
<template #bold>
|
2023-06-20 10:13:18 -07:00
|
|
|
<strong>{{ locale.baseText('settings.sourceControl.readonly.bold') }}</strong>
|
2023-05-12 00:26:41 -07:00
|
|
|
</template>
|
|
|
|
<template #link>
|
2023-06-20 10:13:18 -07:00
|
|
|
<a :href="sourceControlDocsSetupUrl" target="_blank">
|
|
|
|
{{ locale.baseText('settings.sourceControl.readonly.link') }}
|
2023-05-12 00:26:41 -07:00
|
|
|
</a>
|
|
|
|
</template>
|
|
|
|
</i18n>
|
|
|
|
</n8n-checkbox>
|
|
|
|
</div>
|
2023-06-06 02:23:53 -07:00
|
|
|
<div :class="$style.group">
|
2023-06-20 10:13:18 -07:00
|
|
|
<label>{{ locale.baseText('settings.sourceControl.color') }}</label>
|
2023-05-12 00:26:41 -07:00
|
|
|
<div>
|
2023-06-20 10:13:18 -07:00
|
|
|
<n8n-color-picker size="small" v-model="sourceControlStore.preferences.branchColor" />
|
2023-05-12 00:26:41 -07:00
|
|
|
</div>
|
2023-06-06 02:23:53 -07:00
|
|
|
</div>
|
2023-05-12 00:26:41 -07:00
|
|
|
<div :class="[$style.group, 'pt-s']">
|
|
|
|
<n8n-button
|
|
|
|
@click="onSave"
|
|
|
|
size="large"
|
2023-06-20 10:13:18 -07:00
|
|
|
:disabled="!sourceControlStore.preferences.branchName"
|
|
|
|
data-test-id="source-control-save-settings-button"
|
|
|
|
>{{ locale.baseText('settings.sourceControl.button.save') }}</n8n-button
|
2023-05-12 00:26:41 -07:00
|
|
|
>
|
|
|
|
</div>
|
2023-04-26 08:52:53 -07:00
|
|
|
</div>
|
|
|
|
</div>
|
2023-04-21 02:25:39 -07:00
|
|
|
<n8n-action-box
|
|
|
|
v-else
|
2023-06-20 10:13:18 -07:00
|
|
|
data-test-id="source-control-content-unlicensed"
|
2023-04-21 02:25:39 -07:00
|
|
|
:class="$style.actionBox"
|
2023-06-20 10:13:18 -07:00
|
|
|
:description="locale.baseText('settings.sourceControl.actionBox.description')"
|
|
|
|
:buttonText="locale.baseText('settings.sourceControl.actionBox.buttonText')"
|
2023-04-21 02:25:39 -07:00
|
|
|
@click="goToUpgrade"
|
|
|
|
>
|
|
|
|
<template #heading>
|
2023-06-20 10:13:18 -07:00
|
|
|
<span>{{ locale.baseText('settings.sourceControl.actionBox.title') }}</span>
|
2023-04-21 02:25:39 -07:00
|
|
|
</template>
|
2023-06-28 04:59:07 -07:00
|
|
|
<template #description>
|
|
|
|
{{ locale.baseText('settings.sourceControl.actionBox.description') }}
|
|
|
|
<a :href="locale.baseText('settings.sourceControl.docs.url')" target="_blank">
|
|
|
|
{{ locale.baseText('settings.sourceControl.actionBox.description.link') }}
|
|
|
|
</a>
|
|
|
|
</template>
|
2023-04-21 02:25:39 -07:00
|
|
|
</n8n-action-box>
|
2023-04-19 07:01:32 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2023-04-21 02:25:39 -07:00
|
|
|
<style lang="scss" module>
|
2023-04-26 08:52:53 -07:00
|
|
|
.group {
|
2023-05-12 00:26:41 -07:00
|
|
|
padding: 0 0 var(--spacing-s);
|
2023-05-31 06:01:57 -07:00
|
|
|
width: 100%;
|
|
|
|
display: block;
|
2023-04-26 08:52:53 -07:00
|
|
|
|
2023-06-07 02:37:59 -07:00
|
|
|
hr {
|
|
|
|
margin: 0 0 var(--spacing-xl);
|
|
|
|
border: 1px solid var(--color-foreground-light);
|
|
|
|
}
|
|
|
|
|
2023-04-26 08:52:53 -07:00
|
|
|
label {
|
|
|
|
display: inline-block;
|
|
|
|
padding: 0 0 var(--spacing-2xs);
|
|
|
|
font-size: var(--font-size-s);
|
|
|
|
}
|
|
|
|
|
|
|
|
small {
|
|
|
|
display: inline-block;
|
|
|
|
padding: var(--spacing-2xs) 0 0;
|
|
|
|
font-size: var(--font-size-2xs);
|
|
|
|
color: var(--color-text-light);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-05-12 00:26:41 -07:00
|
|
|
.readOnly {
|
|
|
|
span {
|
|
|
|
font-size: var(--font-size-s) !important;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.groupFlex {
|
|
|
|
display: flex;
|
2023-05-31 06:01:57 -07:00
|
|
|
align-items: flex-start;
|
2023-05-12 00:26:41 -07:00
|
|
|
|
|
|
|
> div {
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
margin-left: var(--spacing-2xs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
input {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-26 08:52:53 -07:00
|
|
|
.connect {
|
|
|
|
margin: calc(var(--spacing-2xs) * -1) 0 var(--spacing-2xs);
|
|
|
|
}
|
|
|
|
|
2023-07-07 02:48:44 -07:00
|
|
|
.disconnectButton {
|
|
|
|
margin: 0 0 0 var(--spacing-2xs);
|
|
|
|
height: 40px;
|
|
|
|
}
|
|
|
|
|
2023-04-21 02:25:39 -07:00
|
|
|
.actionBox {
|
|
|
|
margin: var(--spacing-2xl) 0 0;
|
|
|
|
}
|
2023-05-12 00:26:41 -07:00
|
|
|
|
2023-05-31 06:01:57 -07:00
|
|
|
.sshInput {
|
|
|
|
width: 100%;
|
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
> div {
|
|
|
|
width: calc(100% - 144px - var(--spacing-s));
|
|
|
|
}
|
|
|
|
|
|
|
|
> button {
|
|
|
|
height: 42px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-06 05:31:55 -07:00
|
|
|
.branchSelection {
|
|
|
|
display: flex;
|
|
|
|
|
2023-07-07 02:48:44 -07:00
|
|
|
> div:first-child {
|
|
|
|
flex: 1;
|
|
|
|
|
|
|
|
input {
|
|
|
|
height: 36px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-06 05:31:55 -07:00
|
|
|
button.refreshBranches {
|
|
|
|
height: 36px;
|
|
|
|
width: 36px;
|
|
|
|
margin-left: var(--spacing-xs);
|
|
|
|
}
|
|
|
|
}
|
2023-04-21 02:25:39 -07:00
|
|
|
</style>
|