mirror of
https://github.com/moghtech/komodo.git
synced 2026-08-22 00:01:13 +00:00
task links to configs / secrets
This commit is contained in:
@@ -53,6 +53,33 @@ fn convert_task_list_item(
|
||||
)
|
||||
})
|
||||
.unwrap_or_default();
|
||||
let (configs, secrets) = task
|
||||
.spec
|
||||
.and_then(|spec| {
|
||||
spec.container_spec.map(|spec| {
|
||||
(
|
||||
spec
|
||||
.configs
|
||||
.map(|config| {
|
||||
config
|
||||
.into_iter()
|
||||
.filter_map(|config| config.config_name)
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
spec
|
||||
.secrets
|
||||
.map(|secret| {
|
||||
secret
|
||||
.into_iter()
|
||||
.filter_map(|secret| secret.secret_name)
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
.unwrap_or_default(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.unwrap_or_default();
|
||||
SwarmTaskListItem {
|
||||
id: task.id,
|
||||
name: task.name,
|
||||
@@ -61,6 +88,8 @@ fn convert_task_list_item(
|
||||
container_id,
|
||||
state,
|
||||
desired_state: task.desired_state.map(convert_task_state),
|
||||
configs,
|
||||
secrets,
|
||||
created_at: task.created_at,
|
||||
updated_at: task.updated_at,
|
||||
}
|
||||
|
||||
@@ -35,6 +35,14 @@ pub struct SwarmTaskListItem {
|
||||
#[serde(rename = "DesiredState")]
|
||||
pub desired_state: Option<TaskState>,
|
||||
|
||||
/// Attached config names
|
||||
#[serde(rename = "Configs")]
|
||||
pub configs: Vec<String>,
|
||||
|
||||
/// Attached secret names
|
||||
#[serde(rename = "Secrets")]
|
||||
pub secrets: Vec<String>,
|
||||
|
||||
#[serde(rename = "CreatedAt")]
|
||||
pub created_at: Option<String>,
|
||||
|
||||
|
||||
@@ -4256,6 +4256,10 @@ export interface SwarmTaskListItem {
|
||||
ContainerID?: string;
|
||||
State?: TaskState;
|
||||
DesiredState?: TaskState;
|
||||
/** Attached config names */
|
||||
Configs: string[];
|
||||
/** Attached secret names */
|
||||
Secrets: string[];
|
||||
CreatedAt?: string;
|
||||
UpdatedAt?: string;
|
||||
}
|
||||
|
||||
Vendored
+4
@@ -4246,6 +4246,10 @@ export interface SwarmTaskListItem {
|
||||
ContainerID?: string;
|
||||
State?: TaskState;
|
||||
DesiredState?: TaskState;
|
||||
/** Attached config names */
|
||||
Configs: string[];
|
||||
/** Attached secret names */
|
||||
Secrets: string[];
|
||||
CreatedAt?: string;
|
||||
UpdatedAt?: string;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
stroke_color_class_by_intention,
|
||||
swarm_state_intention,
|
||||
} from "@lib/color";
|
||||
import { ReactNode, useMemo } from "react";
|
||||
import { Fragment, ReactNode, useMemo } from "react";
|
||||
import { MobileFriendlyTabsSelector } from "@ui/mobile-friendly-tabs";
|
||||
import { SwarmServiceLogs } from "./log";
|
||||
import { Section } from "@components/layouts";
|
||||
@@ -124,6 +124,28 @@ export default function SwarmTaskPage() {
|
||||
resource_id={service?.ID}
|
||||
name={service?.Name}
|
||||
/>
|
||||
{task?.Configs.map((config) => (
|
||||
<Fragment key={config}>
|
||||
|
|
||||
<SwarmResourceLink
|
||||
type="Config"
|
||||
swarm_id={id}
|
||||
resource_id={config}
|
||||
name={config}
|
||||
/>
|
||||
</Fragment>
|
||||
))}
|
||||
{task?.Secrets.map((secret) => (
|
||||
<Fragment key={secret}>
|
||||
|
|
||||
<SwarmResourceLink
|
||||
type="Secret"
|
||||
swarm_id={id}
|
||||
resource_id={secret}
|
||||
name={secret}
|
||||
/>
|
||||
</Fragment>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user