@fleetbase/fleetops-engine 0.6.40 → 0.6.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addon/routes/operations.js +23 -1
- package/composer.json +1 -1
- package/extension.json +1 -1
- package/package.json +1 -1
- package/server/migrations/2026_04_20_000001_make_orchestrator_priority_nullable_on_orders_table.php +50 -0
- package/server/src/Http/Controllers/Api/v1/OrderController.php +12 -0
- package/server/src/Http/Controllers/Internal/v1/OrderController.php +6 -0
- package/server/src/Models/Order.php +26 -0
- package/translations/es-pa.yaml +1718 -0
|
@@ -1,3 +1,25 @@
|
|
|
1
1
|
import Route from '@ember/routing/route';
|
|
2
|
+
import { inject as service } from '@ember/service';
|
|
2
3
|
|
|
3
|
-
export default class OperationsRoute extends Route {
|
|
4
|
+
export default class OperationsRoute extends Route {
|
|
5
|
+
@service('universe/menu-service') menuService;
|
|
6
|
+
@service universe;
|
|
7
|
+
|
|
8
|
+
beforeModel(transition) {
|
|
9
|
+
if (transition.intent && transition.intent.url) {
|
|
10
|
+
// Here we will check if it's an actual virtual route instead of operations
|
|
11
|
+
const intendedUrl = transition.intent.url;
|
|
12
|
+
const intentSegments = intendedUrl.split('/');
|
|
13
|
+
// Needs to match for section and slug
|
|
14
|
+
const section = intentSegments[2];
|
|
15
|
+
const slug = intentSegments[3];
|
|
16
|
+
// This is not a operations route check menu service for a virtual registration match
|
|
17
|
+
if (section !== 'operations') {
|
|
18
|
+
const menuItem = this.menuService.lookupMenuItem('engine:fleet-ops', slug, null, section);
|
|
19
|
+
if (menuItem) {
|
|
20
|
+
return this.universe.transitionMenuItem('console.fleet-ops.virtual', menuItem);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
package/composer.json
CHANGED
package/extension.json
CHANGED
package/package.json
CHANGED
package/server/migrations/2026_04_20_000001_make_orchestrator_priority_nullable_on_orders_table.php
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
|
|
3
|
+
use Illuminate\Database\Migrations\Migration;
|
|
4
|
+
use Illuminate\Support\Facades\DB;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Make `orchestrator_priority` nullable on the orders table.
|
|
8
|
+
*
|
|
9
|
+
* The original migration (2026_04_08_000003) added this column as NOT NULL
|
|
10
|
+
* with a database-level default of 50. When Eloquent explicitly passes NULL
|
|
11
|
+
* for the column (e.g. when a user submits the order form without filling in
|
|
12
|
+
* orchestrator constraints), the DB default is bypassed and MySQL raises:
|
|
13
|
+
*
|
|
14
|
+
* SQLSTATE[23000]: Integrity constraint violation: 1048
|
|
15
|
+
* Column 'orchestrator_priority' cannot be null
|
|
16
|
+
*
|
|
17
|
+
* This migration makes the column nullable so that existing installations
|
|
18
|
+
* that have already run the original migration are also protected. The
|
|
19
|
+
* application layer (Order model + controllers) already coerces null to 50,
|
|
20
|
+
* so NULL values will not appear in practice; the nullable flag is a
|
|
21
|
+
* belt-and-suspenders safety net for any code path that may have been missed.
|
|
22
|
+
*
|
|
23
|
+
* NOTE: We use raw DB::statement() instead of Blueprint::change() because
|
|
24
|
+
* ->change() relies on Doctrine DBAL to introspect the existing column type,
|
|
25
|
+
* and Doctrine does not recognise MySQL's TINYINT as a mapped type
|
|
26
|
+
* ("Unknown column type tinyinteger requested"), causing the migration to
|
|
27
|
+
* crash on deployment. The raw ALTER TABLE statement is portable across all
|
|
28
|
+
* MySQL/MariaDB versions supported by Fleetbase and requires no extra
|
|
29
|
+
* dependencies.
|
|
30
|
+
*/
|
|
31
|
+
return new class extends Migration {
|
|
32
|
+
public function up(): void
|
|
33
|
+
{
|
|
34
|
+
DB::statement(
|
|
35
|
+
'ALTER TABLE `orders` MODIFY COLUMN `orchestrator_priority` TINYINT UNSIGNED NULL DEFAULT 50'
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public function down(): void
|
|
40
|
+
{
|
|
41
|
+
// Back-fill any NULLs before restoring the NOT NULL constraint.
|
|
42
|
+
DB::table('orders')
|
|
43
|
+
->whereNull('orchestrator_priority')
|
|
44
|
+
->update(['orchestrator_priority' => 50]);
|
|
45
|
+
|
|
46
|
+
DB::statement(
|
|
47
|
+
'ALTER TABLE `orders` MODIFY COLUMN `orchestrator_priority` TINYINT UNSIGNED NOT NULL DEFAULT 50'
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
};
|
|
@@ -299,6 +299,12 @@ class OrderController extends Controller
|
|
|
299
299
|
$input['adhoc'] = Utils::isTrue($input['adhoc']) ? 1 : 0;
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
+
// Ensure orchestrator_priority is never null — the column is NOT NULL
|
|
303
|
+
// and the DB default is bypassed when Eloquent receives an explicit null.
|
|
304
|
+
if (!isset($input['orchestrator_priority']) || !is_numeric($input['orchestrator_priority'])) {
|
|
305
|
+
$input['orchestrator_priority'] = 50;
|
|
306
|
+
}
|
|
307
|
+
|
|
302
308
|
if (!isset($input['payload_uuid'])) {
|
|
303
309
|
return response()->apiError('Attempted to attach invalid payload to order.');
|
|
304
310
|
}
|
|
@@ -527,6 +533,12 @@ class OrderController extends Controller
|
|
|
527
533
|
$order->dispatch();
|
|
528
534
|
}
|
|
529
535
|
|
|
536
|
+
// Ensure orchestrator_priority is never null on update either —
|
|
537
|
+
// only apply the default when the key was explicitly sent as null/empty.
|
|
538
|
+
if (array_key_exists('orchestrator_priority', $input) && !is_numeric($input['orchestrator_priority'])) {
|
|
539
|
+
$input['orchestrator_priority'] = 50;
|
|
540
|
+
}
|
|
541
|
+
|
|
530
542
|
// update the order
|
|
531
543
|
$order->update($input);
|
|
532
544
|
$order->flushAttributesCache();
|
|
@@ -126,6 +126,12 @@ class OrderController extends FleetOpsController
|
|
|
126
126
|
$input['order_config_uuid'] = $defaultOrderConfig->uuid;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
|
|
130
|
+
// Ensure orchestrator_priority is never null — the column is NOT NULL
|
|
131
|
+
// and the DB default is bypassed when Eloquent receives an explicit null.
|
|
132
|
+
if (!isset($input['orchestrator_priority']) || !is_numeric($input['orchestrator_priority'])) {
|
|
133
|
+
$input['orchestrator_priority'] = 50;
|
|
134
|
+
}
|
|
129
135
|
},
|
|
130
136
|
function (&$request, Order &$order, &$requestInput) {
|
|
131
137
|
$input = $request->input('order');
|
|
@@ -219,6 +219,20 @@ class Order extends Model
|
|
|
219
219
|
'orchestrator_priority' => 'integer',
|
|
220
220
|
];
|
|
221
221
|
|
|
222
|
+
/**
|
|
223
|
+
* The model's default attribute values.
|
|
224
|
+
*
|
|
225
|
+
* Ensures that `orchestrator_priority` is never persisted as NULL even when
|
|
226
|
+
* the caller omits the field entirely (e.g. the order/form component does
|
|
227
|
+
* not require the user to fill in orchestrator constraints). The value
|
|
228
|
+
* mirrors the database column default defined in the migration.
|
|
229
|
+
*
|
|
230
|
+
* @var array<string, mixed>
|
|
231
|
+
*/
|
|
232
|
+
protected $attributes = [
|
|
233
|
+
'orchestrator_priority' => 50,
|
|
234
|
+
];
|
|
235
|
+
|
|
222
236
|
/**
|
|
223
237
|
* The attributes excluded from the model's JSON form.
|
|
224
238
|
*
|
|
@@ -619,6 +633,18 @@ class Order extends Model
|
|
|
619
633
|
return data_get($this, 'updatedBy.name');
|
|
620
634
|
}
|
|
621
635
|
|
|
636
|
+
/**
|
|
637
|
+
* Set the orchestrator_priority attribute.
|
|
638
|
+
*
|
|
639
|
+
* Coerces null or non-numeric values to the default priority of 50 so that
|
|
640
|
+
* the NOT NULL database constraint is never violated when a user submits
|
|
641
|
+
* the order form without filling in the orchestrator constraints section.
|
|
642
|
+
*/
|
|
643
|
+
public function setOrchestratorPriorityAttribute($value): void
|
|
644
|
+
{
|
|
645
|
+
$this->attributes['orchestrator_priority'] = is_numeric($value) ? (int) $value : 50;
|
|
646
|
+
}
|
|
647
|
+
|
|
622
648
|
/**
|
|
623
649
|
* Set the order type attribute, which defaults to `default`.
|
|
624
650
|
*/
|