Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show alert/prompt when settings changes require restart (#2401)
* fix: correct 'StatusChecker' typo * feat: add restart required check to StatusChecker * fix(perms): remove MANAGE_SETTINGS permission * fix: allow alert to be dismissed * fix(lang): add missing string in SettingsServices * fix(frontend): fix modal icon border * fix(frontend): un-dismiss alert if setting reverted not require server restart * fix(backend): restart flag only needs to track main settings * fix: rebase issue * refactor: appease Prettier * refactor: swap settings badge order * fix: type import for MainSettings * test: add cypress test for restart prompt
- Loading branch information
1 parent
70dc4c4
commit f3e56da
Showing
40 changed files
with
239 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
describe('General Settings', () => { | ||
beforeEach(() => { | ||
cy.login(Cypress.env('ADMIN_EMAIL'), Cypress.env('ADMIN_PASSWORD')); | ||
}); | ||
|
||
it('opens the settings page from the home page', () => { | ||
cy.visit('/'); | ||
|
||
cy.get('[data-testid=sidebar-toggle]').click(); | ||
cy.get('[data-testid=sidebar-menu-settings-mobile]').click(); | ||
|
||
cy.get('.heading').should('contain', 'General Settings'); | ||
}); | ||
|
||
it('modifies setting that requires restart', () => { | ||
cy.visit('/settings'); | ||
|
||
cy.get('#trustProxy').click(); | ||
cy.get('form').submit(); | ||
cy.get('[data-testid=modal-title]').should( | ||
'contain', | ||
'Server Restart Required' | ||
); | ||
|
||
cy.get('[data-testid=modal-ok-button]').click(); | ||
cy.get('[data-testid=modal-title]').should('not.exist'); | ||
|
||
cy.get('[type=checkbox]#trustProxy').click(); | ||
cy.get('form').submit(); | ||
cy.get('[data-testid=modal-title]').should('not.exist'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import type { MainSettings } from '../lib/settings'; | ||
import { getSettings } from '../lib/settings'; | ||
|
||
class RestartFlag { | ||
private settings: MainSettings; | ||
|
||
public initializeSettings(settings: MainSettings): void { | ||
this.settings = { ...settings }; | ||
} | ||
|
||
public isSet(): boolean { | ||
const settings = getSettings().main; | ||
|
||
return ( | ||
this.settings.csrfProtection !== settings.csrfProtection || | ||
this.settings.trustProxy !== settings.trustProxy | ||
); | ||
} | ||
} | ||
|
||
const restartFlag = new RestartFlag(); | ||
|
||
export default restartFlag; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.