Skip to content

Commit 089adee

Browse files
committed
fix: restore web console runtime compatibility
1 parent d7c6293 commit 089adee

17 files changed

Lines changed: 148 additions & 28 deletions

app/application/route.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import RSVP, { reject } from 'rsvp';
2-
import { cancel, next } from '@ember/runloop';
2+
import { cancel, next, scheduleOnce } from '@ember/runloop';
33
import { service } from '@ember/service';
44
import Route from '@ember/routing/route';
55
import C from 'ui/utils/constants';
@@ -47,6 +47,14 @@ export default Route.extend({
4747
},
4848

4949
actions: {
50+
didTransition() {
51+
// Fast route models can complete without entering Ember's loading
52+
// substate. The initial overlay is rendered visible, so always reconcile
53+
// it after a successful transition.
54+
scheduleOnce('afterRender', this, this.hideLoadingOverlay);
55+
return true;
56+
},
57+
5058
loading(transition) {
5159
this.incrementProperty('loadingId');
5260
let id = this.get('loadingId');
@@ -155,6 +163,13 @@ export default Route.extend({
155163
}
156164
},
157165

166+
hideLoadingOverlay() {
167+
cancel(this.get('hideTimer'));
168+
this.set('loadingShown', false);
169+
$('#loading-overlay').stop(true, true).hide();
170+
$('#loading-underlay').stop(true, true).hide();
171+
},
172+
158173
shortcuts: {
159174
'shift+l': 'langToggle',
160175
},

app/resolver.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1-
import Resolver from 'ember-resolver';
1+
import { getComponentTemplate, setComponentTemplate } from '@ember/component';
2+
import EmberResolver from 'ember-resolver';
23

3-
export default Resolver;
4+
export default class Resolver extends EmberResolver {
5+
resolveComponent(parsedName) {
6+
let component = this.resolveOther(parsedName);
7+
8+
if ( component && !getComponentTemplate(component) ) {
9+
let template = this.resolve(`template:components/${parsedName.fullNameWithoutType}`);
10+
11+
if ( template ) {
12+
setComponentTemplate(template, component);
13+
}
14+
}
15+
16+
return component;
17+
}
18+
}

app/services/user-language.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { resolve } from 'rsvp';
22
import { alias } from '@ember/object/computed';
33
import Service, { service } from '@ember/service';
44
import C from 'ui/utils/constants';
5-
import { ajaxPromise } from 'ember-api-store/utils/ajax-promise';
5+
import fetch from 'ember-api-store/utils/fetch';
66
import { loadScript } from 'ui/utils/load-script';
77

88
import { on } from '@ember/object/evented';
@@ -32,6 +32,7 @@ export default Service.extend({
3232
cookies : service(),
3333
userTheme : service('user-theme'),
3434
loadedLocales : null,
35+
translationFetcher: fetch,
3536

3637
bootstrap: on('init', function() {
3738
this.set('loadedLocales', []);
@@ -144,11 +145,21 @@ export default Service.extend({
144145
return resolve();
145146
}
146147

147-
return ajaxPromise({
148-
url: `${this.get('app.baseAssets')}translations/${language}.json?${application.version}`,
148+
let url = `${this.get('app.baseAssets')}translations/${language}.json?${application.version}`;
149+
let translationFetcher = this.get('translationFetcher');
150+
151+
return translationFetcher(url, {
149152
method: 'GET',
150-
dataType: 'json',
153+
headers: {
154+
Accept: 'application/json',
155+
},
151156
}).then((resp) => {
157+
let translations = resp.body;
158+
159+
if ( !translations || typeof translations !== 'object' || Array.isArray(translations) ) {
160+
throw new Error(`Invalid translation response for ${language}`);
161+
}
162+
152163
let polyfillPromise;
153164
if ( this.get('app.needIntlPolyfill') ) {
154165
polyfillPromise = loadScript(`${this.get('app.baseAssets')}assets/intl/locales/${language.toLowerCase()}.js?${application.version}`);
@@ -157,7 +168,7 @@ export default Service.extend({
157168
}
158169

159170
return polyfillPromise.then(() => {
160-
return this.get('intl').addTranslations(language, resp.xhr.responseJSON);
171+
return this.get('intl').addTranslations(language, translations);
161172
}).then(() => {
162173
if ( !loadedLocales.includes(language) ) {
163174
loadedLocales.push(language);

app/styles/app-dark.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ $bootstrap-config: ("gray-base": $gray-base, "gray-darker": $gray-darker, "gray-
623623
@include meta.load-css("app/styles/vendors/liquidfire-tweak");
624624
@include meta.load-css("app/styles/vendors/copy-to-clipboard", $with: ("brand-info": $brand-info, "brand-primary-dark": $brand-primary-dark, "green": $green, "pre-bg": $pre-bg, "primary": $primary));
625625
@include meta.load-css("app/styles/vendors/prism-theme");
626-
@include meta.load-css("vendor/ember-power-select/app/styles/ember-power-select");
626+
// ember-power-select 9 and ember-basic-dropdown 9 ship their base styles as
627+
// v2-addon public CSS. Keep only PastureStack's themed overrides here.
627628
@include meta.load-css("app/styles/vendors/power-select", $with: ("accent-two": $accent-two, "bottom-row": $bottom-row, "dropdown-border": $dropdown-border, "input-bg": $input-bg, "line-height-small": $line-height-small, "link-color": $link-color, "padding-small-horizontal": $padding-small-horizontal, "padding-small-vertical": $padding-small-vertical, "table-bg-accent": $table-bg-accent, "table-bg-hover": $table-bg-hover, "text-color": $text-color));
628629
@include meta.load-css("app/styles/vendors/bootstrap-tweak", $with: ("accent-two": $accent-two, "blueTwo": $blueTwo, "body-bg": $body-bg, "bold-weight": $bold-weight, "border-radius-base": $border-radius-base, "brand-danger": $brand-danger, "brand-info": $brand-info, "brand-primary": $brand-primary, "brand-success": $brand-success, "brand-warning": $brand-warning, "btn-danger-hover": $btn-danger-hover, "btn-default-bg": $btn-default-bg, "btn-default-border": $btn-default-border, "btn-default-color": $btn-default-color, "btn-default-hover": $btn-default-hover, "btn-disabled-bg": $btn-disabled-bg, "btn-disabled-color": $btn-disabled-color, "btn-primary-bg": $btn-primary-bg, "btn-primary-border": $btn-primary-border, "btn-primary-color": $btn-primary-color, "btn-primary-hover": $btn-primary-hover, "dropdown-bg": $dropdown-bg, "dropdown-link-color": $dropdown-link-color, "greenDark": $greenDark, "icon-chevron-down": $icon-chevron-down, "icon-chevron-up": $icon-chevron-up, "input-bg": $input-bg, "input-border": $input-border, "input-color": $input-color, "lightGray": $lightGray, "lightGrayTwo": $lightGrayTwo, "lightTealDark": $lightTealDark, "line-height-computed": $line-height-computed, "link-color": $link-color, "midGray": $midGray, "midGrayDark": $midGrayDark, "normal-weight": $normal-weight, "page-header-border-color": $page-header-border-color, "primary": $primary, "primaryDark": $primaryDark, "redDark": $redDark, "table-bg": $table-bg, "table-border-color": $table-border-color, "tealTwoDark": $tealTwoDark, "text-color": $text-color, "well-bg": $well-bg, "yellowDark": $yellowDark));
629630

app/styles/app-light.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,8 @@ $bootstrap-config: ("gray-base": $gray-base, "gray-darker": $gray-darker, "gray-
623623
@include meta.load-css("app/styles/vendors/liquidfire-tweak");
624624
@include meta.load-css("app/styles/vendors/copy-to-clipboard", $with: ("brand-info": $brand-info, "brand-primary-dark": $brand-primary-dark, "green": $green, "pre-bg": $pre-bg, "primary": $primary));
625625
@include meta.load-css("app/styles/vendors/prism-theme");
626-
@include meta.load-css("vendor/ember-power-select/app/styles/ember-power-select");
626+
// ember-power-select 9 and ember-basic-dropdown 9 ship their base styles as
627+
// v2-addon public CSS. Keep only PastureStack's themed overrides here.
627628
@include meta.load-css("app/styles/vendors/power-select", $with: ("accent-two": $accent-two, "bottom-row": $bottom-row, "dropdown-border": $dropdown-border, "input-bg": $input-bg, "line-height-small": $line-height-small, "link-color": $link-color, "padding-small-horizontal": $padding-small-horizontal, "padding-small-vertical": $padding-small-vertical, "table-bg-accent": $table-bg-accent, "table-bg-hover": $table-bg-hover, "text-color": $text-color));
628629
@include meta.load-css("app/styles/vendors/bootstrap-tweak", $with: ("accent-two": $accent-two, "blueTwo": $blueTwo, "body-bg": $body-bg, "bold-weight": $bold-weight, "border-radius-base": $border-radius-base, "brand-danger": $brand-danger, "brand-info": $brand-info, "brand-primary": $brand-primary, "brand-success": $brand-success, "brand-warning": $brand-warning, "btn-danger-hover": $btn-danger-hover, "btn-default-bg": $btn-default-bg, "btn-default-border": $btn-default-border, "btn-default-color": $btn-default-color, "btn-default-hover": $btn-default-hover, "btn-disabled-bg": $btn-disabled-bg, "btn-disabled-color": $btn-disabled-color, "btn-primary-bg": $btn-primary-bg, "btn-primary-border": $btn-primary-border, "btn-primary-color": $btn-primary-color, "btn-primary-hover": $btn-primary-hover, "dropdown-bg": $dropdown-bg, "dropdown-link-color": $dropdown-link-color, "greenDark": $greenDark, "icon-chevron-down": $icon-chevron-down, "icon-chevron-up": $icon-chevron-up, "input-bg": $input-bg, "input-border": $input-border, "input-color": $input-color, "lightGray": $lightGray, "lightGrayTwo": $lightGrayTwo, "lightTealDark": $lightTealDark, "line-height-computed": $line-height-computed, "link-color": $link-color, "midGray": $midGray, "midGrayDark": $midGrayDark, "normal-weight": $normal-weight, "page-header-border-color": $page-header-border-color, "primary": $primary, "primaryDark": $primaryDark, "redDark": $redDark, "table-bg": $table-bg, "table-border-color": $table-border-color, "tealTwoDark": $tealTwoDark, "text-color": $text-color, "well-bg": $well-bg, "yellowDark": $yellowDark));
629630

config/environment.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ module.exports = function(environment) {
5353
rootURL: '/',
5454
locationType: 'history',
5555
EmberENV: {
56+
// The inherited 1.6 application and ember-api-store still use Ember's
57+
// observable NativeArray methods. Ember 7 disables these extensions by
58+
// default, so keep the compatibility layer enabled until those call
59+
// sites are migrated deliberately.
60+
EXTEND_PROTOTYPES: {
61+
Array: true
62+
},
5663
FEATURES: {
5764
// Here you can enable experimental features on an ember canary build
5865
// e.g. 'with-controller': true

ember-cli-build.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ var env = EmberApp.env();
55
var dartSass = require('sass');
66
var buildTranslationTrees = require('./lib/production-translations').buildTranslationTrees;
77

8+
var themeOutputPaths = {
9+
'app-light': '/assets/ui-light.css',
10+
'app-dark': '/assets/ui-dark.css'
11+
};
812

913
module.exports = function(defaults) {
1014
// Pull in a few useful environment settings for index.html to use
@@ -36,11 +40,7 @@ module.exports = function(defaults) {
3640
},
3741
outputPaths: {
3842
app: {
39-
js: '/assets/ui.js',
40-
css: {
41-
'app-light': '/assets/ui-light.css',
42-
'app-dark': '/assets/ui-dark.css'
43-
}
43+
js: '/assets/ui.js'
4444
}
4545
},
4646
nodeAssets: {
@@ -91,6 +91,13 @@ module.exports = function(defaults) {
9191
},
9292
});
9393

94+
// Ember CLI 7 normalizes app CSS output paths after reading the build
95+
// options, which otherwise silently replaces the two runtime themes with an
96+
// empty ui.css compiled from app.scss. Keep both the public option and the
97+
// already-created default packager on the same explicit theme contract.
98+
app.options.outputPaths.app.css = themeOutputPaths;
99+
app._defaultPackager.distPaths.appCssFile = themeOutputPaths;
100+
94101
// Use `app.import` to add additional libraries to the generated
95102
// output files.
96103
//

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pasturestack/web-console",
3-
"version": "1.6.56-pasturestack.32",
3+
"version": "1.6.56-pasturestack.33",
44
"private": true,
55
"directories": {
66
"doc": "doc",

patches/ember-api-store+2.8.5.patch

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,12 @@ diff --git a/node_modules/ember-api-store/addon/mixins/type.js b/node_modules/em
109109
index 721f184..d10c1ca 100644
110110
--- a/node_modules/ember-api-store/addon/mixins/type.js
111111
+++ b/node_modules/ember-api-store/addon/mixins/type.js
112-
@@ -1,11 +1,13 @@
112+
@@ -1,11 +1,14 @@
113113
-import Ember from 'ember';
114114
-import { get } from '@ember/object';
115115
+import Mixin from '@ember/object/mixin';
116-
+import { beginPropertyChanges, computed, endPropertyChanges, get } from '@ember/object';
116+
+import { computed, get } from '@ember/object';
117+
+import { beginPropertyChanges, endPropertyChanges } from '@ember/-internals/metal';
117118
+import { isArray } from '@ember/array';
118119
+import { reject } from 'rsvp';
119120
import Serializable from './serializable';
@@ -295,7 +296,7 @@ diff --git a/node_modules/ember-api-store/addon/services/store.js b/node_modules
295296
index 7e80cdf..22e33a4 100644
296297
--- a/node_modules/ember-api-store/addon/services/store.js
297298
+++ b/node_modules/ember-api-store/addon/services/store.js
298-
@@ -1,28 +1,20 @@
299+
@@ -1,28 +1,21 @@
299300
-import Ember from 'ember';
300301
+import Service, { service } from '@ember/service';
301302
+import ArrayProxy from '@ember/array/proxy';
@@ -309,7 +310,8 @@ index 7e80cdf..22e33a4 100644
309310
-import { get, set } from '@ember/object';
310311
-import { reject } from 'rsvp';
311312
-import { inject as service } from '@ember/service';
312-
+import { beginPropertyChanges, computed, endPropertyChanges, get, getProperties, set } from '@ember/object';
313+
+import { computed, get, getProperties, set } from '@ember/object';
314+
+import { beginPropertyChanges, endPropertyChanges } from '@ember/-internals/metal';
313315
+import { defer, reject, resolve } from 'rsvp';
314316
import { isArray } from '@ember/array';
315317
import { parse as setCookieParser } from 'set-cookie-parser';

0 commit comments

Comments
 (0)