diff --git a/web/app/pods/components/bridge-finder/component.js b/web/app/pods/components/bridge-finder/component.js index 588796e..2a8fa03 100644 --- a/web/app/pods/components/bridge-finder/component.js +++ b/web/app/pods/components/bridge-finder/component.js @@ -116,7 +116,6 @@ export default Component.extend({ clearBridgePingIntervalHandle(){ clearInterval(this.get('bridgePingIntervalHandle')); - this.set('bridgePingIntervalHandle', null); }, actions: { diff --git a/web/app/pods/components/groups-list/add-group-modal/component.js b/web/app/pods/components/groups-list/add-group-modal/component.js deleted file mode 100644 index 653fd7b..0000000 --- a/web/app/pods/components/groups-list/add-group-modal/component.js +++ /dev/null @@ -1,70 +0,0 @@ -import Ember from 'ember'; - -const { - Component, - observer, - computed, - isEmpty, - isNone, - $ -} = Ember; - -export default Component.extend({ - groupName: null, - selectedLights: [], - - onIsShowingModalChange: observer('isShowingModal', function(){ - if(this.get('isShowingModal')){ - this.setProperties({ - selectedLights: [], - groupName: null - }); - } - }), - - saveDisabled: computed('groupName', 'selectedLights.[]', function(){ - return isNone(this.get('groupName')) || isEmpty(this.get('selectedLights')) || isEmpty(this.get('groupName').trim()); - }), - - didInsertElement: function() { - $(document).keypress((event) => { - if(!this.get('saveDisabled') && event.which === 13) { - this.send('save'); - } - }); - }, - - actions: { - close: function(){ - this.sendAction(); - }, - save: function(){ - let newGroupData = {"name": this.get('groupName'), "lights": this.get('selectedLights')}, - newGroupsData = this.get('groupsData'); - - $.ajax(this.get('apiURL') + '/groups', { - data: JSON.stringify(newGroupData), - contentType: 'application/json', - type: 'POST' - }); - - // crappy code to redraw the lights - newGroupsData['9999'] = newGroupData; - - this.setProperties({ - updateGroupsData: true, - groupsData: newGroupsData - }); - this.sendAction(); - }, - clickLight: function(id) { - let selectedLights = this.get('selectedLights'); - - if(selectedLights.contains(id)){ - selectedLights.removeObject(id); - } else { - selectedLights.pushObject(id); - } - } - } -}); diff --git a/web/app/pods/components/groups-list/add-group-modal/template.hbs b/web/app/pods/components/groups-list/add-group-modal/template.hbs deleted file mode 100644 index 4cc896c..0000000 --- a/web/app/pods/components/groups-list/add-group-modal/template.hbs +++ /dev/null @@ -1,12 +0,0 @@ -{{#if isShowingModal}} - {{#modal-dialog close="close" alignment="center" translucentOverlay=true}} - - {{light-group lightsData=lightsData activeLights=selectedLights action="clickLight" apiURL=apiURL noHover=true}} - - {{paper-input label="Group name" value=groupName max="32" max-errortext="The group name cannot exceed 32 characters"}} - - {{#paper-button action="close"}}Close{{/paper-button}} - {{#paper-button class="pull-right" action="save" disabled=saveDisabled primary=true}}Save{{/paper-button}} - - {{/modal-dialog}} -{{/if}} \ No newline at end of file diff --git a/web/app/pods/components/groups-list/component.js b/web/app/pods/components/groups-list/component.js deleted file mode 100644 index 5a65303..0000000 --- a/web/app/pods/components/groups-list/component.js +++ /dev/null @@ -1,86 +0,0 @@ -import Ember from 'ember'; - -const { - Component, - observer, - computed, - isEmpty, - isNone, -} = Ember; - -export default Component.extend({ - classNames: ['dropdown-menu'], - elementId: 'group-list', - tagName: null, - groupIdSelection: null, - - groupsArrData: computed('groupsData', 'groupIdSelection', function(){ - let groupsData = this.get('groupsData'), lightsData = this.get('lightsData'), groupsArrData = [], ids = [], groupIdSelection = this.get('groupIdSelection'); - - for (let key in lightsData) { - if(lightsData.hasOwnProperty(key) && lightsData[key].state.reachable){ - ids.push(key); - } - } - groupsArrData.push({name: 'All', data: {lights: ids, key: '0' }, rowClass: groupIdSelection === '0' ? 'group-row selected-row' : 'group-row', deletable: false}); - - for (let key in groupsData) { - if (groupsData.hasOwnProperty(key)) { - let rowClass = 'group-row'; - - if(key === groupIdSelection){ - rowClass += ' selected-row'; - } - - groupsArrData.push({name: groupsData[key].name, data: {lights: groupsData[key].lights, key: key}, rowClass: rowClass, deletable: true}); - } - } - - return groupsArrData; - }), - - onGroupIdSelectionChanged: observer('groupIdSelection', 'groupsArrData', function(){ - let groupIdSelection = this.get('groupIdSelection'), - lights = []; - - this.get('groupsArrData').some(function(group){ - if(group.data.key === groupIdSelection){ - lights = group.data.lights; - return true; - } - }); - - this.get('storage').set('huegasm.selectedGroup', groupIdSelection); - - if(!isNone(groupIdSelection) && !isEmpty(lights)){ - this.set('activeLights', lights); - } - }), - - didInsertElement(){ - let selectGroup = '0', - storageItem = this.get('storage').get('huegasm.selectedGroup'); - - if(storageItem){ - selectGroup = storageItem; - } - - this.set('groupIdSelection', selectGroup); - }, - - actions: { - selectGroup(selection){ - this.set('groupIdSelection', selection); - }, - toggleConfirmDeleteGroupsModal(groupName, groupId){ - this.setProperties({ - deleteGroupName: groupName, - deleteGroupId: groupId - }); - this.toggleProperty('isShowingConfirmDeleteModal'); - }, - toggleAddGroupsModal(){ - this.toggleProperty('isShowingAddGroupsModal'); - } - } -}); diff --git a/web/app/pods/components/groups-list/delete-group-modal/component.js b/web/app/pods/components/groups-list/delete-group-modal/component.js deleted file mode 100644 index c9ac9be..0000000 --- a/web/app/pods/components/groups-list/delete-group-modal/component.js +++ /dev/null @@ -1,40 +0,0 @@ -import Ember from 'ember'; - -const { - Component, - $ -} = Ember; - -export default Component.extend({ - actions: { - close: function(){ - this.sendAction(); - }, - delete: function(){ - let groupId = this.get('groupId'); - - $.ajax(this.get('apiURL') + '/groups/' + groupId, { - contentType: 'application/json', - type: 'DELETE' - }); - - let groupsData = this.get('groupsData'), newGroupsData = []; - for (let key in groupsData) { - if(groupsData.hasOwnProperty(key) && groupsData[key].name !== this.get('groupName') ){ - newGroupsData[key] = groupsData[key]; - } - } - - if(groupId === this.get('groupIdSelection')){ - this.set('groupIdSelection', '0'); - } - - this.setProperties({ - updateGroupsData: true, - groupsData: newGroupsData - }); - - this.sendAction(); - } - } -}); diff --git a/web/app/pods/components/groups-list/delete-group-modal/template.hbs b/web/app/pods/components/groups-list/delete-group-modal/template.hbs deleted file mode 100644 index 2ea092e..0000000 --- a/web/app/pods/components/groups-list/delete-group-modal/template.hbs +++ /dev/null @@ -1,10 +0,0 @@ -{{#if isShowingModal}} - {{#modal-dialog close="close" alignment="center" translucentOverlay=true}} - -

Are you sure you want to delete group "{{groupName}}"?

- - {{#paper-button action="close"}}Close{{/paper-button}} - {{#paper-button class="pull-right" action="delete" primary=true}}Delete{{/paper-button}} - - {{/modal-dialog}} -{{/if}} \ No newline at end of file diff --git a/web/app/pods/components/groups-list/template.hbs b/web/app/pods/components/groups-list/template.hbs deleted file mode 100644 index 1bf0f09..0000000 --- a/web/app/pods/components/groups-list/template.hbs +++ /dev/null @@ -1,15 +0,0 @@ -{{#paper-list}} - {{#paper-item class="new-group-row"}} -
{{paper-icon icon="group-add"}} Add a new group
- {{/paper-item}} - - {{#each groupsArrData as |group|}} - {{#paper-item class=group.rowClass}} -
{{group.name}}
{{#if group.deletable}}{{paper-icon icon="close"}}{{/if}} - {{/paper-item}} - {{/each}} -{{/paper-list}} - -{{groups-list/add-group-modal lightsData=lightsData groupsData=groupsData isShowingModal=isShowingAddGroupsModal apiURL=apiURL updateGroupsData=updateGroupsData action="toggleAddGroupsModal"}} - -{{groups-list/delete-group-modal groupName=deleteGroupName groupId=deleteGroupId groupsData=groupsData isShowingModal=isShowingConfirmDeleteModal apiURL=apiURL updateGroupsData=updateGroupsData groupIdSelection=groupIdSelection action="toggleConfirmDeleteGroupsModal"}} \ No newline at end of file diff --git a/web/app/pods/components/hue-controls/component.js b/web/app/pods/components/hue-controls/component.js index 678d60e..fc90917 100644 --- a/web/app/pods/components/hue-controls/component.js +++ b/web/app/pods/components/hue-controls/component.js @@ -2,7 +2,6 @@ import Ember from 'ember'; const { Component, - observer, computed, isEmpty, isNone, @@ -16,8 +15,6 @@ export default Component.extend({ bridgeIp: null, manualBridgeIp: null, bridgeUsername: null, - updateGroupsData: true, - groupsData: null, lightsData: null, activeLights: [], tabList: ["Lights", "Music"], @@ -28,7 +25,7 @@ export default Component.extend({ musicTabSelected: computed.equal('selectedTab', 1), dimmerOnClass: computed('dimmerOn', function(){ - return this.get('dimmerOn') ? 'dimmerOn' : null; + return this.get('dimmerOn') ? 'dimmerOn md-menu-origin' : 'md-menu-origin'; }), ready: computed('lightsData', 'trial', function() { @@ -76,7 +73,6 @@ export default Component.extend({ this._super(); if(!this.get('trial')) { - this.doUpdateGroupsData(); this.updateLightData(); this.set('lightsDataIntervalHandle', setInterval(this.updateLightData.bind(this), 2000)); } @@ -86,22 +82,6 @@ export default Component.extend({ } }, - onUpdateGroupsDataChange: observer('updateGroupsData', function(){ - if(this.get('updateGroupsData')){ - setTimeout(()=>{ this.doUpdateGroupsData(); }, 1000); - } - }), - - doUpdateGroupsData(){ - $.get(this.get('apiURL') + '/groups', (result, status)=>{ - if (status === 'success' ) { - this.set('groupsData', result); - } - }); - - this.toggleProperty('updateGroupsData'); - }, - updateLightData(){ let fail = ()=>{ clearInterval(this.get('lightsDataIntervalHandle')); @@ -155,7 +135,7 @@ export default Component.extend({ { element: '#music-tab', intro: 'This is the music player. You\'ll use this to play music and synchronize it with your active lights.

' + - 'TIP: Control which lights are active through the Lights tab or through the Groups menu dropdown.' + 'TIP: Control which lights are active through the Lights tab.' }, { element: '#playlist', @@ -196,11 +176,6 @@ export default Component.extend({ intro: 'These icons represent the hue lights in your system. Active lights will be controlled by the application while the inactive lights will have a red X over them and will not be controlled.
' + 'You may toggle a light\'s state by clicking on it.' }, - { - element: $('.settings-item')[0], - intro: 'The Groups menu allows for saving and quickly selecting groups of lights.', - position: 'left' - }, { element: $('.settings-item')[1], intro: 'A few miscellaneous settings can be found here.

' + diff --git a/web/app/pods/components/hue-controls/template.hbs b/web/app/pods/components/hue-controls/template.hbs index 75d225f..e4d2783 100644 --- a/web/app/pods/components/hue-controls/template.hbs +++ b/web/app/pods/components/hue-controls/template.hbs @@ -1,29 +1,27 @@ {{#if ready}}