From 0666377ef8074ad093391d41e08e194704a25dbd Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Fri, 12 May 2023 09:26:41 +0200 Subject: [PATCH] feat(editor): Version Control settings update (WIP) (#6233) --- packages/editor-ui/src/Interface.ts | 3 +- .../src/plugins/i18n/locales/en.json | 18 +- .../src/stores/versionControl.store.ts | 6 +- .../src/views/SettingsVersionControl.vue | 195 ++++++++++++------ 4 files changed, 156 insertions(+), 66 deletions(-) diff --git a/packages/editor-ui/src/Interface.ts b/packages/editor-ui/src/Interface.ts index c90e18da3..3cd3761be 100644 --- a/packages/editor-ui/src/Interface.ts +++ b/packages/editor-ui/src/Interface.ts @@ -1438,7 +1438,8 @@ export type VersionControlPreferences = { repositoryUrl: string; authorName: string; authorEmail: string; - branchName: string; + currentBranch: string; + branches: string[]; branchReadOnly: boolean; branchColor: string; publicKey?: string; diff --git a/packages/editor-ui/src/plugins/i18n/locales/en.json b/packages/editor-ui/src/plugins/i18n/locales/en.json index 64dce45c6..b398af6c2 100644 --- a/packages/editor-ui/src/plugins/i18n/locales/en.json +++ b/packages/editor-ui/src/plugins/i18n/locales/en.json @@ -1290,18 +1290,26 @@ "settings.versionControl.actionBox.title": "Available on Enterprise plan", "settings.versionControl.actionBox.description": "Use Version Control to connect your instance to an external Git repository to backup and track changes made to your workflows, variables, and credentials. With Version Control you can also sync instances across multiple environments (development, production...).", "settings.versionControl.actionBox.buttonText": "See plans", - "settings.versionControl.description": "Versioning allows you to connect your n8n instance to a Git branch of a repository. You can connect your branches to multiples n8n instances to create a multi environments setup. Learn how to set up versioning and environments in n8n.", - "settings.versionControl.repoUrl": "Git repository URL", + "settings.versionControl.description": "Versioning allows you to connect your n8n instance to a Git branch of a repository. You can connect your branches to multiples n8n instances to create a multi environments setup. {link}", + "settings.versionControl.description.link": "Learn how to set up versioning and environments in n8n.", + "settings.versionControl.gitConfig": "Git configuration", + "settings.versionControl.repoUrl": "Git repository URL (SSH)", "settings.versionControl.repoUrlPlaceholder": "e.g. git@github.com:my-team/my-repository", "settings.versionControl.repoUrlDescription": "The SSH url of your Git repository", - "settings.versionControl.authorName": "Author name", - "settings.versionControl.authorEmail": "Author email", + "settings.versionControl.authorName": "Commit author name", + "settings.versionControl.authorEmail": "Commit author email", "settings.versionControl.sshKey": "SSH Key", "settings.versionControl.sshKeyDescription": "Paste the SSH key in yout git repository settings. {link}.", "settings.versionControl.sshKeyDescriptionLink": "More info.", "settings.versionControl.button.continue": "Continue", "settings.versionControl.button.connect": "Connect", - "settings.versionControl.branches": "Select branch", + "settings.versionControl.button.save": "Save settings", + "settings.versionControl.instanceSettings": "Instance settings", + "settings.versionControl.branches": "Branch connected to this n8n instance", + "settings.versionControl.readonly": "{bold}: prevent editing workflows (recommended for production environments). {link}", + "settings.versionControl.readonly.bold": "Read-only instance", + "settings.versionControl.readonly.link": "Learn more.", + "settings.versionControl.color": "Color", "settings.versionControl.switchBranch.title": "Switch to {branch} branch", "settings.versionControl.switchBranch.description": "Please confirm you want to switch the current n8n instance to the branch: {branch}", "settings.versionControl.sync.prompt.title": "Sync changes in {branch} branch", diff --git a/packages/editor-ui/src/stores/versionControl.store.ts b/packages/editor-ui/src/stores/versionControl.store.ts index 6cc0da32d..819836432 100644 --- a/packages/editor-ui/src/stores/versionControl.store.ts +++ b/packages/editor-ui/src/stores/versionControl.store.ts @@ -16,12 +16,13 @@ export const useVersionControlStore = defineStore('versionControl', () => { ); const preferences = reactive({ - branchName: '', + currentBranch: '', + branches: [], authorName: '', authorEmail: '', repositoryUrl: '', branchReadOnly: false, - branchColor: '#000000', + branchColor: '#F4A6DC', connected: false, publicKey: '', }); @@ -77,6 +78,7 @@ export const useVersionControlStore = defineStore('versionControl', () => { return { isEnterpriseVersionControlEnabled, state, + preferences, initSsh, initRepository, sync, diff --git a/packages/editor-ui/src/views/SettingsVersionControl.vue b/packages/editor-ui/src/views/SettingsVersionControl.vue index ca1971b1a..bb5ca3524 100644 --- a/packages/editor-ui/src/views/SettingsVersionControl.vue +++ b/packages/editor-ui/src/views/SettingsVersionControl.vue @@ -1,19 +1,14 @@