Skip to content

Commit

Permalink
Also let the settings be cleared when no authentication is enabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
gashcrumb committed Nov 4, 2013
1 parent ed81b5e commit cbd983d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
4 changes: 2 additions & 2 deletions hawtio-web/src/main/webapp/app/core/html/preferences.html
Expand Up @@ -219,8 +219,8 @@
<div>
<p></p>
<p></p>
<strong>Reset All Preferences</strong>
<p>Complete wipe your settings and logs you out, returning all settings to their default state when you log back in.</p>
<strong>Reset Settings</strong>
<p>Wipe settings stored by {{branding.appName}} in your browser's local storage</p>
<button class="btn btn-danger" ng-click="doReset()">Reset to Defaults</button>
<p></p>
<p></p>
Expand Down
14 changes: 11 additions & 3 deletions hawtio-web/src/main/webapp/app/core/js/preferences.ts
@@ -1,6 +1,8 @@
module Core {

export function PreferencesController($scope, localStorage, userDetails, jolokiaUrl) {
export function PreferencesController($scope, localStorage, userDetails, jolokiaUrl, branding) {

$scope.branding = branding;

if (!angular.isDefined(localStorage['logLevel'])) {
localStorage['logLevel'] = '{"value": 2, "name": "INFO"}';
Expand Down Expand Up @@ -137,12 +139,18 @@ module Core {
console.log("logCacheSize " + $scope.logCacheSize);

$scope.doReset = () => {
logout(jolokiaUrl, userDetails, localStorage, $scope, () => {

var doReset = () => {
localStorage.clear();
setTimeout(() => {
window.location.reload();
}, 10);
});
};
if (Core.isBlank(userDetails.username) && Core.isBlank(userDetails.password)) {
doReset();
} else {
logout(jolokiaUrl, userDetails, localStorage, $scope, doReset);
}
}
}
}

0 comments on commit cbd983d

Please sign in to comment.