This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Working on Save node selections in browser storage #117
- node selections in the "MakeReservationDialog" can now be saved on loaded using the local storage - functionality is implemented in two button classes Still to do: - allow saving/loading multiple different configurations named by the user - allow saving/loading reservation-specific configurations - embed functionality in different contexts (e.g., flash/reset/... controls), e.g. by embedding it into the wisegui-node-table.js instead of the reservation dialog
- Loading branch information
Showing
6 changed files
with
84 additions
and
2 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
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,35 @@ | ||
/** | ||
* ################################################################# | ||
* WiseGuiNodeSelectionLoadButton | ||
* ################################################################# | ||
*/ | ||
|
||
var WiseGuiNodeSelectionLoadButton = function(setSelectionCallback) { | ||
var self = this; | ||
this.view = $('<button class="btn">Load Selection</button>'); | ||
this.view.bind('click', this, function(e) { | ||
if (!self.view.attr('disabled')) { | ||
var selections = JSON.parse(window.localStorage.getItem("wisegui.nodeselections")) || {}; | ||
setSelectionCallback(selections); | ||
} | ||
}); | ||
|
||
this.enable = function(enable) { | ||
if (enable) { | ||
self.view.removeAttr('disabled'); | ||
} else { | ||
self.view.attr('disabled', 'disabled'); | ||
} | ||
}; | ||
|
||
this.updateEnabledState = function() { | ||
var savedSelection = window.localStorage.getItem("wisegui.nodeselections"); | ||
this.enable(savedSelection != null && savedSelection !== undefined); | ||
}; | ||
|
||
$(window).bind('wisegui-nodeselection-storage-changed', function (e) { | ||
self.updateEnabledState(); | ||
}); | ||
|
||
this.updateEnabledState(); | ||
}; |
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,14 @@ | ||
/** | ||
* ################################################################# | ||
* WiseGuiNodeSelectionSaveButton | ||
* ################################################################# | ||
*/ | ||
|
||
var WiseGuiNodeSelectionSaveButton = function(getSelectionCallback) { | ||
this.view = $('<button class="btn">Save Selection</button>'); | ||
this.view.bind('click', this, function(e) { | ||
var selection = getSelectionCallback(); | ||
window.localStorage.setItem("wisegui.nodeselections", JSON.stringify(selection)); | ||
$(window).trigger('wisegui-nodeselection-storage-changed'); | ||
}); | ||
}; |
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