Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[AIDAPP-474] Enhance incidents by introducing the ability to add incident updates #432

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

/*
<COPYRIGHT>

Copyright © 2016-2025, Canyon GBS LLC. All rights reserved.

Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>

Notice:

- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.

For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.

</COPYRIGHT>
*/

namespace AidingApp\ServiceManagement\Database\Factories;

use AidingApp\ServiceManagement\Models\Incident;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\AidingApp\ServiceManagement\Models\Model>
*/
class IncidentUpdateFactory extends Factory
{
public function definition(): array
{
return [
'incident_id' => Incident::factory(),
'update' => $this->faker->sentence(),
'internal' => $this->faker->boolean(),
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php

/*
<COPYRIGHT>

Copyright © 2016-2025, Canyon GBS LLC. All rights reserved.

Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>

Notice:

- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.

For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.

</COPYRIGHT>
*/

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class () extends Migration {
public function up(): void
{
Schema::create('incident_updates', function (Blueprint $table) {
$table->uuid('id')->primary();

$table->foreignUuid('incident_id')->nullable()->constrained('incidents');
$table->text('update');
$table->boolean('internal');

$table->timestamps();
$table->softDeletes();
});
}

public function down(): void
{
Schema::dropIfExists('incident_updates');
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/*
<COPYRIGHT>

Copyright © 2016-2025, Canyon GBS LLC. All rights reserved.

Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>

Notice:

- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.

For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.

</COPYRIGHT>
*/

namespace AidingApp\ServiceManagement\Database\Seeders;

use AidingApp\ServiceManagement\Models\Incident;
use AidingApp\ServiceManagement\Models\IncidentUpdate;
use Illuminate\Database\Seeder;

class IncidentUpdateSeeder extends Seeder
{
public function run(): void
{
Incident::each(function (Incident $incident) {
IncidentUpdate::factory()
->count(3)
->for($incident, 'incident')
->create();
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@
use AidingApp\ServiceManagement\Filament\Resources\IncidentResource\Pages\CreateIncident;
use AidingApp\ServiceManagement\Filament\Resources\IncidentResource\Pages\EditIncident;
use AidingApp\ServiceManagement\Filament\Resources\IncidentResource\Pages\ListIncidents;
use AidingApp\ServiceManagement\Filament\Resources\IncidentResource\Pages\ManageIncidentUpdate;
use AidingApp\ServiceManagement\Filament\Resources\IncidentResource\Pages\ViewIncident;
use AidingApp\ServiceManagement\Models\Incident;
use App\Features\IncidentSeverityStatus;
use Filament\Resources\Pages\Page;
use Filament\Resources\Resource;

class IncidentResource extends Resource
Expand All @@ -63,10 +65,22 @@ public static function canAccess(): bool
return IncidentSeverityStatus::active() && parent::canAccess();
}

public static function getRecordSubNavigation(Page $page): array
{
$navigationItems = [
ViewIncident::class,
EditIncident::class,
ManageIncidentUpdate::class,
];

return $page->generateNavigationItems($navigationItems);
}

public static function getPages(): array
{
return [
'index' => ListIncidents::route('/'),
'manage-incident-update' => ManageIncidentUpdate::route('/{record}/updates'),
'create' => CreateIncident::route('/create'),
'view' => ViewIncident::route('/{record}'),
'edit' => EditIncident::route('/{record}/edit'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ class EditIncident extends EditRecord

protected static string $resource = IncidentResource::class;

protected static ?string $navigationLabel = 'Edit';

public function form(Form $form): Form
{
return $form
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php

/*
<COPYRIGHT>

Copyright © 2016-2025, Canyon GBS LLC. All rights reserved.

Aiding App™ is licensed under the Elastic License 2.0. For more details,
see <https://github.com/canyongbs/aidingapp/blob/main/LICENSE.>

Notice:

- You may not provide the software to third parties as a hosted or managed
service, where the service provides users with access to any substantial set of
the features or functionality of the software.
- You may not move, change, disable, or circumvent the license key functionality
in the software, and you may not remove or obscure any functionality in the
software that is protected by the license key.
- You may not alter, remove, or obscure any licensing, copyright, or other notices
of the licensor in the software. Any use of the licensor’s trademarks is subject
to applicable law.
- Canyon GBS LLC respects the intellectual property rights of others and expects the
same in return. Canyon GBS™ and Aiding App™ are registered trademarks of
Canyon GBS LLC, and we are committed to enforcing and protecting our trademarks
vigorously.
- The software solution, including services, infrastructure, and code, is offered as a
Software as a Service (SaaS) by Canyon GBS LLC.
- Use of this software implies agreement to the license terms and conditions as stated
in the Elastic License 2.0.

For more information or inquiries please visit our website at
<https://www.canyongbs.com> or contact us via email at legal@canyongbs.com.

</COPYRIGHT>
*/

namespace AidingApp\ServiceManagement\Filament\Resources\IncidentResource\Pages;

use AidingApp\ServiceManagement\Filament\Resources\IncidentResource;
use AidingApp\ServiceManagement\Filament\Resources\IncidentResource\RelationManagers\IncidentUpdatesRelationManager;
use Filament\Resources\Pages\ManageRelatedRecords;
use Illuminate\Database\Eloquent\Model;

class ManageIncidentUpdate extends ManageRelatedRecords
{
protected static string $resource = IncidentResource::class;

// TODO: Obsolete when there is no table, remove from Filament
protected static string $relationship = 'incidentUpdates';

protected static ?string $navigationLabel = 'Updates';

protected static ?string $breadcrumb = 'Updates';

public static function canAccess(array $arguments = []): bool
{
return (bool) count(static::managers($arguments['record'] ?? null));
}

public function getRelationManagers(): array
{
return static::managers($this->getRecord());
}

private static function managers(?Model $record = null): array
{
return collect([
IncidentUpdatesRelationManager::class,
])
->toArray();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ class ViewIncident extends ViewRecord
{
protected static string $resource = IncidentResource::class;

protected static ?string $navigationLabel = 'View';

public function infolist(Infolist $infolist): Infolist
{
return $infolist
Expand Down
Loading
Loading