fix(editor): Add button to refresh branches (#6387)

* fix(editor): Add button to refresh branches

* trigger CI
This commit is contained in:
Csaba Tuncsik
2023-06-06 14:31:55 +02:00
committed by GitHub
parent e72521d5ec
commit ce578162f4
2 changed files with 56 additions and 14 deletions

View File

@@ -1403,6 +1403,9 @@
"settings.versionControl.loading.pull": "Pulling from remote",
"settings.versionControl.loading.push": "Pushing to remote",
"settings.versionControl.saved.title": "Settings successfully saved",
"settings.versionControl.refreshBranches.tooltip": "Reload branches list",
"settings.versionControl.refreshBranches.success": "Branches successfully refreshed",
"settings.versionControl.refreshBranches.error": "Error refreshing branches",
"showMessage.cancel": "@:_reusableBaseText.cancel",
"showMessage.ok": "OK",
"showMessage.showDetails": "Show Details",

View File

@@ -162,6 +162,18 @@ async function refreshSshKey() {
toast.showError(error, locale.baseText('settings.versionControl.refreshSshKey.error.title'));
}
}
const refreshBranches = async () => {
try {
await versionControlStore.getBranches();
toast.showMessage({
title: locale.baseText('settings.versionControl.refreshBranches.success'),
type: 'success',
});
} catch (error) {
toast.showError(error, locale.baseText('settings.versionControl.refreshBranches.error'));
}
};
</script>
<template>
@@ -288,6 +300,7 @@ async function refreshSshKey() {
locale.baseText('settings.versionControl.instanceSettings')
}}</n8n-heading>
<label>{{ locale.baseText('settings.versionControl.branches') }}</label>
<div :class="$style.branchSelection">
<n8n-select
:value="versionControlStore.preferences.branchName"
class="mb-s"
@@ -302,6 +315,22 @@ async function refreshSshKey() {
:label="b"
/>
</n8n-select>
<n8n-tooltip placement="top">
<template #content>
<span>
{{ locale.baseText('settings.versionControl.refreshBranches.tooltip') }}
</span>
</template>
<n8n-button
size="small"
type="tertiary"
icon="sync"
square
:class="$style.refreshBranches"
@click="refreshBranches"
/>
</n8n-tooltip>
</div>
<n8n-checkbox
v-model="versionControlStore.preferences.branchReadOnly"
:class="$style.readOnly"
@@ -418,4 +447,14 @@ hr {
margin: 0 0 var(--spacing-xl);
border: 1px solid var(--color-foreground-light);
}
.branchSelection {
display: flex;
button.refreshBranches {
height: 36px;
width: 36px;
margin-left: var(--spacing-xs);
}
}
</style>