lanes 0.1.9.5 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Rakefile +1 -1
- data/client/lanes/Boot.cjsx +3 -3
- data/client/lanes/Config.coffee +38 -3
- data/client/lanes/access/Extension.coffee +1 -1
- data/client/lanes/access/LoginDialog.cjsx +57 -47
- data/client/lanes/access/Roles.coffee +2 -2
- data/client/lanes/access/User.coffee +4 -3
- data/client/lanes/access/screens/user-management/UserManagement.cjsx +12 -11
- data/client/lanes/components/calendar/Calendar.cjsx +16 -0
- data/client/lanes/components/calendar/index.js +3 -0
- data/client/lanes/components/calendar/styles.scss +3 -0
- data/client/lanes/components/grid/Body.cjsx +86 -0
- data/client/lanes/components/grid/CellStyles.coffee +20 -0
- data/client/lanes/components/grid/EditingMixin.cjsx +84 -24
- data/client/lanes/components/grid/Editor.cjsx +45 -0
- data/client/lanes/components/grid/Grid.cjsx +62 -104
- data/client/lanes/components/grid/Header.cjsx +35 -0
- data/client/lanes/components/grid/PopOverMixin.cjsx +19 -9
- data/client/lanes/components/grid/PopoverEditor.cjsx +7 -1
- data/client/lanes/components/grid/RowEditor.cjsx +1 -1
- data/client/lanes/components/grid/Selections.cjsx +39 -0
- data/client/lanes/components/grid/Toolbar.cjsx +24 -5
- data/client/lanes/components/grid/editors.scss +22 -50
- data/client/lanes/components/grid/index.js +0 -1
- data/client/lanes/components/grid/row-editor.scss +68 -0
- data/client/lanes/components/grid/styles.scss +79 -3
- data/client/lanes/components/modal/Modal.cjsx +64 -24
- data/client/lanes/components/modal/styles.scss +12 -0
- data/client/lanes/components/record-finder/Clause.cjsx +11 -4
- data/client/lanes/components/record-finder/Dialog.cjsx +23 -24
- data/client/lanes/components/record-finder/RecordFinder.cjsx +45 -14
- data/client/lanes/components/record-finder/styles.scss +9 -6
- data/client/lanes/components/select-field/SelectField.cjsx +108 -53
- data/client/lanes/components/select-field/styles.scss +19 -0
- data/client/lanes/components/shared/ControlLabel.cjsx +45 -0
- data/client/lanes/components/shared/DateTime.cjsx +48 -0
- data/client/lanes/components/shared/DisplayValue.cjsx +16 -0
- data/client/lanes/components/shared/FieldMixin.cjsx +54 -23
- data/client/lanes/components/shared/FieldSet.cjsx +12 -35
- data/client/lanes/components/shared/FieldWrapper.cjsx +13 -0
- data/client/lanes/components/shared/FormGroup.cjsx +37 -0
- data/client/lanes/components/shared/Icon.cjsx +20 -0
- data/client/lanes/components/shared/ImageSaver.cjsx +33 -0
- data/client/lanes/components/shared/Input.cjsx +19 -0
- data/client/lanes/components/shared/InputFieldMixin.cjsx +48 -0
- data/client/lanes/components/shared/JobProgress.cjsx +27 -0
- data/client/lanes/components/shared/NetworkActivityOverlay.cjsx +58 -0
- data/client/lanes/components/shared/NumberInput.cjsx +29 -0
- data/client/lanes/components/shared/ResizeSensor.cjsx +11 -0
- data/client/lanes/components/shared/ScreenWrapper.cjsx +13 -0
- data/client/lanes/components/shared/Throbber.cjsx +3 -0
- data/client/lanes/components/shared/ToggleField.cjsx +33 -0
- data/client/lanes/components/shared/Tooltip.cjsx +2 -2
- data/client/lanes/components/shared/fields.scss +75 -13
- data/client/lanes/components/shared/fieldset.scss +3 -5
- data/client/lanes/components/shared/image-saver.scss +38 -0
- data/client/lanes/components/shared/index.js +2 -0
- data/client/lanes/{styles/plugins → components/shared}/overlay.scss +17 -4
- data/client/lanes/components/shared/resize-sensor.scss +30 -0
- data/client/lanes/components/shared/styles.scss +13 -0
- data/client/lanes/components/shared/throbber.scss +53 -0
- data/client/lanes/components/toolbar/RemoteChangeSets.cjsx +21 -48
- data/client/lanes/components/toolbar/SaveButton.cjsx +24 -0
- data/client/lanes/components/toolbar/Toolbar.cjsx +24 -37
- data/client/lanes/components/toolbar/changes-notification.scss +10 -6
- data/client/lanes/components/toolbar/styles.scss +29 -9
- data/client/lanes/extension/Base.coffee +4 -5
- data/client/lanes/index.js +0 -1
- data/client/lanes/index.scss.erb +10 -1
- data/client/lanes/lib/HotReload.coffee +13 -15
- data/client/lanes/lib/MakeBaseClass.coffee +6 -1
- data/client/lanes/lib/development.coffee +2 -0
- data/client/lanes/lib/dom-polyfills.coffee +5 -0
- data/client/lanes/lib/dom.coffee +38 -9
- data/client/lanes/lib/format.coffee +11 -0
- data/client/lanes/lib/index.js.erb +2 -0
- data/client/lanes/lib/production.coffee +6 -0
- data/client/lanes/lib/utilFunctions.coffee +50 -15
- data/client/lanes/models/AssociationMap.coffee +122 -46
- data/client/lanes/models/AssociationProxy.coffee +147 -0
- data/client/lanes/models/Base.coffee +97 -85
- data/client/lanes/models/ChangeMonitor.coffee +7 -3
- data/client/lanes/models/ChangeSet.coffee +2 -2
- data/client/lanes/models/Collection.coffee +49 -6
- data/client/lanes/models/JobStatus.coffee +32 -0
- data/client/lanes/models/PubSub.coffee +7 -5
- data/client/lanes/models/Query.coffee +115 -34
- data/client/lanes/models/ServerCache.coffee +67 -52
- data/client/lanes/models/State.coffee +97 -0
- data/client/lanes/models/Sync.coffee +18 -13
- data/client/lanes/models/SystemSettings.coffee +0 -0
- data/client/lanes/models/index.js +1 -0
- data/client/lanes/models/mixins/FileSupport.coffee +60 -0
- data/client/lanes/models/mixins/HasCodeField.coffee +13 -6
- data/client/lanes/models/query/ArrayResult.coffee +188 -0
- data/client/lanes/models/query/CollectionResult.coffee +71 -0
- data/client/lanes/models/query/Result.coffee +9 -0
- data/client/lanes/react/Component.coffee +7 -3
- data/client/lanes/react/PubSub.coffee +7 -7
- data/client/lanes/react/Root.cjsx +1 -4
- data/client/lanes/react/Screen.coffee +1 -0
- data/client/lanes/react/TypeValidators.coffee +3 -3
- data/client/lanes/react/Viewport.coffee +41 -7
- data/client/lanes/react/index.js +0 -1
- data/client/lanes/react/mixins/Access.coffee +4 -1
- data/client/lanes/react/mixins/Data.coffee +40 -25
- data/client/lanes/react/mixins/FieldErrors.coffee +27 -0
- data/client/lanes/react/mixins/RelayEditingState.coffee +4 -0
- data/client/lanes/react/mixins/Screen.coffee +14 -0
- data/client/lanes/react/mixins/Viewport.coffee +9 -3
- data/client/lanes/screens/ChangeListener.coffee +3 -3
- data/client/lanes/screens/Commands.coffee +14 -7
- data/client/lanes/screens/CommonComponents.cjsx +20 -0
- data/client/lanes/screens/Definitions.coffee +64 -20
- data/client/lanes/screens/SystemSettings.cjsx +56 -0
- data/client/lanes/screens/UserPreferences.cjsx +38 -0
- data/client/lanes/screens/index.js +3 -0
- data/client/lanes/screens/styles.scss +2 -1
- data/client/lanes/styles/fonts.scss +1 -0
- data/client/lanes/styles/global.scss +2 -1
- data/client/lanes/styles/global/flexbox.scss +16 -0
- data/client/lanes/styles/global/styles.scss +1 -0
- data/client/lanes/styles/mixins/_dropdown.scss +21 -0
- data/client/lanes/styles/mixins/_flexbox.scss +394 -0
- data/client/lanes/styles/mixins/all.scss +2 -0
- data/client/lanes/styles/variables.scss +28 -0
- data/client/lanes/testing/BeforeEach.coffee +15 -14
- data/client/lanes/testing/Helpers.coffee +14 -5
- data/client/lanes/testing/TestObjects.coffee +10 -2
- data/client/lanes/testing/index.js +1 -0
- data/client/lanes/testing/jasmine-react.js +125 -0
- data/client/lanes/vendor/base.js +56049 -74987
- data/client/lanes/vendor/calendar.js +17301 -0
- data/client/lanes/vendor/calendar.scss +303 -0
- data/client/lanes/vendor/commons.js +14990 -15847
- data/client/lanes/vendor/development.js +4912 -1952
- data/client/lanes/vendor/grid.js +14246 -5551
- data/client/lanes/vendor/grid.scss +876 -335
- data/client/lanes/vendor/index.js +1 -0
- data/client/lanes/vendor/message-bus-ajax.js +44 -0
- data/client/lanes/vendor/message-bus.js +414 -0
- data/client/lanes/vendor/rw-widgets.eot +0 -0
- data/client/lanes/vendor/rw-widgets.svg +18 -0
- data/client/lanes/vendor/rw-widgets.ttf +0 -0
- data/client/lanes/vendor/rw-widgets.woff +0 -0
- data/client/lanes/vendor/toggle.js +345 -0
- data/client/lanes/vendor/toggle.scss +138 -0
- data/client/lanes/vendor/widgets.js +21245 -6839
- data/client/lanes/vendor/widgets.scss +83 -67
- data/client/lanes/workspace/Layout.cjsx +18 -8
- data/client/lanes/workspace/Modal.cjsx +47 -0
- data/client/lanes/workspace/Navbar.cjsx +16 -2
- data/client/lanes/workspace/ScreenView.cjsx +10 -3
- data/client/lanes/workspace/ScreensMenu.cjsx +23 -7
- data/client/lanes/workspace/Tabs.cjsx +55 -0
- data/client/lanes/workspace/UIState.coffee +7 -8
- data/client/lanes/workspace/index.js +2 -1
- data/client/lanes/workspace/mixin.coffee +11 -0
- data/client/lanes/workspace/mixins/UIState.coffee +8 -0
- data/client/lanes/workspace/mixins/index.js +3 -0
- data/client/lanes/workspace/styles.scss +2 -1
- data/client/lanes/workspace/styles/header.scss +23 -1
- data/client/lanes/workspace/styles/layout.scss +26 -24
- data/client/lanes/workspace/styles/screens.scss +0 -4
- data/client/lanes/workspace/styles/tabs.scss +3 -10
- data/config/routes.rb +10 -4
- data/config/screens.rb +25 -0
- data/db/migrate/01_create_system_settings.rb +10 -0
- data/docs/todo-example-part-1.md +18 -20
- data/lanes.gemspec +15 -6
- data/lib/lanes.rb +4 -2
- data/lib/lanes/access/config/routes.rb +5 -3
- data/lib/lanes/access/config/screens.rb +1 -0
- data/lib/lanes/access/db/migrate/20140615031600_create_lanes_users.rb +1 -1
- data/lib/lanes/access/user.rb +1 -1
- data/lib/lanes/api.rb +2 -1
- data/lib/lanes/api/controller.rb +32 -71
- data/lib/lanes/api/default_routes.rb +10 -8
- data/lib/lanes/api/formatted_reply.rb +53 -0
- data/lib/lanes/api/handlers/file.rb +26 -0
- data/lib/lanes/api/helper_methods.rb +29 -5
- data/lib/lanes/api/javascript_processor.rb +36 -17
- data/lib/lanes/api/pub_sub.rb +6 -9
- data/lib/lanes/api/request_wrapper.rb +1 -2
- data/lib/lanes/api/root.rb +11 -43
- data/lib/lanes/api/routing.rb +63 -0
- data/lib/lanes/api/sprockets_extension.rb +15 -7
- data/lib/lanes/api/updates.rb +1 -2
- data/lib/lanes/command.rb +0 -1
- data/lib/lanes/command/app.rb +6 -5
- data/lib/lanes/command/console.rb +1 -0
- data/lib/lanes/command/generate.rb +3 -0
- data/lib/lanes/command/generate_migration.rb +33 -0
- data/lib/lanes/command/generate_model.rb +4 -26
- data/lib/lanes/command/migration_support.rb +29 -0
- data/lib/lanes/command/update_model.rb +14 -5
- data/lib/lanes/concerns/all.rb +2 -0
- data/lib/lanes/concerns/api_path.rb +4 -2
- data/lib/lanes/concerns/association_extensions.rb +1 -1
- data/lib/lanes/concerns/attr_accessor_with_default.rb +3 -1
- data/lib/lanes/concerns/code_identifier.rb +1 -1
- data/lib/lanes/concerns/image_uploader.rb +42 -0
- data/lib/lanes/concerns/pub_sub.rb +0 -1
- data/lib/lanes/concerns/queries.rb +2 -2
- data/lib/lanes/concerns/set_attribute_data.rb +4 -13
- data/lib/lanes/concerns/sorting_expressions.rb +34 -0
- data/lib/lanes/configuration.rb +48 -9
- data/lib/lanes/extension.rb +16 -7
- data/lib/lanes/extension/definition.rb +8 -2
- data/lib/lanes/job.rb +78 -0
- data/lib/lanes/job/failure_logger.rb +33 -0
- data/lib/lanes/model.rb +4 -0
- data/lib/lanes/rake_tasks.rb +6 -0
- data/lib/lanes/redis.rb +13 -0
- data/lib/lanes/screen.rb +34 -18
- data/lib/lanes/system_settings.rb +66 -0
- data/lib/lanes/version.rb +1 -1
- data/lib/lanes/workspace/extension.rb +1 -1
- data/npm-build/base.js +10 -3
- data/npm-build/calendar.js +6 -0
- data/npm-build/development.js +4 -5
- data/npm-build/grid.js +3 -5
- data/npm-build/package.json +40 -29
- data/npm-build/react-toggle.js +5 -0
- data/npm-build/react-widgets.js +6 -0
- data/npm-build/update-dayz +14 -0
- data/npm-build/webpack.config.js +5 -2
- data/spec/command-reference-files/initial/Gemfile +1 -1
- data/spec/command-reference-files/initial/config/routes.rb +2 -0
- data/spec/command-reference-files/initial/lib/appy-app.rb +4 -0
- data/spec/command-reference-files/initial/lib/appy-app/extension.rb +2 -0
- data/spec/command-reference-files/initial/spec/server/{spec_helpers.rb → spec_helper.rb} +0 -0
- data/spec/command-reference-files/model/config/routes.rb +2 -0
- data/spec/command-reference-files/model/spec/server/test_test_spec.rb +1 -1
- data/spec/command-reference-files/screen/client/appy-app/screens/ready-set-go/ReadySetGo.cjsx +6 -4
- data/spec/command-reference-files/screen/client/appy-app/screens/ready-set-go/index.scss +4 -3
- data/spec/command-reference-files/screen/config/screens.rb +4 -2
- data/spec/command-reference-files/screen/spec/appy-app/screens/ready-set-go/ReadySetGoSpec.coffee +1 -1
- data/spec/fixtures/system_settings.yml +1 -0
- data/spec/lanes/components/grid/GridSpec.coffee +56 -31
- data/spec/lanes/components/grid/RowEditorSpec.coffee +96 -0
- data/spec/lanes/components/select-field/SelectFieldSpec.coffee +99 -0
- data/spec/lanes/components/shared/NetworkActivityOverlaySpec.coffee +34 -0
- data/spec/lanes/models/AssociationMapSpec.coffee +36 -2
- data/spec/lanes/models/AssociationProxySpec.coffee +77 -0
- data/spec/lanes/models/BaseSpec.coffee +37 -4
- data/spec/lanes/models/CollectionSpec.coffee +11 -17
- data/spec/lanes/models/PubSubSpec.coffee +1 -1
- data/spec/lanes/models/ServerCacheSpec.coffee +65 -0
- data/spec/server/api/coffeescript_processor_spec.rb +1 -1
- data/spec/server/concerns/pub_sub_spec.rb +9 -10
- data/spec/server/concerns/sorting_expressions_spec.rb +34 -0
- data/spec/server/configuration_spec.rb +3 -3
- data/spec/server/job_spec.rb +54 -0
- data/spec/server/spec_helper.rb +0 -5
- data/spec/server/system_settings_spec.rb +23 -0
- data/templates/client/screens/Screen.cjsx +6 -4
- data/templates/client/screens/styles.scss +4 -3
- data/templates/config/routes.rb +2 -0
- data/templates/config/screen.rb +4 -2
- data/templates/lib/namespace.rb +4 -0
- data/templates/lib/namespace/extension.rb +2 -0
- data/templates/spec/client/Screen.coffee +1 -1
- data/templates/spec/server/model_spec.rb +1 -1
- data/templates/spec/server/{spec_helpers.rb → spec_helper.rb} +0 -0
- data/views/lanes_root_view.erb +70 -0
- data/views/specs.erb +2 -2
- metadata +207 -68
- data/client/images/lanes/dataTables/Sorting icons.psd +0 -0
- data/client/images/lanes/dataTables/back_disabled.png +0 -0
- data/client/images/lanes/dataTables/back_enabled.png +0 -0
- data/client/images/lanes/dataTables/back_enabled_hover.png +0 -0
- data/client/images/lanes/dataTables/favicon.ico +0 -0
- data/client/images/lanes/dataTables/forward_disabled.png +0 -0
- data/client/images/lanes/dataTables/forward_enabled.png +0 -0
- data/client/images/lanes/dataTables/forward_enabled_hover.png +0 -0
- data/client/images/lanes/dataTables/loading-background.png +0 -0
- data/client/images/lanes/dataTables/sort_asc.png +0 -0
- data/client/images/lanes/dataTables/sort_asc_disabled.png +0 -0
- data/client/images/lanes/dataTables/sort_both.png +0 -0
- data/client/images/lanes/dataTables/sort_desc.png +0 -0
- data/client/images/lanes/dataTables/sort_desc_disabled.png +0 -0
- data/client/lanes/components/shared/Resize.cjsx +0 -152
- data/client/lanes/components/shared/TextArea.cjsx +0 -19
- data/client/lanes/components/shared/TextField.cjsx +0 -25
- data/client/lanes/models/Bootstrap.coffee +0 -5
- data/client/lanes/models/QueryResults.coffee +0 -93
- data/client/lanes/react/FormBindings.coffee +0 -103
- data/client/lanes/react/Router.cjsx +0 -18
- data/client/lanes/styles/dataTables.scss +0 -4
- data/client/lanes/styles/plugins/all.scss +0 -2
- data/client/lanes/styles/plugins/resize-sensor.scss +0 -24
- data/client/lanes/vendor/jquery-2.js +0 -9190
- data/client/lanes/vendor/jquery.tap.js +0 -401
- data/client/lanes/vendor/magicsuggest.js +0 -1565
- data/client/lanes/vendor/message-bus.coffee +0 -264
- data/client/lanes/workspace/ActiveScreenSwitcher.cjsx +0 -38
- data/client/lanes/workspace/styles/toolbar.scss +0 -4
- data/lib/lanes/api/eco.js +0 -516
- data/lib/lanes/api/sprockets_compressor.rb +0 -39
- data/spec/command-reference-files/model/lib/appy-app.rb +0 -11
- data/views/index.erb +0 -19
data/lib/lanes/extension.rb
CHANGED
@@ -35,6 +35,11 @@ module Lanes
|
|
35
35
|
ALL
|
36
36
|
end
|
37
37
|
|
38
|
+
def for_identifier(identifier)
|
39
|
+
each{|ext| return ext if ext.identifier == identifier }
|
40
|
+
nil
|
41
|
+
end
|
42
|
+
|
38
43
|
def each_asset(phase: :early, type: :js)
|
39
44
|
each do |ext|
|
40
45
|
if phase == :all || ext.load_phase == phase
|
@@ -72,9 +77,11 @@ module Lanes
|
|
72
77
|
mapped
|
73
78
|
end
|
74
79
|
|
75
|
-
def each
|
80
|
+
def each(reversed: false)
|
76
81
|
@cached_instances ||= sorted.map{ |klass| klass.new }
|
77
|
-
@cached_instances.each
|
82
|
+
(reversed ? @cached_instances.reverse : @cached_instances).each do |ext|
|
83
|
+
yield ext
|
84
|
+
end
|
78
85
|
end
|
79
86
|
|
80
87
|
def controlling
|
@@ -85,13 +92,15 @@ module Lanes
|
|
85
92
|
|
86
93
|
def client_bootstrap_data(view)
|
87
94
|
data = {
|
88
|
-
|
89
|
-
|
95
|
+
api_path: Lanes.config.api_path,
|
96
|
+
root_path: Lanes.config.mounted_at,
|
90
97
|
root_view: Lanes.config.root_view,
|
91
|
-
|
92
|
-
api_path: Lanes.config.mounted_at,
|
98
|
+
csrf_token: view.session[:csrf],
|
93
99
|
environment: Lanes.config.environment,
|
94
|
-
|
100
|
+
system_settings: Lanes::SystemSettings.config.as_json,
|
101
|
+
assets_path_prefix: Lanes.config.assets_path_prefix,
|
102
|
+
controlling_extension: controlling.identifier,
|
103
|
+
initial_workspace_screen_id: Lanes.config.initial_workspace_screen_id
|
95
104
|
}
|
96
105
|
each do | ext |
|
97
106
|
ext_data = ext.client_bootstrap_data(view)
|
@@ -10,6 +10,10 @@ module Lanes
|
|
10
10
|
|
11
11
|
attr_reader :context
|
12
12
|
|
13
|
+
attr_accessor_with_default :client_js_aliases, lambda{ Hash.new }
|
14
|
+
|
15
|
+
attr_accessor_with_default :title, ''
|
16
|
+
|
13
17
|
attr_accessor_with_default :load_phase, :late
|
14
18
|
|
15
19
|
attr_accessor_with_default :identifier
|
@@ -23,7 +27,6 @@ module Lanes
|
|
23
27
|
class_attribute :before
|
24
28
|
class_attribute :after
|
25
29
|
|
26
|
-
|
27
30
|
def self.components(*names)
|
28
31
|
Components.enable(*names)
|
29
32
|
end
|
@@ -92,11 +95,14 @@ module Lanes
|
|
92
95
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
93
96
|
)
|
94
97
|
end
|
98
|
+
|
99
|
+
def apply_configuration
|
100
|
+
end
|
95
101
|
end
|
96
102
|
|
97
103
|
class Base < Definition
|
98
104
|
identifier "lanes"
|
99
|
-
|
105
|
+
title "Lanes Application"
|
100
106
|
root_path Pathname.new(__FILE__).dirname.join("..","..","..").expand_path
|
101
107
|
def stylesheet_include
|
102
108
|
nil
|
data/lib/lanes/job.rb
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'jobba'
|
2
|
+
require 'lanes/api/pub_sub'
|
3
|
+
|
4
|
+
module Jobba
|
5
|
+
module RecordStatus
|
6
|
+
|
7
|
+
def self.included(klass)
|
8
|
+
klass.send(:attr_reader, :job_status)
|
9
|
+
klass.around_enqueue do |job, block|
|
10
|
+
@job_status = Jobba.find!(job.job_id)
|
11
|
+
@job_status.set_job_name(self.class.to_s)
|
12
|
+
@job_status.unqueued!
|
13
|
+
block.call
|
14
|
+
@job_status.queued!
|
15
|
+
end
|
16
|
+
klass.around_perform do |job, block|
|
17
|
+
# we use find! so it will create a record of the job even if
|
18
|
+
# it's created using perform_now. In that case the enqueue step's skipped
|
19
|
+
@job_status = Jobba.find!(job.job_id)
|
20
|
+
@job_status.started!
|
21
|
+
block.call
|
22
|
+
@job_status.succeeded!
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
module Lanes
|
30
|
+
|
31
|
+
# A job in lanes is identical to a ActiveJob::Base job, except it records it's
|
32
|
+
# status using the Jobba::Status mixin module
|
33
|
+
class Job < ::ActiveJob::Base
|
34
|
+
|
35
|
+
after_perform{ |job|
|
36
|
+
job.deliver_progress_to_clients
|
37
|
+
}
|
38
|
+
|
39
|
+
def deliver_progress_to_clients
|
40
|
+
API::PubSub.publish("/lanes/job-statuses/#{job_id}", update: Job.status_for_id(job_id))
|
41
|
+
end
|
42
|
+
|
43
|
+
def save_progress(output, progress=1.0)
|
44
|
+
job_status.set_progress(progress)
|
45
|
+
job_status.save(output: output)
|
46
|
+
deliver_progress_to_clients
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.status_for_id(id)
|
50
|
+
status = Jobba.find(id)
|
51
|
+
return nil unless status
|
52
|
+
{
|
53
|
+
id: status.id,
|
54
|
+
job_name: status.job_name,
|
55
|
+
progress: status.progress,
|
56
|
+
attempt: status.attempt,
|
57
|
+
state: status.state.name,
|
58
|
+
recorded_at: status.recorded_at,
|
59
|
+
queued_at: status.queued_at,
|
60
|
+
errors: status.errors,
|
61
|
+
data: status.data
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.api_status_message(job, message="Job started")
|
66
|
+
return {
|
67
|
+
success: true, message: message, data: {
|
68
|
+
job: Lanes::Job.status_for_id(job.job_id)
|
69
|
+
}
|
70
|
+
}
|
71
|
+
end
|
72
|
+
|
73
|
+
include Jobba::RecordStatus
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "resque"
|
2
|
+
require "resque/failure/multiple"
|
3
|
+
require "resque/failure/redis"
|
4
|
+
require "resque/failure/multiple"
|
5
|
+
|
6
|
+
module Lanes
|
7
|
+
class Job
|
8
|
+
class FailureLogger < ::Resque::Failure::Base
|
9
|
+
|
10
|
+
def self.configure
|
11
|
+
Resque::Failure::Multiple.configure do |multi|
|
12
|
+
# Always stores failure in Redis and writes to log
|
13
|
+
multi.classes = Resque::Failure::Redis, self
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def save
|
18
|
+
Lanes.logger.error detailed
|
19
|
+
end
|
20
|
+
|
21
|
+
def detailed
|
22
|
+
<<-EOF
|
23
|
+
#{worker} failed processing #{queue}:
|
24
|
+
Payload:
|
25
|
+
#{payload.inspect.split("\n").map { |l| " " + l }.join("\n")}
|
26
|
+
Exception:
|
27
|
+
#{exception}
|
28
|
+
#{exception.backtrace.map { |l| " " + l }.join("\n")}
|
29
|
+
EOF
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/lanes/model.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require_relative 'concerns/all'
|
2
|
+
require 'carrierwave/orm/activerecord'
|
2
3
|
|
3
4
|
module Lanes
|
4
5
|
|
6
|
+
::ActiveRecord::Base.raise_in_transactional_callbacks = true
|
5
7
|
|
6
8
|
class Model < ::ActiveRecord::Base
|
7
9
|
self.abstract_class = true
|
@@ -16,6 +18,8 @@ module Lanes
|
|
16
18
|
include Concerns::ApiPath
|
17
19
|
include Concerns::CodeIdentifier
|
18
20
|
include Concerns::SanitizeFields
|
21
|
+
include Concerns::Queries
|
22
|
+
include Concerns::SortingExpressions
|
19
23
|
|
20
24
|
end
|
21
25
|
|
data/lib/lanes/rake_tasks.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'puma/control_cli'
|
2
|
+
require 'resque/tasks'
|
2
3
|
require_relative '../lanes'
|
3
4
|
|
4
5
|
desc "Run the puma server in development mode"
|
@@ -18,6 +19,11 @@ task :console do
|
|
18
19
|
IRB.start
|
19
20
|
end
|
20
21
|
|
22
|
+
task :env do
|
23
|
+
Lanes::DB.configure_rake_environment
|
24
|
+
Lanes::Configuration.apply
|
25
|
+
end
|
26
|
+
|
21
27
|
# ## quite a bit of this is cribbed from Sinatra ActiveRecord
|
22
28
|
load 'active_record/railties/databases.rake'
|
23
29
|
|
data/lib/lanes/redis.rb
ADDED
data/lib/lanes/screen.rb
CHANGED
@@ -6,18 +6,16 @@ module Lanes
|
|
6
6
|
|
7
7
|
module Screen
|
8
8
|
|
9
|
-
|
10
9
|
GROUPS=Hash.new{|h,k| g=Group.new; g.identifier=k; h[k]=g }
|
11
|
-
DEFINITIONS=Hash.new{|h,k| d=Definition.new; d.identifier=k; h[k]=d }
|
10
|
+
DEFINITIONS=Hash.new #{|h,k| d=Definition.new; d.identifier=k; h[k]=d }
|
12
11
|
|
13
12
|
class DefinitionList
|
14
|
-
def initialize(
|
15
|
-
@
|
13
|
+
def initialize(extension_id)
|
14
|
+
@extension_id = extension_id
|
16
15
|
end
|
17
16
|
|
18
17
|
def define(id)
|
19
|
-
definition = DEFINITIONS[id]
|
20
|
-
definition.extension = @ext
|
18
|
+
definition = ( DEFINITIONS[id] ||= Definition.new(id, @extension_id) )
|
21
19
|
yield definition
|
22
20
|
end
|
23
21
|
end
|
@@ -31,9 +29,8 @@ module Lanes
|
|
31
29
|
end
|
32
30
|
end
|
33
31
|
|
34
|
-
def for_extension(
|
35
|
-
|
36
|
-
yield definitions
|
32
|
+
def for_extension(id)
|
33
|
+
yield DefinitionList.new(id)
|
37
34
|
end
|
38
35
|
|
39
36
|
def define_group(id)
|
@@ -89,18 +86,36 @@ module Lanes
|
|
89
86
|
attr_accessor_with_default :group_id
|
90
87
|
attr_accessor_with_default :extension
|
91
88
|
attr_accessor_with_default :view_class
|
92
|
-
attr_accessor_with_default :url_prefix
|
89
|
+
attr_accessor_with_default :url_prefix, lambda {
|
90
|
+
"#{@extension_id}/screens"
|
91
|
+
}
|
93
92
|
attr_accessor_with_default :model_class
|
94
|
-
attr_accessor_with_default :
|
95
|
-
attr_accessor_with_default :
|
93
|
+
attr_accessor_with_default :model_access, 'read'
|
94
|
+
attr_accessor_with_default :js, lambda {
|
95
|
+
has_file_matching?('index.{js,coffee,cjsx}') ? @identifier + '.js' : nil
|
96
|
+
}
|
97
|
+
attr_accessor_with_default :css, lambda {
|
98
|
+
has_file_matching?('index.{css,scss}') ? @identifier + '.css' : nil
|
99
|
+
}
|
100
|
+
|
101
|
+
def initialize(id, extension_id)
|
102
|
+
self.identifier = id
|
103
|
+
@extension_id = extension_id
|
104
|
+
@extension = extension_id.underscore.camelize
|
105
|
+
end
|
106
|
+
|
107
|
+
def has_file_matching?(pattern)
|
108
|
+
Pathname.glob(root_path.join(pattern)).any?
|
109
|
+
end
|
110
|
+
|
111
|
+
def root_path
|
112
|
+
ext = Lanes::Extensions.for_identifier(@extension_id)
|
113
|
+
raise "Unable to find extension '#{@extension_id}' for screen group" unless ext
|
114
|
+
ext.root_path.join('client', url_prefix, identifier)
|
115
|
+
end
|
96
116
|
|
97
117
|
def url_path_for(type)
|
98
|
-
|
99
|
-
if url_prefix
|
100
|
-
"#{url_prefix}/#{file}"
|
101
|
-
else
|
102
|
-
"#{self.extension.underscore}/screens/#{file}"
|
103
|
-
end
|
118
|
+
"#{url_prefix}/#{self.send(type)}"
|
104
119
|
end
|
105
120
|
|
106
121
|
def to_json
|
@@ -113,6 +128,7 @@ module Lanes
|
|
113
128
|
js: js,
|
114
129
|
css: css,
|
115
130
|
assets: [js, css].reject{|asset| asset.blank? },
|
131
|
+
access: model_access,
|
116
132
|
group_id: group_id,
|
117
133
|
extension: extension,
|
118
134
|
url_prefix: url_prefix,
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Lanes
|
2
|
+
|
3
|
+
class SystemSettings < Lanes::Model
|
4
|
+
|
5
|
+
mount_uploader :logo, Lanes::Concerns::ImageUploader
|
6
|
+
|
7
|
+
class ExtensionSettings < OpenStruct
|
8
|
+
def initialize(ext_id, settings)
|
9
|
+
@extension_id = ext_id
|
10
|
+
super(settings)
|
11
|
+
end
|
12
|
+
def persist!
|
13
|
+
SystemSettings.persist!(@extension_id, self.to_h)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
after_commit do
|
18
|
+
Lanes.redis_connection.publish('lanes-system-configuration-update',
|
19
|
+
self.settings)
|
20
|
+
end
|
21
|
+
|
22
|
+
class << self
|
23
|
+
def config
|
24
|
+
@config ||= SystemSettings.find_or_create_by(id: Lanes.config.configuration_id)
|
25
|
+
end
|
26
|
+
|
27
|
+
def for_ext(extension_id)
|
28
|
+
ExtensionSettings.new(extension_id, config.settings[extension_id])
|
29
|
+
end
|
30
|
+
|
31
|
+
def persist!(extension_id, update)
|
32
|
+
config.settings[extension_id] = update
|
33
|
+
config.settings_will_change!
|
34
|
+
config.save!
|
35
|
+
end
|
36
|
+
|
37
|
+
def update_handler
|
38
|
+
lambda do
|
39
|
+
wrap_reply do
|
40
|
+
config = SystemSettings.config
|
41
|
+
if data['settings'].is_a?(Hash)
|
42
|
+
config.update_attributes!(settings: data['settings'])
|
43
|
+
end
|
44
|
+
std_api_reply :update, { settings: config.settings }, success: true
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
Thread.new do
|
52
|
+
Lanes.redis_connection(cache:false).subscribe(
|
53
|
+
'lanes-system-configuration-update') do |on|
|
54
|
+
on.message do |channel, msg|
|
55
|
+
Lanes.logger.warn "Update Config"
|
56
|
+
Lanes::SystemSettings.instance_variable_set(:@config, nil)
|
57
|
+
Lanes::Configuration.apply
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
end
|
data/lib/lanes/version.rb
CHANGED
data/npm-build/base.js
CHANGED
@@ -4,25 +4,32 @@ Lanes.Vendor = ( Lanes.Vendor || {} );
|
|
4
4
|
Lanes.Vendor.Ampersand = ( Lanes.Ampersand || {} );
|
5
5
|
Lanes.Vendor.Ampersand.State = require("ampersand-state");
|
6
6
|
Lanes.Vendor.React = require("react");
|
7
|
+
Lanes.Vendor.ReactDOM = require("react-dom");
|
7
8
|
|
8
9
|
Lanes.Vendor.Ampersand.SubCollection = require("ampersand-subcollection");
|
9
10
|
Lanes.Vendor.Ampersand.RestCollection = require("ampersand-rest-collection");
|
10
11
|
Lanes.Vendor.Ampersand.USCollection = require('ampersand-collection-underscore-mixin');
|
11
12
|
Lanes.Vendor.Ampersand.Collection = require("ampersand-collection");
|
12
13
|
Lanes.Vendor.ReactBootstrap = require("react-bootstrap");
|
13
|
-
Lanes.Vendor.
|
14
|
+
Lanes.Vendor.BrowserHistory = require("history");
|
14
15
|
Lanes.Vendor.Moment = require("moment");
|
15
16
|
Lanes.Vendor.RSVP = require('rsvp');
|
16
17
|
Lanes.Vendor.BBEvents = require('backbone-events-standalone');
|
17
18
|
Lanes.Vendor.xhr = require('xhr');
|
18
|
-
|
19
|
-
|
19
|
+
Lanes.Vendor.ComponentResize = require('react-component-resizable');
|
20
|
+
Lanes.Vendor.List = require('react-list')
|
21
|
+
Lanes.Vendor.Overlay = require('react-overlays');
|
22
|
+
Lanes.log = require('loglevel');
|
20
23
|
Lanes.Vendor.ld = require('lodash');
|
21
24
|
var spf = require('sprintf-js');
|
22
25
|
|
23
26
|
Lanes.Vendor.ld.mixin(require('underscore.inflection'));
|
24
27
|
Lanes.Vendor.s = require('underscore.string');
|
25
28
|
_.mixin(Lanes.Vendor.s.exports());
|
29
|
+
|
30
|
+
_.moment = Lanes.Vendor.Moment;
|
31
|
+
require('moment-range')
|
32
|
+
|
26
33
|
Lanes.Vendor.ld.mixin({
|
27
34
|
Promise : Lanes.Vendor.RSVP.Promise,
|
28
35
|
getPath : require('get-object-path'),
|