Skip to content

Commit

Permalink
merge: #2745
Browse files Browse the repository at this point in the history
2745: feat(app,dal): Add new functionality to start, stop and reboot ec2 instances r=stack72 a=stack72

<img width="435" alt="Screenshot 2023-09-12 at 23 25 52" src="https://github.com/systeminit/si/assets/227823/d8477187-aa09-458e-834a-b45b1123b538">


Co-authored-by: stack72 <[email protected]>
  • Loading branch information
si-bors-ng[bot] and stack72 authored Sep 13, 2023
2 parents 0851478 + 8661603 commit ed426fd
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 13 deletions.
7 changes: 1 addition & 6 deletions app/web/src/components/ApplyHistoryItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@
</template>
<template #default>
<div class="text-sm pl-8">
<!-- Note(victor): Not 100% sure this should be removed, but it looks redundant. Confirm with mark.-->
<!--div class="text-success-500 tracking-tight font-bold">
{{ fixBatch.fixes.length }}
resource{{ fixBatch.fixes.length > 1 ? "s" : "" }} fixed
</div-->
<div
:class="
clsx(
Expand Down Expand Up @@ -80,7 +75,7 @@
<StatusIndicatorIcon type="fix" :status="fix.status" />
<div class="flex flex-col">
<div class="font-bold pl-xs">
{{ `${formatTitle(fix.actionKind)} ${fix.schemaName}` }}
{{ `${fix.displayName}` }}
</div>
</div>
</template>
Expand Down
1 change: 1 addition & 0 deletions app/web/src/store/fixes.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export type Fix = {
resource?: Resource | null;
startedAt?: string;
finishedAt?: string;
displayName?: string;
};

// TODO(nick): use real user data and real timestamps. This is dependent on the backend.
Expand Down
12 changes: 6 additions & 6 deletions lib/dal/src/builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ use crate::{
mod func;
pub mod schema;

pub const SI_AWS_PKG: &str = "si-aws-2023-09-12.sipkg";
pub const SI_AWS_EC2_PKG: &str = "si-aws-ec2-2023-09-12.sipkg";
pub const SI_DOCKER_IMAGE_PKG: &str = "si-docker-image-2023-09-12.sipkg";
pub const SI_COREOS_PKG: &str = "si-coreos-2023-09-12.sipkg";
pub const SI_GENERIC_FRAME_PKG: &str = "si-generic-frame-2023-09-12.sipkg";
pub const SI_AWS_IAM_PKG: &str = "si-aws-iam-2023-09-12.sipkg";
pub const SI_AWS_PKG: &str = "si-aws-2023-09-13.sipkg";
pub const SI_AWS_EC2_PKG: &str = "si-aws-ec2-2023-09-13.sipkg";
pub const SI_DOCKER_IMAGE_PKG: &str = "si-docker-image-2023-09-13.sipkg";
pub const SI_COREOS_PKG: &str = "si-coreos-2023-09-13.sipkg";
pub const SI_GENERIC_FRAME_PKG: &str = "si-generic-frame-2023-09-13.sipkg";
pub const SI_AWS_IAM_PKG: &str = "si-aws-iam-2023-09-13.sipkg";

#[remain::sorted]
#[derive(Error, Debug)]
Expand Down
15 changes: 14 additions & 1 deletion lib/dal/src/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::{
func::backend::js_action::ActionRunResult, impl_standard_model, pk, standard_model,
standard_model_accessor, standard_model_accessor_ro, standard_model_belongs_to, ActionKind,
ActionPrototype, ActionPrototypeError, ActionPrototypeId, Component, ComponentError,
ComponentId, DalContext, FixBatch, FixResolverError, FuncError, HistoryEventError,
ComponentId, DalContext, FixBatch, FixResolverError, Func, FuncError, HistoryEventError,
ResourceView, SchemaError, StandardModel, StandardModelError, Tenancy, Timestamp,
TransactionsError, Visibility, WsEvent, WsEventError, WsEventResult, WsPayload,
};
Expand Down Expand Up @@ -355,6 +355,17 @@ impl Fix {
let (component_name, schema_name, category) =
Self::component_details_for_history_view(ctx, self.component_id).await?;

let mut display_name = self.action_kind().clone().to_string();
let action_prototype = ActionPrototype::get_by_id(ctx, self.action_prototype_id()).await?;
if let Some(ap) = action_prototype {
let func_details = Func::get_by_id(ctx, &ap.func_id()).await?;
if let Some(func) = func_details {
if let Some(name) = func.display_name() {
display_name = name.to_string();
}
}
}

Ok(Some(FixHistoryView {
id: self.id,
status: if resource.is_none() {
Expand All @@ -365,6 +376,7 @@ impl Fix {
.unwrap_or(FixCompletionStatus::Failure)
},
action_kind: *self.action_kind(),
display_name,
schema_name,
component_name,
component_id: self.component_id,
Expand Down Expand Up @@ -413,6 +425,7 @@ pub struct FixHistoryView {
id: FixId,
status: FixCompletionStatus,
action_kind: ActionKind,
display_name: String,
schema_name: String,
component_name: String,
component_id: ComponentId,
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit ed426fd

Please sign in to comment.