nutella_framework 0.6.6 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/framework_components/roomcast-main-app/.gitignore +2 -0
  4. data/framework_components/roomcast-main-app/README.md +9 -0
  5. data/framework_components/roomcast-main-app/dist/LICENSE +21 -0
  6. data/framework_components/roomcast-main-app/dist/app.js +54280 -0
  7. data/framework_components/roomcast-main-app/dist/assets/Logo.png +0 -0
  8. data/framework_components/roomcast-main-app/dist/assets/Logo_alpha.png +0 -0
  9. data/framework_components/roomcast-main-app/dist/assets/Logo_grid.svg +216 -0
  10. data/framework_components/roomcast-main-app/dist/css/ionicons.min.css +11 -0
  11. data/framework_components/roomcast-main-app/dist/fonts/ionicons.eot +0 -0
  12. data/framework_components/roomcast-main-app/dist/fonts/ionicons.svg +2230 -0
  13. data/framework_components/roomcast-main-app/dist/fonts/ionicons.ttf +0 -0
  14. data/framework_components/roomcast-main-app/dist/fonts/ionicons.woff +0 -0
  15. data/framework_components/roomcast-main-app/dist/main.css +3227 -0
  16. data/framework_components/roomcast-main-app/gulp/config.js +47 -0
  17. data/framework_components/roomcast-main-app/gulp/tasks/browserify.js +77 -0
  18. data/framework_components/roomcast-main-app/gulp/tasks/build.js +3 -0
  19. data/framework_components/roomcast-main-app/gulp/tasks/css.js +7 -0
  20. data/framework_components/roomcast-main-app/gulp/tasks/default.js +3 -0
  21. data/framework_components/roomcast-main-app/gulp/tasks/fonts.js +7 -0
  22. data/framework_components/roomcast-main-app/gulp/tasks/less.js +16 -0
  23. data/framework_components/roomcast-main-app/gulp/tasks/markup.js +7 -0
  24. data/framework_components/roomcast-main-app/gulp/tasks/setWatch.js +5 -0
  25. data/framework_components/roomcast-main-app/gulp/tasks/svgs.js +7 -0
  26. data/framework_components/roomcast-main-app/gulp/tasks/watch.js +12 -0
  27. data/framework_components/roomcast-main-app/gulp/util/bundleLogger.js +21 -0
  28. data/framework_components/roomcast-main-app/gulp/util/handleErrors.js +15 -0
  29. data/framework_components/roomcast-main-app/gulpfile.js +16 -0
  30. data/framework_components/roomcast-main-app/index.html +38 -0
  31. data/framework_components/roomcast-main-app/nutella.json +6 -0
  32. data/framework_components/roomcast-main-app/package.json +47 -0
  33. data/framework_components/roomcast-main-app/src/app/app.js +15 -0
  34. data/framework_components/roomcast-main-app/src/app/components/app/Channel.js +72 -0
  35. data/framework_components/roomcast-main-app/src/app/components/app/NutellaMixin.js +23 -0
  36. data/framework_components/roomcast-main-app/src/app/components/app/Player.js +129 -0
  37. data/framework_components/roomcast-main-app/src/app/components/app/iOSMixin.js +22 -0
  38. data/framework_components/roomcast-main-app/src/app/components/app/main.js +519 -0
  39. data/framework_components/roomcast-main-app/src/app/components/app/material-ui/menu-item.jsx +79 -0
  40. data/framework_components/roomcast-main-app/src/app/components/app/material-ui/menu.jsx +177 -0
  41. data/framework_components/roomcast-main-app/src/app/components/app/material-ui/overlay.jsx +21 -0
  42. data/framework_components/roomcast-main-app/src/app/components/app/material-ui/right-nav.jsx +108 -0
  43. data/framework_components/roomcast-main-app/src/app/components/identity-selector/IdentitiesGrid.js +91 -0
  44. data/framework_components/roomcast-main-app/src/app/components/identity-selector/IdentityCard.js +86 -0
  45. data/framework_components/roomcast-main-app/src/app/components/identity-selector/iOSMixin.js +19 -0
  46. data/framework_components/roomcast-main-app/src/app/components/identity-selector/main.js +105 -0
  47. data/framework_components/roomcast-main-app/src/app/components/login/AppIdPage.js +97 -0
  48. data/framework_components/roomcast-main-app/src/app/components/login/BrokerPage.js +139 -0
  49. data/framework_components/roomcast-main-app/src/app/components/login/IdentitiesGrid.js +93 -0
  50. data/framework_components/roomcast-main-app/src/app/components/login/IdentityCard.js +99 -0
  51. data/framework_components/roomcast-main-app/src/app/components/login/RunIdPage.js +78 -0
  52. data/framework_components/roomcast-main-app/src/app/components/login/iOSMixin.js +23 -0
  53. data/framework_components/roomcast-main-app/src/app/components/login/main.js +121 -0
  54. data/framework_components/roomcast-main-app/src/app/components/main.js +64 -0
  55. data/framework_components/roomcast-main-app/src/less/main.less +364 -0
  56. data/framework_components/roomcast-main-app/src/less/my_overrides.less +39 -0
  57. data/framework_components/roomcast-main-app/src/less/right-nav.less +31 -0
  58. data/framework_components/roomcast-package-creator/dist/app.js +17830 -3473
  59. data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.eot +0 -0
  60. data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.svg +0 -0
  61. data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.ttf +0 -0
  62. data/framework_components/roomcast-package-creator/dist/fonts/material-ui-icons.woff +0 -0
  63. data/framework_components/roomcast-package-creator/dist/main.css +2 -1
  64. data/framework_components/roomcast-package-creator/dist/nutella_lib.js +4110 -4050
  65. data/framework_components/roomcast-package-creator/index.html +0 -13
  66. data/framework_components/roomcast-package-creator/package.json +33 -32
  67. data/framework_components/roomcast-package-creator/src/app/app.js +14 -4
  68. data/framework_components/roomcast-package-creator/src/app/components/ChannelCard.js +14 -1
  69. data/framework_components/roomcast-package-creator/src/app/components/main.js +0 -4
  70. data/framework_components/roomcast-package-creator/src/less/main.less +1 -0
  71. metadata +57 -2
@@ -0,0 +1,177 @@
1
+ var React = require('react');
2
+ var Mui = require('material-ui');
3
+ var Paper = Mui.Paper;
4
+ var Dom = require('../../../../../node_modules/material-ui/lib/js/utils/dom');
5
+ var KeyLine = require('../../../../../node_modules/material-ui/lib/js/utils/key-line');
6
+ var MenuItem = require('./menu-item.jsx');
7
+ var RaisedButton = Mui.RaisedButton;
8
+
9
+ var Menu = React.createClass({
10
+
11
+ propTypes: {
12
+ autoWidth: React.PropTypes.bool,
13
+ onItemTap: React.PropTypes.func,
14
+ onItemClick: React.PropTypes.func,
15
+ onToggleClick: React.PropTypes.func,
16
+ menuItems: React.PropTypes.array.isRequired,
17
+ selectedIndex: React.PropTypes.number,
18
+ hideable: React.PropTypes.bool,
19
+ visible: React.PropTypes.bool,
20
+ zDepth: React.PropTypes.number
21
+ },
22
+
23
+ getInitialState: function() {
24
+ return { nestedMenuShown: false }
25
+ },
26
+
27
+ getDefaultProps: function() {
28
+ return {
29
+ autoWidth: true,
30
+ hideable: false,
31
+ visible: true,
32
+ zDepth: 1
33
+ };
34
+ },
35
+
36
+ componentDidMount: function() {
37
+ var el = this.getDOMNode();
38
+
39
+ //Set the menu with
40
+ this._setKeyWidth(el);
41
+
42
+ //Save the initial menu height for later
43
+ this._initialMenuHeight = el.offsetHeight + KeyLine.Desktop.GUTTER_LESS;
44
+
45
+ //Show or Hide the menu according to visibility
46
+ this._renderVisibility();
47
+ },
48
+
49
+ componentDidUpdate: function(prevProps, prevState) {
50
+ if (this.props.visible !== prevProps.visible) this._renderVisibility();
51
+ },
52
+
53
+ render: function() {
54
+ var classes = 'mui-menu';
55
+ if(this.props.hideable) {
56
+ classes += ' mui-menu-hideable';
57
+ }
58
+ if(this.props.visible) {
59
+ classes += ' mui-visible';
60
+ }
61
+
62
+ return (
63
+ <Paper ref="paperContainer" zDepth={this.props.zDepth} className={classes}>
64
+ {this._getChildren()}
65
+ </Paper>
66
+ );
67
+ },
68
+
69
+ _getChildren: function() {
70
+ var children = [],
71
+ menuItem,
72
+ itemComponent,
73
+ isSelected;
74
+
75
+ //This array is used to keep track of all nested menu refs
76
+ this._nestedChildren = [];
77
+
78
+ for (var i=0; i < this.props.menuItems.length; i++) {
79
+ menuItem = this.props.menuItems[i];
80
+ isSelected = i === this.props.selectedIndex;
81
+
82
+ var {
83
+ icon,
84
+ data,
85
+ attribute,
86
+ number,
87
+ toggle,
88
+ onClick,
89
+ ...other
90
+ } = menuItem;
91
+
92
+ itemComponent = (
93
+ <MenuItem
94
+ {...other}
95
+ selected={isSelected}
96
+ key={i}
97
+ index={i}
98
+ icon={menuItem.icon}
99
+ data={menuItem.data}
100
+ attribute={menuItem.attribute}
101
+ number={menuItem.number}
102
+ toggle={menuItem.toggle}
103
+ onClick={this._onItemClick}
104
+ onTouchTap={this._onItemTap}>
105
+ {menuItem.text}
106
+ </MenuItem>
107
+ );
108
+ children.push(itemComponent);
109
+ }
110
+
111
+ var logoutButton = <div className='logout-button-div' key={'logout-button'} >
112
+ <RaisedButton className='logout-button' label='Logout' primary={true} onTouchTap={this.handleLogout} />
113
+ </div>;
114
+ //if(this.props.canLogout) {
115
+ children.push(logoutButton);
116
+ //}
117
+
118
+ return children;
119
+ },
120
+
121
+ _setKeyWidth: function(el) {
122
+ var menuWidth = this.props.autoWidth ?
123
+ KeyLine.getIncrementalDim(el.offsetWidth) + 'px' :
124
+ '100%';
125
+
126
+ //Update the menu width
127
+ Dom.withoutTransition(el, function() {
128
+ el.style.width = menuWidth;
129
+ });
130
+ },
131
+
132
+ _renderVisibility: function() {
133
+ var el;
134
+
135
+ if (this.props.hideable) {
136
+ el = this.getDOMNode();
137
+ var innerContainer = this.refs.paperContainer.getInnerContainer().getDOMNode();
138
+
139
+ if (this.props.visible) {
140
+
141
+ //Open the menu
142
+ el.style.height = this._initialMenuHeight + 'px';
143
+ //This is to account for fast clicks
144
+ if (this.props.visible) {
145
+ innerContainer.style.overflow = 'visible';
146
+ }
147
+
148
+ } else {
149
+
150
+ //Close the menu
151
+ el.style.height = '0px';
152
+
153
+ //Set the overflow to hidden so that animation works properly
154
+ innerContainer.style.overflow = 'hidden';
155
+ }
156
+ }
157
+ },
158
+
159
+ handleLogout: function() {
160
+ this.props.onLogout();
161
+ },
162
+
163
+ _onItemClick: function(e, index) {
164
+ if (this.props.onItemClick) this.props.onItemClick(e, index, this.props.menuItems[index]);
165
+ },
166
+
167
+ _onItemTap: function(e, index) {
168
+ if (this.props.onItemTap) this.props.onItemTap(e, index, this.props.menuItems[index]);
169
+ },
170
+
171
+ _onItemToggle: function(e, index, toggled) {
172
+ if (this.props.onItemToggle) this.props.onItemToggle(e, index, this.props.menuItems[index], toggled);
173
+ }
174
+
175
+ });
176
+
177
+ module.exports = Menu;
@@ -0,0 +1,21 @@
1
+ var React = require('react');
2
+
3
+ var Overlay = React.createClass({
4
+
5
+ render: function() {
6
+
7
+ var {...other} = this.props;
8
+
9
+ var classes = 'mui-overlay';
10
+ if (this.props.show) {
11
+ classes += ' mui-is-shown';
12
+ }
13
+
14
+ return (
15
+ <div {...other} className={classes} />
16
+ );
17
+ }
18
+
19
+ });
20
+
21
+ module.exports = Overlay;
@@ -0,0 +1,108 @@
1
+ var React = require('react'),
2
+ Overlay = require('./overlay.jsx'),
3
+ Mui = require('material-ui'),
4
+ Paper = Mui.Paper,
5
+ Menu = require('./menu.jsx');
6
+
7
+ var RightNav = React.createClass({
8
+
9
+ propTypes: {
10
+ docked: React.PropTypes.bool,
11
+ header: React.PropTypes.element,
12
+ onChange: React.PropTypes.func,
13
+ menuItems: React.PropTypes.array.isRequired,
14
+ selectedIndex: React.PropTypes.number
15
+ },
16
+
17
+ getDefaultProps: function() {
18
+ return {
19
+ docked: true
20
+ };
21
+ },
22
+
23
+ getInitialState: function() {
24
+ return {
25
+ open: this.props.docked,
26
+ modal: false
27
+ };
28
+ },
29
+
30
+ toggle: function() {
31
+ this.setState({ open: !this.state.open });
32
+ return this;
33
+ },
34
+
35
+ close: function() {
36
+ this.setState({ open: false });
37
+ return this;
38
+ },
39
+
40
+ open: function() {
41
+ this.setState({ open: true });
42
+ return this;
43
+ },
44
+
45
+ render: function() {
46
+ var classes = 'mui-right-nav';
47
+ if (!this.state.open) {
48
+ classes += ' mui-closed';
49
+ }
50
+ var selectedIndex = this.props.selectedIndex;
51
+ var overlay;
52
+
53
+ if (!this.props.docked) overlay = <Overlay show={this.state.open} onTouchTap={this._onOverlayTouchTap} />;
54
+ if (this.state.modal) overlay = <Overlay show={this.state.open} onTouchTap={this._onOverlayBlockTouchTap} />;
55
+
56
+ return (
57
+ <div className={classes}>
58
+
59
+ {overlay}
60
+ <Paper
61
+ ref="clickAwayableElement"
62
+ className="mui-right-nav-menu"
63
+ zDepth={2}
64
+ rounded={false}>
65
+
66
+ {this.props.header}
67
+ <Menu
68
+ ref="menuItems"
69
+ zDepth={0}
70
+ menuItems={this.props.menuItems}
71
+ selectedIndex={selectedIndex}
72
+ onItemClick={this._onMenuItemClick}
73
+ onItemTap={this.handleItemTap}
74
+ onLogout={this.handleLogout}
75
+ canLogout={this.props.canLogout} />
76
+
77
+ </Paper>
78
+ </div>
79
+ );
80
+ },
81
+
82
+ handleLogout: function() {
83
+ if (!this.props.docked) this.close();
84
+ this.props.onLogout();
85
+ },
86
+
87
+ _onMenuItemClick: function(e, key, payload) {
88
+ if (!this.props.docked) this.close();
89
+ if (this.props.onChange && this.props.selectedIndex !== key) {
90
+ this.props.onChange(e, key, payload);
91
+ }
92
+ },
93
+
94
+ _onOverlayTouchTap: function() {
95
+ this.close();
96
+ },
97
+
98
+ _onOverlayBlockTouchTap: function() {
99
+ // do nothing
100
+ },
101
+
102
+ handleItemTap: function(e, index, menuItem) {
103
+ this.props.onItemTap(menuItem);
104
+ }
105
+
106
+ });
107
+
108
+ module.exports = RightNav;
@@ -0,0 +1,91 @@
1
+
2
+ var React = require('react');
3
+ var IdentityCard = require('./IdentityCard');
4
+
5
+ var IdentitiesGrid = React.createClass({
6
+
7
+ componentWillMount: function() {
8
+ this._externalMargin = 20;
9
+ this._cardMargin = 20;
10
+ this._heightRatio = 0.6;
11
+
12
+ this.computeGrid(this.props.identities);
13
+ },
14
+
15
+ componentWillReceiveProps: function(nextProps) {
16
+ this.computeGrid(nextProps.identities);
17
+ },
18
+
19
+ getInitialState: function () {
20
+ return {
21
+ hasBeenSelected: false
22
+ }
23
+ },
24
+
25
+ setHasBeenSelected: function(b) {
26
+ this.setState({
27
+ hasBeenSelected: b
28
+ });
29
+ },
30
+
31
+ /**
32
+ * Computes grid size based on given number of configs.
33
+ */
34
+ computeGrid: function(identities) {
35
+ var N = identities.length; // num of total cards
36
+ var i = 1; // num of rows
37
+ var j = 2; // num of columns
38
+ for(var n=1; n<=N; n++) {
39
+ var p = i * j;
40
+ if(n > p) {
41
+ if(i < j) {
42
+ i++;
43
+ } else {
44
+ j++;
45
+ }
46
+ }
47
+ }
48
+ var cardWidth = (window.innerWidth - this._externalMargin*2 - this._cardMargin*2*j) / j;
49
+ var cardHeight = (window.innerHeight*this._heightRatio - this._externalMargin - this._cardMargin*2*i) / i;
50
+ this._cardSize = [cardWidth, cardHeight];
51
+
52
+ },
53
+
54
+ render: function () {
55
+ var self = this;
56
+
57
+ var cards = [];
58
+
59
+ var height = window.innerHeight * this._heightRatio;
60
+ var gridStyle = {height: height};
61
+
62
+ var cardStyle = {
63
+ width: this._cardSize[0],
64
+ height: this._cardSize[1],
65
+ //position: 'absolute',
66
+ flexBasis: this._cardSize[0]
67
+ };
68
+
69
+ this.props.identities.forEach(function(i) {
70
+ cards.push(
71
+ <IdentityCard
72
+ key={i}
73
+ name={i}
74
+ cardStyle={cardStyle}
75
+ hasBeenSelected={self.state.hasBeenSelected}
76
+ onSelectedIdentity={self.setHasBeenSelected}
77
+ onSetRid = {self.props.onSetRid} />);
78
+ });
79
+
80
+ return (
81
+
82
+ <div className='identities-grid' style={gridStyle} >
83
+ {cards}
84
+ </div>
85
+
86
+ );
87
+ }
88
+
89
+ });
90
+
91
+ module.exports = IdentitiesGrid;
@@ -0,0 +1,86 @@
1
+
2
+ var React = require('react');
3
+ var Mui = require('material-ui');
4
+ var Paper = Mui.Paper;
5
+ var iOSMixin = require('./iOSMixin');
6
+
7
+ var IdentityCard = React.createClass({
8
+
9
+ mixins: [iOSMixin],
10
+
11
+ componentDidMount: function() {
12
+ var self= this;
13
+ this._colorSelected = '#00bcd4';
14
+
15
+ },
16
+
17
+ getInitialState: function () {
18
+ return {
19
+ isSelected: false
20
+ }
21
+ },
22
+
23
+ handleSelectedIdentity: function() {
24
+ var self = this;
25
+
26
+ if(!this.props.hasBeenSelected) {
27
+
28
+ this.props.onSelectedIdentity(true);
29
+
30
+ // Show selection
31
+ this.setState({
32
+ isSelected: true
33
+ });
34
+
35
+ // Trigger native animation
36
+ var callback = function() {
37
+ // Exit point from identity-selector
38
+ self.props.onSetRid(self.props.name);
39
+ };
40
+ setTimeout(callback, 500);
41
+ }
42
+
43
+ },
44
+
45
+ render: function () {
46
+
47
+ var selectedCardStyle = {
48
+ backgroundColor: this._colorSelected,
49
+ color: 'white'
50
+ };
51
+
52
+ // Copy
53
+ var cardStyle = {};
54
+ for(var p_ in this.props.cardStyle) {
55
+ cardStyle[p_] = this.props.cardStyle[p_];
56
+ }
57
+
58
+ var className='identity-card';
59
+
60
+ // Add properties if selected
61
+ if(this.state.isSelected) {
62
+ className += ' identity-card-selected';
63
+ for(var p in selectedCardStyle) {
64
+ cardStyle[p] = selectedCardStyle[p];
65
+ }
66
+
67
+ }
68
+
69
+ return (
70
+
71
+ <Paper className={className} style={cardStyle} onTouchTap={this.handleSelectedIdentity} >
72
+
73
+ <div className='card-name'>
74
+
75
+ <span> {this.props.name} </span>
76
+
77
+ </div>
78
+
79
+
80
+
81
+ </Paper>);
82
+ }
83
+
84
+ });
85
+
86
+ module.exports = IdentityCard;
@@ -0,0 +1,19 @@
1
+
2
+ var iOSMixin = {
3
+
4
+ iOScall: function(actionType, actionParameters) {
5
+
6
+ // JavaScript to send an action to iOS code
7
+ var appName = 'roomcast';
8
+ var jsonString = (JSON.stringify(actionParameters));
9
+ var escapedJsonParameters = escape(jsonString);
10
+ var url = appName + '://' + actionType + "#" + escapedJsonParameters;
11
+ console.log('launching url: ', url);
12
+ document.location.href = url;
13
+
14
+ }
15
+
16
+
17
+ };
18
+
19
+ module.exports = iOSMixin;
@@ -0,0 +1,105 @@
1
+
2
+ var React = require('react');
3
+ var Mui = require('material-ui');
4
+ var IdentitiesGrid = require('./IdentitiesGrid');
5
+ var NUTELLA = require('nutella_lib');
6
+
7
+ var Main = React.createClass({
8
+
9
+ componentDidMount: function() {
10
+ var self = this;
11
+
12
+ window.nutella_identity_selector = NUTELLA.init(self.props.params.broker, self.props.params.app_id, self.props.params.run_id, 'identity-selector', function(connected) {
13
+ if(connected) {
14
+ window.nutella_identity_selector.net.request('mapping/retrieve', 'all', function (response) {
15
+ self.extractIdentitiesFromMapping(response);
16
+ });
17
+
18
+ window.nutella_identity_selector.net.subscribe('mapping/updated', function (message, from) {
19
+ self.extractIdentitiesFromMapping(message);
20
+ });
21
+
22
+ window.nutella_identity_selector.net.subscribe('currentConfig/switched', function (message, from) {
23
+ if(self.isMounted()) {
24
+ self.extractIdentitiesFromMapping(message);
25
+ }
26
+ });
27
+ } else {
28
+ console.warn('nutella error in identity-selector');
29
+ }
30
+ });
31
+
32
+ },
33
+
34
+ extractIdentitiesFromMapping: function(mapping) {
35
+ var ids = [];
36
+ mapping.forEach(function (f) {
37
+ for (var i in f.items) {
38
+ if(f.items.hasOwnProperty(i) && f.items[i].name !== '') {
39
+ ids.push(f.items[i].name);
40
+ }
41
+ }
42
+ });
43
+ this.setIdentities(ids);
44
+ },
45
+
46
+ getInitialState: function () {
47
+ return {
48
+ identities: [],
49
+ mode: 'id'
50
+ }
51
+ },
52
+
53
+ setIdentities: function(ids) {
54
+ this.setState({
55
+ identities: ids
56
+ });
57
+ },
58
+
59
+ render: function () {
60
+
61
+ var titlesDivStyle = {
62
+ height: window.innerHeight * (0.4)
63
+ };
64
+
65
+ var gridDivStyle = {
66
+ height: window.innerHeight * (0.6)
67
+ };
68
+
69
+ var label;
70
+ switch(this.props.mode) {
71
+ case 'id':
72
+ label = 'Select new identity';
73
+ break;
74
+ case 'activity':
75
+ label = 'New Activity!';
76
+ break;
77
+ }
78
+
79
+ return (
80
+
81
+ <div className='main-div' >
82
+
83
+ <div className='titles-div' style={titlesDivStyle} >
84
+
85
+ <span className='title' > {label} </span>
86
+ <span className='title' > Who are you? </span>
87
+
88
+ </div>
89
+
90
+ <div className='grid-div' style={gridDivStyle} >
91
+
92
+ <IdentitiesGrid
93
+ identities={this.state.identities}
94
+ onSetRid = {this.props.onSetRid} />
95
+
96
+ </div>
97
+
98
+ </div>
99
+
100
+ );
101
+ }
102
+
103
+ });
104
+
105
+ module.exports = Main;
@@ -0,0 +1,97 @@
1
+
2
+ var React = require('react');
3
+ var IdentitiesGrid = require('./IdentitiesGrid');
4
+
5
+ var AppIdPage = React.createClass({
6
+
7
+ componentDidMount: function() {
8
+ },
9
+
10
+ getInitialState: function () {
11
+ return {
12
+ hasBeenSelected: false
13
+ }
14
+ },
15
+
16
+ handleSetBroker: function(event) {
17
+ if (event.type == "keydown") {
18
+ var charCode;
19
+ if (event.charCode) {
20
+ charCode = event.charCode;
21
+ }
22
+ else {
23
+ charCode = event.keyCode;
24
+ }
25
+ }
26
+ if (charCode == 13) {
27
+ var broker = this.refs['input'].getDOMNode().value;
28
+ this.props.initWithBroker(broker);
29
+ }
30
+ },
31
+
32
+ render: function () {
33
+
34
+ var titlesDivStyle = {
35
+ height: window.innerHeight * (0.4)
36
+ };
37
+
38
+ var gridDivStyle = {
39
+ height: window.innerHeight * (0.6)
40
+ };
41
+
42
+ var app_ids_grid = null;
43
+
44
+ if(this.props.values) {
45
+ var backgroundMessage = null;
46
+ if(this.props.values.length === 0) {
47
+ backgroundMessage = <p className='backgroundMessage' > No available apps </p>;
48
+ }
49
+ app_ids_grid = (
50
+ <div className='grid-div' style={gridDivStyle} >
51
+
52
+ {backgroundMessage}
53
+ <IdentitiesGrid
54
+ identities={this.props.values}
55
+ type='app_id'
56
+ onSwitchPage={this.props.onSwitchPage} />
57
+
58
+ </div>
59
+ );
60
+ } else {
61
+ app_ids_grid = (
62
+ <div className='grid-div' style={gridDivStyle}>
63
+ </div>
64
+ );
65
+ }
66
+
67
+ var brokerStyle = {
68
+ backgroundColor: '#e9eaed',
69
+ border: 'solid 1px white',
70
+ position: 'absolute',
71
+ right: '5px',
72
+ top: '5px'
73
+ };
74
+
75
+ return (
76
+
77
+ <div className='main-div' >
78
+
79
+ <input style={brokerStyle} ref='input' onKeyDown={this.handleSetBroker} ></input>
80
+
81
+ <div className='titles-div' style={titlesDivStyle} >
82
+
83
+ <img src='dist/assets/Logo_alpha.png' className='rc-logo' />
84
+ <span className='title' > application name: </span>
85
+
86
+ </div>
87
+
88
+ {app_ids_grid}
89
+
90
+ </div>
91
+
92
+ );
93
+ }
94
+
95
+ });
96
+
97
+ module.exports = AppIdPage;