logster 2.21.0 → 3.0.0
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/CHANGELOG.md +20 -0
- data/README.md +29 -14
- data/assets/javascript/main-B82IoCiW.js +1 -0
- data/assets/javascript/modules-4-12-BHA4lR2U.js +1 -0
- data/assets/javascript/vendor.js +11 -5260
- data/assets/logster-config.json +18 -0
- data/assets/manifest.json +23 -0
- data/assets/stylesheets/main-CgAFFyi8.css +1 -0
- data/lib/logster/configuration.rb +1 -0
- data/lib/logster/middleware/reporter.rb +34 -3
- data/lib/logster/middleware/viewer.rb +204 -32
- data/lib/logster/rails/railtie.rb +4 -20
- data/lib/logster/redis_store.rb +0 -2
- data/lib/logster/version.rb +1 -1
- data/lib/logster.rb +1 -1
- metadata +17 -186
- data/.github/workflows/ci.yml +0 -140
- data/.gitignore +0 -3
- data/.rubocop.yml +0 -12
- data/.streerc +0 -2
- data/Gemfile +0 -10
- data/Guardfile +0 -10
- data/Rakefile +0 -24
- data/assets/javascript/.gitkeep +0 -0
- data/assets/javascript/chunk.524.b7d0b89d25457a72409c.js +0 -22
- data/assets/javascript/chunk.582.5a04ae4713e692cd335a.js +0 -22
- data/assets/javascript/chunk.747.a730c497582bb6742a6e.js +0 -579
- data/assets/javascript/chunk.761.64949d89942c829e5c1b.js +0 -1213
- data/assets/javascript/client-app.js +0 -1389
- data/assets/stylesheets/.gitkeep +0 -0
- data/assets/stylesheets/client-app.css +0 -1
- data/assets/stylesheets/vendor.css +0 -1
- data/build_client_app.sh +0 -10
- data/client-app/.editorconfig +0 -19
- data/client-app/.ember-cli +0 -9
- data/client-app/.eslintignore +0 -20
- data/client-app/.eslintrc +0 -10
- data/client-app/.gitignore +0 -23
- data/client-app/.prettierignore +0 -21
- data/client-app/.prettierrc +0 -1
- data/client-app/.template-lintrc.js +0 -10
- data/client-app/.watchmanconfig +0 -3
- data/client-app/README.md +0 -56
- data/client-app/app/app.js +0 -12
- data/client-app/app/components/actions-menu.js +0 -50
- data/client-app/app/components/back-to-site-link.js +0 -9
- data/client-app/app/components/back-trace.js +0 -153
- data/client-app/app/components/env-tab.js +0 -68
- data/client-app/app/components/message-info.js +0 -151
- data/client-app/app/components/message-row.js +0 -46
- data/client-app/app/components/page-nav.js +0 -42
- data/client-app/app/components/panel-resizer.js +0 -108
- data/client-app/app/components/patterns-list.js +0 -142
- data/client-app/app/components/tab-contents.js +0 -23
- data/client-app/app/components/tabbed-section.js +0 -45
- data/client-app/app/components/time-formatter.js +0 -36
- data/client-app/app/controllers/index.js +0 -288
- data/client-app/app/controllers/show.js +0 -39
- data/client-app/app/helpers/logster-url.js +0 -12
- data/client-app/app/helpers/or.js +0 -7
- data/client-app/app/index.html +0 -31
- data/client-app/app/initializers/app-init.js +0 -71
- data/client-app/app/lib/decorators.js +0 -13
- data/client-app/app/lib/preload.js +0 -43
- data/client-app/app/lib/utilities.js +0 -230
- data/client-app/app/models/group.js +0 -34
- data/client-app/app/models/message-collection.js +0 -303
- data/client-app/app/models/message.js +0 -128
- data/client-app/app/models/pattern-item.js +0 -32
- data/client-app/app/resolver.js +0 -3
- data/client-app/app/router.js +0 -13
- data/client-app/app/routes/index.js +0 -64
- data/client-app/app/routes/settings.js +0 -32
- data/client-app/app/routes/show.js +0 -16
- data/client-app/app/services/events.js +0 -4
- data/client-app/app/styles/app.css +0 -898
- data/client-app/app/templates/application.hbs +0 -1
- data/client-app/app/templates/components/actions-menu.hbs +0 -31
- data/client-app/app/templates/components/back-to-site-link.hbs +0 -8
- data/client-app/app/templates/components/back-trace.hbs +0 -15
- data/client-app/app/templates/components/env-tab.hbs +0 -10
- data/client-app/app/templates/components/message-info.hbs +0 -86
- data/client-app/app/templates/components/message-row.hbs +0 -32
- data/client-app/app/templates/components/page-nav.hbs +0 -37
- data/client-app/app/templates/components/panel-resizer.hbs +0 -3
- data/client-app/app/templates/components/patterns-list.hbs +0 -78
- data/client-app/app/templates/components/tabbed-section.hbs +0 -18
- data/client-app/app/templates/components/time-formatter.hbs +0 -1
- data/client-app/app/templates/index.hbs +0 -192
- data/client-app/app/templates/settings.hbs +0 -47
- data/client-app/app/templates/show.hbs +0 -13
- data/client-app/config/ember-cli-update.json +0 -18
- data/client-app/config/environment.js +0 -51
- data/client-app/config/icons.js +0 -28
- data/client-app/config/optional-features.json +0 -6
- data/client-app/config/targets.js +0 -26
- data/client-app/ember-cli-build.js +0 -34
- data/client-app/package.json +0 -76
- data/client-app/preload-json-manager.rb +0 -35
- data/client-app/public/assets/images/icon_144x144.png +0 -0
- data/client-app/public/assets/images/icon_64x64.png +0 -0
- data/client-app/testem.js +0 -23
- data/client-app/tests/index.html +0 -41
- data/client-app/tests/integration/components/back-to-site-link-test.js +0 -20
- data/client-app/tests/integration/components/back-trace-test.js +0 -138
- data/client-app/tests/integration/components/env-tab-test.js +0 -220
- data/client-app/tests/integration/components/message-info-test.js +0 -122
- data/client-app/tests/integration/components/patterns-list-test.js +0 -76
- data/client-app/tests/test-helper.js +0 -12
- data/client-app/tests/unit/controllers/index-test.js +0 -77
- data/client-app/tests/unit/controllers/show-test.js +0 -12
- data/client-app/tests/unit/routes/index-test.js +0 -11
- data/client-app/tests/unit/routes/show-test.js +0 -11
- data/client-app/yarn.lock +0 -9905
- data/gemfiles/rails_6.1.gemfile +0 -12
- data/gemfiles/rails_7.0.gemfile +0 -12
- data/gemfiles/rails_7.1.gemfile +0 -9
- data/gemfiles/rails_7.2.gemfile +0 -9
- data/logster.gemspec +0 -43
- data/test/dummy/config/application.rb +0 -31
- data/test/dummy/config/boot.rb +0 -6
- data/test/dummy/config/environment.rb +0 -6
- data/test/examples/test_sidekiq_reporter_example.rb +0 -47
- data/test/fake_data/Gemfile +0 -6
- data/test/fake_data/generate.rb +0 -23
- data/test/logster/middleware/test_reporter.rb +0 -84
- data/test/logster/middleware/test_viewer.rb +0 -495
- data/test/logster/test_base_store.rb +0 -224
- data/test/logster/test_cache.rb +0 -39
- data/test/logster/test_defer_logger.rb +0 -36
- data/test/logster/test_group.rb +0 -92
- data/test/logster/test_ignore_pattern.rb +0 -42
- data/test/logster/test_logger.rb +0 -177
- data/test/logster/test_message.rb +0 -269
- data/test/logster/test_pattern.rb +0 -144
- data/test/logster/test_railtie.rb +0 -21
- data/test/logster/test_redis_rate_limiter.rb +0 -246
- data/test/logster/test_redis_store.rb +0 -1165
- data/test/test_helper.rb +0 -66
|
@@ -1,288 +0,0 @@
|
|
|
1
|
-
import classic from "ember-classic-decorator";
|
|
2
|
-
import { debounce } from "@ember/runloop";
|
|
3
|
-
import { action, computed } from "@ember/object";
|
|
4
|
-
import Controller from "@ember/controller";
|
|
5
|
-
import {
|
|
6
|
-
ajax,
|
|
7
|
-
getLocalStorage,
|
|
8
|
-
setLocalStorage,
|
|
9
|
-
} from "client-app/lib/utilities";
|
|
10
|
-
import Preload from "client-app/lib/preload";
|
|
11
|
-
import { tracked } from "@glimmer/tracking";
|
|
12
|
-
|
|
13
|
-
@classic
|
|
14
|
-
export default class IndexController extends Controller {
|
|
15
|
-
@tracked loading = false;
|
|
16
|
-
@tracked buildingGroupingPattern = false;
|
|
17
|
-
@tracked rowMessagesForGroupingPattern = [];
|
|
18
|
-
@tracked showGroupingPatternDialog = false;
|
|
19
|
-
@tracked groupingPatternValue = "";
|
|
20
|
-
|
|
21
|
-
showDebug = getLocalStorage("showDebug", false);
|
|
22
|
-
showInfo = getLocalStorage("showInfo", false);
|
|
23
|
-
showWarn = getLocalStorage("showWarn", true);
|
|
24
|
-
showErr = getLocalStorage("showErr", true);
|
|
25
|
-
showFatal = getLocalStorage("showFatal", true);
|
|
26
|
-
search = null;
|
|
27
|
-
queryParams = ["search"];
|
|
28
|
-
|
|
29
|
-
@computed
|
|
30
|
-
get showSettings() {
|
|
31
|
-
return Preload.get("patterns_enabled");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@computed
|
|
35
|
-
get backToSiteLinkText() {
|
|
36
|
-
return Preload.get("back_to_site_link_text");
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@computed
|
|
40
|
-
get backToSiteLinkPath() {
|
|
41
|
-
return Preload.get("back_to_site_link_path");
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
@computed
|
|
45
|
-
get hasTopMenu() {
|
|
46
|
-
return this.backToSiteLinkText && this.backToSiteLinkPath;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get actionsInMenu() {
|
|
50
|
-
return (
|
|
51
|
-
/mobile/i.test(navigator.userAgent) && !/iPad/.test(navigator.userAgent)
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get showCreateGroupingPattern() {
|
|
56
|
-
return (
|
|
57
|
-
this.buildingGroupingPattern &&
|
|
58
|
-
this.rowMessagesForGroupingPattern.length > 1
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
@computed("search")
|
|
63
|
-
get searchTerm() {
|
|
64
|
-
if (this.search) {
|
|
65
|
-
this.doSearch(this.search);
|
|
66
|
-
return this.search;
|
|
67
|
-
}
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
async doSearch(term) {
|
|
72
|
-
this.model.set("search", term);
|
|
73
|
-
this.loading = true;
|
|
74
|
-
await this.model.reload();
|
|
75
|
-
this.loading = false;
|
|
76
|
-
this.model.updateSelectedRow();
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
resizePanels(amount) {
|
|
80
|
-
const bottomPanel = document.getElementById("bottom-panel");
|
|
81
|
-
const topPanel = document.getElementById("top-panel");
|
|
82
|
-
bottomPanel.style.height = `${amount - 13}px`;
|
|
83
|
-
topPanel.style.bottom = `${amount + 12}px`;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
@action
|
|
87
|
-
expandMessage(message) {
|
|
88
|
-
message.expand();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
@action
|
|
92
|
-
selectRowAction(row, opts = {}) {
|
|
93
|
-
this.model.selectRow(row, opts);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
@action
|
|
97
|
-
handleCheckboxChange(row, event) {
|
|
98
|
-
if (event.target.checked) {
|
|
99
|
-
this.rowMessagesForGroupingPattern = [
|
|
100
|
-
...this.rowMessagesForGroupingPattern,
|
|
101
|
-
row.message,
|
|
102
|
-
];
|
|
103
|
-
} else {
|
|
104
|
-
this.rowMessagesForGroupingPattern =
|
|
105
|
-
this.rowMessagesForGroupingPattern.filter((i) => i !== row.message);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
@action
|
|
110
|
-
tabChangedAction(newTab) {
|
|
111
|
-
this.model.tabChanged(newTab);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
@action
|
|
115
|
-
showMoreBefore() {
|
|
116
|
-
this.model.showMoreBefore();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
@action
|
|
120
|
-
loadMore() {
|
|
121
|
-
return this.model.loadMore();
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
@action
|
|
125
|
-
async clear() {
|
|
126
|
-
// eslint-disable-next-line no-alert
|
|
127
|
-
if (confirm("Clear the logs?\n\nCancel = No, OK = Clear")) {
|
|
128
|
-
await ajax("/clear", { type: "POST" });
|
|
129
|
-
this.model.reload();
|
|
130
|
-
this.loading = false;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
@action
|
|
135
|
-
removeMessage(msg) {
|
|
136
|
-
const group = this.model.currentRow.group ? this.model.currentRow : null;
|
|
137
|
-
const rows = this.model.rows;
|
|
138
|
-
const idx = group ? rows.indexOf(group) : rows.indexOf(msg);
|
|
139
|
-
|
|
140
|
-
msg.destroy();
|
|
141
|
-
msg.set("selected", false);
|
|
142
|
-
this.model.set("total", this.model.total - 1);
|
|
143
|
-
let removedRow = false;
|
|
144
|
-
let messageIndex = 0;
|
|
145
|
-
|
|
146
|
-
if (group) {
|
|
147
|
-
messageIndex = group.messages.indexOf(msg);
|
|
148
|
-
group.messages.removeObject(msg);
|
|
149
|
-
messageIndex = Math.min(messageIndex, group.messages.length - 1);
|
|
150
|
-
if (group.messages.length === 0) {
|
|
151
|
-
rows.removeObject(group);
|
|
152
|
-
removedRow = true;
|
|
153
|
-
}
|
|
154
|
-
} else {
|
|
155
|
-
rows.removeObject(msg);
|
|
156
|
-
removedRow = true;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
if (removedRow) {
|
|
160
|
-
if (idx > 0) {
|
|
161
|
-
this.model.selectRow(rows[idx - 1]);
|
|
162
|
-
} else if (this.model.total > 0) {
|
|
163
|
-
this.model.selectRow(rows[0]);
|
|
164
|
-
} else {
|
|
165
|
-
this.model.reload();
|
|
166
|
-
}
|
|
167
|
-
} else if (group) {
|
|
168
|
-
this.model.selectRow(rows[idx], { messageIndex });
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
@action
|
|
173
|
-
solveMessage(msg) {
|
|
174
|
-
this.model.solve(msg);
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
@action
|
|
178
|
-
groupedMessageChangedAction(newPosition) {
|
|
179
|
-
this.model.groupedMessageChanged(newPosition);
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
@action
|
|
183
|
-
envChangedAction(newPosition) {
|
|
184
|
-
this.model.envChanged(newPosition);
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@action
|
|
188
|
-
async updateFilter(name) {
|
|
189
|
-
this.toggleProperty(name);
|
|
190
|
-
this.model.set(name, this[name]);
|
|
191
|
-
setLocalStorage(name, this[name]);
|
|
192
|
-
this.loading = true;
|
|
193
|
-
await this.model.reload();
|
|
194
|
-
this.loading = false;
|
|
195
|
-
this.model.updateSelectedRow();
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
@action
|
|
199
|
-
updateSearch(event) {
|
|
200
|
-
const term = event.target.value;
|
|
201
|
-
|
|
202
|
-
if (term === this.search) {
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (term && term.length === 1) {
|
|
207
|
-
return;
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
debounce(this, this.doSearch, term, 250);
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
@action
|
|
214
|
-
toggleGroupingPatternFromSelectedRows() {
|
|
215
|
-
this.buildingGroupingPattern = !this.buildingGroupingPattern;
|
|
216
|
-
this.rowMessagesForGroupingPattern = [];
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
@action
|
|
220
|
-
createGroupingPatternFromSelectedRows() {
|
|
221
|
-
let match = this.findLongestMatchingPrefix(
|
|
222
|
-
this.rowMessagesForGroupingPattern
|
|
223
|
-
);
|
|
224
|
-
match = this.escapeRegExp(match);
|
|
225
|
-
|
|
226
|
-
if (!match.trim().length) {
|
|
227
|
-
// eslint-disable-next-line no-alert
|
|
228
|
-
alert("Can not create a grouping pattern with the given rows");
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
this.groupingPatternValue = match;
|
|
233
|
-
this.showGroupingPatternDialog = true;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
@action
|
|
237
|
-
updateGroupingPatternValue(event) {
|
|
238
|
-
this.groupingPatternValue = event.target.value;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
@action
|
|
242
|
-
async confirmGroupingPattern() {
|
|
243
|
-
const pattern = this.groupingPatternValue.trim();
|
|
244
|
-
if (!pattern.length) {
|
|
245
|
-
return;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
await ajax("/patterns/grouping.json", {
|
|
249
|
-
method: "POST",
|
|
250
|
-
data: { pattern },
|
|
251
|
-
});
|
|
252
|
-
this.showGroupingPatternDialog = false;
|
|
253
|
-
this.groupingPatternValue = "";
|
|
254
|
-
this.rowMessagesForGroupingPattern = [];
|
|
255
|
-
this.buildingGroupingPattern = false;
|
|
256
|
-
this.model.reload();
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
@action
|
|
260
|
-
cancelGroupingPattern() {
|
|
261
|
-
this.showGroupingPatternDialog = false;
|
|
262
|
-
this.groupingPatternValue = "";
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
findLongestMatchingPrefix(strings) {
|
|
266
|
-
const shortestString = strings.reduce(
|
|
267
|
-
(shortest, str) => (str.length < shortest.length ? str : shortest),
|
|
268
|
-
strings[0]
|
|
269
|
-
);
|
|
270
|
-
|
|
271
|
-
let longestMatchingSubstring = "";
|
|
272
|
-
for (let i = 0; i < shortestString.length; i++) {
|
|
273
|
-
const currentSubstring = shortestString.substring(0, i + 1);
|
|
274
|
-
|
|
275
|
-
if (strings.every((str) => str.includes(currentSubstring))) {
|
|
276
|
-
longestMatchingSubstring = currentSubstring;
|
|
277
|
-
} else {
|
|
278
|
-
break;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return longestMatchingSubstring;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
escapeRegExp(string) {
|
|
286
|
-
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); // $& means the whole matched string
|
|
287
|
-
}
|
|
288
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import classic from "ember-classic-decorator";
|
|
2
|
-
import Controller, { inject as controller } from "@ember/controller";
|
|
3
|
-
import { action } from "@ember/object";
|
|
4
|
-
import { inject as service } from "@ember/service";
|
|
5
|
-
|
|
6
|
-
@classic
|
|
7
|
-
export default class ShowController extends Controller {
|
|
8
|
-
@service router;
|
|
9
|
-
@controller("index") indexController;
|
|
10
|
-
|
|
11
|
-
envPosition = 0;
|
|
12
|
-
|
|
13
|
-
@action
|
|
14
|
-
protect() {
|
|
15
|
-
this.model.protect();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@action
|
|
19
|
-
unprotect() {
|
|
20
|
-
this.model.unprotect();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
@action
|
|
24
|
-
async solveMessage(msg) {
|
|
25
|
-
await msg.solve();
|
|
26
|
-
this.router.transitionTo("index");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@action
|
|
30
|
-
async removeMessage(msg) {
|
|
31
|
-
await msg.destroy();
|
|
32
|
-
this.router.transitionTo("index");
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@action
|
|
36
|
-
envChanged(newPosition) {
|
|
37
|
-
this.set("envPosition", newPosition);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { helper } from "@ember/component/helper";
|
|
2
|
-
import { getRootPath } from "client-app/lib/preload";
|
|
3
|
-
|
|
4
|
-
export function logsterUrl(arr) {
|
|
5
|
-
let url = arr[0];
|
|
6
|
-
if (url[0] !== "/") {
|
|
7
|
-
url = `/${url}`;
|
|
8
|
-
}
|
|
9
|
-
return getRootPath() + url;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default helper(logsterUrl);
|
data/client-app/app/index.html
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
6
|
-
<title>ClientApp</title>
|
|
7
|
-
<meta name="description" content="">
|
|
8
|
-
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=yes">
|
|
9
|
-
<meta id="preloaded-data" data-root-path="/logs">
|
|
10
|
-
<meta name="color-scheme" content="dark light">
|
|
11
|
-
|
|
12
|
-
{{content-for "head"}}
|
|
13
|
-
|
|
14
|
-
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/vendor.css">
|
|
15
|
-
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/client-app.css">
|
|
16
|
-
<link rel="shortcut icon" href="{{rootURL}}assets/images/icon_64x64.png">
|
|
17
|
-
|
|
18
|
-
<link href='//fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
|
|
19
|
-
<link href='//fonts.googleapis.com/css?family=Roboto+Mono' rel='stylesheet' type='text/css'>
|
|
20
|
-
|
|
21
|
-
{{content-for "head-footer"}}
|
|
22
|
-
</head>
|
|
23
|
-
<body>
|
|
24
|
-
{{content-for "body"}}
|
|
25
|
-
|
|
26
|
-
<script src="{{rootURL}}assets/vendor.js"></script>
|
|
27
|
-
<script src="{{rootURL}}assets/client-app.js"></script>
|
|
28
|
-
|
|
29
|
-
{{content-for "body-footer"}}
|
|
30
|
-
</body>
|
|
31
|
-
</html>
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ajax,
|
|
3
|
-
resetTitleCount,
|
|
4
|
-
updateHiddenProperty,
|
|
5
|
-
} from "client-app/lib/utilities";
|
|
6
|
-
import { setRootPath } from "client-app/lib/preload";
|
|
7
|
-
|
|
8
|
-
export async function initialize(app) {
|
|
9
|
-
const config = app.resolveRegistration("config:environment");
|
|
10
|
-
setRootPath(config.rootURL.replace(/\/$/, ""));
|
|
11
|
-
|
|
12
|
-
if (config.environment === "development") {
|
|
13
|
-
app.deferReadiness();
|
|
14
|
-
|
|
15
|
-
try {
|
|
16
|
-
const data = await ajax("/development-preload.json");
|
|
17
|
-
const elem = document.getElementById("preloaded-data");
|
|
18
|
-
elem.setAttribute("data-preloaded", JSON.stringify(data));
|
|
19
|
-
} catch (xhr) {
|
|
20
|
-
console.error("Fetching preload data failed.", xhr); // eslint-disable-line no-console
|
|
21
|
-
} finally {
|
|
22
|
-
app.advanceReadiness();
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// config for moment.js
|
|
27
|
-
moment.updateLocale("en", {
|
|
28
|
-
relativeTime: {
|
|
29
|
-
future: "in %s",
|
|
30
|
-
past: "%s ago",
|
|
31
|
-
s: "secs",
|
|
32
|
-
m: "a min",
|
|
33
|
-
mm: "%d mins",
|
|
34
|
-
h: "an hr",
|
|
35
|
-
hh: "%d hrs",
|
|
36
|
-
d: "a day",
|
|
37
|
-
dd: "%d days",
|
|
38
|
-
M: "a mth",
|
|
39
|
-
MM: "%d mths",
|
|
40
|
-
y: "a yr",
|
|
41
|
-
yy: "%d yrs",
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// setup event for updating document title and title count
|
|
46
|
-
let hiddenProperty;
|
|
47
|
-
let visibilitychange;
|
|
48
|
-
|
|
49
|
-
for (const prefix of ["", "webkit", "ms", "moz", "ms"]) {
|
|
50
|
-
const check = prefix + (prefix === "" ? "hidden" : "Hidden");
|
|
51
|
-
|
|
52
|
-
if (document[check] !== undefined) {
|
|
53
|
-
hiddenProperty = check;
|
|
54
|
-
visibilitychange = prefix + "visibilitychange";
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
updateHiddenProperty(hiddenProperty);
|
|
60
|
-
document.addEventListener(visibilitychange, resetTitleCount, false);
|
|
61
|
-
|
|
62
|
-
const isMobile =
|
|
63
|
-
/mobile/i.test(navigator.userAgent) && !/iPad/.test(navigator.userAgent);
|
|
64
|
-
if (isMobile) {
|
|
65
|
-
document.body.classList.add("mobile");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export default {
|
|
70
|
-
initialize,
|
|
71
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function bound(target, key, desc) {
|
|
2
|
-
const orig = desc.value;
|
|
3
|
-
const boundKey = `_${key}Bound`;
|
|
4
|
-
return {
|
|
5
|
-
get() {
|
|
6
|
-
if (this[boundKey]) {
|
|
7
|
-
return this[boundKey];
|
|
8
|
-
}
|
|
9
|
-
this.set(boundKey, orig.bind(this));
|
|
10
|
-
return this[boundKey];
|
|
11
|
-
},
|
|
12
|
-
};
|
|
13
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { set } from "@ember/object";
|
|
2
|
-
|
|
3
|
-
let CONTAINER = {};
|
|
4
|
-
let isInitialized = false;
|
|
5
|
-
let rootPath;
|
|
6
|
-
|
|
7
|
-
export function setRootPath(path) {
|
|
8
|
-
rootPath = path;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function getRootPath() {
|
|
12
|
-
return rootPath;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// exported so that it can be used in tests
|
|
16
|
-
export function init() {
|
|
17
|
-
const dataset = document.getElementById("preloaded-data").dataset;
|
|
18
|
-
CONTAINER = dataset.preloaded ? JSON.parse(dataset.preloaded) : {};
|
|
19
|
-
CONTAINER.rootPath = rootPath;
|
|
20
|
-
isInitialized = true;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
get(key) {
|
|
25
|
-
if (!isInitialized) {
|
|
26
|
-
init();
|
|
27
|
-
}
|
|
28
|
-
return CONTAINER[key];
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
// used in tests
|
|
33
|
-
export function mutatePreload(key, value) {
|
|
34
|
-
if (!isInitialized) {
|
|
35
|
-
init();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
set(CONTAINER, key, value);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function uninitialize() {
|
|
42
|
-
isInitialized = false;
|
|
43
|
-
}
|