Compare commits

..

37 Commits

Author SHA1 Message Date
Ron
5426ac374d Merge pull request #234 from fleetbase/dev-v0.4.13
v0.4.13
2024-03-15 17:27:12 +08:00
Ronald A. Richardson
73f56b7958 added translations for schedule monitor ui 2024-03-15 17:23:06 +08:00
Ronald A. Richardson
095eb87e14 preparing for new release 2024-03-15 17:00:31 +08:00
Ronald A. Richardson
fabc16612b core-api upgrade includes improved upload error reporting 2024-03-13 18:02:22 +08:00
Ronald A. Richardson
3389cba935 added the visibility_handler to the gcs filesystem driver config 2024-03-13 17:13:23 +08:00
Ron
099ea57c39 Merge pull request #231 from fleetbase/dev-v0.4.12
v0.4.12
2024-03-13 15:26:36 +08:00
Ronald A. Richardson
5492bc7299 - Revamped service rates to integrate with the new order configuration system.
- Enhanced activities to now support proof of delivery requirements.
- Patched and improved the stringent validation for creating new orders.
- Added a new column `order_config_uuid` to the `service_rates` table for better data management.
- Various other minor improvements and optimizations for enhanced performance and stability.
- Critical patch and improvement to location service
2024-03-13 15:15:42 +08:00
Ron
00b037a385 Merge pull request #229 from fleetbase/dev-v0.4.11
v0.4.11
2024-03-12 18:18:42 +08:00
Ronald A. Richardson
151fea2505 ready for release 2024-03-12 18:13:35 +08:00
Ronald A. Richardson
08f901d865 patches following major release 2024-03-12 17:55:51 +08:00
Ron
116873a1ce Merge pull request #225 from fleetbase/dev-v0.4.10
v0.4.10
2024-03-11 21:12:01 +08:00
Ronald A. Richardson
20a1793447 remove test url from cors allowed_origins 2024-03-11 21:07:23 +08:00
Ronald A. Richardson
72ab83dc7a release is ready 2024-03-11 21:06:25 +08:00
Ronald A. Richardson
171e365ba6 added commercial license 2024-03-11 20:33:39 +08:00
Ronald A. Richardson
009f2d6e53 Merge branch 'dev-v0.4.10' of github.com:fleetbase/fleetbase into dev-v0.4.10 2024-03-11 16:25:17 +08:00
Ronald A. Richardson
4a59318feb upgraded fleetops-data; fixed custom fields and custom field value models; patch notification model 2024-03-11 16:24:46 +08:00
Ron
8920039b40 Merge pull request #227 from fleetbase/fix/helm_install_order 2024-03-11 12:44:53 +08:00
Eugene Dementyev
cd9be05714 Remove helm service hooks. Use DNS names for services 2024-03-08 20:40:31 +13:00
Ron
fbe35545e9 Merge pull request #223 from fleetbase/feature/nginx_host_header
Make nginx pass the Host header
2024-03-06 13:14:35 +08:00
Ron
56ab967d7a Merge pull request #224 from fleetbase/fix/helm_install_order
Fix/helm install order
2024-03-06 13:14:03 +08:00
Ronald A. Richardson
79604c7981 preparing for v0.4.10 release 2024-03-06 13:10:31 +08:00
Eugene Dementyev
312eb1aa6f Adds pre-install for redis service 2024-03-02 20:55:17 +13:00
Eugene Dementyev
6572a59120 Fixes helm install order 2024-03-02 20:21:18 +13:00
Eugene Dementyev
fa536c6183 Make nginx pass the Host header 2024-02-27 19:54:50 +13:00
Ron
d4626be332 Merge pull request #221 from fleetbase/dev-v0.4.9
v0.4.9
2024-02-24 16:02:05 +07:00
Ronald A. Richardson
ffc54ecdbb upgrade dependencies which has expansion hotfixes 2024-02-24 16:59:12 +08:00
Ron
9bf097b88b Merge pull request #220 from fleetbase/dev-v0.4.8
v0.4.8
2024-02-23 12:48:50 +07:00
Ronald A. Richardson
52c8df8b66 prepared for next release 2024-02-23 13:47:15 +08:00
Ron
908e0eb9ee Merge pull request #219 from fleetbase/dev-v0.4.7
v0.4.7
2024-02-22 17:11:51 +07:00
Ronald A. Richardson
6438138913 add upgraded core-api submodule 2024-02-22 17:57:22 +08:00
Ronald A. Richardson
aee06a2146 update composer lockfile 2024-02-22 17:54:01 +08:00
Ronald A. Richardson
ccacc6c597 adds fleetops migrations hotfix 2024-02-22 12:43:33 +08:00
Ron
62c396b789 Merge pull request #218 from fleetbase/dev-v0.4.6
v0.4.6
2024-02-21 17:48:54 +07:00
Ronald A. Richardson
295da5f331 fix composer files 2024-02-21 18:44:27 +08:00
Ronald A. Richardson
e775ccc2c8 upgraded dependencies and prepared for release 2024-02-21 18:40:36 +08:00
Ronald A. Richardson
bd0759881f updated notification channel config for firebase and apn 2024-02-21 18:16:15 +08:00
Ronald A. Richardson
830ae69b1d hotfix: composer.lock with core-api upgrade 2024-02-17 20:04:35 +08:00
49 changed files with 2623 additions and 1508 deletions

11
COMMERCIAL_LICENSE.md Normal file
View File

@@ -0,0 +1,11 @@
FLEETBASE DUAL LICENSE
COPYRIGHT (C) 2024 FLEETBASE PTE LTD.
PERMISSION IS HEREBY GRANTED, FREE OF CHARGE, TO ANY PERSON OBTAINING A COPY OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE "SOFTWARE"), TO USE THE SOFTWARE FOR NON-COMMERCIAL PURPOSES ONLY. NON-COMMERCIAL PURPOSES INCLUDE INTERNAL OPERATIONS, ACADEMIC RESEARCH, PERSONAL PROJECTS, OR ANY OTHER USE THAT IS NOT INTENDED FOR COMMERCIAL GAIN.
FOR VERSIONS 0.4.10 ONWARDS, YOU ARE PERMITTED TO USE THE SOFTWARE FOR NON-COMMERCIAL PURPOSES FREE OF CHARGE. HOWEVER, COMMERCIAL USE OF THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO BUILDING SAAS PLATFORMS, OFFERING SERVICES TO THIRD PARTIES, OR INTEGRATING WITH COMMERCIAL PRODUCTS, REQUIRES THE PURCHASE OF A COMMERCIAL LICENSE FROM FLEETBASE PTE LTD.
FOR INQUIRIES REGARDING COMMERCIAL LICENSING OR ANY OTHER QUESTIONS RELATED TO FLEETBASE, PLEASE CONTACT HELLO@FLEETBASE.IO.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

21
LICENSE
View File

@@ -1,21 +0,0 @@
MIT License
Copyright (c) 2023 Fleetbase Pte Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

21
LICENSE.md Normal file
View File

@@ -0,0 +1,21 @@
MIT LICENSE
COPYRIGHT (C) 2023 FLEETBASE PTE LTD
PERMISSION IS HEREBY GRANTED, FREE OF CHARGE, TO ANY PERSON OBTAINING A COPY
OF THIS SOFTWARE AND ASSOCIATED DOCUMENTATION FILES (THE "SOFTWARE"), TO DEAL
IN THE SOFTWARE WITHOUT RESTRICTION, INCLUDING WITHOUT LIMITATION THE RIGHTS
TO USE, COPY, MODIFY, MERGE, PUBLISH, DISTRIBUTE, SUBLICENSE, AND/OR SELL
COPIES OF THE SOFTWARE, AND TO PERMIT PERSONS TO WHOM THE SOFTWARE IS
FURNISHED TO DO SO, SUBJECT TO THE FOLLOWING CONDITIONS:
THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN ALL
COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -9,9 +9,9 @@
"license": "MIT",
"require": {
"php": "^8.0",
"fleetbase/core-api": "^1.4.5",
"fleetbase/fleetops-api": "^0.4.12",
"fleetbase/storefront-api": "^0.3.0",
"fleetbase/core-api": "^1.4.14",
"fleetbase/fleetops-api": "^0.4.20",
"fleetbase/storefront-api": "^0.3.5",
"guzzlehttp/guzzle": "^7.0.1",
"laravel/framework": "^10.0",
"laravel/octane": "^2.3",

2061
api/composer.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -27,7 +27,7 @@ return [
'allowed_headers' => ['*'],
'exposed_headers' => [],
'exposed_headers' => ['x-compressed-json', 'access-console-sandbox', 'access-console-sandbox-key'],
'max_age' => 0,

View File

@@ -58,6 +58,7 @@ return [
'bucket' => env('GOOGLE_CLOUD_STORAGE_BUCKET', env('AWS_BUCKET')),
'path_prefix' => env('GOOGLE_CLOUD_STORAGE_PATH_PREFIX', null),
'storage_api_uri' => env('GOOGLE_CLOUD_STORAGE_API_URI', env('AWS_URL')),
'visibility_handler' => \League\Flysystem\GoogleCloudStorage\UniformBucketLevelAccessVisibility::class,
],
],

View File

@@ -17,3 +17,6 @@ php artisan fleetbase:seed
# Restart queue
php artisan queue:restart
# Sync scheduler
php artisan schedule-monitor:sync

View File

@@ -7,6 +7,31 @@
<InputGroup @name="S3 URL" @value={{this.s3Url}} disabled={{this.isLoading}} />
<InputGroup @name="S3 Endpoint" @value={{this.s3Endpoint}} disabled={{this.isLoading}} />
{{/if}}
{{#if (eq this.driver "gcs")}}
{{#if this.isGoogleCloudStorageEnvConfigued}}
<div class="border border-yellow-900 shadow-sm rounded-lg bg-yellow-200 mb-4">
<div class="px-3 py-2 text-sm text-yellow-900 flex items-center">
<FaIcon @icon="triangle-exclamation" @size="md" class="mr-1.5" />
Warning! GCS is already configured in the server environment. Changing values below may break this.
</div>
</div>
{{/if}}
<InputGroup @name="GCS Bucket" @value={{this.gcsBucket}} disabled={{this.isLoading}} />
<InputGroup @name="GCS Service Account Key File" @wrapperClass="">
<div class="flex flex-row items-center mb-0i">
<UploadButton @name="firebase-service-account" @accept="text/plain,text/javascript,application/json" @onFileAdded={{this.uploadGcsCredentialsFile}} @buttonText="Upload Service Account JSON" @icon="upload" class="w-auto m-0i mt-0i" />
{{#if this.gcsCredentialsFile}}
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
<span>{{this.gcsCredentialsFile.original_filename}}</span>
<a href="javascript:;" class="text-red-500 ml-2" {{on "click" this.removeGcsCredentialsFile}}>
<FaIcon @icon="times" class="text-red-500" />
</a>
</div>
{{/if}}
</div>
</InputGroup>
{{/if}}
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />

View File

@@ -6,6 +6,7 @@ import { action } from '@ember/object';
export default class ConfigureFilesystemComponent extends Component {
@service fetch;
@service notifications;
@service currentUser;
@tracked isLoading = false;
@tracked testResponse;
@tracked disks = [];
@@ -13,6 +14,10 @@ export default class ConfigureFilesystemComponent extends Component {
@tracked s3Bucket = null;
@tracked s3Url = null;
@tracked s3Endpoint = null;
@tracked gcsBucket = null;
@tracked gcsCredentialsFileId = null;
@tracked gcsCredentialsFile = null;
@tracked isGoogleCloudStorageEnvConfigued = false;
/**
* Creates an instance of ConfigureFilesystemComponent.
@@ -59,6 +64,8 @@ export default class ConfigureFilesystemComponent extends Component {
url: this.s3Url,
endpoint: this.s3Endpoint,
},
gcsCredentialsFileId: this.gcsCredentialsFileId,
gcsBucket: this.gcsBucket,
})
.then(() => {
this.notifications.success('Filesystem configuration saved.');
@@ -82,4 +89,31 @@ export default class ConfigureFilesystemComponent extends Component {
this.isLoading = false;
});
}
@action removeGcsCredentialsFile() {
this.gcsCredentialsFileId = undefined;
this.gcsCredentialsFile = undefined;
}
@action uploadGcsCredentialsFile(file) {
try {
this.fetch.uploadFile.perform(
file,
{
path: 'gcs',
subject_uuid: this.currentUser.companyId,
subject_type: 'company',
type: 'gcs_credentials',
},
(uploadedFile) => {
console.log('uploadedFile', uploadedFile);
this.gcsCredentialsFileId = uploadedFile.id;
this.gcsCredentialsFile = uploadedFile;
console.log('this.gcsCredentialsFile', this.gcsCredentialsFile);
}
);
} catch (error) {
this.notifications.serverError(error);
}
}
}

View File

@@ -6,7 +6,7 @@
<Textarea class="form-input w-full" @value={{this.apn.private_key_content}} placeholder="APN Private Key" rows="10" disabled={{this.isLoading}} />
</InputGroup> --}}
<InputGroup @wrapperClass="flex flex-row items-center">
<UploadButton @name="apn-key" @accept="text/plain,application/x-pem-file,application/x-pkcs12,application/x-x509-ca-cert,.p12,.pem,.p8" @onFileAdded={{this.uploadApnKey}} @buttonText="Upload P8 Key File" @uploadIcon="upload" class="w-auto m-0i mt-0i" />
<UploadButton @name="apn-key" @accept="text/plain,application/x-pem-file,application/x-pkcs12,application/x-x509-ca-cert,.p12,.pem,.p8" @onFileAdded={{this.uploadApnKey}} @buttonText="Upload P8 Key File" @icon="upload" class="w-auto m-0i mt-0i" />
{{#if this.apn.private_key_file}}
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
@@ -15,16 +15,32 @@
</div>
{{/if}}
</InputGroup>
<InputGroup>
<InputGroup @wrapperClass="mb-0i">
<Checkbox @label="APN Production" @value={{this.apn.production}} @onToggle={{fn (mut this.apn.production)}} @disabled={{this.isLoading}} />
</InputGroup>
</ContentPanel>
<ContentPanel @title="Firebase Configutation" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @wrapperClass="flex flex-row items-center mb-0i">
<UploadButton @name="firebase-service-account" @accept="text/plain,text/javascript,application/json" @onFileAdded={{this.uploadFirebaseCredentials}} @buttonText="Upload Service Account JSON" @icon="upload" class="w-auto m-0i mt-0i" />
{{#if this.firebase.credentials_file}}
<div class="ml-2.5 text-sm dark:text-white text-black flex flex-row items-center border border-blue-500 rounded-lg px-2 py-0.5 -mt-1">
<FaIcon @icon="file-text" @size="sm" class="mr-2 dark:text-white text-black" />
<span>{{this.firebase.credentials_file.original_filename}}</span>
<a href="javascript:;" class="text-red-500 ml-2" {{on "click" this.removeFirebaseCredentialsFile}}><FaIcon @icon="times" class="text-red-500" /></a>
</div>
{{/if}}
</InputGroup>
</ContentPanel>
<ContentPanel @title="Test Push Notification" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-900">
{{#if this.testResponse}}
<div class="animate-pulse flex flex-row items-center rounded-lg border {{if (eq this.testResponse.status 'error') 'border-red-900 bg-red-800 text-red-100' 'border-green-900 bg-green-800 text-green-100'}} shadow-sm my-2 px-4 py-2">
<FaIcon @icon={{if (eq this.testResponse.status 'error') 'triangle-exclamation' 'circle-check'}} class="mr-1.5 {{if (eq this.testResponse.status 'error') 'text-red-200' 'text-green-200'}}" />
<span class="text-xs">{{this.this.testResponse.message}}</span>
</div>
{{/if}}
<div class="mt-3 rounded-lg bg-gray-900 shadow-inner p-3">
<div class="">
<div class="flex flex-col space-y-2">
<div class="flex flex-row items-center">
<div class="text-sm w-40">Title:</div>
@@ -47,6 +63,8 @@
</div>
</ContentPanel>
<Spacer @height="300px" />
<EmberWormhole @to="next-view-section-subheader-actions">
<Button @type="primary" @size="sm" @icon="save" @text="Save Changes" @onClick={{this.save}} @disabled={{this.isLoading}} @isLoading={{this.isLoading}} />
</EmberWormhole>

View File

@@ -18,14 +18,13 @@ export default class ConfigureNotificationChannelsComponent extends Component {
team_id: '',
app_bundle_id: '',
private_key_path: '',
_private_key_path: '',
private_key_file_id: '',
private_key_file: null,
production: true,
};
@tracked fcm = {
firebase_credentials_json: '',
firebase_database_url: '',
firebase_project_name: '',
@tracked firebase = {
credentials: '',
};
constructor() {
@@ -38,26 +37,36 @@ export default class ConfigureNotificationChannelsComponent extends Component {
apnConfig.private_key_file = null;
apnConfig.private_key_file_id = '';
apnConfig.private_key_path = '';
apnConfig._private_key_path = '';
this.apn = apnConfig;
}
@action removeFirebaseCredentialsFile() {
const firebaseConfig = this.firebase;
firebaseConfig.credentials_file = null;
firebaseConfig.credentials_file_id = '';
firebaseConfig.credentials = '';
this.firebase = firebaseConfig;
}
@action uploadApnKey(file) {
try {
this.fetch.uploadFile.perform(
file,
{
disk: 'local',
path: `apn`,
path: 'apn',
subject_uuid: this.currentUser.companyId,
subject_type: `company`,
type: `apn_key`,
subject_type: 'company',
type: 'apn_key',
},
(uploadedFile) => {
const apnConfig = this.apn;
apnConfig.private_key_file = uploadedFile;
apnConfig.private_key_file_id = uploadedFile.id;
apnConfig.private_key_path = uploadedFile.path;
apnConfig._private_key_path = uploadedFile.path;
this.apn = apnConfig;
}
@@ -67,6 +76,30 @@ export default class ConfigureNotificationChannelsComponent extends Component {
}
}
@action uploadFirebaseCredentials(file) {
try {
this.fetch.uploadFile.perform(
file,
{
path: 'firebase',
subject_uuid: this.currentUser.companyId,
subject_type: 'company',
type: 'firebase_credentials',
},
(uploadedFile) => {
const firebaseConfig = this.firebase;
firebaseConfig.credentials_file = uploadedFile;
firebaseConfig.credentials_file_id = uploadedFile.id;
firebaseConfig.credentials_file_path = uploadedFile.path;
this.firebase = firebaseConfig;
}
);
} catch (error) {
this.notifications.serverError(error);
}
}
@action setConfigValues(config) {
for (const key in config) {
if (this[key] !== undefined) {
@@ -94,9 +127,13 @@ export default class ConfigureNotificationChannelsComponent extends Component {
const apnConfig = this.apn;
delete apnConfig.private_key_file;
const firebaseConfig = this.firebase;
delete firebaseConfig.credentials_file;
this.fetch
.post('settings/notification-channels-config', {
apn: apnConfig,
firebase: firebaseConfig,
})
.then(() => {
this.notifications.success("Notification channel's configuration saved.");
@@ -112,6 +149,7 @@ export default class ConfigureNotificationChannelsComponent extends Component {
this.fetch
.post('settings/test-notification-channels-config', {
apn: this.apn,
firebase: this.firebase,
title: this.testTitle,
message: this.testMessage,
apnToken: this.apnToken,

View File

@@ -60,6 +60,13 @@ export default class ConsoleAdminOrganizationsIndexUsersController extends Contr
*/
@tracked company;
/**
* The overlay context API.
*
* @memberof ConsoleAdminOrganizationsIndexUsersController
*/
@tracked contextApi;
/**
* Queryable parameters for this controller's model
*

View File

@@ -0,0 +1,65 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';
export default class ConsoleAdminScheduleMonitorLogsController extends Controller {
/**
* The router service.
*
* @memberof ConsoleAdminScheduleMonitorLogsController
*/
@service router;
/**
* The fetch service.
*
* @memberof ConsoleAdminScheduleMonitorLogsController
*/
@service fetch;
/**
* Tracked property for logs.
* @type {Array}
*/
@tracked logs = [];
/**
* Tracked property for the context API.
* @type {Object}
*/
@tracked contextApi;
/**
* Periodically reloads logs every 3 seconds.
*
* @memberof ConsoleAdminScheduleMonitorLogsController
*/
@task *reload(task) {
this.logs = yield this.fetch.get(`schedule-monitor/${task.id}/logs`);
}
/**
* Set the overlay component context object.
*
* @param {Object} contextApi
* @memberof ConsoleAdminOrganizationsIndexUsersController
*/
@action setOverlayContext(contextApi) {
this.contextApi = contextApi;
}
/**
* Handle closing the overlay.
*
* @return {Promise<Transition>}
* @memberof ConsoleAdminOrganizationsIndexUsersController
*/
@action onPressClose() {
if (this.contextApi && typeof this.contextApi.close === 'function') {
this.contextApi.close();
}
return this.router.transitionTo('console.admin.schedule-monitor');
}
}

View File

@@ -1,7 +1,12 @@
export function initialize() {
const socketClusterClientScript = document.createElement('script');
socketClusterClientScript.src = '/assets/socketcluster-client.min.js';
document.body.appendChild(socketClusterClientScript);
// Check if the script already exists
// Only insert the script tag if it doesn't already exist
if (!document.querySelector('script[data-socketcluster-client]')) {
const socketClusterClientScript = document.createElement('script');
socketClusterClientScript.setAttribute('data-socketcluster-client', '1');
socketClusterClientScript.src = '/assets/socketcluster-client.min.js';
document.body.appendChild(socketClusterClientScript);
}
}
export default {

View File

@@ -29,6 +29,7 @@ export default class CategoryModel extends Model {
@attr('string') slug;
@attr('string') order;
@attr('raw') translations;
@attr('raw') meta;
/** @dates */
@attr('date') deleted_at;

View File

@@ -0,0 +1,54 @@
import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { getOwner } from '@ember/application';
import { format, formatDistanceToNow } from 'date-fns';
function isValidFileObjectJson(str) {
return typeof str === 'string' && str.startsWith('{') && str.endsWith('}');
}
export default class CustomFieldValueModel extends Model {
/** @ids */
@attr('string') company_uuid;
@attr('string') custom_field_uuid;
@attr('string') subject_uuid;
@attr('string') subject_type;
/** @attributes */
@attr('string') value;
@attr('string') value_type;
/** @dates */
@attr('date') created_at;
@attr('date') updated_at;
@attr('date') deleted_at;
/** @computed */
@computed('value') get asFile() {
const owner = getOwner(this);
const fetch = owner.lookup(`service:fetch`);
const value = this.value;
if (!isValidFileObjectJson(value)) {
return null;
}
const fileModel = fetch.jsonToModel(value, 'file');
return fileModel;
}
@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

@@ -0,0 +1,48 @@
import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { format, formatDistanceToNow } from 'date-fns';
export default class CustomFieldModel extends Model {
/** @ids */
@attr('string') company_uuid;
@attr('string') category_uuid;
@attr('string') subject_uuid;
@attr('string') subject_type;
/** @attributes */
@attr('string') name;
@attr('string') description;
@attr('string') help_text;
@attr('string') label;
@attr('string') type;
@attr('string') component;
@attr('string') default_value;
@attr('number') order;
@attr('boolean') required;
@attr('boolean', { defaultValue: true }) editable;
@attr('raw') options;
@attr('raw') validation_rules;
@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

@@ -1,6 +1,5 @@
import Model, { attr } from '@ember-data/model';
import { computed } from '@ember/object';
import { format, formatDistanceToNow } from 'date-fns';
export default class NotificationModel extends Model {

View File

@@ -0,0 +1,10 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ConsoleAdminScheduleMonitorRoute extends Route {
@service fetch;
model() {
return this.fetch.get('schedule-monitor/tasks');
}
}

View File

@@ -0,0 +1,14 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ConsoleAdminScheduleMonitorLogsRoute extends Route {
@service fetch;
model({ id }) {
return this.fetch.get(`schedule-monitor/${id}`);
}
async setupController(controller, model) {
controller.logs = await this.fetch.get(`schedule-monitor/${model.id}/logs`);
}
}

View File

@@ -6,6 +6,7 @@
<Layout::Sidebar::Item @route="console.admin.branding" @icon="palette">{{t "common.branding"}}</Layout::Sidebar::Item>
<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>
<Layout::Sidebar::Item @route="console.admin.schedule-monitor" @icon="calendar-check">{{t "console.admin.schedule-monitor.schedule-monitor"}}</Layout::Sidebar::Item>
{{#each this.universe.adminMenuItems as |menuItem|}}
<Layout::Sidebar::Item
@onClick={{fn this.universe.transitionMenuItem "console.admin.virtual" menuItem}}

View File

@@ -4,7 +4,7 @@
</Layout::Section::Header>
<Layout::Section::Body class="overflow-y-scroll h-full">
<div class="container mx-auto h-screen" {{increase-height-by 300}}>
<div class="container mx-auto h-screen">
<div class="max-w-3xl my-10 mx-auto space-y-6">
<ContentPanel @title={{t "console.admin.branding.title"}} @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<form class="flex flex-col" {{on "submit" this.save}}>
@@ -63,4 +63,5 @@
</ContentPanel>
</div>
</div>
<Spacer @height="300px" />
</Layout::Section::Body>

View File

@@ -4,7 +4,7 @@
</Layout::Section::Header>
<Layout::Section::Body class="overflow-y-scroll h-full">
<div class="container mx-auto h-screen" {{increase-height-by 1200}}>
<div class="container mx-auto h-screen">
<div class="max-w-3xl my-10 mx-auto space-y-4">
{{#each-in this.groupedNotifications as |groupName notifications|}}
<ContentPanel @title={{concat (smart-humanize groupName) (t "console.admin.notifications.notification-settings") }} @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
@@ -29,4 +29,5 @@
{{/each-in}}
</div>
</div>
<Spacer @height="300px" />
</Layout::Section::Body>

View File

@@ -0,0 +1,34 @@
{{page-title (t "console.admin.schedule-monitor.schedule-monitor")}}
<Layout::Section::Header @title={{t "console.admin.schedule-monitor.schedule-monitor"}} />
<Layout::Section::Body class="overflow-y-scroll h-full">
<div class="next-table-wrapper">
<table>
<thead>
<tr>
<th {{set-width "300px"}}>{{t "console.admin.schedule-monitor.name"}}</th>
<th {{set-width "100px"}}>{{t "console.admin.schedule-monitor.type"}}</th>
<th {{set-width "90px"}}>{{t "console.admin.schedule-monitor.timezone"}}</th>
<th>{{t "console.admin.schedule-monitor.last-started"}}</th>
<th>{{t "console.admin.schedule-monitor.last-finished"}}</th>
<th>{{t "console.admin.schedule-monitor.last-failure"}}</th>
</tr>
</thead>
<tbody>
{{#each @model as |task|}}
<tr>
<td>
<LinkTo @route="console.admin.schedule-monitor.logs" @model={{task}}>{{task.name}}</LinkTo>
</td>
<td>{{task.type}}</td>
<td>{{task.timezone}}</td>
<td>{{n-a task.last_started_at_fmt}}</td>
<td>{{n-a task.last_finished_at_fmt}}</td>
<td>{{n-a task.last_failed_at_fmt}}</td>
</tr>
{{/each}}
</tbody>
</table>
</div>
</Layout::Section::Body>
{{outlet}}

View File

@@ -0,0 +1,34 @@
{{page-title (concat (t "console.admin.schedule-monitor.schedule-monitor") " - " @model.name)}}
<Overlay @isOpen={{true}} @onLoad={{this.setOverlayContext}} @position="right" @noBackdrop={{true}} @fullHeight={{true}} @width="600px" @isResizable={{true}}>
<Overlay::Header @title={{concat (t "console.admin.schedule-monitor.task-logs-for") @model.name}} @titleClass="max-w-400px truncate" @hideStatusDot={{true}} @titleWrapperClass="leading-5">
<div class="flex flex-1 justify-end">
<Button @type="default" @icon="times" @helpText={{t "common.close-and-save"}} @onClick={{this.onPressClose}} />
</div>
</Overlay::Header>
<Overlay::Body>
<div class="p-4">
<div class="flex items-center justify-between mb-4">
<div class="text-sm">{{t "console.admin.schedule-monitor.showing-last-count" count=20}}</div>
<Button @size="xs" @icon="arrows-rotate" @onClick={{perform this.reload @model}} @isLoading={{not this.reload.isIdle}} />
</div>
<div class="space-y-4">
{{#each this.logs as |log|}}
<div class="bg-gray-100 border border-gray-200 dark:border-gray-700 dark:bg-gray-800 rounded-lg p-2 font-mono text-xs">
<div class="font-mono"><span class="font-semibold font-mono">{{t "console.admin.schedule-monitor.date"}}:</span> {{log.created_at_fmt}}</div>
<div class="font-mono"><span class="font-semibold font-mono">{{t "console.admin.schedule-monitor.memory"}}:</span> {{format-bytes log.meta.memory}}</div>
<div class="font-mono"><span class="font-semibold font-mono">{{t "console.admin.schedule-monitor.runtime"}}:</span> {{format-milliseconds log.meta.runtime}}</div>
<div class="font-semibold font-mono mb-2">{{t "console.admin.schedule-monitor.output"}}:</div>
<div class="whitespace-pre-line overflow-hidden bg-black text-green-400 rounded-lg p-2 font-mono text-xs border border-gray-900">
{{#if log.meta.output}}
{{log.meta.output}}
{{else}}
{{t "console.admin.schedule-monitor.no-output"}}
{{/if}}
</div>
</div>
{{/each}}
</div>
</div>
</Overlay::Body>
</Overlay>

View File

@@ -4,7 +4,7 @@
</Layout::Section::Header>
<Layout::Section::Body class="overflow-y-scroll h-full">
<div class="container mx-auto h-screen" {{increase-height-by 1200}}>
<div class="container mx-auto h-screen">
<div class="max-w-3xl my-10 mx-auto space-y-4">
<ContentPanel @title="2FA Config" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
{{#if this.loadSystemTwoFaConfig.isIdle}}
@@ -25,4 +25,5 @@
</ContentPanel>
</div>
</div>
<Spacer @height="300px" />
</Layout::Section::Body>

View File

@@ -46,9 +46,12 @@ module.exports = function (environment) {
driverImage: getenv('DEFAULT_DRIVER_IMAGE', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/no-avatar.png'),
userImage: getenv('DEFAULT_USER_IMAGE', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/no-avatar.png'),
contactImage: getenv('DEFAULT_CONTACT_IMAGE', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/no-avatar.png'),
entityImage: getenv('DEFAULT_ENTITY_IMAGE', 'https://flb-assets.s3-ap-southeast-1.amazonaws.com/static/parcels/medium.png'),
vendorImage: getenv('DEFAULT_VENDOR_IMAGE', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/no-avatar.png'),
vehicleImage: getenv('DEFAULT_VEHICLE_IMAGE', 'https://s3.ap-southeast-1.amazonaws.com/flb-assets/static/vehicle-placeholder.png'),
vehicleAvatar: getenv('DEFAUL_VEHICLE_AVATAR', 'https://flb-assets.s3-ap-southeast-1.amazonaws.com/static/vehicle-icons/mini_bus.svg'),
driverAvatar: getenv('DEFAUL_DRIVER_AVATAR', 'https://flb-assets.s3-ap-southeast-1.amazonaws.com/static/driver-icons/moto-driver.png'),
placeAvatar: getenv('DEFAUL_PLACE_AVATAR', 'https://flb-assets.s3-ap-southeast-1.amazonaws.com/static/place-icons/basic-building.png'),
},
'ember-simple-auth': {
@@ -60,6 +63,11 @@ module.exports = function (environment) {
keyDelimiter: '/',
includeEmberDataSupport: true,
},
'ember-cli-notifications': {
autoClear: true,
clearDuration: 1000 * 3.5,
},
};
if (environment === 'development') {

View File

@@ -1,6 +1,6 @@
{
"name": "@fleetbase/console",
"version": "0.4.5",
"version": "0.4.13",
"private": true,
"description": "Fleetbase Console",
"repository": "https://github.com/fleetbase/fleetbase",
@@ -29,11 +29,11 @@
"test:ember": "ember test"
},
"dependencies": {
"@fleetbase/ember-core": "^0.2.4",
"@fleetbase/ember-ui": "^0.2.10",
"@fleetbase/storefront-engine": "^0.3.0",
"@fleetbase/fleetops-engine": "^0.4.12",
"@fleetbase/fleetops-data": "^0.1.8",
"@fleetbase/ember-core": "^0.2.8",
"@fleetbase/ember-ui": "^0.2.11",
"@fleetbase/fleetops-engine": "^0.4.20",
"@fleetbase/fleetops-data": "^0.1.14",
"@fleetbase/storefront-engine": "^0.3.5",
"@fleetbase/dev-engine": "^0.2.1",
"@fleetbase/iam-engine": "^0.0.9",
"@fleetbase/leaflet-routing-machine": "^3.2.16",
@@ -142,9 +142,9 @@
},
"pnpm": {
"overrides": {
"@fleetbase/ember-core": "^0.2.4",
"@fleetbase/ember-ui": "^0.2.10",
"@fleetbase/fleetops-data": "^0.1.8"
"@fleetbase/ember-core": "^0.2.8",
"@fleetbase/ember-ui": "^0.2.11",
"@fleetbase/fleetops-data": "^0.1.14"
}
},
"prettier": {

1423
console/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -54,6 +54,9 @@ Router.map(function () {
this.route('users', { path: '/:public_id/users' });
});
});
this.route('schedule-monitor', function () {
this.route('logs', { path: '/:id/logs' });
});
});
});
this.route('install');

View File

@@ -0,0 +1,12 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Controller | console/admin/schedule-monitor/logs', function (hooks) {
setupTest(hooks);
// TODO: Replace this with your real tests.
test('it exists', function (assert) {
let controller = this.owner.lookup('controller:console/admin/schedule-monitor/logs');
assert.ok(controller);
});
});

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Route | console/admin/schedule-monitor', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup('route:console/admin/schedule-monitor');
assert.ok(route);
});
});

View File

@@ -0,0 +1,11 @@
import { module, test } from 'qunit';
import { setupTest } from '@fleetbase/console/tests/helpers';
module('Unit | Route | console/admin/schedule-monitor/logs', function (hooks) {
setupTest(hooks);
test('it exists', function (assert) {
let route = this.owner.lookup('route:console/admin/schedule-monitor/logs');
assert.ok(route);
});
});

View File

@@ -16,6 +16,7 @@ common:
confirm: Confirm
edit: Edit
save: Save
save-changes: Save Changes
cancel: Cancel
2fa-config: 2FA Config
account: Account
@@ -59,6 +60,7 @@ common:
users: Users
changelog: Changelog
ok: OK
select-file: Select File
component:
file:
dropdown-label: File actions
@@ -71,7 +73,9 @@ component:
upload-images-videos: Upload Images & Videos
upload-documents: Upload Documents
upload-documents-files: Upload Documents & Files
upload-avatar-files: Upload Custom Avatars
dropzone-supported-images-videos: Drag and drop image and video files onto this dropzone
dropzone-supported-avatars: Drag and drop SVG or PNG files
dropzone-supported-files: Drag and drop files onto this dropzone
or-select-button-text: or select files to upload.
upload-queue: Upload Queue
@@ -200,6 +204,22 @@ console:
phone: Your phone number.
photos: photos
admin:
schedule-monitor:
schedule-monitor: Schedule Monitor
task-logs-for: >-
Task Logs For:
showing-last-count: Showing last {count} logs
name: Name
type: Type
timezone: Timezone
last-started: Last Started
last-finished: Last Finished
last-failure: Last Failure
date: Date
memory: Memory
runtime: Runtime
output: Output
no-output: No output
config:
database:
title: Database Configuration

View File

@@ -12,7 +12,32 @@ server {
send_timeout 600;
index index.php;
# tweaks
client_max_body_size 600M;
client_body_buffer_size 1m;
client_header_buffer_size 1k;
large_client_header_buffers 4 16k;
keepalive_timeout 2 2;
#gzip tweaks
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain application/javascript application/json application/x-javascript text/xml text/css;
#open file cache tweaks
open_file_cache max=2000 inactive=20s;
open_file_cache_valid 60s;
open_file_cache_min_uses 5;
open_file_cache_errors off;
location / {
proxy_set_header Host $host;
proxy_pass http://${NGINX_APPLICATION_HOSTNAME}:8000;
}
}

View File

@@ -52,13 +52,13 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- define "helm.commonVariables" -}}
- name: CACHE_URL
value: $(REDIS_SERVICE_PORT)/1
value: tcp://redis-service.{{ .Release.Namespace }}.svc.cluster.local/1
- name: CACHE_DRIVER
value: redis
- name: SOCKETCLUSTER_PORT
value: "80"
- name: SOCKETCLUSTER_HOST
value: $(SOCKETCLUSTER_SERVICE_HOST)
value: socketcluster.{{ .Release.Namespace }}.svc.cluster.local
{{- end }}
{{/*
Create the name of the service account to use

View File

@@ -10,7 +10,7 @@ metadata:
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
annotations:
"helm.sh/hook": pre-install,pre-upgrade
"helm.sh/hook-weight": "0"
"helm.sh/hook-weight": "20"
"helm.sh/hook-delete-policy": before-hook-creation
spec:
template:

View File

@@ -30,4 +30,3 @@ spec:
port: 6379
targetPort: 6379
type: ClusterIP

View File

@@ -33,4 +33,3 @@ spec:
port: 80
targetPort: 8000
type: ClusterIP