mirror of
https://github.com/fleetbase/fleetbase.git
synced 2026-01-08 07:16:49 +00:00
little progress and bugfixes
This commit is contained in:
3
.github/workflows/cd.yml
vendored
3
.github/workflows/cd.yml
vendored
@@ -138,7 +138,8 @@ jobs:
|
||||
echo "//npm.pkg.github.com/:_authToken=${{ secrets._GITHUB_AUTH_TOKEN }}" > .npmrc
|
||||
fi
|
||||
if [[ -n "${{ secrets.FLEETBASE_REGISTRY_TOKEN }}" ]]; then
|
||||
echo "//registry.fleetbase.io/:_authToken=${{ secrets.FLEETBASE_REGISTRY_TOKEN }}" > .npmrc
|
||||
echo "//registry.fleetbase.io/:_authToken=${{ secrets.FLEETBASE_REGISTRY_TOKEN }}" >> .npmrc
|
||||
echo "@fleetbase:registry=https://registry.fleetbase.io" >> .npmrc
|
||||
fi
|
||||
working-directory: ./console
|
||||
|
||||
|
||||
@@ -5,13 +5,25 @@ import { action } from '@ember/object';
|
||||
export default class PortalController extends Controller {
|
||||
@service session;
|
||||
|
||||
/**
|
||||
* Action handler.
|
||||
*
|
||||
* @void
|
||||
*/
|
||||
@action onAction(action, ...params) {
|
||||
if (typeof this[action] === 'function') {
|
||||
this[action](...params);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action to invalidate and log user out
|
||||
*
|
||||
* @void
|
||||
*/
|
||||
@action invalidateSession(event) {
|
||||
event.preventDefault();
|
||||
console.log('invalidateSession', ...arguments)
|
||||
// event.preventDefault();
|
||||
this.session.invalidateWithLoader();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export default class ConsoleRoute extends Route {
|
||||
* @return {Promise}
|
||||
* @memberof ConsoleRoute
|
||||
*/
|
||||
async beforeModel (transition) {
|
||||
async beforeModel(transition) {
|
||||
this.session.requireAuthentication(transition, 'auth.login');
|
||||
|
||||
if (this.session.data.authenticated.type === 'customer') {
|
||||
@@ -30,7 +30,7 @@ export default class ConsoleRoute extends Route {
|
||||
* @return {BrandModel}
|
||||
* @memberof ConsoleRoute
|
||||
*/
|
||||
model () {
|
||||
model() {
|
||||
return this.store.findRecord('brand', 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,14 @@ import { inject as service } from '@ember/service';
|
||||
export default class PortalRoute extends Route {
|
||||
@service store;
|
||||
@service session;
|
||||
@service theme;
|
||||
|
||||
/**
|
||||
* Require authentication to access all `portal` routes.
|
||||
*
|
||||
* @param {Transition} transition
|
||||
* @return {Promise}
|
||||
* @memberof ConsoleRoute
|
||||
* @memberof PortalRoute
|
||||
*/
|
||||
async beforeModel(transition) {
|
||||
this.session.requireAuthentication(transition, 'auth.portal-login');
|
||||
@@ -22,9 +23,18 @@ export default class PortalRoute extends Route {
|
||||
* Get the branding settings.
|
||||
*
|
||||
* @return {BrandModel}
|
||||
* @memberof ConsoleRoute
|
||||
* @memberof PortalRoute
|
||||
*/
|
||||
model() {
|
||||
return this.store.findRecord('brand', 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the fleetbase-portal body class.
|
||||
*
|
||||
* @memberof PortalRoute
|
||||
*/
|
||||
activate() {
|
||||
this.theme.setRoutebodyClassNames(['fleetbase-portal']);
|
||||
}
|
||||
}
|
||||
|
||||
3
console/app/routes/portal/account.js
Normal file
3
console/app/routes/portal/account.js
Normal file
@@ -0,0 +1,3 @@
|
||||
import Route from '@ember/routing/route';
|
||||
|
||||
export default class PortalAccountRoute extends Route {}
|
||||
@@ -1,8 +1,14 @@
|
||||
{{page-title "Portal"}}
|
||||
<div class="portal-container">
|
||||
<div class="container">
|
||||
<Portal::Container>
|
||||
<Portal::Header @onAction={{this.onAction}} />
|
||||
<Portal::Main>
|
||||
<Portal::Sidebar />
|
||||
<Portal::Section>{{outlet}}</Portal::Section>
|
||||
</Portal::Main>
|
||||
</Portal::Container>
|
||||
{{!-- <div class="container">
|
||||
<div class="flex flex-row">
|
||||
<a href="javascript:;" {{on "click" this.invalidateSession}}>Sign out</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div> --}}
|
||||
2
console/app/templates/portal/account.hbs
Normal file
2
console/app/templates/portal/account.hbs
Normal file
@@ -0,0 +1,2 @@
|
||||
{{page-title "Account"}}
|
||||
{{outlet}}
|
||||
@@ -3,7 +3,7 @@ module.exports = function asArray(value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (typeof value === 'string' && value.includes(',')) {
|
||||
if (typeof value === 'string') {
|
||||
return value.split(',');
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ export default class Router extends EmberRouter {
|
||||
}
|
||||
|
||||
Router.map(function () {
|
||||
this.route('install');
|
||||
this.route('auth', function () {
|
||||
this.route('login', { path: '/' });
|
||||
this.route('forgot-password');
|
||||
@@ -22,6 +23,9 @@ Router.map(function () {
|
||||
this.route('for-driver', { path: '/fleet/:public_id' });
|
||||
this.route('for-user', { path: '/org/:public_id' });
|
||||
});
|
||||
this.route('portal', function () {
|
||||
this.route('account');
|
||||
});
|
||||
this.route('console', { path: '/' }, function () {
|
||||
this.route('home', { path: '/' });
|
||||
this.route('notifications');
|
||||
@@ -59,6 +63,4 @@ Router.map(function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
this.route('portal');
|
||||
this.route('install');
|
||||
});
|
||||
|
||||
11
console/tests/unit/routes/portal/account-test.js
Normal file
11
console/tests/unit/routes/portal/account-test.js
Normal file
@@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit';
|
||||
import { setupTest } from '@fleetbase/console/tests/helpers';
|
||||
|
||||
module('Unit | Route | portal/account', function (hooks) {
|
||||
setupTest(hooks);
|
||||
|
||||
test('it exists', function (assert) {
|
||||
let route = this.owner.lookup('route:portal/account');
|
||||
assert.ok(route);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user