hippo-fw 0.9.3 → 0.9.4
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.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/client/hippo/__mocks__/config.js +4 -4
- data/client/hippo/boot.jsx +8 -8
- data/client/hippo/components/form.jsx +1 -2
- data/client/hippo/components/form/wrapper.jsx +20 -8
- data/client/hippo/config.android.js +8 -0
- data/client/hippo/config.ios.js +8 -0
- data/client/hippo/config.js +5 -71
- data/client/hippo/lib/pub_sub.js +34 -0
- data/client/hippo/models/base.js +6 -6
- data/client/hippo/models/config.js +60 -0
- data/client/hippo/models/pub_sub.js +157 -0
- data/client/hippo/models/pub_sub/channel.js +35 -0
- data/client/hippo/screens/definition.js +1 -1
- data/client/hippo/screens/index.js +2 -10
- data/client/hippo/screens/user-management/edit-form.jsx +10 -7
- data/client/hippo/user.js +1 -3
- data/client/hippo/workspace/index.jsx +16 -15
- data/client/hippo/workspace/menu.jsx +2 -8
- data/client/hippo/workspace/screen.jsx +6 -6
- data/config/database.yml +1 -0
- data/config/routes.rb +4 -4
- data/config/webpack.config.js +18 -16
- data/hippo-fw.gemspec +2 -2
- data/lib/hippo.rb +1 -3
- data/lib/hippo/api.rb +1 -0
- data/lib/hippo/api/cable.rb +19 -20
- data/lib/hippo/api/handlers/user_session.rb +1 -1
- data/lib/hippo/api/pub_sub.rb +7 -5
- data/lib/hippo/api/routing.rb +1 -1
- data/lib/hippo/api/updates.rb +1 -1
- data/lib/hippo/concerns/api_path.rb +2 -3
- data/lib/hippo/configuration.rb +2 -0
- data/lib/hippo/rails.rb +9 -0
- data/lib/hippo/user.rb +2 -1
- data/lib/hippo/version.rb +1 -1
- data/package-lock.json +6823 -0
- data/package.json +43 -34
- data/spec/client/models/pub_sub.spec.js +27 -0
- data/templates/js/config-data.js +1 -1
- data/templates/js/screen-definitions.js +2 -2
- data/yarn.lock +307 -15
- metadata +28 -9
- data/client/extension.js +0 -0
- data/client/hippo/models/PubSub.js +0 -208
- data/lib/generators/hippo/migrations/install_generator.rb +0 -42
- data/lib/hippo/rails_engine.rb +0 -5
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hippo-fw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Stitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activejob
|
@@ -39,19 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 5.0.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: litecable
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.4.1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.4.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: websocket
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.4
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.2.4
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: mail
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -649,7 +663,6 @@ files:
|
|
649
663
|
- README.md
|
650
664
|
- Rakefile
|
651
665
|
- bin/hippo
|
652
|
-
- client/extension.js
|
653
666
|
- client/hippo/__mocks__/config.js
|
654
667
|
- client/hippo/access/index.js
|
655
668
|
- client/hippo/access/login-dialog.jsx
|
@@ -737,6 +750,8 @@ files:
|
|
737
750
|
- client/hippo/components/toolbar/index.js
|
738
751
|
- client/hippo/components/toolbar/styles.scss
|
739
752
|
- client/hippo/components/warning-notification.jsx
|
753
|
+
- client/hippo/config.android.js
|
754
|
+
- client/hippo/config.ios.js
|
740
755
|
- client/hippo/config.js
|
741
756
|
- client/hippo/extensions/EarlyExtensions.js.erb
|
742
757
|
- client/hippo/extensions/LateLoaded.js.erb
|
@@ -754,16 +769,19 @@ files:
|
|
754
769
|
- client/hippo/lib/bootstrap.js
|
755
770
|
- client/hippo/lib/index.js.erb
|
756
771
|
- client/hippo/lib/loader.js
|
772
|
+
- client/hippo/lib/pub_sub.js
|
757
773
|
- client/hippo/lib/request-assets.js
|
758
774
|
- client/hippo/lib/smooth-scroll.js
|
759
775
|
- client/hippo/lib/util.js
|
760
|
-
- client/hippo/models/PubSub.js
|
761
776
|
- client/hippo/models/__mocks__/sync.js
|
762
777
|
- client/hippo/models/asset.js
|
763
778
|
- client/hippo/models/base.js
|
764
779
|
- client/hippo/models/collection.js
|
780
|
+
- client/hippo/models/config.js
|
765
781
|
- client/hippo/models/decorators.js
|
766
782
|
- client/hippo/models/index.js
|
783
|
+
- client/hippo/models/pub_sub.js
|
784
|
+
- client/hippo/models/pub_sub/channel.js
|
767
785
|
- client/hippo/models/query.js
|
768
786
|
- client/hippo/models/query/array-result.js
|
769
787
|
- client/hippo/models/query/clause.js
|
@@ -906,7 +924,6 @@ files:
|
|
906
924
|
- docs/todo-example-part-1.md
|
907
925
|
- docs/welcome.md
|
908
926
|
- hippo-fw.gemspec
|
909
|
-
- lib/generators/hippo/migrations/install_generator.rb
|
910
927
|
- lib/hippo-fw.rb
|
911
928
|
- lib/hippo.rb
|
912
929
|
- lib/hippo/access.rb
|
@@ -1006,7 +1023,7 @@ files:
|
|
1006
1023
|
- lib/hippo/mailer.rb
|
1007
1024
|
- lib/hippo/model.rb
|
1008
1025
|
- lib/hippo/numbers.rb
|
1009
|
-
- lib/hippo/
|
1026
|
+
- lib/hippo/rails.rb
|
1010
1027
|
- lib/hippo/rake_tasks.rb
|
1011
1028
|
- lib/hippo/redis.rb
|
1012
1029
|
- lib/hippo/reloadable_sinatra.rb
|
@@ -1030,6 +1047,7 @@ files:
|
|
1030
1047
|
- lib/hippo/workspace.rb
|
1031
1048
|
- lib/hippo/workspace/config/screens.rb
|
1032
1049
|
- log/.gitkeep
|
1050
|
+
- package-lock.json
|
1033
1051
|
- package.json
|
1034
1052
|
- spec/client/.eslintrc.js
|
1035
1053
|
- spec/client/access/login-dialog.spec.jsx
|
@@ -1050,6 +1068,7 @@ files:
|
|
1050
1068
|
- spec/client/models/asset.spec.js
|
1051
1069
|
- spec/client/models/base.spec.js
|
1052
1070
|
- spec/client/models/collection.spec.js
|
1071
|
+
- spec/client/models/pub_sub.spec.js
|
1053
1072
|
- spec/client/models/query.spec.js
|
1054
1073
|
- spec/client/models/sync.spec.js
|
1055
1074
|
- spec/client/models/system-setting.spec.js
|
data/client/extension.js
DELETED
File without changes
|
@@ -1,208 +0,0 @@
|
|
1
|
-
import { find, remove, extend } from 'lodash';
|
2
|
-
import { logger } from '../lib/logger';
|
3
|
-
import {
|
4
|
-
BaseModel,
|
5
|
-
} from '../models/base';
|
6
|
-
|
7
|
-
import User from '../user';
|
8
|
-
import Config from '../config';
|
9
|
-
|
10
|
-
const ActionCable = {};
|
11
|
-
|
12
|
-
class ModelConfig {
|
13
|
-
|
14
|
-
constructor(type, model) {
|
15
|
-
this.type = type;
|
16
|
-
this.id = model.getId();
|
17
|
-
this.channel = `${model.identifiedBy}/${this.id}`;
|
18
|
-
this.count = 0;
|
19
|
-
this.models = [];
|
20
|
-
}
|
21
|
-
|
22
|
-
add(model) {
|
23
|
-
if (0 === this.count) {
|
24
|
-
// Hippo.Models.PubSub.channel.subscribe(this.channel);
|
25
|
-
// __guard__(Hippo.Models.PubSub.channel, x => x
|
26
|
-
// .subscribe(this.channel)); // , @mbCallBack(@models))
|
27
|
-
}
|
28
|
-
this.count += 1;
|
29
|
-
const config = this.modelConfig(model);
|
30
|
-
return (config.count += 1);
|
31
|
-
}
|
32
|
-
|
33
|
-
modelConfig(model) {
|
34
|
-
let config = find(this.models, { model });
|
35
|
-
if (!config) {
|
36
|
-
config = { model, count: 0 };
|
37
|
-
this.models.push(config);
|
38
|
-
}
|
39
|
-
return config;
|
40
|
-
}
|
41
|
-
|
42
|
-
remove(model) {
|
43
|
-
const config = find(this.models, { model });
|
44
|
-
if (!config) { return null; }
|
45
|
-
this.count -= 1;
|
46
|
-
if (0 === this.count) { // all removed, just unsubscribe
|
47
|
-
return this.unsubscribe();
|
48
|
-
}
|
49
|
-
config.count -= 1;
|
50
|
-
if (0 === config.count) { return remove(this.models, { model }); }
|
51
|
-
return null;
|
52
|
-
}
|
53
|
-
|
54
|
-
unsubscribe() {
|
55
|
-
// __guard__(Hippo.Models.PubSub.channel, x => x.unsubscribe(this.channel));
|
56
|
-
return delete this.type.records[this.id];
|
57
|
-
}
|
58
|
-
|
59
|
-
onChange(data) {
|
60
|
-
return Array.from(this.models).map(config => config.model.addChangeSet(data));
|
61
|
-
}
|
62
|
-
}
|
63
|
-
|
64
|
-
class ModelType {
|
65
|
-
|
66
|
-
constructor(attr) {
|
67
|
-
extend(this, attr);
|
68
|
-
this.records = {};
|
69
|
-
}
|
70
|
-
|
71
|
-
add(model) {
|
72
|
-
const config = this.records[model.id] || (
|
73
|
-
this.records[model.id] = new ModelConfig(this, model)
|
74
|
-
);
|
75
|
-
return config.add(model);
|
76
|
-
}
|
77
|
-
|
78
|
-
remove(model) {
|
79
|
-
return this.records[model.id] && this.records[model.id].remove(model);
|
80
|
-
}
|
81
|
-
|
82
|
-
onChange(id, data) {
|
83
|
-
return this.records[id].onChange(data);
|
84
|
-
}
|
85
|
-
|
86
|
-
unsubscribeAll() {
|
87
|
-
return (() => {
|
88
|
-
const result = [];
|
89
|
-
this.recoards.forEach((record) => {
|
90
|
-
result.push(record.unsubscribe());
|
91
|
-
});
|
92
|
-
return result;
|
93
|
-
})();
|
94
|
-
}
|
95
|
-
}
|
96
|
-
|
97
|
-
class ModelTypesCollection extends BaseModel {
|
98
|
-
static initClass() {
|
99
|
-
this.prototype.model = ModelType;
|
100
|
-
}
|
101
|
-
|
102
|
-
forModel(model) {
|
103
|
-
const path = model.identifiedBy;
|
104
|
-
return this.get(path) || this.add({ id: path });
|
105
|
-
}
|
106
|
-
}
|
107
|
-
ModelTypesCollection.initClass();
|
108
|
-
|
109
|
-
const CableChannel = {};
|
110
|
-
|
111
|
-
const PubSub = {
|
112
|
-
|
113
|
-
types: new ModelTypesCollection(),
|
114
|
-
|
115
|
-
add(model) {
|
116
|
-
// if (!__guardMethod__(model, 'isPersistent',
|
117
|
-
// o => o.isPersistent())) { return; }
|
118
|
-
return this.types.forModel(model).add(model);
|
119
|
-
},
|
120
|
-
|
121
|
-
remove(model) {
|
122
|
-
// if (!model || !__guardMethod__(model, 'isPersistent',
|
123
|
-
// o => o.isPersistent())) { return; }
|
124
|
-
return this.types.forModel(model).remove(model);
|
125
|
-
},
|
126
|
-
|
127
|
-
// instanceFor(model_klass, id) {
|
128
|
-
// // const path = _.result(model_klass.prototype, 'api_path');
|
129
|
-
// //return __guard__(__guard__(__guard__(this.types.get(path),
|
130
|
-
// // x2 => x2.records[id]), x1 => x1.models[0]), x => x.model);
|
131
|
-
// },
|
132
|
-
|
133
|
-
// clear() {
|
134
|
-
// return this.types = new ModelTypesCollection();
|
135
|
-
// },
|
136
|
-
|
137
|
-
// initialize() {
|
138
|
-
// Hippo.current_user.on('change:isLoggedIn', _.bind(this.onLoginChange, this));
|
139
|
-
// if (Hippo.current_user.isLoggedIn) { return this.onLoginChange(); }
|
140
|
-
// },
|
141
|
-
|
142
|
-
// onChange(path, id, data) {
|
143
|
-
// return this.types.get(path).onChange(id, data);
|
144
|
-
// },
|
145
|
-
|
146
|
-
onLoginChange() {
|
147
|
-
if (User.isLoggedIn) {
|
148
|
-
const url = `${Config.api_host}${Config.api_path}/ws`;
|
149
|
-
this.cable = ActionCable.createConsumer(url);
|
150
|
-
this.channel = this.cable.subscriptions.create(
|
151
|
-
'Hippo::API::PubSub', CableChannel,
|
152
|
-
);
|
153
|
-
}
|
154
|
-
PubSub.types.each(t => t.unsubscribeAll());
|
155
|
-
delete this.channel;
|
156
|
-
this.cable.disconnect();
|
157
|
-
return delete this.cable;
|
158
|
-
},
|
159
|
-
|
160
|
-
};
|
161
|
-
|
162
|
-
const CHANNEL_SPLITTER = new RegExp('^(.*):(.*)/([^/]+)$');
|
163
|
-
|
164
|
-
extend(CableChannel, {
|
165
|
-
connected() {
|
166
|
-
// return this.subscribe('file-change', () => HotReload.initiate(changes));
|
167
|
-
},
|
168
|
-
|
169
|
-
subscribe(channel) {
|
170
|
-
logger.info(`[pubsub] subscribe to: ${channel}`);
|
171
|
-
return this.perform('on', { channel });
|
172
|
-
},
|
173
|
-
|
174
|
-
unsubscribe(channel) {
|
175
|
-
logger.info(`[pubsub] unsubscribe from: ${channel}`);
|
176
|
-
return this.perform('off', { channel });
|
177
|
-
},
|
178
|
-
|
179
|
-
received(data) {
|
180
|
-
const [channel, _, model, id] = Array.from(
|
181
|
-
data.channel.match(CHANNEL_SPLITTER),
|
182
|
-
);
|
183
|
-
logger.info(`[pubsub] change recvd for: ${channel}`);
|
184
|
-
PubSub.onChange(
|
185
|
-
model, id, _.omit(data, 'channel'),
|
186
|
-
);
|
187
|
-
},
|
188
|
-
|
189
|
-
});
|
190
|
-
|
191
|
-
export function start() {
|
192
|
-
// PubSub.initialize();
|
193
|
-
}
|
194
|
-
|
195
|
-
export function stop() {
|
196
|
-
PubSub.kill();
|
197
|
-
}
|
198
|
-
|
199
|
-
|
200
|
-
function __guard__(value, transform) {
|
201
|
-
return ('undefined' !== typeof value && null !== value) ? transform(value) : undefined;
|
202
|
-
}
|
203
|
-
function __guardMethod__(obj, methodName, transform) {
|
204
|
-
if ('undefined' !== typeof obj && null !== obj && 'function' === typeof obj[methodName]) {
|
205
|
-
return transform(obj, methodName);
|
206
|
-
}
|
207
|
-
return undefined;
|
208
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
require 'hippo/db/migrations'
|
2
|
-
|
3
|
-
module Hippo
|
4
|
-
|
5
|
-
module Migrations
|
6
|
-
|
7
|
-
class InstallGenerator < Rails::Generators::Base
|
8
|
-
include Rails::Generators::Migration
|
9
|
-
|
10
|
-
source_root Hippo::DB::Migrations.paths.first
|
11
|
-
|
12
|
-
Hippo::DB::Migrations.paths.slice(1..-1).each do | source_path |
|
13
|
-
source_paths << source_path
|
14
|
-
end
|
15
|
-
|
16
|
-
desc "Install Stockor migrations"
|
17
|
-
def self.next_migration_number(path)
|
18
|
-
unless @prev_migration_nr
|
19
|
-
@prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
|
20
|
-
else
|
21
|
-
@prev_migration_nr += 1
|
22
|
-
end
|
23
|
-
@prev_migration_nr.to_s
|
24
|
-
end
|
25
|
-
|
26
|
-
def copy_migrations
|
27
|
-
Hippo::DB::Migrations.paths.each do | source_path |
|
28
|
-
|
29
|
-
Pathname.glob( source_path.join('*') ).each do | migration |
|
30
|
-
from = File.basename( migration )
|
31
|
-
dest = from.gsub(/^\d+_(.*).rb$/,'\\1.rb')
|
32
|
-
if self.class.migration_exists?("db/migrate", "#{dest}")
|
33
|
-
say_status("skipped", "Migration #{dest} already exists")
|
34
|
-
else
|
35
|
-
migration_template( from, "db/migrate/#{dest}" )
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|