Merge pull request #192 from fleetbase/dev-v0.3.10

v0.3.10
This commit is contained in:
Ron
2024-02-01 20:05:22 +08:00
committed by GitHub
25 changed files with 963 additions and 512 deletions

View File

@@ -9,9 +9,9 @@
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fleetbase/core-api": "^1.3.12",
"fleetbase/fleetops-api": "^0.4.3",
"fleetbase/storefront-api": "^0.2.8",
"fleetbase/core-api": "^1.3.13",
"fleetbase/fleetops-api": "^0.4.4",
"fleetbase/storefront-api": "^0.2.9",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^8.75",

699
api/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -13,7 +13,7 @@ return [
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
'default' => env('FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------

View File

@@ -127,6 +127,15 @@ export default class AuthVerificationController extends Controller {
);
}
/**
* Allow user to manually trigger no code received prompt.
*
* @memberof AuthVerificationController
*/
@action onDidntReceiveCode() {
this.stillWaiting = true;
}
/**
* Validates the input
*

View File

@@ -0,0 +1,44 @@
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
import { computed } from '@ember/object';
import { format, formatDistanceToNow } from 'date-fns';
export default class CommentModel extends Model {
/** @ids */
@attr('string') company_uuid;
@attr('string') parent_comment_uuid;
@attr('string') subject_uuid;
@attr('string') subject_type;
/** @relationships */
@belongsTo('user') author;
@belongsTo('comment', { inverse: 'replies' }) parent;
@hasMany('comment', { inverse: 'parent' }) replies;
/** @attributes */
@attr('string') content;
@attr('boolean') editable;
@attr('raw') tags;
@attr('raw') meta;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
@attr('date') deleted_at;
/** @computed */
@computed('created_at') get createdAgo() {
return formatDistanceToNow(this.created_at);
}
@computed('created_at') get createdAt() {
return format(this.created_at, 'PPP p');
}
@computed('updated_at') get updatedAgo() {
return formatDistanceToNow(this.updated_at);
}
@computed('updated_at') get updatedAt() {
return format(this.updated_at, 'PPP p');
}
}

View File

@@ -10,7 +10,7 @@ Router.map(function () {
this.route('auth', function () {
this.route('login', { path: '/' });
this.route('forgot-password');
this.route('reset-password');
this.route('reset-password', { path: '/reset-password/:id' });
this.route('two-fa');
this.route('verification');
});
@@ -50,26 +50,6 @@ Router.map(function () {
this.route('two-fa-settings');
this.route('virtual', { path: '/:slug/:view' });
});
this.mount('@fleetbase/dev-engine', {
as: 'developers',
path: 'developers'
});
this.mount('@fleetbase/fleetops-engine', {
as: 'fleet-ops',
path: 'fleet-ops'
});
this.mount('@fleetbase/iam-engine', {
as: 'iam',
path: 'iam'
});
this.mount('@fleetbase/storefront-engine', {
as: 'storefront',
path: 'storefront'
});
});
this.route('install');
});

View File

@@ -4,7 +4,14 @@ import { inject as service } from '@ember/service';
export default class AuthResetPasswordRoute extends Route {
@service store;
model() {
return this.store.findRecord('brand', 1);
async model(params) {
return params;
}
async setupController(controller) {
super.setupController(...arguments);
// set brand to controller
this.brand = await this.store.findRecord('brand', 1);
}
}

View File

@@ -0,0 +1,38 @@
import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
export default class CommentSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
/**
* Embedded relationship attributes
*
* @var {Object}
*/
get attrs() {
return {
author: { embedded: 'always' },
parent: { embedded: 'always' },
replies: { embedded: 'always' },
};
}
serializeAttribute(snapshot, json, key, attributes) {
if (key === 'editable') {
return;
}
super.serializeAttribute(...arguments);
}
serializeHasMany(snapshot, json, relationship) {
let key = relationship.key;
if (key === 'replies') {
return;
} else {
super.serializeHasMany(...arguments);
}
}
serializeBelongsTo() {
return;
}
}

View File

@@ -4,6 +4,8 @@
color: rgb(202 138 4);
}
body[data-theme='dark'] .btn.btn-warning-alert.btn-warning,
.btn.btn-warning-alert.btn-warning,
.two-fa-enforcement-alert button#two-fa-setup-button.btn.btn-warning,
body[data-theme='dark'] .two-fa-enforcement-alert button#two-fa-setup-button.btn.btn-warning {
background-color: rgb(202 138 4);

View File

@@ -1,6 +1,6 @@
<div class="bg-white dark:bg-gray-800 py-8 px-4 shadow rounded-lg">
<div class="mb-4">
<Image src={{@model.logo_url}} @fallbackSrc="/images/fleetbase-logo-svg.svg" alt={{t "app.name"}} width="160" height="56" class="w-40 h-14 mx-auto" />
<Image src={{this.brand.logo_url}} @fallbackSrc="/images/fleetbase-logo-svg.svg" alt={{t "app.name"}} width="160" height="56" class="w-40 h-14 mx-auto" />
<h2 class="text-center text-lg font-extrabold text-gray-900 dark:text-white truncate">
{{t "auth.reset-password.title"}}
</h2>

View File

@@ -1,9 +1,10 @@
{{page-title "Account Verification"}}
{{page-title (t "auth.verification.header-title")}}
<div class="bg-white dark:bg-gray-800 py-8 px-4 shadow rounded-lg w-full">
<div class="mb-8">
<img class="mx-auto h-12 w-auto " src="/images/fleetbase-logo-svg.svg" alt={{t "app.name"}}>
<h2 class="mt-6 text-center text-lg font-extrabold text-gray-900 dark:text-white truncate">
Verify your email address
{{t "auth.verification.title"}}
</h2>
</div>
@@ -12,15 +13,16 @@
<FaIcon @icon="shield-check" @size="lg" class="text-blue-900 mr-4" />
</div>
<p class="flex-1 text-sm text-blue-900 dark:text-blue-900">
<strong>Almost done!</strong><br> Check your email for a verification code.
{{t "auth.verification.message-text" htmlSafe=true}}
</p>
</div>
<form class="mt-8 space-y-6" {{on "submit" this.verifyCode}}>
<InputGroup @type="tel" @name="Verification Code" @value={{this.code}} @helpText="Enter the verification code you received via email." @inputClass="input-lg" {{on "input" this.validateInput}} />
<InputGroup @type="tel" @name={{t "auth.verification.verification-input-label"}} @value={{this.code}} @helpText={{t "auth.verification.verification-code-text"}} @inputClass="input-lg" {{on "input" this.validateInput}} />
<div>
<div class="flex flex-row items-center space-x-4">
<Button @icon="check" @iconPrefix="fas" @buttonType="submit" @type="primary" @size="lg" @text="Verify & Continue" @isLoading={{this.isLoading}} @disabled={{this.isNotReadyToSubmit}} @onClick={{this.verifyCode}} />
<a href="#" {{on "click" this.onDidntReceiveCode}} class="text-sm text-blue-400 hover:text-blue-300">{{t "auth.verification.didnt-receive-a-code"}}</a>
</div>
{{#if this.stillWaiting}}
@@ -30,14 +32,14 @@
<FaIcon @icon="exclamation-triangle" @size="lg" class="text-yellow-400" />
</div>
<div class="ml-3 flex items-center">
<span class="text-lg font-extrabold text-yellow-800">Didn't receive an email yet?</span>
<span class="text-lg font-extrabold text-yellow-800">{{t "auth.verification.didnt-receive-a-code"}}</span>
</div>
</div>
<div class="py-3">
<p class="text-yellow-700">Use alternaitve options below to verify your account.</p>
<div class="py-1">
<p class="text-yellow-700 text-sm">{{t "auth.verification.not-sent.alternative-choice"}}</p>
<div class="flex items-center mt-3">
<Button @type="default" class="mr-2" @onClick={{this.resendEmail}}>Resend Email</Button>
<Button @type="default" @onClick={{this.resendBySms}}>Send by SMS</Button>
<Button @buttonType="button" @type="warning" @wrapperClass="mr-2" @onClick={{this.resendEmail}} class="btn-warning-alert">{{t "auth.verification.not-sent.resend-email"}}</Button>
<Button @buttonType="button" @type="warning" @onClick={{this.resendBySms}} class="btn-warning-alert">{{t "auth.verification.not-sent.send-by-sms"}}</Button>
</div>
</div>
</div>

View File

@@ -6,12 +6,20 @@
<Layout::Sidebar::Item @route="console.admin.notifications" @icon="bell">{{t "common.notifications"}}</Layout::Sidebar::Item>
<Layout::Sidebar::Item @route="console.admin.two-fa-settings" @icon="shield-halved">{{t "common.2fa-config"}}</Layout::Sidebar::Item>
{{#each this.universe.adminMenuItems as |menuItem|}}
<Layout::Sidebar::Item @onClick={{fn this.universe.transitionMenuItem "console.admin.virtual" menuItem}} @item={{menuItem}} @icon={{menuItem.icon}}>{{menuItem.title}}</Layout::Sidebar::Item>
<Layout::Sidebar::Item
@onClick={{fn this.universe.transitionMenuItem "console.admin.virtual" menuItem}}
@item={{menuItem}}
@icon={{menuItem.icon}}
>{{menuItem.title}}</Layout::Sidebar::Item>
{{/each}}
{{#each this.universe.adminMenuPanels as |menuPanel|}}
<Layout::Sidebar::Panel @open={{menuPanel.open}} @title={{menuPanel.title}}>
{{#each menuPanel.items as |menuItem|}}
<Layout::Sidebar::Item @onClick={{fn this.universe.transitionMenuItem "console.admin.virtual" menuItem}} @item={{menuItem}} @icon={{menuItem.icon}}>{{menuItem.title}}</Layout::Sidebar::Item>
<Layout::Sidebar::Item
@onClick={{fn this.universe.transitionMenuItem "console.admin.virtual" menuItem}}
@item={{menuItem}}
@icon={{menuItem.icon}}
>{{menuItem.title}}</Layout::Sidebar::Item>
{{/each}}
</Layout::Sidebar::Panel>
{{/each}}

View File

@@ -1,7 +1,8 @@
{{page-title "Account Verification"}}
{{page-title (t "onboard.verify-email.header-title")}}
<div class="bg-white dark:bg-gray-800 py-8 px-4 shadow rounded-lg w-full">
<div class="mb-8">
<img class="mx-auto h-12 w-auto" src="/images/fleetbase-logo-svg.svg" alt={{t "app.name"}}>
<img class="mx-auto h-12 w-auto " src="/images/fleetbase-logo-svg.svg" alt={{t "app.name"}}>
<h2 class="mt-6 text-center text-lg font-extrabold text-gray-900 dark:text-white truncate">
{{t "onboard.verify-email.title"}}
</h2>
@@ -12,15 +13,16 @@
<FaIcon @icon="shield-check" @size="lg" class="text-blue-900 mr-4" />
</div>
<p class="flex-1 text-sm text-blue-900 dark:text-blue-900">
{{t "onboard.verify-email.message-text" htmlSafe=true}}
{{t "onboard.verify-email.message-text" htmlSafe=true}}
</p>
</div>
<form class="mt-8 space-y-6" {{on "submit" this.verifyCode}}>
<InputGroup @type="tel" @name="Verification Code" @value={{this.code}} @helpText={{t "onboard.verify-email.verification-code-text"}} @inputClass="input-lg" {{on "input" this.validateInput}} />
<InputGroup @type="tel" @name={{t "onboard.verify-email.verification-input-label"}} @value={{this.code}} @helpText={{t "onboard.verify-email.verification-code-text"}} @inputClass="input-lg" {{on "input" this.validateInput}} />
<div>
<Button @icon="check" @iconPrefix="fas" @buttonType="submit" @type="primary" @size="lg" @text={{t "onboard.verify-email.verify-button-text"}} @isLoading={{this.isLoading}} @disabled={{this.isNotReadyToSubmit}} @onClick={{this.verifyCode}} />
<div class="flex flex-row items-center space-x-4">
<Button @icon="check" @iconPrefix="fas" @buttonType="submit" @type="primary" @size="lg" @text="Verify & Continue" @isLoading={{this.isLoading}} @disabled={{this.isNotReadyToSubmit}} @onClick={{this.verifyCode}} />
<a href="#" {{on "click" this.onDidntReceiveCode}} class="text-sm text-blue-400 hover:text-blue-300">{{t "onboard.verify-email.didnt-receive-a-code"}}</a>
</div>
{{#if this.stillWaiting}}
@@ -30,14 +32,14 @@
<FaIcon @icon="exclamation-triangle" @size="lg" class="text-yellow-400" />
</div>
<div class="ml-3 flex items-center">
<span class="text-lg font-extrabold text-yellow-800">{{t "onboard.verify-email.not-sent.message"}}</span>
<span class="text-lg font-extrabold text-yellow-800">{{t "onboard.verify-email.didnt-receive-a-code"}}</span>
</div>
</div>
<div class="py-3">
<p class="text-yellow-700">{{t "onboard.verify-email.not-sent.alternative-choice"}}</p>
<div class="py-1">
<p class="text-yellow-700 text-sm">{{t "onboard.verify-email.not-sent.alternative-choice"}}</p>
<div class="flex items-center mt-3">
<Button @type="default" class="mr-2" @onClick={{this.resendEmail}}>{{t "onboard.verify-email.not-sent.resent-button-text"}}</Button>
<Button @type="default" @onClick={{this.resendBySms}}>{{t "onboard.verify-email.not-sent.sms-button-text"}}</Button>
<Button @buttonType="button" @type="warning" @wrapperClass="mr-2" @onClick={{this.resendEmail}} class="btn-warning-alert">{{t "onboard.verify-email.not-sent.resend-email"}}</Button>
<Button @buttonType="button" @type="warning" @onClick={{this.resendBySms}} class="btn-warning-alert">{{t "onboard.verify-email.not-sent.send-by-sms"}}</Button>
</div>
</div>
</div>

View File

@@ -1,6 +1,6 @@
{
"name": "@fleetbase/console",
"version": "0.3.9",
"version": "0.3.10",
"private": true,
"description": "Fleetbase Console",
"repository": "https://github.com/fleetbase/fleetbase",
@@ -28,10 +28,10 @@
},
"dependencies": {
"@fleetbase/ember-core": "^0.2.1",
"@fleetbase/ember-ui": "^0.2.9",
"@fleetbase/storefront-engine": "^0.2.8",
"@fleetbase/fleetops-engine": "^0.4.3",
"@fleetbase/fleetops-data": "^0.1.7",
"@fleetbase/ember-ui": "^0.2.10",
"@fleetbase/storefront-engine": "^0.2.9",
"@fleetbase/fleetops-engine": "^0.4.4",
"@fleetbase/fleetops-data": "^0.1.8",
"@fleetbase/dev-engine": "^0.2.1",
"@fleetbase/iam-engine": "^0.0.9",
"@fleetbase/leaflet-routing-machine": "^3.2.16",
@@ -137,9 +137,9 @@
},
"pnpm": {
"overrides": {
"@fleetbase/fleetops-data": "^0.1.7",
"@fleetbase/fleetops-data": "^0.1.8",
"@fleetbase/ember-core": "^0.2.1",
"@fleetbase/ember-ui": "^0.2.9"
"@fleetbase/ember-ui": "^0.2.10"
}
},
"prettier": {

461
console/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@ Router.map(function () {
this.route('auth', function () {
this.route('login', { path: '/' });
this.route('forgot-password');
this.route('reset-password');
this.route('reset-password', { path: '/reset-password/:id' });
this.route('two-fa');
this.route('verification');
});

View File

@@ -0,0 +1,14 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Model | comment', function (hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function (assert) {
let store = this.owner.lookup('service:store');
let model = store.createRecord('comment', {});
assert.ok(model);
});
});

View File

@@ -0,0 +1,24 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Serializer | comment', function (hooks) {
setupTest(hooks);
// Replace this with your real tests.
test('it exists', function (assert) {
let store = this.owner.lookup('service:store');
let serializer = store.serializerFor('comment');
assert.ok(serializer);
});
test('it serializes records', function (assert) {
let store = this.owner.lookup('service:store');
let record = store.createRecord('comment', {});
let serializedRecord = record.serialize();
assert.ok(serializedRecord);
});
});

View File

@@ -13,6 +13,9 @@ terms:
search: Search
search-input: Search Input
common:
edit: Edit
save: Save
cancel: Cancel
2fa-config: 2FA Config
account: Account
admin: Admin
@@ -46,11 +49,52 @@ common:
two-factor: Two Factor
uploading: Uploading...
your-profile: Your Profile
component:
component:
file:
dropdown-label: File actions
dropzone:
file: file
drop-to-upload: Drop to upload
invalid: Invalid
files-ready-for-upload: >-
{numOfFiles} ready for upload.
upload-images-videos: Upload Images & Videos
upload-documents: Upload Documents
upload-documents-files: Upload Documents & Files
dropzone-supported-images-videos: Drag and drop image and video files onto this dropzone
dropzone-supported-files: Drag and drop files onto this dropzone
or-select-button-text: or select files to upload.
upload-queue: Upload Queue
uploading: Uploading...
two-fa-enforcement-alert:
message: To enhance the security of your account, your organization requires Two-Factor Authentication (2FA). Enable 2FA in your account settings for an additional layer of protection.
button-text: Setup 2FA
comment-thread:
publish-comment-button-text: Publish comment
publish-reply-button-text: Publish reply
reply-comment-button-text: Reply
edit-comment-button-text: Edit
delete-comment-button-text: Delete
comment-published-ago: >-
{createdAgo} ago
comment-input-placeholder: Input a new comment...
comment-reply-placeholder: Input your reply...
comment-input-empty-notification: You cannot publish empty comments...
comment-min-length-notification: Comment must be atleast 2 characters
auth:
verification:
header-title: Account Verification
title: Verify your email address
message-text: <strong>Almost done!</strong><br> Check your email for a verification code.
verification-code-text: Enter the verification code you received via email.
verification-input-label: Verification Code
verify-button-text: Verify & Continue
didnt-receive-a-code: Didn't receive a code yet?
not-sent:
message: Didn't receive a code yet?
alternative-choice: Use alternaitve options below to verify your account.
resend-email: Resend Email
send-by-sms: Send by SMS
two-fa:
verify-code:
invalid-session-error-notification: Invalid session. Please try again.
@@ -188,15 +232,18 @@ onboard:
confirm-password-help-text: Just to confirm the password you entered above.
continue-button-text: Continue
verify-email:
header-title: Account Verification
title: Verify your email address
message-text: <strong>Almost done!</strong><br> Check your email for a verification code.
verification-code-text: Enter the verification code you received via email.
verification-input-label: Verification Code
verify-button-text: Verify & Continue
didnt-receive-a-code: Didn't receive a code yet?
not-sent:
message: Didn't receive an email yet?
message: Didn't receive a code yet?
alternative-choice: Use alternaitve options below to verify your account.
resent-button-text: Resend Email
sms-button-text: Send by SMS
resend-email: Resend Email
send-by-sms: Send by SMS
install:
installer-header: Installer
failed-message-sent: The install failed! Click the button below to retry the install.

View File

@@ -56,7 +56,7 @@ app.kubernetes.io/instance: {{ .Release.Name }}
- name: CACHE_DRIVER
value: redis
- name: SOCKETCLUSTER_PORT
value: "8000"
value: "80"
- name: SOCKETCLUSTER_HOST
value: $(SOCKETCLUSTER_SERVICE_HOST)
{{- end }}

View File

@@ -4,7 +4,7 @@
set -e
echo "Switching to the main branch..."
git checkout main
# git checkout main
echo "Updating submodules..."
git submodule update --init --recursive