-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
show slas on deployment details component
- Loading branch information
1 parent
ae0a04f
commit 73c043d
Showing
8 changed files
with
159 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<template> | ||
<p-card class="deployment-service-level-agreement-card"> | ||
<p-key-value label="Name" :value="serviceLevelAgreement.name" /> | ||
<p-key-value label="Severity" :value="uppercase(serviceLevelAgreement.severity)" /> | ||
<p-key-value v-if="serviceLevelAgreement.description" label="Description" :value="serviceLevelAgreement.description" /> | ||
<p-key-value label="Duration" :value="`${serviceLevelAgreement.durationInSeconds()} seconds`" /> | ||
</p-card> | ||
</template> | ||
|
||
|
||
<script lang="ts" setup> | ||
import { ServiceLevelAgreement } from '@/models/ServiceLevelAgreement' | ||
import { uppercase } from '@/utilities' | ||
defineProps<{ | ||
serviceLevelAgreement: ServiceLevelAgreement, | ||
}>() | ||
</script> | ||
|
||
<style> | ||
.deployment-service-level-agreement-card { @apply | ||
text-sm | ||
gap-y-2 | ||
w-full | ||
} | ||
</style> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ServiceLevelAgreementResponse } from '@/models/api/ServiceLevelAgreementResponse' | ||
import { ServiceLevelAgreement } from '@/models/ServiceLevelAgreement' | ||
import { MapFunction } from '@/services/Mapper' | ||
|
||
export const mapServiceLevelAgreementResponseToServiceLevelAgreement: MapFunction<ServiceLevelAgreementResponse, ServiceLevelAgreement> = function(source) { | ||
return new ServiceLevelAgreement({ | ||
id: source.id, | ||
name: source.name, | ||
description: source.description, | ||
enabled: source.enabled, | ||
trigger: this.map('AutomationTriggerResponse', source.trigger, 'AutomationTrigger'), | ||
labels: source.labels, | ||
severity: source.severity, | ||
created: this.map('string', source.created, 'Date'), | ||
updated: this.map('string', source.updated, 'Date'), | ||
account: source.account, | ||
workspace: source.workspace, | ||
actor: { | ||
actorId: source.actor.actor_id, | ||
handle: source.actor.handle, | ||
userId: source.actor.user_id, | ||
botId: source.actor.bot_id, | ||
}, | ||
}) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { AutomationTrigger } from '@/automations' | ||
|
||
export type ServiceLevelAgreementSeverity = 'minor' | 'low' | 'moderate' | 'high' | 'critical' | ||
|
||
export interface IServiceLevelAgreement { | ||
id: string, | ||
name: string, | ||
description: string, | ||
enabled: boolean, | ||
trigger: AutomationTrigger, | ||
labels: Record<string, string>[], | ||
severity: ServiceLevelAgreementSeverity, | ||
created: Date, | ||
updated: Date, | ||
account: string, | ||
workspace: string, | ||
actor: { | ||
actorId: string, | ||
handle: string, | ||
userId: string | null, | ||
botId: string | null, | ||
}, | ||
} | ||
|
||
export class ServiceLevelAgreement implements IServiceLevelAgreement { | ||
public readonly id: string | ||
public readonly name: string | ||
public readonly description: string | ||
public readonly enabled: boolean | ||
public readonly trigger: AutomationTrigger | ||
public readonly labels: Record<string, string>[] | ||
public readonly severity: ServiceLevelAgreementSeverity | ||
public readonly created: Date | ||
public readonly updated: Date | ||
public readonly account: string | ||
public readonly workspace: string | ||
public readonly actor: { | ||
actorId: string, | ||
handle: string, | ||
userId: string | null, | ||
botId: string | null, | ||
} | ||
|
||
public constructor(serviceLevelAgreement: IServiceLevelAgreement) { | ||
this.id = serviceLevelAgreement.id | ||
this.name = serviceLevelAgreement.name | ||
this.description = serviceLevelAgreement.description | ||
this.enabled = serviceLevelAgreement.enabled | ||
this.trigger = serviceLevelAgreement.trigger | ||
this.labels = serviceLevelAgreement.labels | ||
this.created = serviceLevelAgreement.created | ||
this.updated = serviceLevelAgreement.updated | ||
this.account = serviceLevelAgreement.account | ||
this.workspace = serviceLevelAgreement.workspace | ||
this.actor = serviceLevelAgreement.actor | ||
this.severity = serviceLevelAgreement.severity | ||
} | ||
|
||
public durationInSeconds(): number { | ||
return this.trigger.within | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { AutomationActionResponse } from '@/automations/types/api/actions' | ||
import { AutomationTriggerResponse } from '@/automations/types/api/triggers' | ||
import { ServiceLevelAgreementSeverity } from '@/models/ServiceLevelAgreement' | ||
|
||
|
||
export type ServiceLevelAgreementResponse = { | ||
name: string, | ||
description: string, | ||
enabled: boolean, | ||
trigger: AutomationTriggerResponse, | ||
actions_on_resolve: AutomationActionResponse[], | ||
labels: Record<string, string>[], | ||
severity: ServiceLevelAgreementSeverity, | ||
id: string, | ||
created: string, | ||
updated: string, | ||
account: string, | ||
workspace: string, | ||
actor: { | ||
actor_id: string, | ||
handle: string, | ||
user_id: string | null, | ||
bot_id: string | null, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters