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';
|
2023-07-26 00:25:01 -07:00
|
|
|
import { MODAL_CONFIRM } from '@/constants';
|
2023-11-28 03:15:08 -08:00
|
|
|
import { useSourceControlStore } from '@/stores/sourceControl.store';
|
|
|
|
import { useUIStore } from '@/stores/ui.store';
|
|
|
|
import { useToast } from '@/composables/useToast';
|
|
|
|
import { useLoadingService } from '@/composables/useLoadingService';
|
|
|
|
import { useI18n } from '@/composables/useI18n';
|
|
|
|
import { useMessage } from '@/composables/useMessage';
|
2023-05-12 00:26:41 -07:00
|
|
|
import CopyInput from '@/components/CopyInput.vue';
|
2023-09-14 05:40:34 -07:00
|
|
|
import type { TupleToUnion } from '@/utils/typeHelpers';
|
|
|
|
import type { SshKeyTypes } from '@/Interface';
|
2023-04-21 02:25:39 -07:00
|
|
|
|
2023-07-28 00:51:07 -07:00
|
|
|
const 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-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();
|
2023-07-26 00:25:01 -07:00
|
|
|
loadingService.setLoadingText(locale.baseText('settings.sourceControl.loading.connecting'));
|
2023-05-31 06:01:57 -07:00
|
|
|
try {
|
2023-06-20 10:13:18 -07:00
|
|
|
await sourceControlStore.savePreferences({
|
|
|
|
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-10-06 04:16:27 -07:00
|
|
|
void 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,
|
2023-09-14 05:40:34 -07:00
|
|
|
keyGeneratorType: 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-09-11 11:54:03 -07:00
|
|
|
regex:
|
|
|
|
/^git@(?:\[[0-9a-fA-F:]+\]|(?:[a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)(?::[0-9]+)*:(?:v[0-9]+\/)?[a-zA-Z0-9_.\-\/]+(\.git)?(?:\/[a-zA-Z0-9_.\-\/]+)*$/,
|
2023-06-20 10:13:18 -07:00
|
|
|
message: locale.baseText('settings.sourceControl.repoUrlInvalid'),
|
2023-05-31 06:01:57 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2023-09-14 05:40:34 -07:00
|
|
|
const keyGeneratorTypeValidationRules: Array<Rule | RuleGroup> = [{ name: 'REQUIRED' }];
|
|
|
|
|
2023-07-26 00:25:01 -07:00
|
|
|
const validForConnection = computed(() => formValidationStatus.repoUrl);
|
2023-07-07 02:48:44 -07:00
|
|
|
const branchNameValidationRules: Array<Rule | RuleGroup> = [{ name: 'REQUIRED' }];
|
|
|
|
|
2023-05-31 06:01:57 -07:00
|
|
|
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-09-14 05:40:34 -07:00
|
|
|
await sourceControlStore.generateKeyPair(sourceControlStore.preferences.keyGeneratorType);
|
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-09-14 05:40:34 -07:00
|
|
|
|
|
|
|
const onSelectSshKeyType = async (sshKeyType: TupleToUnion<SshKeyTypes>) => {
|
|
|
|
if (sshKeyType === sourceControlStore.preferences.keyGeneratorType) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
sourceControlStore.preferences.keyGeneratorType = sshKeyType;
|
|
|
|
};
|
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-07-28 00:51:07 -07:00
|
|
|
<i18n-t keypath="settings.sourceControl.description" tag="span">
|
2023-05-12 00:26:41 -07:00
|
|
|
<template #link>
|
2023-07-26 00:25:01 -07:00
|
|
|
<a :href="locale.baseText('settings.sourceControl.docs.url')" target="_blank">
|
2023-06-20 10:13:18 -07:00
|
|
|
{{ locale.baseText('settings.sourceControl.description.link') }}
|
2023-05-12 00:26:41 -07:00
|
|
|
</a>
|
|
|
|
</template>
|
2023-07-28 00:51:07 -07:00
|
|
|
</i18n-t>
|
2023-05-12 00:26:41 -07:00
|
|
|
</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-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 }">
|
2023-09-14 05:40:34 -07:00
|
|
|
<n8n-form-input
|
|
|
|
v-if="!isConnected"
|
|
|
|
:class="$style.sshKeyTypeSelect"
|
|
|
|
label
|
|
|
|
type="select"
|
|
|
|
id="keyGeneratorType"
|
|
|
|
name="keyGeneratorType"
|
|
|
|
data-test-id="source-control-ssh-key-type-select"
|
|
|
|
validateOnBlur
|
|
|
|
:validationRules="keyGeneratorTypeValidationRules"
|
|
|
|
:options="sourceControlStore.sshKeyTypesWithLabel"
|
|
|
|
:modelValue="sourceControlStore.preferences.keyGeneratorType"
|
|
|
|
@validate="(value) => onValidate('keyGeneratorType', value)"
|
|
|
|
@update:modelValue="onSelectSshKeyType"
|
|
|
|
/>
|
2023-05-31 06:01:57 -07:00
|
|
|
<CopyInput
|
2023-09-14 05:40:34 -07:00
|
|
|
:class="$style.copyInput"
|
2023-05-31 06:01:57 -07:00
|
|
|
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"
|
|
|
|
@click="refreshSshKey"
|
2023-09-14 05:40:34 -07:00
|
|
|
data-test-id="source-control-refresh-ssh-key-button"
|
2023-05-31 06:01:57 -07:00
|
|
|
>
|
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-07-28 00:51:07 -07:00
|
|
|
<i18n-t keypath="settings.sourceControl.sshKeyDescription" tag="span">
|
2023-04-26 08:52:53 -07:00
|
|
|
<template #link>
|
2023-07-26 00:25:01 -07:00
|
|
|
<a
|
|
|
|
:href="locale.baseText('settings.sourceControl.docs.setup.ssh.url')"
|
|
|
|
target="_blank"
|
|
|
|
>{{ locale.baseText('settings.sourceControl.sshKeyDescriptionLink') }}</a
|
|
|
|
>
|
2023-04-26 08:52:53 -07:00
|
|
|
</template>
|
2023-07-28 00:51:07 -07:00
|
|
|
</i18n-t>
|
2023-04-26 08:52:53 -07:00
|
|
|
</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"
|
2023-07-28 00:51:07 -07:00
|
|
|
:modelValue="sourceControlStore.preferences.branchName"
|
2023-07-07 02:48:44 -07:00
|
|
|
@validate="(value) => onValidate('branchName', value)"
|
2023-07-28 00:51:07 -07:00
|
|
|
@update:modelValue="onSelect"
|
2023-07-07 02:48:44 -07:00
|
|
|
/>
|
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-07-28 00:51:07 -07:00
|
|
|
<i18n-t keypath="settings.sourceControl.protected" tag="span">
|
2023-05-12 00:26:41 -07:00
|
|
|
<template #bold>
|
2023-07-26 00:25:01 -07:00
|
|
|
<strong>{{ locale.baseText('settings.sourceControl.protected.bold') }}</strong>
|
2023-05-12 00:26:41 -07:00
|
|
|
</template>
|
2023-07-28 00:51:07 -07:00
|
|
|
</i18n-t>
|
2023-05-12 00:26:41 -07:00
|
|
|
</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-07-28 00:51:07 -07:00
|
|
|
@click:button="goToUpgrade"
|
2023-04-21 02:25:39 -07:00
|
|
|
>
|
|
|
|
<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 {
|
2023-09-14 05:40:34 -07:00
|
|
|
flex: 1 1 auto;
|
2023-05-31 06:01:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
> button {
|
|
|
|
height: 42px;
|
|
|
|
}
|
2023-09-14 05:40:34 -07:00
|
|
|
|
|
|
|
.copyInput {
|
|
|
|
margin: 0 var(--spacing-2xs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.sshKeyTypeSelect {
|
|
|
|
min-width: 120px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.copyInput {
|
|
|
|
overflow: auto;
|
2023-05-31 06:01:57 -07:00
|
|
|
}
|
|
|
|
|
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>
|