altair-rails 0.0.2 → 0.0.3
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/README.md +4 -2
- data/lib/altair/rails/configuration.rb +56 -3
- data/lib/altair/rails/engine.rb +5 -52
- data/lib/altair/rails/version.rb +3 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 344439a2ddfd5623e093e51a9ca06500e41bc98164e2e1882d40a78f36ce8972
|
4
|
+
data.tar.gz: 54c35fb4b182cfdf734e39b098ac09ba0f8b04626986cbb8ed664987e4c23d78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b3425f713767207c1fdac7c65bb9638ff230ac39646174b587a43031375fa594bfec27036f66ed98088707ee367d845c7ff0a97b7e75ad8aff1ab1df965ebf05
|
7
|
+
data.tar.gz: 85ed28c6666dab28382765b14c26724ad37ad563e9cf1e14943c0403a8505a9f7b80ffb7137a54692d69a8307e7140cba930a8cd869f706845b1cee7575af241
|
data/README.md
CHANGED
@@ -51,10 +51,12 @@ end
|
|
51
51
|
|
52
52
|
## License
|
53
53
|
|
54
|
-
|
54
|
+
This project is released under the MIT license:
|
55
55
|
|
56
56
|
* https://opensource.org/licenses/MIT
|
57
57
|
|
58
58
|
Copyright 2023 [jejacks0n](https://github.com/jejacks0n)
|
59
59
|
|
60
|
-
## Make Code Not War
|
60
|
+
## Make Code Not War
|
61
|
+
|
62
|
+
[](http://forthebadge.com)
|
@@ -5,14 +5,19 @@ module Altair
|
|
5
5
|
class Configuration
|
6
6
|
include Singleton
|
7
7
|
|
8
|
-
cattr_accessor(*[
|
8
|
+
cattr_accessor(*[
|
9
|
+
:mount_at,
|
10
|
+
:graphql_path,
|
11
|
+
:action_cable_path,
|
12
|
+
:altair_options,
|
13
|
+
:altair_version,
|
14
|
+
:altair_template
|
15
|
+
])
|
9
16
|
|
10
17
|
# Where you want to mount the engine in your application. If set to nil,
|
11
18
|
# the engine will not be mounted automatically and it will need to be
|
12
19
|
# mounted manually. E.g.: in your routes.rb file, adding:
|
13
20
|
# mount Altair::Rails::Engine => "/altair"`
|
14
|
-
#
|
15
|
-
# Defaults to "/altair".
|
16
21
|
@@mount_at = "/altair"
|
17
22
|
|
18
23
|
# The path to your GraphQL endpoint. This is used to set the endpointURL.
|
@@ -29,6 +34,54 @@ module Altair
|
|
29
34
|
# Generally this should be left to the release version of altair-rails,
|
30
35
|
# but if you really want, you can override it here.
|
31
36
|
@@altair_version = "5.0.28" # Altair::Rails.version
|
37
|
+
|
38
|
+
# Generally this should be left to the release version of altair-rails,
|
39
|
+
# but if you really want, you can override it here.
|
40
|
+
@@altair_template = ->(env) do
|
41
|
+
[200, {}, <<~HTML_BODY]
|
42
|
+
<!DOCTYPE html>
|
43
|
+
<html>
|
44
|
+
<head>
|
45
|
+
<meta charset="utf-8" />
|
46
|
+
<title>Altair</title>
|
47
|
+
<base href="https://cdn.jsdelivr.net/npm/altair-static@#{altair_version}/build/dist/">
|
48
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
49
|
+
<link href="styles.css" rel="stylesheet" />
|
50
|
+
<style>.loading-screen { display: none }</style>
|
51
|
+
</head>
|
52
|
+
<body>
|
53
|
+
<script>
|
54
|
+
// window.__ALTAIR_WEB_APP__ = 1;
|
55
|
+
const defaultOptions = {
|
56
|
+
endpointURL: window.location.origin + "#{graphql_path}",
|
57
|
+
subscriptionsEndpoint: "ws://" + window.location.host + "#{action_cable_path}",
|
58
|
+
initialSubscriptionsProvider: "action-cable"
|
59
|
+
};
|
60
|
+
document.addEventListener('DOMContentLoaded', function() {
|
61
|
+
AltairGraphQL.init(Object.assign({}, defaultOptions, #{altair_options.to_json}));
|
62
|
+
});
|
63
|
+
</script>
|
64
|
+
<app-root>
|
65
|
+
<div class="loading-screen styled">
|
66
|
+
<div class="loading-screen-inner">
|
67
|
+
<div class="loading-screen-logo-container">
|
68
|
+
<img src="assets/img/logo_350.svg" alt="Altair" />
|
69
|
+
</div>
|
70
|
+
<div class="loading-screen-loading-indicator">
|
71
|
+
<span class="loading-indicator-dot"></span>
|
72
|
+
<span class="loading-indicator-dot"></span>
|
73
|
+
<span class="loading-indicator-dot"></span>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
</app-root>
|
78
|
+
<script rel="preload" as="script" type="text/javascript" src="runtime.js"></script>
|
79
|
+
<script rel="preload" as="script" type="text/javascript" src="polyfills.js" ></script>
|
80
|
+
<script rel="preload" as="script" type="text/javascript" src="main.js" ></script>
|
81
|
+
</body>
|
82
|
+
</html>
|
83
|
+
HTML_BODY
|
84
|
+
end
|
32
85
|
end
|
33
86
|
|
34
87
|
mattr_accessor :configuration
|
data/lib/altair/rails/engine.rb
CHANGED
@@ -5,59 +5,12 @@ module Altair
|
|
5
5
|
class Engine < ::Rails::Engine
|
6
6
|
isolate_namespace Altair::Rails
|
7
7
|
|
8
|
-
|
8
|
+
conf = Altair::Rails.configuration
|
9
|
+
opts = { at: conf.mount_at, as: :altair }
|
9
10
|
|
10
|
-
|
11
|
-
config.after_initialize do |app|
|
12
|
-
app.routes.prepend { mount Altair::Rails::Engine => altair_rails.mount_at }
|
13
|
-
end
|
14
|
-
end
|
11
|
+
routes { root to: conf.altair_template }
|
15
12
|
|
16
|
-
routes
|
17
|
-
root to: ->(_) { [200, {}, <<~HTML_BODY] }
|
18
|
-
<!DOCTYPE html>
|
19
|
-
<html>
|
20
|
-
<head>
|
21
|
-
<meta charset="utf-8" />
|
22
|
-
<title>Altair</title>
|
23
|
-
<base href="https://cdn.jsdelivr.net/npm/altair-static@#{altair_rails.altair_version}/build/dist/">
|
24
|
-
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
25
|
-
<link href="styles.css" rel="stylesheet" />
|
26
|
-
<style>.loading-screen { display: none }</style>
|
27
|
-
</head>
|
28
|
-
<body>
|
29
|
-
<script>
|
30
|
-
// window.__ALTAIR_WEB_APP__ = 1;
|
31
|
-
const defaultOptions = {
|
32
|
-
endpointURL: window.location.origin + "#{altair_rails.graphql_path}",
|
33
|
-
subscriptionsEndpoint: "ws://" + window.location.host + "#{altair_rails.action_cable_path}",
|
34
|
-
initialSubscriptionsProvider: "action-cable"
|
35
|
-
};
|
36
|
-
document.addEventListener('DOMContentLoaded', function() {
|
37
|
-
AltairGraphQL.init(Object.assign({}, defaultOptions, #{altair_rails.altair_options.to_json}));
|
38
|
-
});
|
39
|
-
</script>
|
40
|
-
<app-root>
|
41
|
-
<div class="loading-screen styled">
|
42
|
-
<div class="loading-screen-inner">
|
43
|
-
<div class="loading-screen-logo-container">
|
44
|
-
<img src="assets/img/logo_350.svg" alt="Altair" />
|
45
|
-
</div>
|
46
|
-
<div class="loading-screen-loading-indicator">
|
47
|
-
<span class="loading-indicator-dot"></span>
|
48
|
-
<span class="loading-indicator-dot"></span>
|
49
|
-
<span class="loading-indicator-dot"></span>
|
50
|
-
</div>
|
51
|
-
</div>
|
52
|
-
</div>
|
53
|
-
</app-root>
|
54
|
-
<script rel="preload" as="script" type="text/javascript" src="runtime.js"></script>
|
55
|
-
<script rel="preload" as="script" type="text/javascript" src="polyfills.js" ></script>
|
56
|
-
<script rel="preload" as="script" type="text/javascript" src="main.js" ></script>
|
57
|
-
</body>
|
58
|
-
</html>
|
59
|
-
HTML_BODY
|
60
|
-
end
|
13
|
+
config.after_initialize { |app| app.routes.prepend { mount(Engine, opts) } } if conf.mount_at.present?
|
61
14
|
end
|
62
15
|
end
|
63
|
-
end
|
16
|
+
end
|
data/lib/altair/rails/version.rb
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
|
3
3
|
module Altair
|
4
4
|
module Rails
|
5
|
-
# Returns the currently loaded version
|
6
|
-
# +Gem::Version+.
|
5
|
+
# Returns the currently loaded version as a +Gem::Version+.
|
7
6
|
def self.version
|
8
7
|
Gem::Version.new(VERSION::STRING)
|
9
8
|
end
|
@@ -11,10 +10,10 @@ module Altair
|
|
11
10
|
module VERSION
|
12
11
|
MAJOR = 0
|
13
12
|
MINOR = 0
|
14
|
-
TINY =
|
13
|
+
TINY = 3
|
15
14
|
PRE = nil
|
16
15
|
|
17
16
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
18
17
|
end
|
19
18
|
end
|
20
|
-
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: altair-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Jackson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|