minor changes from work

This commit is contained in:
lone-cloud 2015-10-26 17:09:33 -07:00
parent 99b99ab341
commit c54d9a25be
10 changed files with 23 additions and 20 deletions

View file

@ -76,7 +76,7 @@ export default Em.Component.extend({
if (status === 'success' && result.length === 1) { if (status === 'success' && result.length === 1) {
this.set('bridgeIp', result[0].internalipaddress); this.set('bridgeIp', result[0].internalipaddress);
localStorage.setItem('huegasm.bridgeIp', result[0].internalipaddress); this.get('storage').set('huegasm.bridgeIp', result[0].internalipaddress);
bridgeFindStatus = 'success'; bridgeFindStatus = 'success';
} else if (result.length > 1) { } else if (result.length > 1) {
var multipleBridgeIps = this.get('multipleBridgeIps'); var multipleBridgeIps = this.get('multipleBridgeIps');
@ -121,7 +121,7 @@ export default Em.Component.extend({
if (status === 'success') { if (status === 'success') {
if (!result[0].error) { if (!result[0].error) {
self.set('bridgeUsername', result[0].success.username); self.set('bridgeUsername', result[0].success.username);
localStorage.setItem('huegasm.bridgeUsername', result[0].success.username); this.get('storage').set('huegasm.bridgeUsername', result[0].success.username);
clearInterval(self.get('bridgePingIntervalHandle')); clearInterval(self.get('bridgePingIntervalHandle'));
self.set('bridgePingIntervalHandle', null); self.set('bridgePingIntervalHandle', null);
} }

View file

@ -59,7 +59,7 @@ export default Em.Component.extend({
} }
}); });
localStorage.setItem('huegasm.selectedGroup', groupIdSelection); this.get('storage').set('huegasm.selectedGroup', groupIdSelection);
if(!Em.isNone(groupIdSelection) && !Em.isEmpty(lights)){ if(!Em.isNone(groupIdSelection) && !Em.isEmpty(lights)){
this.set('activeLights', lights); this.set('activeLights', lights);
@ -67,7 +67,7 @@ export default Em.Component.extend({
}.observes('groupIdSelection', 'groupsArrData'), }.observes('groupIdSelection', 'groupsArrData'),
didInsertElement(){ didInsertElement(){
var selectGroup = '0', storageItem = localStorage.getItem('huegasm.selectedGroup'); var selectGroup = '0', storageItem = this.get('storage').get('huegasm.selectedGroup');
if(storageItem){ if(storageItem){
selectGroup = storageItem; selectGroup = storageItem;

View file

@ -18,15 +18,16 @@ export default Em.Component.extend({
changeTab(tabName){ changeTab(tabName){
var index = this.get('tabList').indexOf(tabName); var index = this.get('tabList').indexOf(tabName);
this.set('selectedTab', index); this.set('selectedTab', index);
localStorage.setItem('huegasm.selectedTab', index); this.get('storage').set('huegasm.selectedTab', index);
}, },
clearBridge() { clearBridge() {
delete localStorage['huegasm.bridgeUsername']; var storage = this.get('storage');
delete localStorage['huegasm.bridgeIp']; storage.remove('huegasm.bridgeUsername');
storage.remove('huegasm.bridgeIp');
location.reload(); location.reload();
}, },
clearAllSettings() { clearAllSettings() {
localStorage.clear(); this.get('storage').clear();
location.reload(); location.reload();
} }
}, },
@ -60,8 +61,8 @@ export default Em.Component.extend({
this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 1000)); this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 1000));
} }
if (localStorage.getItem('huegasm.selectedTab')) { if (this.get('storage').get('huegasm.selectedTab')) {
this.set('selectedTab', Number(localStorage.getItem('huegasm.selectedTab'))); this.set('selectedTab', Number(this.get('storage').get('huegasm.selectedTab')));
} }
}, },

View file

@ -11,7 +11,7 @@
<span data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{paper-icon icon="group" class=dimmerOnClass}}Groups <span class="caret"></span> <span data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{paper-icon icon="group" class=dimmerOnClass}}Groups <span class="caret"></span>
</span> </span>
{{groups-list lightsData=lightsData groupsData=groupsData activeLights=activeLights apiURL=apiURL updateGroupsData=updateGroupsData groupControlDisplayed=groupControlDisplayed}} {{groups-list lightsData=lightsData groupsData=groupsData activeLights=activeLights apiURL=apiURL updateGroupsData=updateGroupsData groupControlDisplayed=groupControlDisplayed storage=storage}}
</div> </div>
<div class="settingsItem"> <div class="settingsItem">

View file

@ -43,7 +43,7 @@ export default Em.Component.extend({
init(){ init(){
this._super(); this._super();
var storage = new window.Locally.Store(); var storage = new window.Locally.Store({ compress: true });
this.set('storage', storage); this.set('storage', storage);
['bridgeIp', 'bridgeUsername', 'dimmerOn'].forEach((item) => { ['bridgeIp', 'bridgeUsername', 'dimmerOn'].forEach((item) => {

View file

@ -2,7 +2,7 @@
{{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn storage=storage}} {{hue-controls bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial dimmerOn=dimmerOn storage=storage}}
{{else}} {{else}}
{{#if ready}} {{#if ready}}
{{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial}} {{bridge-finder bridgeIp=bridgeIp bridgeUsername=bridgeUsername trial=trial storage=storage}}
{{else}} {{else}}
<div class="readyBlock"> <div class="readyBlock">
<div class="title">Huegasm</div> <div class="title">Huegasm</div>

View file

@ -146,6 +146,8 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
this.send('removeAudio', playQueuePointer); this.send('removeAudio', playQueuePointer);
debugger;
if(event.target.error.code === 2){ if(event.target.error.code === 2){
this.get('notify').alert({html: this.get('failedToDecodeFileHtml')(song.fileName)}); this.get('notify').alert({html: this.get('failedToDecodeFileHtml')(song.fileName)});
} else { } else {
@ -442,7 +444,7 @@ export default Em.Component.extend(helperMixin, visualizerMixin, {
songBeatPreferences[title] = {threshold: this.get('threshold'), interval: this.get('interval'), frequency: this.get('frequency') }; songBeatPreferences[title] = {threshold: this.get('threshold'), interval: this.get('interval'), frequency: this.get('frequency') };
this.set('usingBeatPreferences', true); this.set('usingBeatPreferences', true);
this.get('storage').set('huegasm.songBeatPreferences', songBeatPreferences, { compress: true }); this.get('storage').set('huegasm.songBeatPreferences', songBeatPreferences);
}, },
loadSongBeatPreferences() { loadSongBeatPreferences() {

View file

@ -290,7 +290,7 @@ export default Em.Mixin.create({
onOptionChange: function(self, option){ onOptionChange: function(self, option){
option = option.replace('.[]', ''); option = option.replace('.[]', '');
this.get('storage').set('huegasm.' + option, this.get(option), { compress: true }); this.get('storage').set('huegasm.' + option, this.get(option));
}.observes('randomTransition', 'onBeatBriAndColor', 'playQueue.[]', 'playQueuePointer'), }.observes('randomTransition', 'onBeatBriAndColor', 'playQueue.[]', 'playQueuePointer'),
onRepeatChange: function () { onRepeatChange: function () {

View file

@ -1,7 +1,7 @@
import Em from 'ember'; import Em from 'ember';
export default Em.Mixin.create({ export default Em.Mixin.create({
currentVisName: 'Wave', currentVisName: 'None',
visNames: ['None', 'Bars', 'Wave'], visNames: ['None', 'Bars', 'Wave'],
@ -35,7 +35,7 @@ export default Em.Mixin.create({
ctx.clearRect(0, 0, w, h); ctx.clearRect(0, 0, w, h);
if (currentVisName === 'Wave') { if (currentVisName === 'Wave') {
let width = 2, let width = 1,
count = 1024, count = 1024,
gradient = ctx.createLinearGradient(0, 0, 0, 300); gradient = ctx.createLinearGradient(0, 0, 0, 300);

View file

@ -68,7 +68,7 @@ md-progress-circular[md-mode=indeterminate] .md-spinner-wrapper {
span md-icon { span md-icon {
position: relative; position: relative;
bottom: 5px; bottom: 5px;
right: 10px; right: 5px;
} }
} }
@ -158,7 +158,7 @@ md-progress-linear {
background: white; background: white;
box-shadow: 5px 10px 15px 5px rgba(0, 0, 0, 0.3); box-shadow: 5px 10px 15px 5px rgba(0, 0, 0, 0.3);
width: 175px; width: 175px;
left: -115px; left: -85px;
top: 20px; top: 20px;
border: none; border: none;
color: black; color: black;
@ -269,7 +269,7 @@ md-slider.md-default-theme .md-thumb:after {
border-radius: 0 0 5px 5px; border-radius: 0 0 5px 5px;
width: 300px; width: 300px;
top: 20px; top: 20px;
left: -240px; left: -210px;
position: absolute; position: absolute;
background-color: white; background-color: white;
max-height: 400px; max-height: 400px;