Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

New Features: #100

Merged
merged 1 commit into from
Oct 30, 2024
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
439 changes: 224 additions & 215 deletions src/app/app-routing.module.ts

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/app/interfaces/incident.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ export interface Incident {

iAmIn?: boolean;

postmortem?: {
wentWrong: string;
canBeLearned: string;
howToPrevent: string;
}



}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@
<p>Postmortem Culture: Learning from Failure. The postmortem is a retrospective of the incident, focusing on what went wrong, what can be learned, and how to prevent similar incidents in the future.</p>
</ion-card-content>
<ion-card-content class="flex flex-row justify-center items-center w-full">
<ion-button color="primary" class="w-full" (click)="closeIncident()">Incident Postmortem</ion-button>
<ion-button color="primary" class="w-full" (click)="postmortemIncident()">Incident Postmortem</ion-button>
</ion-card-content>
</ion-card>
</ion-col>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,33 @@ export class IncidentDetailsPage implements OnInit {


closeIncident() {
this.incidentService.closeIncident(this.orgName, this.productObjective, this.productStep, this.incident).then(async res => {
if (res) {
// navigate one step back
await this.router.navigate(['/incident-manager', {
productObjective: this.productObjective,
step: this.productStep
}]);
}
});

}

saveChanges() {


async postmortemIncident() {
await this.router.navigate(['/incident-postmortem', {
orgName: this.orgName,
productObjective: this.productObjective,
step: this.productStep,
currentUser: this.currentUser,
incidentTitle: this.incident.title
}]);
}




/**
* Show a loading spinner.
*/
Expand All @@ -207,4 +225,5 @@ export class IncidentDetailsPage implements OnInit {
upload.value = '';
this.isImageLoaded = false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
<ion-label class="text-white">
<div class=" flex flex-row justify-between items-center">
<h2>{{incident.title}}</h2>
<div>
@if (incident.iAmIn) {
<ion-chip> Assigned to you</ion-chip>
}
<ion-chip color="success" >Open</ion-chip>
</div>
</div>
</ion-label>
</ion-item>
Expand All @@ -37,13 +40,20 @@ <h2>{{incident.title}}</h2>
<ion-card class="p-5">
<ion-card-content>
<ion-list>
<ion-item *ngFor="let incident of closeIncidents" (click)='goToIncident(incident)'>
<ion-item *ngFor="let incident of closeIncidents">
<ion-label class="text-white">
<div class=" flex flex-row justify-between items-center">
<h2>{{incident.title}}</h2>
@if (incident.iAmIn) {
<ion-chip> Assigned to you</ion-chip>
}
<h2 (click)='goToIncident(incident)' >{{incident.title}}</h2>
<div>
@if (incident.iAmIn) {
<ion-chip (click)='goToIncident(incident)' > Assigned to you</ion-chip>
}
@if (incident.state === 'postmortem') {
<ion-chip color="primary" (click)="goToPostmortem(incident)" > Postmortem</ion-chip>
} @else {
<ion-chip color="danger" (click)='goToIncident(incident)' > Closed</ion-chip>
}
</div>
</div>
</ion-label>
</ion-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class IncidentManagerPage implements OnInit {

async closeIncident() {
this.closeIncidents = await this.incidentService.getIncidents(this.orgName, this.productObjective, this.productStep );
this.closeIncidents = this.closeIncidents.filter(incident => incident.state === 'closed');
this.closeIncidents = this.closeIncidents.filter(incident => incident.state === 'closed' || incident.state === 'postmortem');
}


Expand Down Expand Up @@ -135,4 +135,11 @@ export class IncidentManagerPage implements OnInit {
await this.loadingCtrl.dismiss();
}

goToPostmortem(incident: Incident) {
this.router.navigate(['incident-postmortem', {
productObjective: this.productObjective,
step: this.productStep,
incidentTitle: incident.title
}]);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { IncidentPostmortemPage } from './incident-postmortem.page';

const routes: Routes = [
{
path: '',
component: IncidentPostmortemPage
}
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class IncidentPostmortemPageRoutingModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

import { IonicModule } from '@ionic/angular';

import { IncidentPostmortemPageRoutingModule } from './incident-postmortem-routing.module';

import { IncidentPostmortemPage } from './incident-postmortem.page';
import {ComponentsModule} from "../../../components/components.module";

@NgModule({
imports: [
CommonModule,
FormsModule,
IonicModule,
IncidentPostmortemPageRoutingModule,
ComponentsModule
],
declarations: [IncidentPostmortemPage]
})
export class IncidentPostmortemPageModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<app-header-return [title]="'Incident Postmortem'" ></app-header-return>

<ion-content [fullscreen]="true">
<ion-grid>
<app-title [title]="'Incident Postmortem'"></app-title>
<ion-row class="lg:m-10 md:m-10">
<ion-col size="12" size-md="4" size-lg="4" class="">
<p>Postmortem for {{ incident.title }}</p>
</ion-col>
</ion-row>
<ion-row class="lg:m-10 md:m-10">
<ion-col size="12" size-md="12" size-lg="12" class="">
<ion-card>
<ion-card-content>

<ion-row class="lg:m-10 md:m-10">
<ion-col size="12" size-md="12" size-lg="12" class="">
<div class="flex flex-row items-center justify-between w-full">
<h1 class="text-white text-3xl pb-5">What went wrong?</h1>
<ion-avatar class="h-12 w-12 bg-purple-600 p-2" (click)="sendToAI('wentWrong')">
<ion-icon class="w-full h-full text-white" name="color-wand"></ion-icon>
</ion-avatar>
</div>
<ion-textarea fill="outline" autoGrow="true" [(ngModel)]="wentWrong" [value]="incident.postmortem?.wentWrong"></ion-textarea>
</ion-col>
</ion-row>
<ion-row class="lg:m-10 md:m-10">
<ion-col size="12" size-md="12" size-lg="12" class="">
<div class="flex flex-row items-center justify-between w-full">
<h1 class="text-white text-3xl pb-5">What can be learned?</h1>
<ion-avatar class="h-12 w-12 bg-purple-600 p-2" (click)="sendToAI('canBeLearned')">
<ion-icon class="w-full h-full text-white" name="color-wand"></ion-icon>
</ion-avatar>
</div>
<ion-textarea fill="outline" autoGrow="true" [(ngModel)]="canBeLearned" [value]="incident.postmortem?.canBeLearned"></ion-textarea>
</ion-col>
</ion-row>
<ion-row class="lg:m-10 md:m-10">
<ion-col size="12" size-md="12" size-lg="12" class="">
<div class="flex flex-row items-center justify-between w-full">
<h1 class="text-white text-3xl pb-5">How to prevent similar incidents in the future?</h1>
<ion-avatar class="h-12 w-12 bg-purple-600 p-2" (click)="sendToAI('howToPrevent')">
<ion-icon class="w-full h-full text-white" name="color-wand"></ion-icon>
</ion-avatar>
</div>
<ion-textarea fill="outline" autoGrow="true" [(ngModel)]="howToPrevent" [value]="incident.postmortem?.howToPrevent"></ion-textarea>
</ion-col>
</ion-row>
</ion-card-content>
</ion-card>
</ion-col>

<ion-col size="12" size-md="12" size-lg="12" class="">
<ion-card>
<ion-card-content>
<ion-button expand="block" color="danger" (click)="savePostmortem()">Save and Close</ion-button>
</ion-card-content>
</ion-card>
</ion-col>
</ion-row>
</ion-grid>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { IncidentPostmortemPage } from './incident-postmortem.page';

describe('IncidentPostmortemPage', () => {
let component: IncidentPostmortemPage;
let fixture: ComponentFixture<IncidentPostmortemPage>;

beforeEach(() => {
fixture = TestBed.createComponent(IncidentPostmortemPage);
component = fixture.componentInstance;
fixture.detectChanges();
});

it('should create', () => {
expect(component).toBeTruthy();
});
});
Loading