feat: 🎸 add disconnect button to error page
This commit is contained in:
8 files changed
+46
-3
No files matched your search
@@ -60,7 +60,7 @@ module('Integration | Component | error/message', function (hooks) {
|
|||||||
);
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
find('.rose-message-description').textContent.trim(),
|
find('.rose-message-description').textContent.trim(),
|
||||||
'Please contact your administrator or try again later.'
|
'We\'re not sure what happened. Please contact your administrator or try again later.'
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -3,6 +3,7 @@ cancel: Cancel
|
|||||||
delete: Delete
|
delete: Delete
|
||||||
remove: Remove
|
remove: Remove
|
||||||
discard: Discard
|
discard: Discard
|
||||||
|
disconnect: Disconnect
|
||||||
dismiss: Dismiss
|
dismiss: Dismiss
|
||||||
save: Save
|
save: Save
|
||||||
submit: Submit
|
submit: Submit
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
description: We ran into a problem and could not continue. You can ask your administrator or try again later.
|
description: We ran into a problem and could not continue. You can ask your administrator or try again later.
|
||||||
unknown:
|
unknown:
|
||||||
title: Something went wrong
|
title: Something went wrong
|
||||||
description: Please contact your administrator or try again later.
|
description: We're not sure what happened. Please contact your administrator or try again later.
|
||||||
generic:
|
generic:
|
||||||
title: Error
|
title: Error
|
||||||
authentication-failed:
|
authentication-failed:
|
||||||
|
|||||||
@@ -71,6 +71,16 @@ export default class ApplicationRoute extends Route.extend(
|
|||||||
this.session.invalidate();
|
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
|
* Hooks into ember-loading to kick off loading indicator in the
|
||||||
* application template.
|
* application template.
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import Service from '@ember/service';
|
import Service from '@ember/service';
|
||||||
import { assert } from '@ember/debug';
|
import { assert } from '@ember/debug';
|
||||||
import { inject as service } from '@ember/service';
|
import { inject as service } from '@ember/service';
|
||||||
|
import { notifyError } from 'core/decorators/notify';
|
||||||
|
|
||||||
export default class OriginService extends Service {
|
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');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,15 @@
|
|||||||
{{page-title (t "errors.generic.title") }}
|
{{page-title (t "errors.generic.title") }}
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<Rose::Layout::Centered>
|
<Rose::Layout::Centered>
|
||||||
<Error::Message />
|
<Error::Message />
|
||||||
</Rose::Layout::Centered>
|
</Rose::Layout::Centered>
|
||||||
|
|
||||||
|
<Rose::Layout::Centered>
|
||||||
|
<Rose::Button @style="primary" {{on "click" (route-action "disconnect")}}>
|
||||||
|
{{t "actions.disconnect"}}
|
||||||
|
</Rose::Button>
|
||||||
|
</Rose::Layout::Centered>
|
||||||
|
|
||||||
</main>
|
</main>
|
||||||
@@ -17,6 +17,13 @@ handle('setOrigin', async (requestOrigin) => {
|
|||||||
origin.origin = requestOrigin;
|
origin.origin = requestOrigin;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets the origin.
|
||||||
|
*/
|
||||||
|
handle('resetOrigin', async (requestOrigin) => {
|
||||||
|
origin.resetOrigin();
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for boundary cli existence
|
* Check for boundary cli existence
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class RuntimeSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Validates the origin is reachable and has a scopes endpoint.
|
||||||
*/
|
*/
|
||||||
async validateOrigin(origin) {
|
async validateOrigin(origin) {
|
||||||
// If the origin is the Electron origin, it is automatically valid.
|
// 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
|
// Quick and dirty event handler pattern to enable the application to respond
|
||||||
// when the origin is changed.
|
// when the origin is changed.
|
||||||
#originWatchers = [];
|
#originWatchers = [];
|
||||||
|
|||||||
Reference in new issue
Block a user