Skip to content

Modular logistics and supply chain operating system (LSOS)

critical hotfix to make sure session store is set for json resources

Ronald A. Richardson331e98af20f4
diff --git a/api/composer.json b/api/composer.json
index 7fff07e7..e8b953e3 100644
--- a/api/composer.json
+++ b/api/composer.json
@@ -9,7 +9,7 @@
"license": "AGPL-3.0-or-later",
"require": {
"php": "^8.0",
- "fleetbase/core-api": "^1.5.11",
+ "fleetbase/core-api": "^1.5.12",
"fleetbase/fleetops-api": "^0.5.9",
"fleetbase/registry-bridge": "^0.0.16",
"fleetbase/storefront-api": "^0.3.15",
diff --git a/api/composer.lock b/api/composer.lock
index 8e99ce04..32c26b69 100644
--- a/api/composer.lock
+++ b/api/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "8e4e82d71a9b40574bb3de8f8141c988",
+ "content-hash": "f5e847518bf3f1ae7ebfb84605985f77",
"packages": [
{
"name": "aws/aws-crt-php",
@@ -62,16 +62,16 @@
},
{
"name": "aws/aws-sdk-php",
- "version": "3.323.3",
+ "version": "3.323.4",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
- "reference": "9dec2a6453bdb32b3abeb475fc63b46ba1cbd996"
+ "reference": "e66ee025b1d169fad3c784934f56648d3eec11ae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9dec2a6453bdb32b3abeb475fc63b46ba1cbd996",
- "reference": "9dec2a6453bdb32b3abeb475fc63b46ba1cbd996",
+ "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e66ee025b1d169fad3c784934f56648d3eec11ae",
+ "reference": "e66ee025b1d169fad3c784934f56648d3eec11ae",
"shasum": ""
},
"require": {
@@ -154,9 +154,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
- "source": "https://github.com/aws/aws-sdk-php/tree/3.323.3"
+ "source": "https://github.com/aws/aws-sdk-php/tree/3.323.4"
},
- "time": "2024-10-08T18:05:47+00:00"
+ "time": "2024-10-09T18:10:22+00:00"
},
{
"name": "aws/aws-sdk-php-laravel",
@@ -2299,16 +2299,16 @@
},
{
"name": "fleetbase/core-api",
- "version": "1.5.11",
+ "version": "1.5.12",
"source": {
"type": "git",
"url": "https://github.com/fleetbase/core-api.git",
- "reference": "41b0068c18b00c7305cf920c245f35052d905cc4"
+ "reference": "b19b9606f15ef1bc6f39c464df66032f0b4342df"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/fleetbase/core-api/zipball/41b0068c18b00c7305cf920c245f35052d905cc4",
- "reference": "41b0068c18b00c7305cf920c245f35052d905cc4",
+ "url": "https://api.github.com/repos/fleetbase/core-api/zipball/b19b9606f15ef1bc6f39c464df66032f0b4342df",
+ "reference": "b19b9606f15ef1bc6f39c464df66032f0b4342df",
"shasum": ""
},
"require": {
@@ -2391,9 +2391,9 @@
],
"support": {
"issues": "https://github.com/fleetbase/core-api/issues",
- "source": "https://github.com/fleetbase/core-api/tree/v1.5.11"
+ "source": "https://github.com/fleetbase/core-api/tree/v1.5.12"
},
- "time": "2024-10-09T16:24:17+00:00"
+ "time": "2024-10-10T02:48:01+00:00"
},
{
"name": "fleetbase/fleetops-api",
@@ -17848,5 +17848,5 @@
"php": "^8.0"
},
"platform-dev": [],
- "plugin-api-version": "2.2.0"
+ "plugin-api-version": "2.6.0"
}
diff --git a/console/app/controllers/console.js b/console/app/controllers/console.js
index 62bad4c0..8c46da9d 100644
--- a/console/app/controllers/console.js
+++ b/console/app/controllers/console.js
@@ -161,7 +161,7 @@ export default class ConsoleController extends Controller {
}
/**
- * Action to invalidate and log user out
+ * Action to create or join an organization.
*
* @void
*/
diff --git a/console/app/controllers/console/account/organizations.js b/console/app/controllers/console/account/organizations.js
index 42217cd1..6d92e6cc 100644
--- a/console/app/controllers/console/account/organizations.js
+++ b/console/app/controllers/console/account/organizations.js
@@ -11,12 +11,17 @@ export default class ConsoleAccountOrganizationsController extends Controller {
@service notifications;
@service intl;
@service fetch;
+ @service router;
@action async leaveOrganization (organization) {
const isOwner = this.currentUser.id === organization.owner_uuid;
const hasOtherMembers = organization.users_count > 1;
const willBeDeleted = isOwner && organization.users_count === 1;
+ if (this.model.length === 1) {
+ return this.notifications.warning('Unable to leave your only organization.');
+ }
+
if (hasOtherMembers) {
organization.loadUsers({ exclude: [this.currentUser.id] });
}
@@ -32,7 +37,7 @@ export default class ConsoleAccountOrganizationsController extends Controller {
willBeDeleted,
organization,
newOwnerId: null,
- selectNewOwner: (newOwnerId) => {
+ selectNewOwner: newOwnerId => {
this.modalsManager.setOption('newOwnerId', newOwnerId);
this.modalsManager.setOption('acceptButtonDisabled', false);
},
@@ -47,16 +52,18 @@ export default class ConsoleAccountOrganizationsController extends Controller {
} catch (error) {
this.notifications.serverError(error);
}
- return modal.done();
+
+ return this.router.refresh();
}
if (willBeDeleted) {
try {
- await organization.delete();
+ await organization.destroyRecord();
} catch (error) {
this.notifications.serverError(error);
}
- return modal.done();
+
+ return this.router.refresh();
}
}
@@ -66,7 +73,7 @@ export default class ConsoleAccountOrganizationsController extends Controller {
this.notifications.serverError(error);
}
- return modal.done();
+ return this.router.refresh();
},
});
}
@@ -118,10 +125,15 @@ export default class ConsoleAccountOrganizationsController extends Controller {
acceptButtonText: 'Delete Organization',
acceptButtonScheme: 'danger',
acceptButtonIcon: 'trash',
- confirm: () => {
+ confirm: async modal => {
modal.startLoading();
- return organization.delete();
+ try {
+ await organization.destroyRecord();
+ return this.router.refresh();
+ } catch (error) {
+ this.notifications.serverError(error);
+ }
},
});
}
@@ -133,10 +145,58 @@ export default class ConsoleAccountOrganizationsController extends Controller {
acceptButtonIcon: 'save',
isOwner: this.currentUser.id === organization.owner_uuid,
organization,
- confirm: (modal) => {
+ confirm: async modal => {
+ modal.startLoading();
+
+ try {
+ await organization.save();
+ return this.router.refresh();
+ } catch (error) {
+ this.notifications.serverError(error);
+ }
+ },
+ });
+ }
+
+ @action createOrganization () {
+ const currency = this.currentUser.currency;
+ const country = this.currentUser.country;
+
+ this.modalsManager.show('modals/edit-organization', {
+ title: 'Create Organization',
+ acceptButtonText: this.intl.t('common.confirm'),
+ acceptButtonIcon: 'check',
+ acceptButtonIconPrefix: 'fas',
+ organization: {
+ name: null,
+ decription: null,
+ phone: null,
+ currency,
+ country,
+ timezone: null,
+ },
+ confirm: async modal => {
modal.startLoading();
- return organization.save();
+ const organization = modal.getOption('organization');
+ const { name, description, phone, currency, country, timezone } = organization;
+
+ try {
+ await this.fetch.post('auth/create-organization', {
+ name,
+ description,
+ phone,
+ currency,
+ country,
+ timezone,
+ });
+ this.fetch.flushRequestCache('auth/organizations');
+ this.notifications.success(this.intl.t('console.create-or-join-organization.create-success-notification'));
+ return this.router.refresh();
+ } catch (error) {
+ modal.stopLoading();
+ return this.notifications.serverError(error);
+ }
},
});
}
diff --git a/console/app/routes/console/account/organizations.js b/console/app/routes/console/account/organizations.js
index 947e9103..ed385943 100644
--- a/console/app/routes/console/account/organizations.js
+++ b/console/app/routes/console/account/organizations.js
@@ -5,6 +5,6 @@ export default class ConsoleAccountOrganizationsRoute extends Route {
@service currentUser;
model() {
- return this.currentUser.organizations;
+ return this.currentUser.loadOrganizations();
}
}
diff --git a/console/app/templates/console/account/organizations.hbs b/console/app/templates/console/account/organizations.hbs
index 67e03105..f312c0d4 100644
--- a/console/app/templates/console/account/organizations.hbs
+++ b/console/app/templates/console/account/organizations.hbs
@@ -3,7 +3,10 @@
<Layout::Section::Body class="overflow-y-scroll h-full">
<div class="container mx-auto h-screen">
- <div class="max-w-3xl my-10 mx-auto space-y-6">
+ <div class="max-w-3xl my-10 mx-auto space-y-4">
+ <div class="flex flex-row justify-end">
+ <Button @type="primary" @icon="plus" @text="Create Organization" @onClick={{this.createOrganization}} />
+ </div>
<ContentPanel @title="Your Organizations" @open={{true}} @pad={{true}} @panelBodyClass="bg-white dark:bg-gray-800">
<div class="space-y-2">
{{#each @model as |organization|}}
diff --git a/packages/core-api b/packages/core-api
index 41b0068c..b19b9606 160000
--- a/packages/core-api
+++ b/packages/core-api
@@ -1 +1 @@
-Subproject commit 41b0068c18b00c7305cf920c245f35052d905cc4
+Subproject commit b19b9606f15ef1bc6f39c464df66032f0b4342df