Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
> v0.7.1 ~ "The adhoc dispatch migration runs on MySQL 8.4 and after a failed run"
> v0.7.2 ~ "Foreign keys point at unique keys, and Passenger for everyone"

---
## Highlights

- **The v0.7.0 migration now runs on MySQL 8.4.** MySQL 8.4 turns on `restrict_fk_on_non_standard_key` by default and then rejects any change to a table whose foreign keys point at a non-unique key, with `1553 Cannot drop index '<unknown key name>': needed in a foreign key constraint`. `order_configs.uuid` is one of those, so `2026_11_06_000001_adhoc_dispatch_and_order_config_policies` failed there. Its column changes now run with that setting off for the session, and nothing changes on MySQL 8.0, MariaDB or SQLite.
- **A failed run of that migration no longer blocks the next one.** MySQL doesn't roll back schema changes, so the tables and columns made before the failure stayed, and running it again failed on "table already exists". Each table and column is now created only if it's missing.
- **Fleet-Ops tables that foreign keys point at can be altered on MySQL 8.4 with `restrict_fk_on_non_standard_key` on.** MySQL 8.4 refuses any change to a table that a foreign key points at through a non-unique key, with `1553 Cannot drop index '<unknown key name>'`. v0.7.1 worked around this for one migration. This release removes the cause: `uuid` is now unique on `devices`, `inspection_forms`, `inspection_submissions`, `order_configs`, `telematics`, `warranties` and `work_orders`. Each column's old index is replaced, so it is not indexed twice. A column that already has a unique or primary key is left alone. A table with duplicate values is skipped and reported, and the migration can be run again once they are removed. Runs on the main and sandbox databases. Storefront's foreign keys to `order_configs` are covered too.
- **Every organization gets the Passenger order config.** It sits next to **Transport**, so the Passenger app works without running `fleetops:create-order-config passenger` first. New organizations get it when they're created. The migration `2026_11_18_000001_create_passenger_order_configs` adds it to every existing organization; one that already made it with the command keeps the config it has. Like Transport, it can't be deleted and its flow is read-only, while its policies and triggers can be edited.

- **Push apps: your own apps send pushes with their own keys.** Settings → **Push Apps** holds each of the organization's own apps (a customer app such as Passenger, a white-label driver app) with its Apple key and Firebase service account. Keys are stored encrypted and never shown again.
- Each push app has a key. An app sends it as `push_app` (and its APNs build as `environment`) to `v1/customers/register-device` or `v1/drivers/register-device`, and that device's Fleet-Ops pushes then go out with the app's own credentials. An unknown key is refused.
- Every Fleet-Ops push (order updates from order config triggers, assigned, dispatched, canceled, completed, pings and the rest) reaches push-app devices this way. Navigator and every device registered without a key keep the install-wide push settings, unchanged.
- **Send test push** checks an app's keys against one device token.

---
## Upgrading
If a v0.7.0 upgrade stopped in this migration, upgrade to v0.7.1 and run `php artisan migrate` again. It finishes from where it stopped. Run `php artisan sandbox:migrate` too if you use sandbox.

- Requires `fleetbase/core-api` 2.0.3, which adds push apps (the `push_apps` table).
- Run `php artisan migrate` and `php artisan sandbox:migrate`. If a table is reported as having duplicate values, it is skipped. Remove the duplicates, then run the `php artisan migrate:refresh --force --path=…` command the message gives. It rolls back and re-runs only that migration, and lists every other migration as "Migration not found" without touching them.
- No new dependency: the migration doesn't need core-api 2.0.2's migration hook.

---
## Need help?
- [GitHub Discussions](https://github.com/fleetbase/fleetbase/discussions)
- [Discord](https://discord.gg/HnTqQ6zAVn)
---
2 changes: 2 additions & 0 deletions addon/components/layout/fleet-ops-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ export default class LayoutFleetOpsSidebarComponent extends Component {
this.createItem('menu.map', 'map', 'settings.map', 'fleet-ops view map-settings', 'fleet-ops see map-settings'),
this.createItem('menu.payments', 'cash-register', 'settings.payments', 'fleet-ops view payments', 'fleet-ops see payments'),
this.createItem('menu.notifications', 'bell', 'settings.notifications', 'fleet-ops view notification-settings', 'fleet-ops see notification-settings'),
this.createItem('menu.push-apps', 'mobile-screen', 'settings.push-apps', 'fleet-ops view notification-settings', 'fleet-ops see notification-settings'),
this.createItem('menu.routing', 'route', 'settings.routing', 'fleet-ops view routing-settings', 'fleet-ops see routing-settings'),
this.createItem('menu.dispatch', 'paper-plane', 'settings.dispatch', 'fleet-ops view routing-settings', 'fleet-ops see routing-settings'),
this.createItem('menu.orchestrator', 'circle-nodes', 'settings.orchestrator', 'fleet-ops view routing-settings', 'fleet-ops see routing-settings'),
Expand Down Expand Up @@ -411,6 +412,7 @@ export default class LayoutFleetOpsSidebarComponent extends Component {
'settings.map': 2,
'settings.payments': 3,
'settings.notifications': 4,
'settings.push-apps': 4,
'settings.routing': 5,
'settings.dispatch': 6,
'settings.orchestrator': 7,
Expand Down
163 changes: 163 additions & 0 deletions addon/controllers/settings/push-apps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import Controller from '@ember/controller';
import { tracked } from '@glimmer/tracking';
import { inject as service } from '@ember/service';
import { action } from '@ember/object';
import { task } from 'ember-concurrency';

const P = 'settings.push-apps';
const blankForm = () => ({
name: '',
status: 'active',
apn: { key_id: '', team_id: '', app_bundle_id: '', private_key_content: '', environment: '' },
fcm: { credentials: '', android_channel_id: '' },
});

/**
* The organization's own apps and each one's Apple (APNs) and Firebase (FCM) settings. One
* push app covers an app on iOS and Android. An app registers devices with its push app key;
* secrets are entered here but never shown again, and leaving one empty when editing keeps the
* saved one. The server answers each app's settings under `providers`, by provider key.
*/
export default class SettingsPushAppsController extends Controller {
@service fetch;
@service notifications;
@service modalsManager;
@service intl;
@service abilities;

@tracked pushApps = [];
@tracked editing = null;
@tracked form = blankForm();
@tracked error = null;
@tracked testing = null;
@tracked test = { token: '', push_provider: '', environment: '' };
@tracked testResult = null;

get canUpdate() {
return this.abilities.can('fleet-ops update notification-settings');
}

get environments() {
return [
{ value: '', label: this.intl.t(`${P}.environment-both`) },
{ value: 'production', label: this.intl.t(`${P}.environment-production`) },
{ value: 'sandbox', label: this.intl.t(`${P}.environment-sandbox`) },
];
}

get tokenTypes() {
return [
{ value: '', label: this.intl.t(`${P}.token-type-auto`) },
{ value: 'apn', label: this.intl.t(`${P}.token-type-apn`) },
{ value: 'fcm', label: this.intl.t(`${P}.token-type-fcm`) },
];
}

get editingApp() {
return this.pushApps.find((app) => app.id === this.editing) ?? null;
}

@task *load() {
try {
const { push_apps } = yield this.fetch.get('fleet-ops/settings/push-apps');
this.pushApps = push_apps ?? [];
} catch (error) {
this.notifications.serverError(error);
}
}

@action add() {
this.editing = 'new';
this.form = blankForm();
this.error = null;
}

@action edit(app) {
this.editing = app.id;
this.error = null;
const { apn, fcm } = app.providers ?? {};
this.form = {
name: app.name,
status: app.status,
apn: {
key_id: apn?.key_id ?? '',
team_id: apn?.team_id ?? '',
app_bundle_id: apn?.app_bundle_id ?? '',
private_key_content: '',
environment: apn?.environment ?? '',
},
fcm: { credentials: '', android_channel_id: fcm?.android_channel_id ?? '' },
};
}

@action cancel() {
this.editing = null;
this.error = null;
}

@action set(path, event) {
const value = event?.target ? event.target.value : event;
const [group, field] = path.split('.');
this.form = field ? { ...this.form, [group]: { ...this.form[group], [field]: value } } : { ...this.form, [group]: value };
}

@action toggleStatus(on) {
this.form = { ...this.form, status: on ? 'active' : 'inactive' };
}

@task *save() {
this.error = null;
const isNew = this.editing === 'new';
try {
const { push_app } = isNew ? yield this.fetch.post('fleet-ops/settings/push-apps', this.form) : yield this.fetch.put(`fleet-ops/settings/push-apps/${this.editing}`, this.form);
this.pushApps = isNew ? [...this.pushApps, push_app] : this.pushApps.map((app) => (app.id === push_app.id ? push_app : app));
this.editing = null;
this.notifications.success(this.intl.t(isNew ? `${P}.created` : `${P}.saved`, { name: push_app.name }));
} catch (error) {
this.error = error?.message ?? String(error);
}
}

@action remove(app) {
this.modalsManager.confirm({
title: this.intl.t(`${P}.delete-title`, { name: app.name }),
body: this.intl.t(`${P}.delete-body`, { count: app.devices }),
acceptButtonText: this.intl.t(`${P}.delete`),
acceptButtonScheme: 'danger',
onConfirm: async () => {
try {
await this.fetch.delete(`fleet-ops/settings/push-apps/${app.id}`);
this.pushApps = this.pushApps.filter((item) => item.id !== app.id);
this.notifications.success(this.intl.t(`${P}.deleted`, { name: app.name }));
} catch (error) {
this.notifications.serverError(error);
}
},
});
}

@action openTest(app) {
this.testing = this.testing === app.id ? null : app.id;
this.testResult = null;
this.test = { token: '', push_provider: '', environment: '' };
}

@action setTest(field, event) {
this.test = { ...this.test, [field]: event?.target ? event.target.value : event };
if (this.test.push_provider === 'fcm') {
this.test = { ...this.test, environment: '' };
}
}

@task *sendTest(app) {
this.testResult = null;
try {
const result = yield this.fetch.post(`fleet-ops/settings/push-apps/${app.id}/test`, this.test);
this.testResult = result.sent
? { ok: true, text: this.intl.t(`${P}.test-sent`) }
: { ok: false, text: this.intl.t(`${P}.test-failed`, { reason: result.reason ?? result.status }) };
} catch (error) {
this.testResult = { ok: false, text: error?.message ?? String(error) };
}
}
}
1 change: 1 addition & 0 deletions addon/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export default buildRoutes(function () {
this.route('settings', function () {
this.route('navigator-app');
this.route('notifications');
this.route('push-apps');
this.route('custom-fields');
this.route('avatars');
this.route('routing');
Expand Down
21 changes: 21 additions & 0 deletions addon/routes/settings/push-apps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';

export default class SettingsPushAppsRoute extends Route {
@service notifications;
@service hostRouter;
@service abilities;
@service intl;

beforeModel() {
if (this.abilities.cannot('fleet-ops view notification-settings')) {
this.notifications.warning(this.intl.t('common.unauthorized-access'));
return this.hostRouter.transitionTo('console.fleet-ops');
}
}

setupController(controller) {
super.setupController(...arguments);
controller.load.perform();
}
}
11 changes: 11 additions & 0 deletions addon/styles/fleetops-engine.css
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,17 @@ body[data-theme='light'] .flow-activity-link-label-text {
border: 1px solid var(--oc-border);
}

.oc-tag {
display: inline-flex;
align-items: center;
padding: 0.125rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
color: var(--oc-muted);
background: var(--oc-surface);
border: 1px solid var(--oc-border);
}

.oc-flow-events {
display: inline-flex;
align-items: center;
Expand Down
Loading
Loading