Compare commits

..

48 Commits

Author SHA1 Message Date
Ronald A. Richardson
35925aec2f upgraded fleetops with v0.4.25 which contains hotfix for driver update via api 2024-04-09 12:51:44 +08:00
Ronald A. Richardson
b9b0eb308b Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-04-02 18:06:15 +08:00
Ronald A. Richardson
48e1b89ec8 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-03-27 21:09:51 +08:00
Ronald A. Richardson
5e02c95b66 Upgrade extension 'fleetops' to version v0.4.22 2024-03-19 19:25:51 +08:00
Ronald A. Richardson
db8b5c4d6a Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-03-17 12:32:42 +08:00
Ronald A. Richardson
aa214ccad7 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-03-15 17:33:37 +08:00
Ronald A. Richardson
cdd5524cf3 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-03-13 15:31:47 +08:00
Ronald A. Richardson
d99cefd2a4 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-03-12 18:25:56 +08:00
Ronald A. Richardson
1c58fd43c3 v0.4.10l fixed console lockfile 2024-03-11 21:56:26 +08:00
Ronald A. Richardson
9226394159 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-03-11 21:19:32 +08:00
Ronald A. Richardson
9b23b39f32 upgraded to v0.4.9 2024-02-24 17:07:49 +08:00
Ronald A. Richardson
5310fc3ff3 upgraded to v0.4.8 2024-02-23 13:52:21 +08:00
Ronald A. Richardson
9569053f50 upgraded to v0.4.7 2024-02-22 18:16:12 +08:00
Ronald A. Richardson
b08c054b99 upgraded to v0.4.6 2024-02-21 18:59:10 +08:00
Ronald A. Richardson
2e517f2f95 hotfix core-api w/ composer lock 2024-02-17 19:53:53 +08:00
Ronald A. Richardson
7038d375b0 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-02-17 19:31:14 +08:00
Ronald A. Richardson
d5ea7f7790 Upgraded fleetops-api v0.4.11 - Fixes deprecation error/warning which occurs in some environments Implicit conversion from float x to int loses precision when creating a DistanceMatrix object 2024-02-16 03:04:16 +07:00
Ronald A. Richardson
4eb4b04121 use fixed fleetbase/laravel-mysql-spatial v1.0.2 2024-02-16 01:34:01 +07:00
Ronald A. Richardson
24c5b93005 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-02-16 00:16:49 +07:00
Ronald A. Richardson
80610b9a48 Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-02-15 23:52:27 +07:00
Ronald A. Richardson
9e5551972e upgraded to v0.4.3 2024-02-13 17:02:37 +08:00
Ronald A. Richardson
b784f890f3 upgraded to v0.4.2 2024-02-13 14:45:20 +08:00
Ronald A. Richardson
797a3d61fe fix router 2024-02-13 13:55:57 +08:00
Ronald A. Richardson
d2f0bfe83e upgraded to v0.4.1 2024-02-13 13:54:46 +08:00
Ronald A. Richardson
f28ad85c1a Upgraded fleetops to v0.4.8 for LocationService minifcation hotfix 2024-02-09 19:07:32 +08:00
Ronald A. Richardson
d7b0826f3f upgrade core-api to v1.4.1 2024-02-08 19:07:10 +08:00
Ronald A. Richardson
dd6008a8aa dont copy auth.json 2024-02-08 17:44:52 +08:00
Ronald A. Richardson
6671fefaaa Upgraded to v0.4.0 2024-02-08 17:41:02 +08:00
Ronald A. Richardson
7136f6195c v0.3.10 upgraded lockfile 2024-02-01 20:19:52 +08:00
Ronald A. Richardson
2384887620 Upgraded to v0.3.10 2024-02-01 20:14:31 +08:00
Ronald A. Richardson
a2778f1552 Upgraded to v0.3.9 2024-01-25 20:10:39 +08:00
Ronald A. Richardson
acfda5ed1a Merge branch 'main' of github.com:fleetbase/fleetbase into cloud 2024-01-24 18:32:51 +08:00
Ronald A. Richardson
e08255007a remove later hook from extensions initializer 2024-01-23 21:37:22 +08:00
Ronald A. Richardson
41761ea50e add delay to extensions initialization step 2024-01-23 21:20:51 +08:00
Ronald A. Richardson
5c623819ed use node:18.15.0-alpine for console build 2024-01-23 20:13:23 +08:00
Ronald A. Richardson
2bd885b1a2 Upgraded fleetbase/core-api to v1.3.11 2024-01-19 20:16:06 +08:00
Ronald A. Richardson
88c3842441 Upgraded to v0.3.7 2024-01-19 19:55:47 +08:00
Ronald A. Richardson
2c2a4121a8 Upgraded fleetbase/core-api to v1.3.9 with critical patches 2024-01-19 17:02:47 +08:00
Ronald A. Richardson
aadd03f14b upgrade fleetbase/core-api to v1.3.8 2024-01-18 20:00:32 +08:00
Ronald A. Richardson
706e94270d upgraded to v0.3.6 2024-01-18 19:18:52 +08:00
Ronald A. Richardson
1dabc375f9 upgraded to v0.3.5 2024-01-12 18:44:52 +08:00
Ronald A. Richardson
0efec46155 updated production env backend vars 2024-01-08 14:42:58 +08:00
Ronald A. Richardson
8bb2c6b65d fix socketcluster port for environments 2024-01-03 17:37:35 +08:00
Ronald A. Richardson
1c0af1a119 set correct values in .env files for console 2024-01-03 13:27:10 +08:00
Ronald A. Richardson
dd65ee619b upgraded to v0.3.4 2023-12-27 12:01:39 +08:00
Ronald A. Richardson
e790a0e123 upgraded to v0.3.3 2023-12-27 11:07:33 +08:00
Ronald A. Richardson
723e3ca3d1 fix composer file 2023-11-27 10:23:44 +08:00
Ronald A. Richardson
4eb706d33e upgraded to v0.3.1 / cloud version 2023-11-27 10:19:56 +08:00
36 changed files with 17680 additions and 742 deletions

View File

@@ -9,9 +9,11 @@
"license": "MIT",
"require": {
"php": "^8.0",
"fleetbase/core-api": "^1.4.19",
"fleetbase/fleetops-api": "^0.4.26",
"fleetbase/core-api": "^1.4.16",
"fleetbase/fleetops-api": "^0.4.25",
"fleetbase/storefront-api": "^0.3.7",
"fleetbase/billing-api": "dev-main",
"fleetbase/internals-api": "dev-main",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^10.0",
"laravel/octane": "^2.3",
@@ -32,6 +34,16 @@
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/fleetbase/billing"
},
{
"type": "vcs",
"url": "https://github.com/fleetbase/internals"
}
],
"autoload": {
"psr-4": {
"App\\": "app/",

616
api/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -52,7 +52,7 @@ return [
|
*/
'url' => env('APP_URL', 'http://localhost:8000'),
'url' => env('APP_URL', 'http://localhost'),
'asset_url' => env('ASSET_URL', null),

View File

@@ -0,0 +1,30 @@
<div class="next-user-button" ...attributes>
<BasicDropdown @defaultClass={{@wrapperClass}} @onOpen={{@onOpen}} @onClose={{@onClose}} @verticalPosition={{@verticalPosition}} @horizontalPosition={{@horizontalPosition}} @renderInPlace={{or @renderInPlace true}} @initiallyOpened={{@initiallyOpened}} as |dd|>
<dd.Trigger class={{@triggerClass}}>
<div class="next-org-button-trigger flex-shrink-0 {{if dd.isOpen 'is-open'}}">
<FaIcon @icon="globe" @size="sm" />
</div>
</dd.Trigger>
<dd.Content class={{@contentClass}}>
<div class="next-dd-menu {{@dropdownMenuClass}} {{if dd.isOpen 'is-open'}}">
{{#each-in this.availableLocales as |key country|}}
<div class="px-1">
<a href="javascript:;" class="next-dd-item" {{on "click" (fn this.changeLocale key)}}>
<div class="flex flex-row items-center justify-between w-full">
<div class="flex-1">
<span class="mr-1">{{country.emoji}}</span>
<span>{{country.language}}</span>
</div>
{{#if (eq this.currentLocale key)}}
<div>
<FaIcon @icon="check" class="text-green-400" />
</div>
{{/if}}
</div>
</a>
</div>
{{/each-in}}
</div>
</dd.Content>
</BasicDropdown>
</div>

View File

@@ -0,0 +1,144 @@
import Component from '@glimmer/component';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { task } from 'ember-concurrency-decorators';
export default class LocaleSelectorComponent extends Component {
/**
* Inject the intl service.
*
* @memberof LocaleSelectorComponent
*/
@service intl;
/**
* Inject the intl service.
*
* @memberof LocaleSelectorComponent
*/
@service fetch;
/**
* Tracks all the available locales.
*
* @memberof LocaleSelectorComponent
*/
@tracked locales = [];
/**
* All available countries data.
*
* @memberof LocaleSelectorComponent
*/
@tracked countries = [];
/**
* The current locale in use.
*
* @memberof LocaleSelectorComponent
*/
@tracked currentLocale;
/**
* Creates an instance of LocaleSelectorComponent.
* @memberof LocaleSelectorComponent
*/
constructor() {
super(...arguments);
this.locales = this.intl.locales;
this.currentLocale = this.intl.primaryLocale;
this.loadAvailableCountries.perform();
// Check for locale change
this.intl.onLocaleChanged(() => {
this.currentLocale = this.intl.primaryLocale;
});
}
/**
* Handles the change of locale.
* @param {string} selectedLocale - The selected locale.
* @returns {void}
* @memberof LocaleSelectorComponent
* @method changeLocale
* @instance
* @action
*/
@action changeLocale(selectedLocale) {
this.currentLocale = selectedLocale;
this.intl.setLocale(selectedLocale);
// Persist to server
this.saveUserLocale.perform(selectedLocale);
}
/**
* Loads available countries asynchronously.
* @returns {void}
* @memberof LocaleSelectorComponent
* @method loadAvailableCountries
* @instance
* @task
* @generator
*/
@task *loadAvailableCountries() {
this.countries = yield this.fetch.get('lookup/countries', { columns: ['name', 'cca2', 'flag', 'emoji', 'languages'] });
this.availableLocales = this._createAvailableLocaleMap();
}
/**
* Saves the user's selected locale to the server.
* @param {string} locale - The user's selected locale.
* @returns {void}
* @memberof LocaleSelectorComponent
* @method saveUserLocale
* @instance
* @task
* @generator
*/
@task *saveUserLocale(locale) {
yield this.fetch.post('users/locale', { locale });
}
/**
* Creates a map of available locales.
* @private
* @returns {Object} - The map of available locales.
* @memberof LocaleSelectorComponent
* @method _createAvailableLocaleMap
* @instance
*/
_createAvailableLocaleMap() {
const localeMap = {};
for (let i = 0; i < this.locales.length; i++) {
const locale = this.locales.objectAt(i);
localeMap[locale] = this._findCountryDataForLocale(locale);
}
return localeMap;
}
/**
* Finds country data for a given locale.
* @private
* @param {string} locale - The locale to find country data for.
* @returns {Object|null} - The country data or null if not found.
* @memberof LocaleSelectorComponent
* @method _findCountryDataForLocale
* @instance
*/
_findCountryDataForLocale(locale) {
const localeCountry = locale.split('-')[1];
const country = this.countries.find((country) => country.cca2.toLowerCase() === localeCountry);
if (country) {
// get the language
country.language = Object.values(country.languages)[0];
}
return country;
}
}

View File

@@ -174,7 +174,6 @@ export default class ConsoleController extends Controller {
@action setSidebarContext(sidebarContext) {
this.sidebarContext = sidebarContext;
this.universe.sidebarContext = sidebarContext;
this.universe.trigger('sidebarContext.available', sidebarContext);
if (this.hiddenSidebarRoutes.includes(this.router.currentRouteName)) {
this.sidebarContext.hideNow();

View File

@@ -1,84 +0,0 @@
import Model, { attr, belongsTo } from '@ember-data/model';
import { getOwner } from '@ember/application';
import { computed } from '@ember/object';
import { format, formatDistanceToNow, isValid as isValidDate } from 'date-fns';
import isVideoFile from '@fleetbase/ember-core/utils/is-video-file';
import isImageFile from '@fleetbase/ember-core/utils/is-image-file';
export default class ChatAttachment extends Model {
/** @ids */
@attr('string') chat_channel_uuid;
@attr('string') sender_uuid;
@attr('string') file_uuid;
@attr('string') chat_message_uuid;
/** @relationships */
@belongsTo('user', { async: true }) sender;
@belongsTo('chat-channel', { async: true }) chatChannel;
@belongsTo('file', { async: true }) file;
/** @attributes */
@attr('string') chat_channel_uuid;
@attr('string') sender_uuid;
@attr('string') file_uuid;
@attr('string') url;
@attr('string') filename;
@attr('string') content_type;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
/** @computed */
@computed('updated_at') get updatedAgo() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDistanceToNow(this.updated_at);
}
@computed('updated_at') get updatedAt() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP HH:mm');
}
@computed('created_at') get createdAgo() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDistanceToNow(this.created_at);
}
@computed('created_at') get createdAt() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP HH:mm');
}
@computed('content_type') get isVideo() {
return isVideoFile(this.content_type);
}
@computed('content_type') get isImage() {
return isImageFile(this.content_type);
}
/** @methods */
downloadFromApi() {
window.open(ENV.api.host + '/' + ENV.api.namespace + '/files/download?file=' + this.file_uuid, '_self');
}
download() {
const owner = getOwner(this);
const fetch = owner.lookup('service:fetch');
return fetch.download('files/download', { file: this.file_uuid }, { fileName: this.filename, mimeType: this.content_type });
}
}

View File

@@ -1,87 +0,0 @@
import Model, { attr, hasMany, belongsTo } from '@ember-data/model';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';
import { format, formatDistanceToNow, isValid as isValidDate } from 'date-fns';
export default class ChatChannelModel extends Model {
/** @ids */
@attr('string') public_id;
@attr('string') company_uuid;
@attr('string') created_by_uuid;
/** @attributes */
@attr('string') name;
@attr('string') title;
@attr('number') unread_count;
@attr('string') slug;
@attr('array') feed;
@attr('array') meta;
/** @relationships */
@hasMany('chat-participant', { async: false }) participants;
@belongsTo('chat-message', { async: false }) last_message;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
/** @computed */
@computed('updated_at') get updatedAgo() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDistanceToNow(this.updated_at);
}
@computed('updated_at') get updatedAt() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP HH:mm');
}
@computed('created_at') get createdAgo() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDistanceToNow(this.created_at);
}
@computed('created_at') get createdAt() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP HH:mm');
}
/** @methods */
toJSON() {
return {
company_uuid: this.company_uuid,
name: this.name,
meta: this.meta,
};
}
reloadParticipants() {
const owner = getOwner(this);
const store = owner.lookup('service:store');
return store.query('chat-participant', { chat_channel_uuid: this.id }).then((participants) => {
this.set('participants', participants);
return participants;
});
}
existsInFeed(type, record) {
return this.feed.find((_) => _.type === type && _.record.id === record.id) !== undefined;
}
doesntExistsInFeed(type, record) {
return this.feed.find((_) => _.type === type && _.record.id === record.id) === undefined;
}
}

View File

@@ -1,54 +0,0 @@
import Model, { attr, belongsTo } from '@ember-data/model';
import { computed } from '@ember/object';
import { format, formatDistanceToNow, isValid as isValidDate } from 'date-fns';
export default class ChatLogModel extends Model {
/** @ids */
@attr('string') company_uuid;
@attr('string') chat_channel_uuid;
@attr('string') initiator_uuid;
/** @attributes */
@attr('string') content;
@attr('string') resolved_content;
@attr('string') event_type;
@attr('string') status;
@attr('array') meta;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
/** @computed */
@computed('updated_at') get updatedAgo() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDistanceToNow(this.updated_at, { addSuffix: true });
}
@computed('updated_at') get updatedAt() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP HH:mm');
}
@computed('created_at') get createdAgo() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDistanceToNow(this.created_at, { addSuffix: true });
}
@computed('created_at') get createdAt() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP HH:mm');
}
}

View File

@@ -1,64 +0,0 @@
import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
import { computed } from '@ember/object';
import { format, formatDistanceToNow, isValid as isValidDate } from 'date-fns';
export default class ChatMessage extends Model {
/** @ids */
@attr('string') chat_channel_uuid;
@attr('string') sender_uuid;
/** @attributes */
@attr('string') content;
@attr('array') attachment_files;
/** @relationships */
@belongsTo('chat-participant', { async: false }) sender;
@hasMany('chat-attachment', { async: false }) attachments;
@hasMany('chat-receipt', { async: false }) receipts;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
/** @computed */
@computed('updated_at') get updatedAgo() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDistanceToNow(this.updated_at, { addSuffix: true });
}
@computed('updated_at') get updatedAt() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP HH:mm');
}
@computed('created_at') get createdAgo() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDistanceToNow(this.created_at, { addSuffix: true });
}
@computed('created_at') get createdAt() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP HH:mm');
}
/** @methods */
hasReadReceipt(chatParticipant) {
return chatParticipant && this.receipts.find((receipt) => chatParticipant.id === receipt.participant_uuid) !== undefined;
}
doesntHaveReadReceipt(chatParticipant) {
return !this.hasReadReceipt(chatParticipant);
}
}

View File

@@ -1,75 +0,0 @@
import Model, { attr, belongsTo } from '@ember-data/model';
import { computed } from '@ember/object';
import { format, formatDistanceToNow, isValid as isValidDate } from 'date-fns';
export default class ChatParticipant extends Model {
/** @ids */
@attr('string') user_uuid;
@attr('string') chat_channel_uuid;
/** @attributes */
@attr('string') name;
@attr('string') username;
@attr('string') phone;
@attr('string') email;
@attr('string') avatar_url;
@attr('boolean') is_online;
/** @relationships */
@belongsTo('user', { async: true }) user;
@belongsTo('chat-channel', { async: true }) chatChannel;
/** @dates */
@attr('date') last_seen_at;
@attr('date') created_at;
@attr('date') updated_at;
/** @computed */
@computed('updated_at') get updatedAgo() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDistanceToNow(this.updated_at);
}
@computed('updated_at') get updatedAt() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP HH:mm');
}
@computed('created_at') get createdAgo() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDistanceToNow(this.created_at);
}
@computed('created_at') get createdAt() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP HH:mm');
}
@computed('last_seen_at') get lastSeenAgo() {
if (!isValidDate(this.last_seen_at)) {
return null;
}
return formatDistanceToNow(this.last_seen_at);
}
@computed('last_seen_at') get lastSeenAt() {
if (!isValidDate(this.last_seen_at)) {
return null;
}
return formatDate(this.last_seen_at, 'PP HH:mm');
}
}

View File

@@ -1,70 +0,0 @@
import Model, { attr, belongsTo } from '@ember-data/model';
import { computed } from '@ember/object';
import { format as formatDate, formatDistanceToNow, isValid as isValidDate } from 'date-fns';
export default class ChatReceipt extends Model {
/** @ids */
@attr('string') participant_uuid;
@attr('string') chat_message_uuid;
/** @relationships */
@belongsTo('chat-participant', { async: true }) participant;
@belongsTo('chat-message', { async: true }) chatMessage;
/** @attributes */
@attr('string') participant_name;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
@attr('date') read_at;
/** @computed */
@computed('updated_at') get updatedAgo() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDistanceToNow(this.updated_at, { addSuffix: true });
}
@computed('updated_at') get updatedAt() {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP HH:mm');
}
@computed('created_at') get createdAgo() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDistanceToNow(this.created_at, { addSuffix: true });
}
@computed('created_at') get createdAt() {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP HH:mm');
}
@computed('read_at') get readAgo() {
if (!isValidDate(this.read_at)) {
return null;
}
return formatDistanceToNow(this.read_at, { addSuffix: true });
}
@computed('read_at') get readAt() {
if (!isValidDate(this.read_at)) {
return null;
}
return formatDate(this.read_at, 'PP HH:mm');
}
}

View File

@@ -69,8 +69,8 @@ export default class FileModel extends Model {
download() {
const owner = getOwner(this);
const fetch = owner.lookup('service:fetch');
const fetch = owner.lookup(`service:store`);
return fetch.download('files/download', { file: this.id }, { fileName: this.original_filename, mimeType: this.content_type });
return fetch.download('files/download', { file: this.id });
}
}

View File

@@ -26,13 +26,11 @@ export default class UserModel extends Model {
@attr('string') type;
@attr('string') session_status;
@attr('string') status;
@attr('boolean') is_online;
@attr('boolean') is_admin;
@attr('raw') types;
@attr('raw') meta;
/** @dates */
@attr('date') last_seen_at;
@attr('date') phone_verified_at;
@attr('date') email_verified_at;
@attr('date') last_login;

View File

@@ -50,8 +50,9 @@ Router.map(function () {
this.route('two-fa-settings');
this.route('virtual', { path: '/:slug/:view' });
this.route('organizations', function () {
this.route('index', { path: '/' });
this.route('users', { path: '/:company_id' });
this.route('index', { path: '/' }, function () {
this.route('users', { path: '/:public_id/users' });
});
});
});
});

View File

@@ -1,60 +0,0 @@
import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
import { getOwner } from '@ember/application';
import { underscore } from '@ember/string';
import { isArray } from '@ember/array';
export default class ChatChannelSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
/**
* Embedded relationship attributes
*
* @var {Object}
*/
get attrs() {
return {
participants: { embedded: 'always' },
last_message: { embedded: 'always' },
};
}
serialize(snapshot) {
let json = {
name: snapshot.attr('name'),
meta: snapshot.attr('meta'),
};
return json;
}
normalize(typeClass, hash) {
if (isArray(hash.feed)) {
hash.feed = this.serializeFeed(hash.feed);
}
return super.normalize(...arguments);
}
serializeFeed(feed = []) {
return feed.map((item) => this.serializeItem(item)).sortBy('created_at');
}
serializeItem(item) {
switch (item.type) {
case 'message':
return { ...item, record: this.serializeItemType('chat-message', item.data) };
case 'log':
return { ...item, record: this.serializeItemType('chat-log', item.data) };
case 'attachment':
return { ...item, record: this.serializeItemType('chat-attachment', item.data) };
default:
return null;
}
}
serializeItemType(modelType, data) {
const owner = getOwner(this);
const store = owner.lookup('service:store');
const normalized = store.normalize(modelType, data);
return store.push(normalized);
}
}

View File

@@ -1,17 +0,0 @@
import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
export default class ChatMessageSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
/**
* Embedded relationship attributes
*
* @var {Object}
*/
get attrs() {
return {
sender: { embedded: 'always' },
attachments: { embedded: 'always' },
receipts: { embedded: 'always' },
};
}
}

View File

@@ -1,3 +0,0 @@
import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
export default class ChatParticipantSerializer extends ApplicationSerializer {}

View File

@@ -14,5 +14,9 @@
</Layout::Main>
<Layout::MobileNavbar @brand={{@model}} @user={{this.user}} @organizations={{this.organizations}} @menuItems={{this.universe.headerMenuItems}} @extensions={{this.extensions}} @onAction={{this.onAction}} />
</Layout::Container>
<ChatContainer />
<ConsoleWormhole />
{{!-- Add Locale Selector to Header --}}
<EmberWormhole @to="view-header-actions">
<LocaleSelector class="mr-0.5" />
</EmberWormhole>
<ConsoleWormhole />

View File

@@ -1,9 +1,9 @@
API_HOST=
API_HOST=https://api.fleetbase.io
API_NAMESPACE=int/v1
API_SECURE=true
SOCKETCLUSTER_PATH=/socketcluster/
SOCKETCLUSTER_HOST=
SOCKETCLUSTER_HOST=socket.fleetbase.io
SOCKETCLUSTER_SECURE=true
SOCKETCLUSTER_PORT=38000
SOCKETCLUSTER_PORT=8000
OSRM_HOST=https://bundle.routing.fleetbase.io
OSRM_SERVERS=https://canada.routing.fleetbase.io,https://us.routing.fleetbase.io

View File

@@ -0,0 +1,9 @@
API_HOST=https://api.qa.fleetbase.io
API_NAMESPACE=int/v1
API_SECURE=true
SOCKETCLUSTER_PATH=/socketcluster/
SOCKETCLUSTER_HOST=socket.qa.fleetbase.io
SOCKETCLUSTER_SECURE=true
SOCKETCLUSTER_PORT=8000
OSRM_HOST=https://bundle.routing.fleetbase.io
OSRM_SERVERS=https://canada.routing.fleetbase.io,https://us.routing.fleetbase.io

View File

@@ -1,6 +1,6 @@
{
"name": "@fleetbase/console",
"version": "0.4.18",
"version": "0.4.16",
"private": true,
"description": "Fleetbase Console",
"repository": "https://github.com/fleetbase/fleetbase",
@@ -29,13 +29,14 @@
"test:ember": "ember test"
},
"dependencies": {
"@fleetbase/ember-core": "^0.2.9",
"@fleetbase/ember-ui": "^0.2.13",
"@fleetbase/fleetops-engine": "^0.4.26",
"@fleetbase/ember-core": "^0.2.8",
"@fleetbase/ember-ui": "^0.2.12",
"@fleetbase/fleetops-engine": "^0.4.25",
"@fleetbase/fleetops-data": "^0.1.14",
"@fleetbase/storefront-engine": "^0.3.7",
"@fleetbase/dev-engine": "^0.2.2",
"@fleetbase/iam-engine": "^0.0.10",
"@fleetbase/billing-engine": "^0.0.6",
"@fleetbase/leaflet-routing-machine": "^3.2.16",
"@ember/legacy-built-in-components": "^0.4.1",
"@fortawesome/ember-fontawesome": "^0.4.1",
@@ -142,8 +143,8 @@
},
"pnpm": {
"overrides": {
"@fleetbase/ember-core": "^0.2.9",
"@fleetbase/ember-ui": "^0.2.13",
"@fleetbase/ember-core": "^0.2.8",
"@fleetbase/ember-ui": "^0.2.12",
"@fleetbase/fleetops-data": "^0.1.14"
}
},

16924
console/pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from '@fleetbase/console/tests/helpers';
import { render } from '@ember/test-helpers';
import { hbs } from 'ember-cli-htmlbars';
module('Integration | Component | locale-selector', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Set any properties with this.set('myProperty', 'value');
// Handle any actions with this.set('myAction', function(val) { ... });
await render(hbs`<LocaleSelector />`);
assert.dom().hasText('');
// Template block usage:
await render(hbs`
<LocaleSelector>
template block text
</LocaleSelector>
`);
assert.dom().hasText('template block text');
});
});

View File

@@ -1,14 +0,0 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Model | chat log', 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('chat-log', {});
assert.ok(model);
});
});

View File

@@ -1,24 +0,0 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Serializer | chat channel', 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('chat-channel');
assert.ok(serializer);
});
test('it serializes records', function (assert) {
let store = this.owner.lookup('service:store');
let record = store.createRecord('chat-channel', {});
let serializedRecord = record.serialize();
assert.ok(serializedRecord);
});
});

View File

@@ -1,24 +0,0 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Serializer | chat message', 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('chat-message');
assert.ok(serializer);
});
test('it serializes records', function (assert) {
let store = this.owner.lookup('service:store');
let record = store.createRecord('chat-message', {});
let serializedRecord = record.serialize();
assert.ok(serializedRecord);
});
});

View File

@@ -1,24 +0,0 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Serializer | chat participant', 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('chat-participant');
assert.ok(serializer);
});
test('it serializes records', function (assert) {
let store = this.owner.lookup('service:store');
let record = store.createRecord('chat-participant', {});
let serializedRecord = record.serialize();
assert.ok(serializedRecord);
});
});