Skip to content

Commit

Permalink
Merge pull request #28 from fleetbase/dev-v0.1.10
Browse files Browse the repository at this point in the history
v0.1.10
  • Loading branch information
roncodes authored Mar 4, 2024
2 parents b2f6355 + 3b4c1c3 commit 07b517c
Show file tree
Hide file tree
Showing 27 changed files with 162 additions and 60 deletions.
4 changes: 2 additions & 2 deletions addon/models/contact.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class ContactModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -73,6 +73,6 @@ export default class ContactModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default class CustomerModel extends ContactModel {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -52,6 +52,6 @@ export default class CustomerModel extends ContactModel {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default class DriverModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -119,7 +119,7 @@ export default class DriverModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}

@computed('location') get latitude() {
Expand Down
4 changes: 2 additions & 2 deletions addon/models/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class EntityModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -124,6 +124,6 @@ export default class EntityModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/facilitator.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default class FacilitatorModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -60,6 +60,6 @@ export default class FacilitatorModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/fleet-driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class FleetDriverModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -56,6 +56,6 @@ export default class FleetDriverModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/fleet.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default class FleetModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -78,6 +78,6 @@ export default class FleetModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/fuel-report.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default class FuelReportModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -76,7 +76,7 @@ export default class FuelReportModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}

/** @methods */
Expand Down
4 changes: 2 additions & 2 deletions addon/models/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default class IssueModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -79,7 +79,7 @@ export default class IssueModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}

/** @methods */
Expand Down
112 changes: 107 additions & 5 deletions addon/models/order-config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,109 @@
import ExtensionModel from '@fleetbase/console/models/extension';
import { attr } from '@ember-data/model';
import Model, { attr, belongsTo } from '@ember-data/model';
import { computed, action } from '@ember/object';
import { format as formatDate, formatDistanceToNow, isValid as isValidDate } from 'date-fns';

export default class OrderConfigModel extends ExtensionModel {
@attr('string') install_uuid;
@attr('boolean') installed;
export default class OrderConfigModel extends Model {
/** @ids */
@attr('string') company_uuid;
@attr('string') author_uuid;
@attr('string') category_uuid;
@attr('string') icon_uuid;

/** @relationships */
@belongsTo('user') author;
@belongsTo('category') category;
@belongsTo('file') icon;

/** @attributs */
@attr('string') name;
@attr('string') namespace;
@attr('string') description;
@attr('string') key;
@attr('string') status;
@attr('string') version;
@attr('boolean', { defaultValue: false }) core_service;
@attr('array') tags;
@attr('object') flow;
@attr('object') entities;
@attr('object') meta;

/** @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('updated_at') get updatedAtShort() {
if (!isValidDate(this.updated_at)) {
return null;
}

return formatDate(this.updated_at, 'dd, MMM');
}

@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('created_at') get createdAtShort() {
if (!isValidDate(this.created_at)) {
return null;
}

return formatDate(this.created_at, 'dd, MMM');
}

/** @methods */
/**
* Adds a new tag to the tags array.
*
* This method takes a tag and adds it to the 'tags' array property
* of the current instance. The 'pushObject' method is used, which is
* typically available in Ember.js or similar frameworks that extend
* JavaScript array functionalities.
*
* @param {string} tag - The tag to be added to the tags array.
*/
@action addTag(tag) {
this.tags.push(tag);
this.tags = [...this.tags];
}

/**
* Removes a tag from the tags array at a specific index.
*
* This method takes an index and removes the element at that position
* from the 'tags' array property of the current instance. The 'removeAt'
* method is used, which is typically available in Ember.js or similar
* frameworks that provide extended array functionalities.
*
* @param {number} index - The index of the tag to be removed from the tags array.
*/
@action removeTag(index) {
this.tags.removeAt(index);
this.tags = [...this.tags];
}
}
10 changes: 5 additions & 5 deletions addon/models/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export default class OrderModel extends Model {
return null;
}

return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -194,7 +194,7 @@ export default class OrderModel extends Model {
return null;
}

return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}

@computed('created_at') get createdAtWithTime() {
Expand Down Expand Up @@ -226,15 +226,15 @@ export default class OrderModel extends Model {
return null;
}

return formatDate(this.dispatched_at, 'PP HH:mm');
return formatDate(this.dispatched_at, 'PP HH:mm');
}

@computed('dispatched_at') get dispatchedAtShort() {
if (!isValidDate(this.dispatched_at)) {
return null;
}

return formatDate(this.dispatched_at, 'PP');
return formatDate(this.dispatched_at, 'dd, MMM');
}

@computed('started_at') get startedAgo() {
Expand All @@ -258,7 +258,7 @@ export default class OrderModel extends Model {
return null;
}

return formatDate(this.started_at, 'PP');
return formatDate(this.started_at, 'dd, MMM');
}

@computed('scheduled_at') get scheduledAt() {
Expand Down
4 changes: 2 additions & 2 deletions addon/models/payload.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default class PayloadModel extends Model {
}

@computed('updated_at') get updatedAtShort() {
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -118,7 +118,7 @@ export default class PayloadModel extends Model {
}

@computed('created_at') get createdAtShort() {
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}

/** @methods */
Expand Down
4 changes: 2 additions & 2 deletions addon/models/place.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export default class PlaceModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -156,6 +156,6 @@ export default class PlaceModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/purchase-rate.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class PurchaseRateModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -62,6 +62,6 @@ export default class PurchaseRateModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
4 changes: 2 additions & 2 deletions addon/models/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class RouteModel extends Model {
if (!isValidDate(this.updated_at)) {
return null;
}
return formatDate(this.updated_at, 'PP');
return formatDate(this.updated_at, 'dd, MMM');
}

@computed('created_at') get createdAgo() {
Expand All @@ -58,6 +58,6 @@ export default class RouteModel extends Model {
if (!isValidDate(this.created_at)) {
return null;
}
return formatDate(this.created_at, 'PP');
return formatDate(this.created_at, 'dd, MMM');
}
}
Loading

0 comments on commit 07b517c

Please sign in to comment.