diff --git a/console/app/controllers/console/admin/organizations/index.js b/console/app/controllers/console/admin/organizations/index.js
index 0fd040bf..58567544 100644
--- a/console/app/controllers/console/admin/organizations/index.js
+++ b/console/app/controllers/console/admin/organizations/index.js
@@ -17,6 +17,14 @@ export default class ConsoleAdminOrganizationsController extends Controller {
* @type {Object}
*/
@service store;
+
+ /**
+ * Inject the `intl` service
+ *
+ * @var {Service}
+ */
+ @service intl;
+
/**
* The Ember Router service for handling transitions between routes.
*
@@ -60,6 +68,13 @@ export default class ConsoleAdminOrganizationsController extends Controller {
*/
@tracked name;
+ /**
+ * The filterable param `country`
+ *
+ * @var {String}
+ */
+ @tracked country;
+
/**
* Queryable parameters for this controller's model
*
@@ -79,15 +94,23 @@ export default class ConsoleAdminOrganizationsController extends Controller {
this.getAllCompanies();
this.columns = [
{
- label: 'Name',
+ label: this.intl.t('common.name'),
valuePath: 'name',
+ resizable: true,
+ sortable: true,
+ filterable: true,
+ filterComponent: 'filter/string',
},
{
- label: 'Country',
+ label: this.intl.t('common.country'),
valuePath: 'country_name',
+ resizable: true,
+ sortable: true,
+ filterable: true,
+ filterComponent: 'filter/string',
},
{
- label: 'Created At',
+ label: this.intl.t('common.created-at'),
valuePath: 'createdAt',
},
];
diff --git a/console/app/controllers/console/admin/organizations/users.js b/console/app/controllers/console/admin/organizations/users.js
index 2e0aae07..26226c44 100644
--- a/console/app/controllers/console/admin/organizations/users.js
+++ b/console/app/controllers/console/admin/organizations/users.js
@@ -9,6 +9,13 @@ export default class ConsoleAdminOrganizationUsersController extends Controller
*/
@service filters;
+ /**
+ * Inject the `intl` service
+ *
+ * @var {Service}
+ */
+ @service intl;
+
/**
* The current page of data being viewed
*
@@ -69,19 +76,19 @@ export default class ConsoleAdminOrganizationUsersController extends Controller
super(...arguments);
this.columns = [
{
- label: 'Name',
+ label: this.intl.t('common.name'),
valuePath: 'name',
},
{
- label: 'Phone',
+ label: this.intl.t('common.phone-number'),
valuePath: 'phone',
},
{
- label: 'Email',
+ label: this.intl.t('common.email'),
valuePath: 'email',
},
{
- label: 'Status',
+ label: this.intl.t('common.status'),
valuePath: 'status',
},
];
diff --git a/console/app/router.js b/console/app/router.js
index 53539546..4e2c3533 100644
--- a/console/app/router.js
+++ b/console/app/router.js
@@ -57,22 +57,22 @@ Router.map(function () {
this.mount('@fleetbase/dev-engine', {
as: 'developers',
- path: 'developers',
+ path: 'developers'
});
this.mount('@fleetbase/iam-engine', {
as: 'iam',
- path: 'iam',
+ path: 'iam'
});
this.mount('@fleetbase/storefront-engine', {
as: 'storefront',
- path: 'storefront',
+ path: 'storefront'
});
this.mount('@fleetbase/fleetops-engine', {
as: 'fleet-ops',
- path: 'fleet-ops',
+ path: 'fleet-ops'
});
});
this.route('install');
diff --git a/console/app/routes/console/admin/organizations/index.js b/console/app/routes/console/admin/organizations/index.js
index 61ce321c..da1a9005 100644
--- a/console/app/routes/console/admin/organizations/index.js
+++ b/console/app/routes/console/admin/organizations/index.js
@@ -1,9 +1,57 @@
import Route from '@ember/routing/route';
+import { inject as service } from '@ember/service';
+import { task } from 'ember-concurrency';
+/**
+ * `ConsoleAdminOrganizationsRoute` is a Route that handles the logic for the admin organizations console.
+ *
+ * @class ConsoleAdminOrganizationsRoute
+ * @extends Route
+ * @public
+ */
export default class ConsoleAdminOrganizationsRoute extends Route {
+ /**
+ * `store` is a service that provides methods for querying and manipulating the application's data store.
+ *
+ * @service store
+ * @public
+ */
+ @service store;
+
queryParams = {
page: { refreshModel: true },
+ query: { refreshModel: true },
+ sort: { refreshModel: true },
limit: { refreshModel: true },
name: { refreshModel: true },
+ country: { refreshModel: true },
};
+
+ /**
+ * `search` is a task that performs a search query on the 'company' model in the store.
+ *
+ * @method search
+ * @param {string} query - The search query.
+ * @returns {Promise} A promise that resolves with the search results.
+ * @public
+ */
+ search = task(function* (query) {
+ try {
+ return yield this.store.query('company', { query });
+ } catch (error) {
+ console.error('An error occurred during the search:', error);
+ }
+ }).restartable();
+
+ /**
+ * `model` is a method that queries the 'company' model in the store with the provided parameters.
+ *
+ * @method model
+ * @param {Object} params - The query parameters.
+ * @returns {Promise} A promise that resolves with the query results.
+ * @public
+ */
+ model(params) {
+ return this.store.query('company', params);
+ }
}
diff --git a/console/app/routes/console/admin/organizations/users.js b/console/app/routes/console/admin/organizations/users.js
index d3903e3a..1b979cfc 100644
--- a/console/app/routes/console/admin/organizations/users.js
+++ b/console/app/routes/console/admin/organizations/users.js
@@ -41,16 +41,4 @@ export default class ConsoleAdminOrganizationUsersRoute extends Route {
const users = await this.fetch.get(`companies/${id}/users`);
return users.toArray();
}
-
- /**
- * Sets up the controller with the company ID.
- *
- * @method setupController
- * @param {Controller} controller - The controller for this route.
- * @param {Array} model - An array containing the users associated with the company.
- */
- setupController(controller, model) {
- super.setupController(controller, model);
- controller.companyId = model.company_id;
- }
}
diff --git a/console/app/templates/console/admin/organizations/index.hbs b/console/app/templates/console/admin/organizations/index.hbs
index a57f4fc9..27d453e0 100644
--- a/console/app/templates/console/admin/organizations/index.hbs
+++ b/console/app/templates/console/admin/organizations/index.hbs
@@ -1,4 +1,4 @@
-
+
{{outlet}}
\ No newline at end of file
diff --git a/console/app/templates/console/admin/organizations/users.hbs b/console/app/templates/console/admin/organizations/users.hbs
index 614881ad..3469185e 100644
--- a/console/app/templates/console/admin/organizations/users.hbs
+++ b/console/app/templates/console/admin/organizations/users.hbs
@@ -1,4 +1,4 @@
-
+