hippo-fw 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/.nvmrc +2 -0
  3. data/.travis.yml +1 -1
  4. data/client/hippo/access/login-dialog.jsx +3 -5
  5. data/client/hippo/boot.jsx +2 -2
  6. data/client/hippo/components/asset.jsx +0 -1
  7. data/client/hippo/components/data-list.jsx +16 -15
  8. data/client/hippo/components/data-list/data-list.scss +10 -0
  9. data/client/hippo/components/data-table.jsx +14 -14
  10. data/client/hippo/components/data-table/header-cell.jsx +0 -1
  11. data/client/hippo/components/data-table/table-styles.scss +7 -0
  12. data/client/hippo/components/date-time.jsx +19 -16
  13. data/client/hippo/components/date-time/calendar.jsx +5 -7
  14. data/client/hippo/components/date-time/date-time-drop.jsx +0 -2
  15. data/client/hippo/components/date-time/time.jsx +0 -1
  16. data/client/hippo/components/form.jsx +1 -1
  17. data/client/hippo/components/form/{model.js → api.js} +25 -7
  18. data/client/hippo/components/form/fields.jsx +12 -11
  19. data/client/hippo/components/form/fields/date-wrapper.jsx +1 -1
  20. data/client/hippo/components/form/fields/form-field.scss +9 -1
  21. data/client/hippo/components/form/fields/label.jsx +14 -0
  22. data/client/hippo/components/form/fields/select-wrapper.jsx +2 -3
  23. data/client/hippo/components/form/wrapper.jsx +1 -3
  24. data/client/hippo/components/icon.jsx +2 -69
  25. data/client/hippo/components/master-detail.jsx +0 -2
  26. data/client/hippo/components/network-activity-overlay.jsx +1 -4
  27. data/client/hippo/components/query-builder.jsx +15 -16
  28. data/client/hippo/components/record-finder.jsx +2 -5
  29. data/client/hippo/components/record-finder/query-layer.jsx +1 -5
  30. data/client/hippo/components/screen.jsx +7 -3
  31. data/client/hippo/components/text-editor.jsx +2 -8
  32. data/client/hippo/components/tool-tip.jsx +2 -3
  33. data/client/hippo/components/warning-notification.jsx +3 -3
  34. data/client/hippo/lib/date-range.js +28 -0
  35. data/client/hippo/lib/util.js +6 -0
  36. data/client/hippo/models/asset.js +6 -3
  37. data/client/hippo/models/config.js +1 -1
  38. data/client/hippo/models/pub_sub.js +12 -7
  39. data/client/hippo/models/pub_sub/channel.js +6 -4
  40. data/client/hippo/models/query.js +19 -4
  41. data/client/hippo/models/query/array-result.js +9 -8
  42. data/client/hippo/models/query/clause.js +21 -13
  43. data/client/hippo/models/query/field.js +7 -2
  44. data/client/hippo/models/query/info.js +7 -3
  45. data/client/hippo/models/sync.js +11 -14
  46. data/client/hippo/react/Root.jsx +1 -2
  47. data/client/hippo/react/{DefaultComponentNotFound.jsx → component-not-found.jsx} +1 -3
  48. data/client/hippo/screens/index.js +6 -2
  49. data/client/hippo/screens/system-settings.jsx +10 -6
  50. data/client/hippo/screens/system-settings/mailer-config.jsx +0 -2
  51. data/client/hippo/screens/system-settings/tenant.jsx +1 -4
  52. data/client/hippo/screens/user-management.jsx +0 -1
  53. data/client/hippo/screens/user-management/edit-form.jsx +1 -2
  54. data/client/hippo/workspace/index.jsx +21 -12
  55. data/client/hippo/workspace/menu-group.jsx +4 -7
  56. data/client/hippo/workspace/menu-option.jsx +1 -3
  57. data/client/hippo/workspace/menu.jsx +29 -11
  58. data/client/hippo/workspace/navbar.jsx +1 -2
  59. data/client/hippo/workspace/root-view.jsx +5 -2
  60. data/client/hippo/workspace/screen.jsx +2 -3
  61. data/client/hippo/workspace/styles.scss +17 -0
  62. data/command-reference-files/screen/client/appy-app/screens/ready-set-go.jsx +2 -1
  63. data/db/migrate/20170530120004_create_users.rb +1 -1
  64. data/hippo-fw.gemspec +3 -2
  65. data/lib/hippo/api/cable.rb +13 -13
  66. data/lib/hippo/api/controller_base.rb +1 -0
  67. data/lib/hippo/api/handlers/tenant.rb +1 -1
  68. data/lib/hippo/api/handlers/user_session.rb +2 -1
  69. data/lib/hippo/api/helper_methods.rb +4 -1
  70. data/lib/hippo/api/pub_sub.rb +7 -6
  71. data/lib/hippo/api/to_json.rb +1 -1
  72. data/lib/hippo/api/updates.rb +2 -0
  73. data/lib/hippo/command/console.rb +11 -3
  74. data/lib/hippo/command/jest.rb +2 -0
  75. data/lib/hippo/configuration.rb +4 -7
  76. data/lib/hippo/rake_tasks.rb +1 -1
  77. data/lib/hippo/screen.rb +31 -93
  78. data/lib/hippo/screen/definition.rb +76 -0
  79. data/lib/hippo/screen/group.rb +26 -0
  80. data/lib/hippo/spec_helper.rb +3 -0
  81. data/lib/hippo/system_settings.rb +6 -0
  82. data/lib/hippo/user.rb +11 -3
  83. data/lib/hippo/version.rb +1 -1
  84. data/package-lock.json +419 -533
  85. data/package.json +32 -30
  86. data/spec/client/access/login-dialog.spec.jsx +4 -5
  87. data/spec/client/components/__snapshots__/query-builder.spec.jsx.snap +1 -1
  88. data/spec/client/components/__snapshots__/record-finder.spec.jsx.snap +72 -0
  89. data/spec/client/components/asset.spec.jsx +2 -6
  90. data/spec/client/components/data-list.spec.jsx +2 -6
  91. data/spec/client/components/data-table.spec.jsx +3 -5
  92. data/spec/client/components/date-time.spec.jsx +1 -1
  93. data/spec/client/components/form.spec.jsx +2 -2
  94. data/spec/client/components/master-detail.spec.jsx +1 -2
  95. data/spec/client/components/network-activity-overlay.spec.jsx +2 -3
  96. data/spec/client/components/query-builder.spec.jsx +3 -6
  97. data/spec/client/components/record-finder.spec.jsx +4 -4
  98. data/spec/client/models/pub_sub.spec.js +3 -1
  99. data/spec/client/models/query.spec.js +4 -9
  100. data/spec/client/screens/system-settings-tenants.spec.jsx +1 -1
  101. data/spec/client/screens/system-settings.spec.jsx +1 -4
  102. data/spec/client/workspace/__snapshots__/menu.spec.jsx.snap +15 -20
  103. data/spec/client/workspace/menu.spec.jsx +1 -2
  104. data/spec/server/api/user_sessions_spec.rb +15 -0
  105. data/templates/client/screens/screen.jsx +2 -1
  106. data/views/hippo_root_view.erb +1 -0
  107. metadata +30 -52
  108. data/client/hippo/components/calendar/Calendar.jsx +0 -25
  109. data/client/hippo/components/calendar/index.js +0 -3
  110. data/client/hippo/components/calendar/styles.scss +0 -3
  111. data/client/hippo/components/shared/AssetsListing.jsx +0 -23
  112. data/client/hippo/components/shared/Checkbox.jsx +0 -49
  113. data/client/hippo/components/shared/CountBadge.jsx +0 -13
  114. data/client/hippo/components/shared/DateTime.jsx +0 -58
  115. data/client/hippo/components/shared/DisplayValue.jsx +0 -15
  116. data/client/hippo/components/shared/ErrorDisplay.jsx +0 -37
  117. data/client/hippo/components/shared/FieldMixin.jsx +0 -254
  118. data/client/hippo/components/shared/FieldSet.jsx +0 -52
  119. data/client/hippo/components/shared/FieldWrapper.jsx +0 -94
  120. data/client/hippo/components/shared/FormGroup.jsx +0 -41
  121. data/client/hippo/components/shared/GenericField.jsx +0 -7
  122. data/client/hippo/components/shared/IconButton.jsx +0 -13
  123. data/client/hippo/components/shared/ImageAsset.jsx +0 -78
  124. data/client/hippo/components/shared/IndeterminateCheckbox.jsx +0 -31
  125. data/client/hippo/components/shared/Input.jsx +0 -16
  126. data/client/hippo/components/shared/InputFieldMixin.jsx +0 -78
  127. data/client/hippo/components/shared/JobProgress.jsx +0 -46
  128. data/client/hippo/components/shared/NumberInput.jsx +0 -37
  129. data/client/hippo/components/shared/PanelHeader.jsx +0 -15
  130. data/client/hippo/components/shared/RadioField.jsx +0 -33
  131. data/client/hippo/components/shared/ResizeSensor.jsx +0 -18
  132. data/client/hippo/components/shared/ScreenWrapper.jsx +0 -17
  133. data/client/hippo/components/shared/TextArea.jsx +0 -19
  134. data/client/hippo/components/shared/Throbber.jsx +0 -8
  135. data/client/hippo/components/shared/ToggleField.jsx +0 -2
  136. data/client/hippo/components/shared/Tooltip.jsx +0 -23
  137. data/client/hippo/components/shared/fields.scss +0 -58
  138. data/client/hippo/components/shared/fieldset.scss +0 -27
  139. data/client/hippo/components/shared/image-asset.scss +0 -53
  140. data/client/hippo/components/shared/index.js +0 -5
  141. data/client/hippo/components/shared/overlay.scss +0 -83
  142. data/client/hippo/components/shared/resize-sensor.scss +0 -30
  143. data/client/hippo/components/shared/styles.scss +0 -64
  144. data/client/hippo/components/shared/throbber.scss +0 -53
  145. data/client/hippo/fonts/fontawesome-webfont.woff +0 -0
  146. data/client/hippo/fonts/fontawesome-webfont.woff2 +0 -0
  147. data/client/hippo/workspace/content.jsx +0 -22
  148. data/client/hippo/workspace/tabs.jsx +0 -60
  149. data/client/hippo/workspace/viewport.jsx +0 -82
  150. data/spec/client/screens/__snapshots__/tabs.spec.jsx.snap +0 -127
  151. data/spec/client/screens/tabs.spec.jsx +0 -36
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
-
3
- import Tabs from './tabs';
4
-
5
- import Box from 'grommet/components/Box';
6
- import Paragraph from 'grommet/components/Paragraph';
7
-
8
- export default class Content extends React.Component {
9
-
10
- render() {
11
- return (
12
- <Box className="content-pane" justify="start" align="stretch" pad="none" direction="column" full="vertical">
13
- <Tabs />
14
-
15
- <Box justify="start" align="stretch" pad="none" flex="grow">
16
- {this.props.children}
17
- </Box>
18
-
19
- </Box>
20
- );
21
- }
22
- }
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { observer } from 'mobx-react';
4
- import classnames from 'classnames';
5
- import Icon from '../components/icon';
6
- import ScreenInstances from '../screens/instance';
7
-
8
- import Tabs from 'grommet/components/Tabs';
9
- import Tab from 'grommet/components/Tab';
10
-
11
- @observer
12
- export class ScreenTab extends React.Component {
13
- static propTypes = {
14
- screen: PropTypes.shape({
15
- title: PropTypes.string.isRequired,
16
- definition: PropTypes.shape({
17
- icon: PropTypes.string.isRequired,
18
- }).isRequired,
19
- }).isRequired,
20
- }
21
-
22
- setModelState(nextState) {
23
- if (this.model.active) {
24
- _.dom(document.head).qs('title').text = this.model.title();
25
- this.context.viewport.history.replace(this.model.historyUrl());
26
- }
27
- if (Hippo.Screens.Definitions.displaying.length === 0) {
28
- this.context.viewport.history.push('/');
29
- }
30
- return (
31
- this.setState(nextState)
32
- );
33
- }
34
-
35
- activate() {
36
- this.model.active = true;
37
- this.context.viewport.history.push(this.model.historyUrl());
38
- return (
39
- null
40
- );
41
- }
42
-
43
- close() { return this.model.remove(); }
44
-
45
- render() {
46
- const { screen } = this.props;
47
- // const title = <span><Icon type="hourglass" />{screen.title}</span>
48
- return (
49
- <Tab title={screen.title} />
50
- );
51
- }
52
- }
53
-
54
- const ScreenTabs = observer(() => (
55
- <Tabs justify="start">
56
- {ScreenInstances.displaying.map(s => <ScreenTab key={s.id} screen={s} />)}
57
- </Tabs>
58
- ));
59
- ScreenTabs.displayName = 'NavbarTabs';
60
- export default ScreenTabs;
@@ -1,82 +0,0 @@
1
- import React from 'react';
2
-
3
- /* const Screen = React.createClass({
4
- *
5
- * displayName: 'Screen',
6
- * shouldComponentUpdate() {
7
- * return (
8
- * false
9
- * );
10
- * },
11
- * render() {
12
- * return (
13
- * React.createElement(this.props.screen.component(), this.props.screen.props)
14
- * );
15
- * },
16
- * });*/
17
-
18
- export default class ScreenView extends React.Component {
19
- /* contextTypes: {
20
- * uistate: React.PropTypes.object.isRequired,
21
- * },*/
22
-
23
- /* static modelBindings: {
24
- * displaying() { return Hippo.Screens.Definitions.displaying; },
25
- * allScreens() { return Hippo.Screens.Definitions.all; },
26
- * },
27
-
28
- * bindEvents: {
29
- * displaying: 'add remove reset change:active',
30
- * allScreens: 'change:loading',
31
- * },
32
- */
33
- renderScreen(screen) {
34
- return (
35
- <div
36
- key={screen.id}
37
- className={_.classnames('screen', { active: screen.active })}
38
- >
39
- <Screen screen={screen} />
40
- </div>
41
- );
42
- }
43
-
44
- renderLoading() {
45
- const screen = Hippo.Screens.Definitions.all.findWhere({ loading: true });
46
- return (
47
- <LC.NetworkActivityOverlay visible message={`Loading ${screen.title}…`} />
48
- );
49
- }
50
-
51
- BaseView() {
52
- const Base = __guardMethod__(Hippo.Extensions.controlling(), 'initialScreen', o => o.initialScreen()) || Hippo.Workspace.FirstRun;
53
- return (
54
- <div className="screen active base">
55
- <Base />
56
- </div>
57
- );
58
- }
59
-
60
- render() {
61
- const child = this.displaying.isEmpty() ? React.createElement(this.BaseView, null) : this.displaying.map(this.renderScreen);
62
- return (
63
- <div className={`page-content ${this.context.uistate.layout_size}`}>
64
- {this.allScreens.isLoading() ? this.renderLoading() : undefined}
65
- {child}
66
- </div>
67
- );
68
- }
69
- }
70
-
71
- /*
72
- * function __guardMethod__(obj, methodName, transform) {
73
- * if (typeof obj !== 'undefined' && obj !== null && typeof obj[methodName] === 'function') {
74
- * return (
75
- * transform(obj, methodName)
76
- * );
77
- * } else {
78
- * return (
79
- * undefined
80
- * );
81
- * }
82
- * }*/
@@ -1,127 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Workspace Navbar renders a tab 1`] = `
4
- <li
5
- className="grommetux-tab"
6
- id={undefined}
7
- >
8
- <button
9
- aria-expanded={undefined}
10
- aria-label={undefined}
11
- aria-selected={undefined}
12
- className="grommetux-button grommetux-button--plain grommetux-tab__button"
13
- disabled={false}
14
- href={undefined}
15
- onBlur={[Function]}
16
- onClick={[Function]}
17
- onFocus={[Function]}
18
- onMouseDown={[Function]}
19
- onMouseUp={[Function]}
20
- role="tab"
21
- type="button"
22
- >
23
- <label
24
- className="grommetux-tab__label"
25
- htmlFor={undefined}
26
- >
27
- title
28
- </label>
29
- </button>
30
- </li>
31
- `;
32
-
33
- exports[`Workspace Navbar renders and adds/removes tabs 1`] = `
34
- <div
35
- role="tablist"
36
- >
37
- <ul
38
- className="grommetux-tabs grommetux-tabs--justify-start grommetux-tabs--responsive"
39
- >
40
- <li
41
- className="grommetux-tab"
42
- id={undefined}
43
- >
44
- <button
45
- aria-expanded={undefined}
46
- aria-label={undefined}
47
- aria-selected={undefined}
48
- className="grommetux-button grommetux-button--plain grommetux-tab__button"
49
- disabled={false}
50
- href={undefined}
51
- onBlur={[Function]}
52
- onClick={[Function]}
53
- onFocus={[Function]}
54
- onMouseDown={[Function]}
55
- onMouseUp={[Function]}
56
- role="tab"
57
- type="button"
58
- >
59
- <label
60
- className="grommetux-tab__label"
61
- htmlFor={undefined}
62
- >
63
- title
64
- </label>
65
- </button>
66
- </li>
67
- <li
68
- className="grommetux-tab"
69
- id={undefined}
70
- >
71
- <button
72
- aria-expanded={undefined}
73
- aria-label={undefined}
74
- aria-selected={undefined}
75
- className="grommetux-button grommetux-button--plain grommetux-tab__button"
76
- disabled={false}
77
- href={undefined}
78
- onBlur={[Function]}
79
- onClick={[Function]}
80
- onFocus={[Function]}
81
- onMouseDown={[Function]}
82
- onMouseUp={[Function]}
83
- role="tab"
84
- type="button"
85
- >
86
- <label
87
- className="grommetux-tab__label"
88
- htmlFor={undefined}
89
- >
90
- title
91
- </label>
92
- </button>
93
- </li>
94
- <li
95
- className="grommetux-tab"
96
- id={undefined}
97
- >
98
- <button
99
- aria-expanded={undefined}
100
- aria-label={undefined}
101
- aria-selected={undefined}
102
- className="grommetux-button grommetux-button--plain grommetux-tab__button"
103
- disabled={false}
104
- href={undefined}
105
- onBlur={[Function]}
106
- onClick={[Function]}
107
- onFocus={[Function]}
108
- onMouseDown={[Function]}
109
- onMouseUp={[Function]}
110
- role="tab"
111
- type="button"
112
- >
113
- <label
114
- className="grommetux-tab__label"
115
- htmlFor={undefined}
116
- >
117
- title
118
- </label>
119
- </button>
120
- </li>
121
- </ul>
122
- <div
123
- aria-label="Tab Contents"
124
- role="tabpanel"
125
- />
126
- </div>
127
- `;
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { each, range } from 'lodash';
3
-
4
- import Tabs, { ScreenTab } from 'hippo/workspace/tabs';
5
- import Instance from 'hippo/screens/instance';
6
-
7
- import { getTestScreen } from '../test-models';
8
- import { Context, Snapshot } from 'hippo/testing/screens';
9
-
10
- const addTab = () =>
11
- new Instance({ definition: getTestScreen() });
12
-
13
- describe('Workspace Navbar', () => {
14
- beforeEach(() => {
15
- each(range(0, 3), addTab);
16
- });
17
-
18
- it('renders and adds/removes tabs', () => {
19
- const options = new Context();
20
- const tabs = shallow(<Tabs />, options);
21
- expect(tabs.find('ScreenTab').length).toEqual(3);
22
- addTab();
23
- expect(tabs.find('ScreenTab').length).toEqual(4);
24
- Instance.displaying[2].remove();
25
- expect(tabs.find('ScreenTab').length).toEqual(3);
26
- expect(Snapshot(<Tabs />)).toMatchSnapshot();
27
- });
28
-
29
- it('renders a tab', () => {
30
- const options = new Context();
31
- const screen = Instance.displaying[2];
32
- const tab = shallow(<ScreenTab screen={screen} />, options);
33
- expect(tab).toHaveRendered(`Tab[title="${screen.title}"]`);
34
- expect(Snapshot(<ScreenTab screen={Instance.displaying[2]} />)).toMatchSnapshot();
35
- });
36
- });