Skip to content

Commit

Permalink
Merge pull request #31 from fleetbase/dev-v0.3.6
Browse files Browse the repository at this point in the history
v0.3.6
  • Loading branch information
roncodes authored Dec 25, 2023
2 parents a23a611 + 2b0caff commit 2f5a534
Show file tree
Hide file tree
Showing 145 changed files with 4,609 additions and 4,175 deletions.
12 changes: 2 additions & 10 deletions .ember-cli
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
{
/**
Ember CLI sends analytics information by default. The data is completely
anonymous, but there are times when you might want to disable this behavior.

Setting `disableAnalytics` to true will prevent any data from being sent.
*/
"disableAnalytics": false,

/**
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
Setting `isTypeScriptProject` to true will force the blueprint generators to generate TypeScript
rather than JavaScript by default, when a TypeScript version of a given blueprint is available.
*/
"isTypeScriptProject": false
}
7 changes: 0 additions & 7 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.*/
.eslintcache

# ember-try
/.node_modules.ember-try/
Expand Down
20 changes: 8 additions & 12 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

module.exports = {
root: true,
parser: 'babel-eslint',
parser: '@babel/eslint-parser',
parserOptions: {
ecmaVersion: 2018,
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
legacyDecorators: true,
requireConfigFile: false,
babelOptions: {
plugins: [['@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }]],
},
},
plugins: ['ember'],
Expand All @@ -27,7 +28,7 @@ module.exports = {
'ember/no-get': 'off',
'ember/classic-decorator-no-classic-methods': 'off',
'no-prototype-builtins': 'off',
'node/no-unpublished-require': [
'n/no-unpublished-require': [
'error',
{
allowModules: ['resolve'],
Expand All @@ -40,6 +41,7 @@ module.exports = {
files: [
'./.eslintrc.js',
'./.prettierrc.js',
'./.stylelintrc.js',
'./.template-lintrc.js',
'./ember-cli-build.js',
'./index.js',
Expand All @@ -55,13 +57,7 @@ module.exports = {
browser: false,
node: true,
},
plugins: ['node'],
extends: ['plugin:node/recommended'],
},
{
// test files
files: ['tests/**/*-test.{js,ts}'],
extends: ['plugin:qunit/recommended'],
extends: ['plugin:n/recommended'],
},
],
};
10 changes: 5 additions & 5 deletions .github/workflows/ember.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
node-version: [16.x] # Build on Node.js 16
node-version: [18.x] # Build on Node.js 18

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -42,10 +42,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Node.js 16.x
- name: Setup Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- name: Setup pnpm
uses: pnpm/[email protected]
Expand All @@ -71,10 +71,10 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Setup Node.js 16.x
- name: Setup Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 16.x
node-version: 18.x

- name: Setup pnpm
uses: pnpm/[email protected]
Expand Down
9 changes: 1 addition & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
# See https://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist/
/tmp/
/declarations/

# dependencies
/bower_components/
/node_modules/

# misc
/.env*
/.pnp*
/.sass-cache
/.eslintcache
/connect.lock
/coverage/
/libpeerconnection.log
/npm-debug.log*
/testem.log
/yarn-error.log

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
Expand Down
9 changes: 2 additions & 7 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
/dist/
/tmp/

# dependencies
/bower_components/

# misc
/.bowerrc
/.editorconfig
/.ember-cli
/.env*
Expand All @@ -18,11 +14,11 @@
/.gitignore
/.prettierignore
/.prettierrc.js
/.stylelintignore
/.stylelintrc.js
/.template-lintrc.js
/.travis.yml
/.watchmanconfig
/bower.json
/config/ember-try.js
/CONTRIBUTING.md
/ember-cli-build.js
/testem.js
Expand All @@ -33,7 +29,6 @@

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
Expand Down
14 changes: 1 addition & 13 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
# unconventional js
/blueprints/*/files/
/vendor/

# compiled output
/dist/
/tmp/

# dependencies
/bower_components/
/node_modules/

# misc
/coverage/
!.*
.eslintcache
.lint-todo/
.*/

# ember-try
/.node_modules.ember-try/
/bower.json.ember-try
/npm-shrinkwrap.json.ember-try
/package.json.ember-try
/package-lock.json.ember-try
/yarn.lock.ember-try
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
printWidth: 190,
overrides: [
{
files: '*.hbs',
files: '*.{hbs,js,ts}',
options: {
singleQuote: false,
},
Expand Down
12 changes: 12 additions & 0 deletions .stylelintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# unconventional files
/blueprints/*/files/

# compiled output
/dist/

# addons
/.node_modules.ember-try/

# server
/server/
/server_vendor/
8 changes: 8 additions & 0 deletions .stylelintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
'use strict';

module.exports = {
extends: ['stylelint-config-standard', 'stylelint-prettier/recommended'],
rules: {
'selector-class-pattern': null,
},
};
3 changes: 2 additions & 1 deletion .template-lintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ module.exports = {
rules: {
'no-invalid-interactive': 'off',
'no-yield-only': 'off',
'no-down-event-binding': 'off',
'no-pointer-down-event-binding': 'off',
'table-groups': 'off',
'link-href-attributes': 'off',
'require-input-label': 'off',
'no-array-prototype-extensions': 'off',
},
};
2 changes: 1 addition & 1 deletion .watchmanconfig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"ignore_dirs": ["tmp", "dist"]
"ignore_dirs": ["dist"]
}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ This monorepo contains both the frontend and backend components of the FleetOps

### Requirements

- PHP 7.3.0 or above
- Ember.js v3.24 or above
- Ember CLI v3.24 or above
- Node.js v14 or above
* PHP 7.3.0 or above
* Ember.js v4.8 or above
* Ember CLI v4.8 or above
* Node.js v18 or above

## Structure

Expand Down
5 changes: 5 additions & 0 deletions addon/components/admin/navigator-app.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ContentPanel @title="Navigator App" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<InputGroup @name="URL">
<ClickToCopy>{{this.url}}</ClickToCopy>
</InputGroup>
</ContentPanel>
27 changes: 27 additions & 0 deletions addon/components/admin/navigator-app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import Component from '@glimmer/component';
import { inject as service } from '@ember/service';
import { tracked } from '@glimmer/tracking';

export default class NavigatorAppControlsComponent extends Component {
@service fetch;
@tracked isLoading = false;
@tracked url;

constructor() {
super(...arguments);
this.getAppLinkUrl();
}

getAppLinkUrl() {
this.isLoading = true;

return this.fetch
.get('fleet-ops/navigator/get-link-app')
.then(({ linkUrl }) => {
this.url = linkUrl;
})
.finally(() => {
this.isLoading = false;
});
}
}
32 changes: 13 additions & 19 deletions addon/components/driver-form-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,25 +100,19 @@ export default class DriverFormPanelComponent extends Component {

contextComponentCallback(this, 'onBeforeSave', driver);

try {
return driver
.save()
.then((driver) => {
this.notifications.success(`Driver (${driver.name}) saved successfully.`);
contextComponentCallback(this, 'onAfterSave', driver);
})
.catch((error) => {
this.notifications.serverError(error);
})
.finally(() => {
this.loader.removeLoader('.next-content-overlay-panel-container ');
this.isLoading = false;
});
} catch (error) {
this.notifications.error(error.message);
this.loader.removeLoader('.next-content-overlay-panel-container ');
this.isLoading = false;
}
return driver
.save()
.then((driver) => {
this.notifications.success(`Driver (${driver.name}) saved successfully.`);
contextComponentCallback(this, 'onAfterSave', driver);
})
.catch((error) => {
this.notifications.serverError(error);
})
.finally(() => {
this.loader.removeLoader('.next-content-overlay-panel-container ');
this.isLoading = false;
});
}

/**
Expand Down
1 change: 0 additions & 1 deletion addon/components/file-icon.js

This file was deleted.

5 changes: 2 additions & 3 deletions addon/components/leaflet-draw-control.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import BaseLayer from 'ember-leaflet/components/base-layer';
import { computed } from '@ember/object';
import { assign } from '@ember/polyfills';
import { scheduleOnce } from '@ember/runloop';
import { classify, camelize } from '@ember/string';
import getWithDefault from '@fleetbase/ember-core/utils/get-with-default';
Expand Down Expand Up @@ -75,8 +74,8 @@ export default class LeafletDrawControl extends BaseLayer {
const showDrawingLayer = getWithDefault(this.args, 'showDrawingLayer', true);

if (this.map && this._layer && this.L.drawLocal) {
this.options.edit = assign({ featureGroup: this._layer }, this.options.edit);
this.options.draw = assign({}, this.L.drawLocal.draw, this.options.draw);
this.options.edit = Object.assign({ featureGroup: this._layer }, this.options.edit);
this.options.draw = Object.assign({}, this.L.drawLocal.draw, this.options.draw);

// create draw control
const drawControl = new this.L.Control.Draw(this.options);
Expand Down
11 changes: 7 additions & 4 deletions addon/components/live-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1911,7 +1911,8 @@ export default class LiveMapComponent extends Component {

// from the `get-active-order-coordinates` the responded coordinates will always be [longitude, latitude]
// const [latitude, longitude] = extractCoordinates(coordinates.firstObject.coordinates);
const [longitude, latitude] = coordinates.filter((point) => point.cordinates[0] !== 0).firstObject?.coordinates;
const validCoordinates = coordinates.filter((point) => point.cordinates[0] !== 0);
const [longitude, latitude] = getWithDefault(validCoordinates, '0.coordiantes', [0, 0]);

initialCoordinates.latitude = latitude;
initialCoordinates.longitude = longitude;
Expand All @@ -1934,10 +1935,12 @@ export default class LiveMapComponent extends Component {
this.isLoading = true;

return new Promise((resolve) => {
const cachedRecords = this.serviceAreas?.getFromCache('serviceAreas', 'service-area');
if (this.serviceAreas && typeof this.serviceAreas.getFromCache === 'function') {
const cachedRecords = this.serviceAreas.getFromCache('serviceAreas', 'service-area');

if (cachedRecords) {
resolve(cachedRecords);
if (cachedRecords) {
resolve(cachedRecords);
}
}

return this.store
Expand Down
Loading

0 comments on commit 2f5a534

Please sign in to comment.