nutella_framework 0.4.13 → 0.4.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/VERSION +1 -1
- data/framework_components/order.json +2 -1
- data/framework_components/roomcast-bot/data/default/channels-data.json +1 -0
- data/framework_components/roomcast-bot/data/default/channels.json +1 -0
- data/framework_components/roomcast-bot/data/default/configs.json +1 -0
- data/framework_components/roomcast-bot/data/default/mapping.json +1 -0
- data/framework_components/roomcast-bot/roomcast_bot.rb +178 -0
- data/framework_components/roomcast-bot/startup +5 -0
- data/framework_components/roomcast-channel-creator/.gitignore +2 -0
- data/framework_components/roomcast-channel-creator/README.md +9 -0
- data/framework_components/roomcast-channel-creator/dist/app.js +29607 -0
- data/framework_components/roomcast-channel-creator/dist/css/font-awesome.min.css +4 -0
- data/framework_components/roomcast-channel-creator/dist/css/ionicons.min.css +11 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/FontAwesome.otf +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/fontawesome-webfont.eot +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/fontawesome-webfont.svg +565 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/fontawesome-webfont.ttf +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/fontawesome-webfont.woff +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/fontawesome-webfont.woff2 +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/ionicons.eot +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/ionicons.svg +2230 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/ionicons.ttf +0 -0
- data/framework_components/roomcast-channel-creator/dist/fonts/ionicons.woff +0 -0
- data/framework_components/roomcast-channel-creator/dist/main.css +3304 -0
- data/framework_components/roomcast-channel-creator/dist/nutella_lib.js +5068 -0
- data/framework_components/roomcast-channel-creator/gulp/config.js +51 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/browserify.js +77 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/build.js +3 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/css.js +7 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/default.js +3 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/fonts.js +7 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/less.js +16 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/mui-fonts.js +7 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/nutella.js +7 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/setWatch.js +5 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/svgs.js +7 -0
- data/framework_components/roomcast-channel-creator/gulp/tasks/watch.js +12 -0
- data/framework_components/roomcast-channel-creator/gulp/util/bundleLogger.js +21 -0
- data/framework_components/roomcast-channel-creator/gulp/util/handleErrors.js +15 -0
- data/framework_components/roomcast-channel-creator/gulpfile.js +16 -0
- data/framework_components/roomcast-channel-creator/index.html +52 -0
- data/framework_components/roomcast-channel-creator/nutella.json +6 -0
- data/framework_components/roomcast-channel-creator/package.json +37 -0
- data/framework_components/roomcast-channel-creator/src/app/app.js +22 -0
- data/framework_components/roomcast-channel-creator/src/app/components/AnimationMixin.js +44 -0
- data/framework_components/roomcast-channel-creator/src/app/components/CataloguePage.js +130 -0
- data/framework_components/roomcast-channel-creator/src/app/components/Channel.js +378 -0
- data/framework_components/roomcast-channel-creator/src/app/components/ColorCell.js +28 -0
- data/framework_components/roomcast-channel-creator/src/app/components/ColorPicker.js +53 -0
- data/framework_components/roomcast-channel-creator/src/app/components/DetailPage.js +66 -0
- data/framework_components/roomcast-channel-creator/src/app/components/NutellaMixin.js +40 -0
- data/framework_components/roomcast-channel-creator/src/app/components/PageSliderMixin.js +68 -0
- data/framework_components/roomcast-channel-creator/src/app/components/Router.js +52 -0
- data/framework_components/roomcast-channel-creator/src/app/components/TopBar.js +86 -0
- data/framework_components/roomcast-channel-creator/src/app/components/main.js +333 -0
- data/framework_components/roomcast-channel-creator/src/css/font-awesome.min.css +4 -0
- data/framework_components/roomcast-channel-creator/src/css/ionicons.min.css +11 -0
- data/framework_components/roomcast-channel-creator/src/fonts/FontAwesome.otf +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/fontawesome-webfont.eot +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/fontawesome-webfont.svg +565 -0
- data/framework_components/roomcast-channel-creator/src/fonts/fontawesome-webfont.ttf +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/fontawesome-webfont.woff +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/fontawesome-webfont.woff2 +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/ionicons.eot +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/ionicons.svg +2230 -0
- data/framework_components/roomcast-channel-creator/src/fonts/ionicons.ttf +0 -0
- data/framework_components/roomcast-channel-creator/src/fonts/ionicons.woff +0 -0
- data/framework_components/roomcast-channel-creator/src/less/main.less +500 -0
- data/framework_components/roomcast-channel-creator/src/less/my_overrides.less +14 -0
- data/framework_components/roomcast-package-creator/.gitignore +2 -0
- data/framework_components/roomcast-package-creator/README.md +9 -0
- data/framework_components/roomcast-package-creator/dist/app.js +36624 -0
- data/framework_components/roomcast-package-creator/dist/css/font-awesome.min.css +4 -0
- data/framework_components/roomcast-package-creator/dist/css/ionicons.min.css +11 -0
- data/framework_components/roomcast-package-creator/dist/fonts/FontAwesome.otf +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/fontawesome-webfont.eot +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/fontawesome-webfont.svg +565 -0
- data/framework_components/roomcast-package-creator/dist/fonts/fontawesome-webfont.ttf +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/fontawesome-webfont.woff +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/fontawesome-webfont.woff2 +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/ionicons.eot +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/ionicons.svg +2230 -0
- data/framework_components/roomcast-package-creator/dist/fonts/ionicons.ttf +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/ionicons.woff +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.eot +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.svg +14 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.ttf +0 -0
- data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.woff +0 -0
- data/framework_components/roomcast-package-creator/dist/main.css +5932 -0
- data/framework_components/roomcast-package-creator/dist/nutella_lib.js +5068 -0
- data/framework_components/roomcast-package-creator/gulp/config.js +51 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/browserify.js +77 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/build.js +3 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/css.js +7 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/default.js +3 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/fonts.js +7 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/less.js +16 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/mui-fonts.js +7 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/nutella.js +7 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/setWatch.js +5 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/svgs.js +7 -0
- data/framework_components/roomcast-package-creator/gulp/tasks/watch.js +12 -0
- data/framework_components/roomcast-package-creator/gulp/util/bundleLogger.js +21 -0
- data/framework_components/roomcast-package-creator/gulp/util/handleErrors.js +15 -0
- data/framework_components/roomcast-package-creator/gulpfile.js +16 -0
- data/framework_components/roomcast-package-creator/index.html +51 -0
- data/framework_components/roomcast-package-creator/nutella.json +6 -0
- data/framework_components/roomcast-package-creator/package.json +38 -0
- data/framework_components/roomcast-package-creator/src/app/app.js +19 -0
- data/framework_components/roomcast-package-creator/src/app/components/ButtonInteractionsMixin.js +45 -0
- data/framework_components/roomcast-package-creator/src/app/components/ChannelCard.js +87 -0
- data/framework_components/roomcast-package-creator/src/app/components/ChannelItem.js +71 -0
- data/framework_components/roomcast-package-creator/src/app/components/ChannelsCatalogue.js +64 -0
- data/framework_components/roomcast-package-creator/src/app/components/ChannelsPanel.js +127 -0
- data/framework_components/roomcast-package-creator/src/app/components/ConfigField.js +50 -0
- data/framework_components/roomcast-package-creator/src/app/components/ConfigurationsPanel.js +114 -0
- data/framework_components/roomcast-package-creator/src/app/components/ContextButton.js +37 -0
- data/framework_components/roomcast-package-creator/src/app/components/GlobalButton.js +26 -0
- data/framework_components/roomcast-package-creator/src/app/components/NutellaMixin.js +23 -0
- data/framework_components/roomcast-package-creator/src/app/components/PoolHeader.js +67 -0
- data/framework_components/roomcast-package-creator/src/app/components/PoolRow.js +160 -0
- data/framework_components/roomcast-package-creator/src/app/components/ResourceFamilyPool.js +168 -0
- data/framework_components/roomcast-package-creator/src/app/components/ResourcesPanel.js +76 -0
- data/framework_components/roomcast-package-creator/src/app/components/main.js +222 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/dialog_.jsx +66 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/drop-down-menu.jsx +163 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/enhanced-textarea.jsx +113 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/floating-action-button_.jsx +73 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/menu-item.jsx +100 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/menu.jsx +209 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/overlay.jsx +21 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/raised-button_.jsx +72 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/right-nav.jsx +108 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/drop-down-arrow.jsx +17 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/navigation-chevron-left.jsx +16 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/navigation-chevron-right.jsx +17 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/navigation-menu.jsx +16 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/svg-icon.jsx +23 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/toggle-check-box-checked.jsx +16 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/toggle-check-box-outline-blank.jsx +16 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/toggle-radio-button-off.jsx +16 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/svg-icons/toggle-radio-button-on.jsx +16 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/text-field.jsx +215 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/css-event.js +52 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/date-time.js +132 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/dom.js +71 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/events.js +34 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/key-code.js +10 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/key-line.js +13 -0
- data/framework_components/roomcast-package-creator/src/app/components/material-ui/utils/unique-id.js +7 -0
- data/framework_components/roomcast-package-creator/src/css/font-awesome.min.css +4 -0
- data/framework_components/roomcast-package-creator/src/css/ionicons.min.css +11 -0
- data/framework_components/roomcast-package-creator/src/fonts/FontAwesome.otf +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/fontawesome-webfont.eot +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/fontawesome-webfont.svg +565 -0
- data/framework_components/roomcast-package-creator/src/fonts/fontawesome-webfont.ttf +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/fontawesome-webfont.woff +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/fontawesome-webfont.woff2 +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/ionicons.eot +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/ionicons.svg +2230 -0
- data/framework_components/roomcast-package-creator/src/fonts/ionicons.ttf +0 -0
- data/framework_components/roomcast-package-creator/src/fonts/ionicons.woff +0 -0
- data/framework_components/roomcast-package-creator/src/less/drop-down-icon.less +43 -0
- data/framework_components/roomcast-package-creator/src/less/drop-down-menu.less +77 -0
- data/framework_components/roomcast-package-creator/src/less/enhanced-textarea.less +16 -0
- data/framework_components/roomcast-package-creator/src/less/main.less +491 -0
- data/framework_components/roomcast-package-creator/src/less/menu-item.less +69 -0
- data/framework_components/roomcast-package-creator/src/less/menu.less +50 -0
- data/framework_components/roomcast-package-creator/src/less/my_overrides.less +15 -0
- data/framework_components/roomcast-package-creator/src/less/svg-icon.less +11 -0
- data/framework_components/roomcast-package-creator/src/less/text-field.less +168 -0
- data/lib/commands/checkup.rb +1 -1
- data/nutella_lib/framework_net.rb +0 -1
- metadata +173 -4
@@ -0,0 +1,168 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
var PoolHeader = require('./PoolHeader');
|
3
|
+
var PoolRow = require('./PoolRow');
|
4
|
+
var Mui = require('material-ui');
|
5
|
+
var Paper = Mui.Paper;
|
6
|
+
var ButtonInteractionsMixin = require('./ButtonInteractionsMixin');
|
7
|
+
var d3 = require('d3');
|
8
|
+
|
9
|
+
var ResourceFamilyPool = React.createClass({
|
10
|
+
|
11
|
+
mixins: [ButtonInteractionsMixin],
|
12
|
+
|
13
|
+
handleAddRow: function() {
|
14
|
+
this.props.onAddRow(this.props.familyName);
|
15
|
+
},
|
16
|
+
|
17
|
+
handleSelectedChannel: function(ch) {
|
18
|
+
this.props.onSelectedChannel(ch);
|
19
|
+
},
|
20
|
+
|
21
|
+
handleRemovedAllChannels: function() {
|
22
|
+
var familyItems=[];
|
23
|
+
this.props.resourcesWithChannels.forEach(function(res) {
|
24
|
+
familyItems.push({
|
25
|
+
name: res.name,
|
26
|
+
channels: []
|
27
|
+
});
|
28
|
+
});
|
29
|
+
this.handleUpdatedFamily(familyItems);
|
30
|
+
},
|
31
|
+
|
32
|
+
handleAddedChannelToPool: function(chId) {
|
33
|
+
var self=this;
|
34
|
+
var familyItems=[];
|
35
|
+
this.props.resourcesWithChannels.forEach(function(res) {
|
36
|
+
var newChannels = self.insertNewChannel(res.channels, chId);
|
37
|
+
familyItems.push({
|
38
|
+
name: res.name,
|
39
|
+
channels: newChannels
|
40
|
+
});
|
41
|
+
});
|
42
|
+
this.handleUpdatedFamily(familyItems);
|
43
|
+
},
|
44
|
+
|
45
|
+
handleRemovedChannelFromPool: function(chId) {
|
46
|
+
var self=this;
|
47
|
+
var familyItems=[];
|
48
|
+
this.props.resourcesWithChannels.forEach(function(res) {
|
49
|
+
var newChannels = self.removeChannel(res.channels, chId);
|
50
|
+
familyItems.push({
|
51
|
+
name: res.name,
|
52
|
+
channels: newChannels
|
53
|
+
});
|
54
|
+
});
|
55
|
+
this.handleUpdatedFamily(familyItems);
|
56
|
+
},
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Handles updates at row level and pushes them upwards.
|
60
|
+
* @param resourceMapping
|
61
|
+
* @param rowIndex
|
62
|
+
*/
|
63
|
+
handleUpdatedMapping: function(resourceMapping, rowIndex) {
|
64
|
+
|
65
|
+
// create new object for single family of resources
|
66
|
+
var familyItems = [];
|
67
|
+
var added = false;
|
68
|
+
if(rowIndex != null) {
|
69
|
+
this.props.resourcesWithChannels.forEach(function(item, i) {
|
70
|
+
if(i===rowIndex) {
|
71
|
+
familyItems.push(resourceMapping);
|
72
|
+
added = true;
|
73
|
+
} else {
|
74
|
+
familyItems.push({
|
75
|
+
name: item.name,
|
76
|
+
channels: item.channels
|
77
|
+
});
|
78
|
+
}
|
79
|
+
});
|
80
|
+
} else {
|
81
|
+
// handle new empty row
|
82
|
+
if(!added) {
|
83
|
+
familyItems.push(resourceMapping);
|
84
|
+
}
|
85
|
+
}
|
86
|
+
this.handleUpdatedFamily(familyItems);
|
87
|
+
},
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Wraps the items and pushes new data upwards.
|
91
|
+
* @param familyItems
|
92
|
+
*/
|
93
|
+
handleUpdatedFamily: function(familyItems) {
|
94
|
+
var familyMapping = {
|
95
|
+
family: this.props.familyName,
|
96
|
+
items: familyItems
|
97
|
+
};
|
98
|
+
this.props.onUpdatedMapping(familyMapping);
|
99
|
+
},
|
100
|
+
|
101
|
+
handleDeleteRow: function(rowIndex) {
|
102
|
+
var familyItems = [];
|
103
|
+
this.props.resourcesWithChannels.forEach(function(item, i) {
|
104
|
+
if(i!==rowIndex) {
|
105
|
+
familyItems.push(item)
|
106
|
+
}
|
107
|
+
});
|
108
|
+
this.handleUpdatedFamily(familyItems);
|
109
|
+
},
|
110
|
+
|
111
|
+
render: function() {
|
112
|
+
|
113
|
+
var self=this;
|
114
|
+
var rows=[];
|
115
|
+
var i = 0;
|
116
|
+
this.props.resourcesWithChannels.forEach(function(resource, k) {
|
117
|
+
rows.push(<PoolRow
|
118
|
+
key={k}
|
119
|
+
mapping={self.props.mapping}
|
120
|
+
resourceWithChannels={resource}
|
121
|
+
channels={self.props.channels}
|
122
|
+
selectedChannel={self.props.selectedChannel}
|
123
|
+
onSelectedChannel={self.handleSelectedChannel}
|
124
|
+
onUpdatedMapping={self.handleUpdatedMapping}
|
125
|
+
onDeleteRow={self.handleDeleteRow}
|
126
|
+
rowIndex={i} />
|
127
|
+
);
|
128
|
+
i++;
|
129
|
+
});
|
130
|
+
|
131
|
+
return (
|
132
|
+
|
133
|
+
<div className="resource-family-pool">
|
134
|
+
|
135
|
+
<Paper>
|
136
|
+
|
137
|
+
<table>
|
138
|
+
|
139
|
+
<thead>
|
140
|
+
|
141
|
+
<PoolHeader familyName={this.props.familyName}
|
142
|
+
selectedChannel={self.props.selectedChannel}
|
143
|
+
onRemovedAllChannels={this.handleRemovedAllChannels}
|
144
|
+
onAddedChannelToPool={this.handleAddedChannelToPool}
|
145
|
+
onRemovedChannelFromPool={this.handleRemovedChannelFromPool} />
|
146
|
+
|
147
|
+
</thead>
|
148
|
+
|
149
|
+
<tbody>
|
150
|
+
|
151
|
+
{rows}
|
152
|
+
<tr className='pool-row pool-add-row' ref={this.props.familyName + 'pool'} onTouchTap={this.handleAddRow}> <td colSpan='4'> Add Row </td> </tr>
|
153
|
+
|
154
|
+
</tbody>
|
155
|
+
|
156
|
+
</table>
|
157
|
+
|
158
|
+
</Paper>
|
159
|
+
|
160
|
+
|
161
|
+
</div> );
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
});
|
166
|
+
|
167
|
+
module.exports = ResourceFamilyPool;
|
168
|
+
|
@@ -0,0 +1,76 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
var ResourceFamilyPool = require('./ResourceFamilyPool');
|
3
|
+
var ConfigurationsPanel = require('./ConfigurationsPanel');
|
4
|
+
|
5
|
+
var ResourcesPanel = React.createClass({
|
6
|
+
|
7
|
+
handleSelectedChannel: function(ch) {
|
8
|
+
this.props.onSelectedChannel(ch);
|
9
|
+
},
|
10
|
+
|
11
|
+
handleUpdatedMapping: function(familyMapping) {
|
12
|
+
|
13
|
+
// create new object to update complete data structure (RESOURCES)
|
14
|
+
var mapping = [];
|
15
|
+
this.props.mapping.forEach(function(family) {
|
16
|
+
if(family.family===familyMapping.family) {
|
17
|
+
mapping.push(familyMapping);
|
18
|
+
} else {
|
19
|
+
mapping.push({
|
20
|
+
family: family.family,
|
21
|
+
items: family.items
|
22
|
+
});
|
23
|
+
}
|
24
|
+
});
|
25
|
+
|
26
|
+
this.props.onUpdatedMapping(mapping);
|
27
|
+
},
|
28
|
+
|
29
|
+
handleAddRow: function(family) {
|
30
|
+
this.props.onAddRow(family);
|
31
|
+
},
|
32
|
+
|
33
|
+
handleUpdateConfigName: function(id, value) {
|
34
|
+
this.props.onUpdateConfigName(id, value);
|
35
|
+
},
|
36
|
+
|
37
|
+
render: function(){
|
38
|
+
|
39
|
+
var {...other} = this.props;
|
40
|
+
|
41
|
+
var self=this;
|
42
|
+
var pools = [];
|
43
|
+
var channels = this.props.channels;
|
44
|
+
this.props.mapping.forEach(function(family, i) {
|
45
|
+
pools.push(<ResourceFamilyPool
|
46
|
+
key={i}
|
47
|
+
mapping={self.props.mapping}
|
48
|
+
familyName={family.family}
|
49
|
+
resourcesWithChannels={family.items}
|
50
|
+
channels={channels}
|
51
|
+
selectedChannel={self.props.selectedChannel}
|
52
|
+
onSelectedChannel={self.handleSelectedChannel}
|
53
|
+
onUpdatedMapping={self.handleUpdatedMapping}
|
54
|
+
onAddRow={self.handleAddRow} />
|
55
|
+
);
|
56
|
+
});
|
57
|
+
|
58
|
+
return (
|
59
|
+
<div className="resources-panel">
|
60
|
+
|
61
|
+
<ConfigurationsPanel
|
62
|
+
configs={this.props.configs}
|
63
|
+
onChangeConfig={this.props.onChangeConfig}
|
64
|
+
onDeleteConfig={this.props.onDeleteConfig}
|
65
|
+
onAddEmptyConfig={this.props.onAddEmptyConfig}
|
66
|
+
onUpdateConfigName={this.handleUpdateConfigName} />
|
67
|
+
|
68
|
+
{pools}
|
69
|
+
|
70
|
+
</div> );
|
71
|
+
}
|
72
|
+
|
73
|
+
});
|
74
|
+
|
75
|
+
module.exports = ResourcesPanel;
|
76
|
+
|
@@ -0,0 +1,222 @@
|
|
1
|
+
var React = require('react'),
|
2
|
+
mui = require('material-ui'),
|
3
|
+
RaisedButton = mui.RaisedButton;
|
4
|
+
|
5
|
+
var ResourcesPanel = require('./ResourcesPanel.js');
|
6
|
+
var ChannelsPanel = require('./ChannelsPanel');
|
7
|
+
|
8
|
+
var Main = React.createClass({
|
9
|
+
|
10
|
+
componentDidMount: function() {
|
11
|
+
var self = this;
|
12
|
+
|
13
|
+
// Get current channels catalogue
|
14
|
+
nutella.net.request('channels/retrieve', 'all', function (response) {
|
15
|
+
self.handleUpdatedChannelsCatalogue(response);
|
16
|
+
self.nutellaRequestConfigs();
|
17
|
+
|
18
|
+
nutella.net.subscribe('channels/updated', function (message, from) {
|
19
|
+
self.handleUpdatedChannelsCatalogue(message);
|
20
|
+
});
|
21
|
+
|
22
|
+
});
|
23
|
+
|
24
|
+
// TODO subscribe to changed configs
|
25
|
+
|
26
|
+
},
|
27
|
+
|
28
|
+
/**
|
29
|
+
* @state selectedChannel: the current selected channel from UI
|
30
|
+
* @state configs: the list of configurations fetched from server
|
31
|
+
* @state currentConfig: the current selected configuration, also called 'mapping'
|
32
|
+
* @state channelsCatalogue: the list of available channels fetched from server
|
33
|
+
*/
|
34
|
+
getInitialState: function() {
|
35
|
+
return {
|
36
|
+
selectedChannel: null,
|
37
|
+
configs: [],
|
38
|
+
currentConfigId: null,
|
39
|
+
currentConfig: [],
|
40
|
+
channelsCatalogue: {}
|
41
|
+
};
|
42
|
+
},
|
43
|
+
|
44
|
+
nutellaRequestConfigs: function() {
|
45
|
+
var self = this;
|
46
|
+
nutella.net.request('configs/retrieve', 'all', function(response) {
|
47
|
+
self.handleUpdatedConfigs(response);
|
48
|
+
self.handleUpdatedCurrentConfigId(+Object.keys(response)[Object.keys(response).length - 1]);
|
49
|
+
self.handleUpdatedCurrentConfig(response[Object.keys(response)[Object.keys(response).length - 1]].mapping)
|
50
|
+
});
|
51
|
+
},
|
52
|
+
|
53
|
+
handleSelection: function(selectedChannel) {
|
54
|
+
this.setState({
|
55
|
+
selectedChannel: selectedChannel
|
56
|
+
});
|
57
|
+
},
|
58
|
+
|
59
|
+
handleUpdatedConfigs: function(configs, publish) {
|
60
|
+
var self = this;
|
61
|
+
var callback = function() {
|
62
|
+
if(publish) {
|
63
|
+
nutella.net.publish('configs/update', self.state.configs);
|
64
|
+
}
|
65
|
+
};
|
66
|
+
this.setState({
|
67
|
+
configs: configs
|
68
|
+
}, callback());
|
69
|
+
},
|
70
|
+
|
71
|
+
handleUpdatedCurrentConfigId: function(id) {
|
72
|
+
this.setState({
|
73
|
+
currentConfigId: id
|
74
|
+
});
|
75
|
+
},
|
76
|
+
|
77
|
+
handleUpdatedCurrentConfig: function(config) {
|
78
|
+
this.setState({
|
79
|
+
currentConfig: config
|
80
|
+
});
|
81
|
+
},
|
82
|
+
|
83
|
+
handleUpdatedChannelsCatalogue: function(cat) {
|
84
|
+
this.setState({
|
85
|
+
channelsCatalogue: cat
|
86
|
+
});
|
87
|
+
},
|
88
|
+
|
89
|
+
handleSaveChanges: function() {
|
90
|
+
var publish = true;
|
91
|
+
this.saveLocalConfigs(publish);
|
92
|
+
},
|
93
|
+
|
94
|
+
handleUndoChanges: function() {
|
95
|
+
this.nutellaRequestConfigs();
|
96
|
+
},
|
97
|
+
|
98
|
+
handleAddRow: function(family) {
|
99
|
+
var mapping = this.state.currentConfig;
|
100
|
+
var newMapping = [];
|
101
|
+
mapping.forEach(function(f) {
|
102
|
+
if(f.family === family) {
|
103
|
+
f.items.push({name:'', channels:[]});
|
104
|
+
}
|
105
|
+
newMapping.push(f);
|
106
|
+
});
|
107
|
+
this.handleUpdatedCurrentConfig(newMapping);
|
108
|
+
},
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Synchronizes the local copy of the current mapping with the shared state configs
|
112
|
+
* @param publish true if you also want to save the changes to the server
|
113
|
+
*/
|
114
|
+
saveLocalConfigs: function(publish) {
|
115
|
+
var configs = this.state.configs;
|
116
|
+
configs[this.state.currentConfigId].mapping = this.state.currentConfig;
|
117
|
+
if (publish) {
|
118
|
+
this.handleUpdatedConfigs(configs, publish);
|
119
|
+
} else {
|
120
|
+
this.handleUpdatedConfigs(configs);
|
121
|
+
}
|
122
|
+
},
|
123
|
+
|
124
|
+
handleChangeConfig: function(configId) {
|
125
|
+
|
126
|
+
// update local configs copy
|
127
|
+
this.saveLocalConfigs();
|
128
|
+
|
129
|
+
// update current local configuration to selected one
|
130
|
+
this.handleUpdatedCurrentConfigId(configId);
|
131
|
+
this.handleUpdatedCurrentConfig(this.state.configs[configId].mapping)
|
132
|
+
},
|
133
|
+
|
134
|
+
handleDeleteConfig: function(configId) {
|
135
|
+
var configs = this.state.configs;
|
136
|
+
delete configs[configId];
|
137
|
+
this.handleUpdatedConfigs(configs);
|
138
|
+
},
|
139
|
+
|
140
|
+
handleAddEmptyConfig: function(configName) {
|
141
|
+
var configs = this.state.configs;
|
142
|
+
var newConfigId = 1;
|
143
|
+
|
144
|
+
// Find max id
|
145
|
+
if(configs.length !== 0) {
|
146
|
+
var ids = [];
|
147
|
+
for (var c in configs) {
|
148
|
+
if (configs.hasOwnProperty(c)) {
|
149
|
+
ids.push(+c);
|
150
|
+
}
|
151
|
+
}
|
152
|
+
newConfigId = Math.max.apply(null, ids) + 1;
|
153
|
+
}
|
154
|
+
|
155
|
+
// Save current config
|
156
|
+
this.saveLocalConfigs();
|
157
|
+
|
158
|
+
// Add new config
|
159
|
+
configs[newConfigId] = {
|
160
|
+
"name": configName,
|
161
|
+
"mapping": [{
|
162
|
+
"family": "iPad",
|
163
|
+
"items": [{
|
164
|
+
"name": "",
|
165
|
+
"channels": []
|
166
|
+
}]
|
167
|
+
}, {
|
168
|
+
"family": "Mac",
|
169
|
+
"items": [{
|
170
|
+
"name": "",
|
171
|
+
"channels": []
|
172
|
+
}]
|
173
|
+
}]
|
174
|
+
};
|
175
|
+
this.handleUpdatedConfigs(configs);
|
176
|
+
|
177
|
+
console.log('new assigned id', newConfigId);
|
178
|
+
|
179
|
+
// Update current local configuration to selected one
|
180
|
+
this.handleUpdatedCurrentConfigId(newConfigId);
|
181
|
+
this.handleUpdatedCurrentConfig(this.state.configs[newConfigId].mapping)
|
182
|
+
},
|
183
|
+
|
184
|
+
handleUpdateConfigName: function(id, value) {
|
185
|
+
var configs = this.state.configs;
|
186
|
+
configs[id].name = value;
|
187
|
+
this.handleUpdatedConfigs(configs);
|
188
|
+
},
|
189
|
+
|
190
|
+
render: function () {
|
191
|
+
|
192
|
+
return (
|
193
|
+
<div className='outer-div'>
|
194
|
+
|
195
|
+
<ResourcesPanel
|
196
|
+
configs={this.state.configs}
|
197
|
+
mapping={this.state.currentConfig}
|
198
|
+
onUpdatedMapping={this.handleUpdatedCurrentConfig}
|
199
|
+
channels={this.state.channelsCatalogue}
|
200
|
+
selectedChannel={this.state.selectedChannel}
|
201
|
+
onSelectedChannel={this.handleSelection}
|
202
|
+
onAddRow={this.handleAddRow}
|
203
|
+
onChangeConfig={this.handleChangeConfig}
|
204
|
+
onDeleteConfig={this.handleDeleteConfig}
|
205
|
+
onAddEmptyConfig={this.handleAddEmptyConfig}
|
206
|
+
onUpdateConfigName={this.handleUpdateConfigName} />
|
207
|
+
|
208
|
+
<ChannelsPanel
|
209
|
+
ref={'channelsPanel'}
|
210
|
+
channels={this.state.channelsCatalogue}
|
211
|
+
selectedChannel={this.state.selectedChannel}
|
212
|
+
onSelectedChannel={this.handleSelection}
|
213
|
+
onSaveChanges={this.handleSaveChanges}
|
214
|
+
onUndoChanges={this.handleUndoChanges} />
|
215
|
+
|
216
|
+
</div>
|
217
|
+
);
|
218
|
+
}
|
219
|
+
|
220
|
+
});
|
221
|
+
|
222
|
+
module.exports = Main;
|
@@ -0,0 +1,66 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
var Classable = require('../../../../node_modules/material-ui/src/js/mixins/classable');
|
3
|
+
var DialogWindow = require('../../../../node_modules/material-ui/src/js/dialog-window.jsx');
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Version extracted from website.
|
7
|
+
* @type {*|Function}
|
8
|
+
* @private
|
9
|
+
*/
|
10
|
+
var Dialog_ = React.createClass({
|
11
|
+
|
12
|
+
displayName: "Dialog",
|
13
|
+
|
14
|
+
mixins: [Classable],
|
15
|
+
|
16
|
+
propTypes: {
|
17
|
+
title: React.PropTypes.string
|
18
|
+
},
|
19
|
+
|
20
|
+
render: function() {
|
21
|
+
|
22
|
+
var $__0 = this.props,
|
23
|
+
className = $__0.className,
|
24
|
+
title = $__0.title,
|
25
|
+
other = (function(source, exclusion) {
|
26
|
+
var rest = {};
|
27
|
+
var hasOwn = Object.prototype.hasOwnProperty;
|
28
|
+
if (source == null) {
|
29
|
+
throw new TypeError();
|
30
|
+
}
|
31
|
+
for (var key in source) {
|
32
|
+
if (hasOwn.call(source, key) && !hasOwn.call(exclusion, key)) {
|
33
|
+
rest[key] = source[key];
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return rest;
|
37
|
+
}) ($__0, {className:1, title:1});
|
38
|
+
|
39
|
+
var classes = this.getClasses('mui-dialog');
|
40
|
+
|
41
|
+
return (
|
42
|
+
React.createElement(DialogWindow, React.__spread({},
|
43
|
+
other,
|
44
|
+
{ref: "dialogWindow",
|
45
|
+
className: classes}),
|
46
|
+
|
47
|
+
//React.createElement("h3", {className: "mui-dialog-title"}, this.props.title),
|
48
|
+
React.createElement("div", {ref: "dialogContent", className: "mui-dialog-content"},
|
49
|
+
this.props.children
|
50
|
+
)
|
51
|
+
|
52
|
+
)
|
53
|
+
);
|
54
|
+
},
|
55
|
+
|
56
|
+
dismiss: function() {
|
57
|
+
this.refs.dialogWindow.dismiss();
|
58
|
+
},
|
59
|
+
|
60
|
+
show: function() {
|
61
|
+
this.refs.dialogWindow.show();
|
62
|
+
}
|
63
|
+
|
64
|
+
});
|
65
|
+
|
66
|
+
module.exports = Dialog_;
|
data/framework_components/roomcast-package-creator/src/app/components/material-ui/drop-down-menu.jsx
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
var React = require('react');
|
2
|
+
var Mui = require('material-ui');
|
3
|
+
var Paper = Mui.Paper;
|
4
|
+
var Menu = require('./menu.jsx');
|
5
|
+
var DropDownArrow = require('./svg-icons/drop-down-arrow.jsx');
|
6
|
+
var ClickAwayable = require('../../../../node_modules/material-ui/src/js/mixins/click-awayable');
|
7
|
+
|
8
|
+
var DropDownMenu = React.createClass({
|
9
|
+
|
10
|
+
mixins: [ClickAwayable],
|
11
|
+
|
12
|
+
propTypes: {
|
13
|
+
autoWidth: React.PropTypes.bool,
|
14
|
+
onChange: React.PropTypes.func,
|
15
|
+
menuItems: React.PropTypes.array.isRequired
|
16
|
+
},
|
17
|
+
|
18
|
+
getDefaultProps: function() {
|
19
|
+
return {
|
20
|
+
autoWidth: true
|
21
|
+
};
|
22
|
+
},
|
23
|
+
|
24
|
+
getInitialState: function() {
|
25
|
+
return {
|
26
|
+
open: false,
|
27
|
+
selectedIndex: this.props.selectedIndex || 0
|
28
|
+
}
|
29
|
+
},
|
30
|
+
|
31
|
+
componentClickAway: function() {
|
32
|
+
this.setState({ open: false });
|
33
|
+
},
|
34
|
+
|
35
|
+
componentDidMount: function() {
|
36
|
+
if (this.props.autoWidth) this._setWidth();
|
37
|
+
this._setWidth();
|
38
|
+
},
|
39
|
+
|
40
|
+
componentWillReceiveProps: function(nextProps) {
|
41
|
+
if (nextProps.hasOwnProperty('selectedIndex')) {
|
42
|
+
this.setState({selectedIndex: nextProps.selectedIndex});
|
43
|
+
}
|
44
|
+
},
|
45
|
+
|
46
|
+
render: function() {
|
47
|
+
|
48
|
+
var classes = 'mui-drop-down-menu';
|
49
|
+
if(this.state.open) {
|
50
|
+
classes += ' mui-open';
|
51
|
+
}
|
52
|
+
|
53
|
+
//console.log('selected:', this.state.selectedIndex, this.props.menuItems); // TODO check performance
|
54
|
+
|
55
|
+
return (
|
56
|
+
<div className={classes}>
|
57
|
+
<div className="mui-menu-control" onClick={this._onControlClick}>
|
58
|
+
<Paper className="mui-menu-control-bg" zDepth={0} />
|
59
|
+
<div className="mui-menu-label">
|
60
|
+
{this.props.menuItems[this.state.selectedIndex].text}
|
61
|
+
</div>
|
62
|
+
<DropDownArrow className="mui-menu-drop-down-icon" />
|
63
|
+
<div className="mui-menu-control-underline" />
|
64
|
+
</div>
|
65
|
+
<Menu
|
66
|
+
ref="menu"
|
67
|
+
autoWidth={this.props.autoWidth}
|
68
|
+
selectedIndex={this.state.selectedIndex}
|
69
|
+
menuItems={this.props.menuItems}
|
70
|
+
hideable={true}
|
71
|
+
visible={this.state.open}
|
72
|
+
configMenu={this.props.configMenu}
|
73
|
+
onItemTap={this._onMenuItemClick}
|
74
|
+
onInputChange={this.handleInputChange} />
|
75
|
+
</div>
|
76
|
+
);
|
77
|
+
},
|
78
|
+
|
79
|
+
handleInputChange: function(id, value) {
|
80
|
+
this.props.onInputChange(id, value);
|
81
|
+
},
|
82
|
+
|
83
|
+
_setWidth: function() {
|
84
|
+
var el = this.getDOMNode(),
|
85
|
+
menuItemsDom = this.refs.menu.getDOMNode();
|
86
|
+
|
87
|
+
el.style.width = menuItemsDom.offsetWidth + 'px';
|
88
|
+
},
|
89
|
+
|
90
|
+
_onControlClick: function(e) {
|
91
|
+
this.setState({ open: !this.state.open });
|
92
|
+
},
|
93
|
+
|
94
|
+
_onMenuItemClick: function(e, key, payload, action) {
|
95
|
+
|
96
|
+
if(action === 'change') {
|
97
|
+
|
98
|
+
if (this.props.onChange && this.state.selectedIndex !== key) this.props.onChange(e, null, payload);
|
99
|
+
this.setState({
|
100
|
+
selectedIndex: key,
|
101
|
+
open: false
|
102
|
+
});
|
103
|
+
|
104
|
+
} else {
|
105
|
+
|
106
|
+
if(action === 'delete') {
|
107
|
+
|
108
|
+
var nextKey, nextConfigId;
|
109
|
+
var currentIndex = this.state.selectedIndex;
|
110
|
+
|
111
|
+
if(currentIndex !== key) {
|
112
|
+
|
113
|
+
// We're not deleting the current selected item, just delete
|
114
|
+
var newIndex = key < currentIndex ? currentIndex - 1 : currentIndex;
|
115
|
+
this.setState({
|
116
|
+
selectedIndex: newIndex
|
117
|
+
});
|
118
|
+
|
119
|
+
} else {
|
120
|
+
|
121
|
+
// If it's the last actual menu item
|
122
|
+
if(key === this.props.menuItems.length - 2) {
|
123
|
+
nextKey = key - 1;
|
124
|
+
nextConfigId = nextKey;
|
125
|
+
} else {
|
126
|
+
nextKey = key;
|
127
|
+
nextConfigId = nextKey + 1;
|
128
|
+
}
|
129
|
+
|
130
|
+
// Update menu selected item
|
131
|
+
this.setState({
|
132
|
+
selectedIndex: nextKey
|
133
|
+
});
|
134
|
+
|
135
|
+
// Update actual shown configuration
|
136
|
+
if (this.props.onChange) this.props.onChange(e, null, this.props.menuItems[nextConfigId]);
|
137
|
+
|
138
|
+
}
|
139
|
+
|
140
|
+
// Apply actual deletion
|
141
|
+
this.props.onDeleteConfig(payload);
|
142
|
+
|
143
|
+
} else {
|
144
|
+
|
145
|
+
if(action === 'add') {
|
146
|
+
|
147
|
+
// Update menu selected item
|
148
|
+
this.setState({
|
149
|
+
selectedIndex: 0
|
150
|
+
});
|
151
|
+
|
152
|
+
console.log(this.refs.menu);
|
153
|
+
this.props.onAddEmptyConfig(this.refs.menu.refs['configField_true'].getValue());
|
154
|
+
|
155
|
+
}
|
156
|
+
}
|
157
|
+
}
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
});
|
162
|
+
|
163
|
+
module.exports = DropDownMenu;
|