mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-09 22:24:05 -08:00
fix(editor): Show nice error when environment is not set up (#7778)
Adds a nicer error message with a link for owners who press Push to Git without having a repository connected yet.
This commit is contained in:
parent
67a88914f2
commit
5835e055d3
|
@ -7,9 +7,16 @@ export const sourceControlLicensedAndEnabledMiddleware: RequestHandler = (req, r
|
|||
const sourceControlPreferencesService = Container.get(SourceControlPreferencesService);
|
||||
if (sourceControlPreferencesService.isSourceControlLicensedAndEnabled()) {
|
||||
next();
|
||||
} else {
|
||||
if (!sourceControlPreferencesService.isSourceControlConnected()) {
|
||||
res.status(412).json({
|
||||
status: 'error',
|
||||
message: 'source_control_not_connected',
|
||||
});
|
||||
} else {
|
||||
res.status(401).json({ status: 'error', message: 'Unauthorized' });
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export const sourceControlLicensedMiddleware: RequestHandler = (req, res, next) => {
|
||||
|
|
|
@ -593,7 +593,18 @@ export default defineComponent({
|
|||
data: { eventBus: this.eventBus, status },
|
||||
});
|
||||
} catch (error) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
||||
switch (error.message) {
|
||||
case 'source_control_not_connected':
|
||||
this.showError(
|
||||
{ ...error, message: '' },
|
||||
this.$locale.baseText('settings.sourceControl.error.not.connected.title'),
|
||||
this.$locale.baseText('settings.sourceControl.error.not.connected.message'),
|
||||
);
|
||||
break;
|
||||
default:
|
||||
this.showError(error, this.$locale.baseText('error'));
|
||||
}
|
||||
} finally {
|
||||
this.stopLoading();
|
||||
}
|
||||
|
|
|
@ -1654,6 +1654,8 @@
|
|||
"settings.sourceControl.docs.setup.ssh.url": "https://docs.n8n.io/source-control-environments/setup/#step-3-set-up-a-deploy-key",
|
||||
"settings.sourceControl.docs.using.url": "https://docs.n8n.io/source-control-environments/using/",
|
||||
"settings.sourceControl.docs.using.pushPull.url": "https://docs.n8n.io/source-control-environments/using/push-pull",
|
||||
"settings.sourceControl.error.not.connected.title": "Environments have not been enabled",
|
||||
"settings.sourceControl.error.not.connected.message": "Please head over to <a href='/settings/environments'>environment settings</a> to connect a git repository first to activate this functionality.",
|
||||
"showMessage.cancel": "@:_reusableBaseText.cancel",
|
||||
"settings.auditLogs.title": "Audit Logs",
|
||||
"settings.auditLogs.actionBox.title": "Available on the Enterprise plan",
|
||||
|
|
Loading…
Reference in a new issue