Disallow reset of server url (#11067)

* Don't allow server url to be reset when there is no default

* Add e2e test

* Fix e2e test
This commit is contained in:
Neil MacDougall 2024-05-22 10:16:07 +01:00 committed by GitHub
parent 3bbf0cafbc
commit 87a70c1104
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 0 deletions

View File

@ -376,4 +376,18 @@ describe('Settings', { testIsolation: 'off' }, () => {
expect(obj.kind).to.equal('Config');
});
});
// The server-url can not be reset as there is no default - so check that is the case
it('can not reset server url', { tags: ['@globalSettings', '@adminUser'] }, () => {
SettingsPagePo.navTo();
settingsPage.editSettingsByLabel('server-url');
const settingsEdit = settingsPage.editSettings('_', 'server-url');
settingsEdit.waitForPage();
settingsEdit.title().contains('Setting: server-url').should('be.visible');
settingsEdit.useDefaultButton().should('be.visible');
settingsEdit.useDefaultButton().should('be.disabled');
});
});

View File

@ -52,6 +52,12 @@ export default {
path: 'value',
rules: this.setting.ruleSet.map(({ name }) => name)
}] : [];
// Don't allow the user to reset the server URL if there is no default
// helps to ensure that a value is always set
if (isServerUrl(this.value.id) && !this.value.default) {
this.canReset = false;
}
},
computed: {