diff --git a/ui/acl.md b/ui/acl.md new file mode 100644 index 0000000000..080e3a450a --- /dev/null +++ b/ui/acl.md @@ -0,0 +1,6 @@ +- ACL management + - KV takes ?token=ACCESS_KEY + - There is a default token + - Allow setting a token + - store the token in local storage + - return error (notification) if the write fails diff --git a/ui/javascripts/app/mixins.js b/ui/javascripts/app/mixins.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/ui/javascripts/app/router.js b/ui/javascripts/app/router.js index e29f614f69..d3e616e103 100644 --- a/ui/javascripts/app/router.js +++ b/ui/javascripts/app/router.js @@ -1,13 +1,41 @@ window.App = Ember.Application.create({ rootElement: "#app", - currentPath: '', + currentPath: '' +}); + +Ember.Application.initializer({ + name: 'settings', initialize: function(container, application) { - console.log("initialize"); - console.log(localStorage.getItem("foobars")); + application.set('settings', App.Settings.create()); } }); +// Wrap localstorage with an ember object +App.Settings = Ember.Object.extend({ + unknownProperty: function(key) { + return localStorage[key]; + }, + + setUnknownProperty: function(key, value) { + if(Ember.isNone(value)) { + delete localStorage[key]; + } else { + localStorage[key] = value; + } + this.notifyPropertyChange(key); + return value; + }, + + clear: function() { + this.beginPropertyChanges(); + for (var i=0, l=localStorage.length; i