Skip to content

Modular logistics and supply chain operating system (LSOS)

checking in comments implementation

Ronald A. Richardson00806d4f0c29
diff --git a/api/config/filesystems.php b/api/config/filesystems.php
index 2a985fb6..9907ce43 100644
--- a/api/config/filesystems.php
+++ b/api/config/filesystems.php
@@ -13,7 +13,7 @@ return [
|
*/
- 'default' => env('FILESYSTEM_DRIVER', 'local'),
+ 'default' => env('FILESYSTEM_DRIVER', 'public'),
/*
|--------------------------------------------------------------------------
diff --git a/console/app/models/comment.js b/console/app/models/comment.js
new file mode 100644
index 00000000..97fc5a60
--- /dev/null
+++ b/console/app/models/comment.js
@@ -0,0 +1,44 @@
+import Model, { attr, belongsTo, hasMany } from '@ember-data/model';
+import { computed } from '@ember/object';
+import { format, formatDistanceToNow } from 'date-fns';
+
+export default class CommentModel extends Model {
+ /** @ids */
+ @attr('string') company_uuid;
+ @attr('string') parent_comment_uuid;
+ @attr('string') subject_uuid;
+ @attr('string') subject_type;
+
+ /** @relationships */
+ @belongsTo('user') author;
+ @belongsTo('comment', { inverse: 'replies' }) parent;
+ @hasMany('comment', { inverse: 'parent' }) replies;
+
+ /** @attributes */
+ @attr('string') content;
+ @attr('boolean') editable;
+ @attr('raw') tags;
+ @attr('raw') meta;
+
+ /** @dates */
+ @attr('date') created_at;
+ @attr('date') updated_at;
+ @attr('date') deleted_at;
+
+ /** @computed */
+ @computed('created_at') get createdAgo() {
+ return formatDistanceToNow(this.created_at);
+ }
+
+ @computed('created_at') get createdAt() {
+ return format(this.created_at, 'PPP p');
+ }
+
+ @computed('updated_at') get updatedAgo() {
+ return formatDistanceToNow(this.updated_at);
+ }
+
+ @computed('updated_at') get updatedAt() {
+ return format(this.updated_at, 'PPP p');
+ }
+}
diff --git a/console/app/serializers/comment.js b/console/app/serializers/comment.js
new file mode 100644
index 00000000..691b2b66
--- /dev/null
+++ b/console/app/serializers/comment.js
@@ -0,0 +1,38 @@
+import ApplicationSerializer from '@fleetbase/ember-core/serializers/application';
+import { EmbeddedRecordsMixin } from '@ember-data/serializer/rest';
+
+export default class CommentSerializer extends ApplicationSerializer.extend(EmbeddedRecordsMixin) {
+ /**
+ * Embedded relationship attributes
+ *
+ * @var {Object}
+ */
+ get attrs() {
+ return {
+ author: { embedded: 'always' },
+ parent: { embedded: 'always' },
+ replies: { embedded: 'always' },
+ };
+ }
+
+ serializeAttribute(snapshot, json, key, attributes) {
+ if (key === 'editable') {
+ return;
+ }
+
+ super.serializeAttribute(...arguments);
+ }
+
+ serializeHasMany(snapshot, json, relationship) {
+ let key = relationship.key;
+ if (key === 'replies') {
+ return;
+ } else {
+ super.serializeHasMany(...arguments);
+ }
+ }
+
+ serializeBelongsTo() {
+ return;
+ }
+}
diff --git a/console/tests/unit/models/comment-test.js b/console/tests/unit/models/comment-test.js
new file mode 100644
index 00000000..7efa31ac
--- /dev/null
+++ b/console/tests/unit/models/comment-test.js
@@ -0,0 +1,14 @@
+import { module, test } from 'qunit';
+
+import { setupTest } from '@fleetbase/console/tests/helpers';
+
+module('Unit | Model | comment', function (hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function (assert) {
+ let store = this.owner.lookup('service:store');
+ let model = store.createRecord('comment', {});
+ assert.ok(model);
+ });
+});
diff --git a/console/tests/unit/serializers/comment-test.js b/console/tests/unit/serializers/comment-test.js
new file mode 100644
index 00000000..2bb5e728
--- /dev/null
+++ b/console/tests/unit/serializers/comment-test.js
@@ -0,0 +1,24 @@
+import { module, test } from 'qunit';
+
+import { setupTest } from '@fleetbase/console/tests/helpers';
+
+module('Unit | Serializer | comment', function (hooks) {
+ setupTest(hooks);
+
+ // Replace this with your real tests.
+ test('it exists', function (assert) {
+ let store = this.owner.lookup('service:store');
+ let serializer = store.serializerFor('comment');
+
+ assert.ok(serializer);
+ });
+
+ test('it serializes records', function (assert) {
+ let store = this.owner.lookup('service:store');
+ let record = store.createRecord('comment', {});
+
+ let serializedRecord = record.serialize();
+
+ assert.ok(serializedRecord);
+ });
+});
diff --git a/console/translations/en-us.yaml b/console/translations/en-us.yaml
index d3ca0162..34f5c76b 100644
--- a/console/translations/en-us.yaml
+++ b/console/translations/en-us.yaml
@@ -13,6 +13,9 @@ terms:
search: Search
search-input: Search Input
common:
+ edit: Edit
+ save: Save
+ cancel: Cancel
2fa-config: 2FA Config
account: Account
admin: Admin
@@ -46,10 +49,37 @@ common:
two-factor: Two Factor
uploading: Uploading...
your-profile: Your Profile
-component:
+component:
+ file:
+ dropdown-label: File actions
+ dropzone:
+ file: file
+ drop-to-upload: Drop to upload
+ invalid: Invalid
+ files-ready-for-upload: >-
+ {numOfFiles} ready for upload.
+ upload-images-videos: Upload Images & Videos
+ upload-documents: Upload Documents
+ upload-documents-files: Upload Documents & Files
+ dropzone-supported-images-videos: Drag and drop image and video files onto this dropzone
+ dropzone-supported-files: Drag and drop files onto this dropzone
+ or-select-button-text: or select files to upload.
+ upload-queue: Upload Queue
two-fa-enforcement-alert:
message: To enhance the security of your account, your organization requires Two-Factor Authentication (2FA). Enable 2FA in your account settings for an additional layer of protection.
button-text: Setup 2FA
+ comment-thread:
+ publish-comment-button-text: Publish comment
+ publish-reply-button-text: Publish reply
+ reply-comment-button-text: Reply
+ edit-comment-button-text: Edit
+ delete-comment-button-text: Delete
+ comment-published-ago: >-
+ {createdAgo} ago
+ comment-input-placeholder: Input a new comment...
+ comment-reply-placeholder: Input your reply...
+ comment-input-empty-notification: You cannot publish empty comments...
+ comment-min-length-notification: Comment must be atleast 2 characters
auth:
verification:
header-title: Account Verification
diff --git a/packages/core-api b/packages/core-api
index b1a6b5f4..9cbad092 160000
--- a/packages/core-api
+++ b/packages/core-api
@@ -1 +1 @@
-Subproject commit b1a6b5f4614bad34591336a3aa0d41679085d8b8
+Subproject commit 9cbad092017591e7a9cf0d50a6f2fa76487b5e00
diff --git a/packages/ember-ui b/packages/ember-ui
index c6694206..e532986a 160000
--- a/packages/ember-ui
+++ b/packages/ember-ui
@@ -1 +1 @@
-Subproject commit c6694206e96efc75d9ff2afabea41446354e2797
+Subproject commit e532986a5b358788b6fcaa7472df56cac7be9039
diff --git a/packages/fleetops-data b/packages/fleetops-data
index 08520b39..9d92927c 160000
--- a/packages/fleetops-data
+++ b/packages/fleetops-data
@@ -1 +1 @@
-Subproject commit 08520b39817fcfc0d2d76492ce23b8fda06a83ac
+Subproject commit 9d92927c9b8c44d6e52e5025034deb162adaa4c3