Merge branch 'main' into hide-devtools-in-prod

This commit is contained in:
Susmitha Girumala authored and GitHub committed 2021-02-12 10:23:49 -05:00
commit 6e2e0f6be0
9 files changed
+69 -3

No files matched your search

+10
View File
@@ -71,6 +71,16 @@ export default class ApplicationRoute extends Route.extend(
this.session.invalidate();
}
/**
* Disconnects from origin and invalidates session, thereby resetting
* the client and reloading to the onboarding origin screen.
*/
@action
disconnect() {
this.origin.resetOrigin();
this.invalidateSession();
}
/**
* Hooks into ember-loading to kick off loading indicator in the
* application template.
+10
View File
@@ -1,6 +1,7 @@
import Service from '@ember/service';
import { assert } from '@ember/debug';
import { inject as service } from '@ember/service';
import { notifyError } from 'core/decorators/notify';
export default class OriginService extends Service {
@@ -72,4 +73,13 @@ export default class OriginService extends Service {
}
}
/**
* Resets the origin.
*/
@notifyError(({ message }) => message, { catch: true })
async resetOrigin() {
this.rendererOrigin = null;
await this.ipc.invoke('resetOrigin');
}
}
+8
View File
@@ -1,7 +1,15 @@
{{page-title (t "errors.generic.title") }}
<main>
<Rose::Layout::Centered>
<Error::Message />
</Rose::Layout::Centered>
<Rose::Layout::Centered>
<Rose::Button @style="primary" {{on "click" (route-action "disconnect")}}>
{{t "actions.disconnect"}}
</Rose::Button>
</Rose::Layout::Centered>
</main>
@@ -0,0 +1,23 @@
{{page-title (t "errors.generic.title") }}
{{! Most error types will land here }}
{{#if @model.errors}}
<Rose::Layout::Centered>
{{#each @model.errors as |error|}}
<Error::Message @status={{error.status}}/>
{{/each}}
</Rose::Layout::Centered>
{{/if}}
{{! But a disconnected state doesn't get normalized errors }}
{{#unless @model.errors}}
<Rose::Layout::Centered>
<Error::Message />
</Rose::Layout::Centered>
<Rose::Layout::Centered>
<Rose::Button @style="primary" {{on "click" (route-action "disconnect")}}>
{{t "actions.disconnect"}}
</Rose::Button>
</Rose::Layout::Centered>
{{/unless}}
+7
View File
@@ -17,6 +17,13 @@ handle('setOrigin', async (requestOrigin) => {
origin.origin = requestOrigin;
});
/**
* Resets the origin.
*/
handle('resetOrigin', async (requestOrigin) => {
origin.resetOrigin();
});
/**
* Check for boundary cli existence
*/
+8 -1
View File
@@ -24,7 +24,7 @@ class RuntimeSettings {
}
/**
*
* Validates the origin is reachable and has a scopes endpoint.
*/
async validateOrigin(origin) {
// If the origin is the Electron origin, it is automatically valid.
@@ -40,6 +40,13 @@ class RuntimeSettings {
}
}
/**
* Sets the origin to null.
*/
async resetOrigin() {
this.origin = null;
}
// Quick and dirty event handler pattern to enable the application to respond
// when the origin is changed.
#originWatchers = [];