Merge branch 'main' into feature-add-sources-capability

This commit is contained in:
Randall Morey authored and GitHub committed 2021-09-30 08:39:30 -04:00
commit c5c8bcf165
14 files changed
+130 -120

No files matched your search

+1
View File
@@ -89,6 +89,7 @@ These environment variables may be used to customized the build.
| `APP_UPDATER_LATEST_VERSION_LOCATION` | Location of app release to use for updating client. Can be a filepath or url. |
| `BYPASS_CLI_SETUP` | Disable download and extraction of cli. For development use only. |
| `BYPASS_APP_UPDATER` | Disable app updater feature. For development use only. |
| `DISABLE_WINDOW_CHROME` | Disable window chrome. For internal use only. |
### Building for Production
-14
View File
@@ -1,7 +1,6 @@
import Controller from '@ember/controller';
import { inject as service } from '@ember/service';
import config from '../config/environment';
import { computed } from '@ember/object';
export default class ApplicationController extends Controller {
// =services
@@ -11,17 +10,4 @@ export default class ApplicationController extends Controller {
// =attributes
notifyTimeout = config.notifyTimeout;
// =attributes
/**
* Display OS window actions (minimize, fullscreen, close) for
* Windows and Linux as OS frame/shell is disable.
* Does not apply to MacOS.
* @type {boolean}
*/
@computed('isMacOS')
get isFrameless() {
return !this.isMacOS;
}
}
+6 -2
View File
@@ -31,10 +31,14 @@ export default class ApplicationRoute extends Route {
}
/**
* Add OS config on controller.
* Add window frame config on controller.
*/
async setupController(controller) {
controller.set('isMacOS', await this.ipc.invoke('isMacOS'));
controller.set('hasMacOSChrome', await this.ipc.invoke('hasMacOSChrome'));
controller.set(
'showWindowActions',
await this.ipc.invoke('showWindowActions')
);
}
// =actions
+3 -3
View File
@@ -1,14 +1,14 @@
{{page-title (app-name)}}
<Rose::Layout::Global
class='{{if this.isFrameless ' layout-scroll'}}'
class='{{if this.showWindowActions ' layout-scroll'}}'
as |layout|
>
<layout.header>
<Rose::Header
class='{{if (is-loading) ' loading'}}
{{if this.isMacOS ' header-cushion'}}'
{{if this.hasMacOSChrome ' header-cushion'}}'
as |header|
>
<header.brand @logo='logo-app' @text={{app-name}} />
@@ -19,7 +19,7 @@
{{/if}}
<header.utilities as |utilities|>
{{#if this.isFrameless}}
{{#if this.showWindowActions}}
<Rose::Button
@iconOnly='flight-icons/svg/x-16'
@style='warning'
+4 -2
View File
@@ -39,7 +39,7 @@
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"decompress": "^4.2.1",
"devtron": "^1.4.0",
"electron": "12.0.2"
"electron": "12.1.2"
},
"resolutions": {
"highlight.js": "^10.4.1",
@@ -48,6 +48,8 @@
"normalize-url": "^4.5.1",
"jszip": "^3.7.0",
"path-parse": "^1.0.7",
"tar": "^6.1.9"
"tar": "^6.1.9",
"ansi-regex": "^5.0.1",
"nth-check": "^2.0.1"
}
}
+10 -2
View File
@@ -113,11 +113,19 @@ app.on('ready', async () => {
}
Menu.setApplicationMenu(menuTemplate);
/**
* Enable electron OS window frame/chrome for MacOS only.
* Disable frame/chrome regardless of OS when
* `DISABLE_WINDOW_CHROME=true`.
*/
let showWindowChrome = isMac();
if (process.env.DISABLE_WINDOW_CHROME) showWindowChrome = false;
const browserWindowOptions = {
width: 1280,
height: 760,
titleBarStyle: 'hiddenInset',
frame: isMac(),
frame: showWindowChrome,
titleBarStyle: showWindowChrome ? 'hiddenInset' : 'none',
webPreferences: {
partition,
sandbox: true,
+15 -2
View File
@@ -69,9 +69,22 @@ handle('connect', ({ target_id, token, host_id }) =>
handle('stop', ({ session_id }) => sessionManager.stopById(session_id));
/**
* Check for MacOS OS
* Check for OS window chrome. Enabled on MacOS only.
* Window chrome is disabled regardless of platform for
* `DISABLE_WINDOW_CHROME=true`.
*/
handle('isMacOS', () => isMac());
handle('hasMacOSChrome', () =>
process.env.DISABLE_WINDOW_CHROME ? false : isMac()
);
/**
* Show window actions for non-MacOS platforms.
* Window actions are disabled regardless of platform for
* `DISABLE_WINDOW_CHROME=true`.
*/
handle('showWindowActions', () =>
process.env.DISABLE_WINDOW_CHROME ? false : !isMac()
);
/**
* Minimize window
+12 -22
View File
@@ -416,20 +416,10 @@ ansi-escapes@^4.2.1:
dependencies:
type-fest "^0.21.3"
ansi-regex@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df"
integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8=
ansi-regex@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998"
integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=
ansi-regex@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75"
integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==
ansi-regex@^2.0.0, ansi-regex@^3.0.0, ansi-regex@^5.0.0, ansi-regex@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.1.tgz#082cb2c89c9fe8659a311a53bd6a4dc5301db304"
integrity sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==
ansi-styles@^4.0.0, ansi-styles@^4.1.0:
version "4.3.0"
@@ -1267,10 +1257,10 @@ electron-winstaller@^5.0.0:
lodash.template "^4.2.2"
temp "^0.9.0"
electron@12.0.2:
version "12.0.2"
resolved "https://registry.yarnpkg.com/electron/-/electron-12.0.2.tgz#d92be205f1937627bd6718aad44ac161382b4c2d"
integrity sha512-14luh9mGzfL4e0sncyy0+kW37IU7Y0Y1tvI97FDRSW0ZBQxi5cmAwSs5dmPmNBFBIGtzkaGaEB01j9RjZuCmow==
electron@12.1.2:
version "12.1.2"
resolved "https://registry.yarnpkg.com/electron/-/electron-12.1.2.tgz#aca178efc40fe422f7bfeddeeec63e40c11a16c5"
integrity sha512-yWlnKfJYDsvJjV2GyiBqpbqYI4DkTwk1OP/YRVodp9tfDLqAp9VdE8VZXbl1y29pZtIY+/YtUedBQc1RY3RMqQ==
dependencies:
"@electron/get" "^1.0.1"
"@types/node" "^14.6.2"
@@ -2600,10 +2590,10 @@ npmlog@^4.0.2, npmlog@^4.1.2:
gauge "~2.7.3"
set-blocking "~2.0.0"
nth-check@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.0.0.tgz#1bb4f6dac70072fc313e8c9cd1417b5074c0a125"
integrity sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q==
nth-check@^2.0.0, nth-check@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.0.1.tgz#2efe162f5c3da06a28959fbd3db75dbeea9f0fc2"
integrity sha512-it1vE95zF6dTT9lBsYbxvqh0Soy4SPowchj0UBGj/V6cTPnXXtQOPUbhZ6CmGzAD/rW22LQK6E96pcdJXk4A4w==
dependencies:
boolbase "^1.0.0"
+30 -10
View File
@@ -47,21 +47,41 @@ module('Acceptance | origin', function (hooks) {
sinon.restore();
});
test('visiting index on MacOS hides custom window actions', async function (assert) {
test('visiting index with chrome disabled hides custom window actions', async function (assert) {
assert.expect(3);
stubs.ipcService.withArgs('isMacOS').returns(true);
stubs.ipcService.withArgs('showWindowActions').returns(false);
await visit(urls.origin);
assert.notOk(find('.button-window-close'));
assert.notOk(find('.button-window-minimize'));
assert.notOk(find('.button-window-fullscreen'));
assert.notOk(find('.button-window-close'), 'Window close button');
assert.notOk(find('.button-window-minimize'), 'Window minimize button');
assert.notOk(find('.button-window-fullscreen'), 'Window fullscreen button');
});
test('visiting index on non-MacOS shows custom window actions', async function (assert) {
test('visiting index with chrome enabled shows custom window actions', async function (assert) {
assert.expect(3);
stubs.ipcService.withArgs('isMacOS').returns(false);
stubs.ipcService.withArgs('showWindowActions').returns(true);
await visit(urls.origin);
assert.ok(find('.button-window-close'));
assert.ok(find('.button-window-minimize'));
assert.ok(find('.button-window-fullscreen'));
assert.ok(find('.button-window-close'), 'Window close button');
assert.ok(find('.button-window-minimize'), 'Window minimize button');
assert.ok(find('.button-window-fullscreen'), 'Window fullscreen button');
});
test('visiting index with MacOS chrome enabled', async function (assert) {
assert.expect(1);
stubs.ipcService.withArgs('hasMacOSChrome').returns(true);
await visit(urls.origin);
assert.ok(
find('.rose-header.header-cushion'),
'Adds header padding around native window actions'
);
});
test('visiting index with MacOS chrome disabled', async function (assert) {
assert.expect(1);
stubs.ipcService.withArgs('hasMacOSChrome').returns(false);
await visit(urls.origin);
assert.notOk(
find('.rose-header.header-cushion'),
'Does not add header padding around native window actions'
);
});
});
+2 -1
View File
@@ -17,7 +17,8 @@ class MockIPC {
}
resetOrigin() {}
isMacOS() {}
hasMacOSChrome() {}
showWindowActions() {}
}
/**