forked from github-starred/komodo
fix the ts client
This commit is contained in:
@@ -2,7 +2,7 @@ use anyhow::Context;
|
||||
use async_timing_util::{wait_until_timelength, Timelength};
|
||||
use futures::future::join_all;
|
||||
use monitor_types::entities::{
|
||||
deployment::{BasicContainerInfo, Deployment, DockerContainerState},
|
||||
deployment::{ContainerSummary, Deployment, DockerContainerState},
|
||||
server::{
|
||||
stats::{
|
||||
AllSystemStats, BasicSystemStats, ServerHealth, SingleDiskUsage, StatsState,
|
||||
@@ -29,7 +29,7 @@ pub struct CachedServerStatus {
|
||||
pub struct CachedDeploymentStatus {
|
||||
pub id: String,
|
||||
pub state: DockerContainerState,
|
||||
pub container: Option<BasicContainerInfo>,
|
||||
pub container: Option<ContainerSummary>,
|
||||
}
|
||||
|
||||
impl State {
|
||||
|
||||
@@ -39,19 +39,25 @@ enum ReadRequest {
|
||||
FindResources(FindResources),
|
||||
|
||||
// ==== SERVER ====
|
||||
GetServer(GetServer),
|
||||
ListServers(ListServers),
|
||||
GetServerStatus(GetServerStatus),
|
||||
GetPeripheryVersion(GetPeripheryVersion),
|
||||
GetSystemInformation(GetSystemInformation),
|
||||
GetDockerContainers(GetDockerContainers),
|
||||
GetDockerImages(GetDockerImages),
|
||||
GetDockerNetworks(GetDockerNetworks),
|
||||
GetServer(GetServer),
|
||||
ListServers(ListServers),
|
||||
GetServerActionState(GetServerActionState),
|
||||
|
||||
// ==== DEPLOYMENT ====
|
||||
GetDeployment(GetDeployment),
|
||||
ListDeployments(ListDeployments),
|
||||
GetDeploymentStatus(GetDeploymentStatus),
|
||||
GetDeploymentActionState(GetDeploymentActionState),
|
||||
GetDeployedVersion(GetDeployedVersion),
|
||||
GetDeploymentStats(GetDeploymentStats),
|
||||
GetLog(GetLog),
|
||||
|
||||
|
||||
// ==== BUILD ====
|
||||
GetBuild(GetBuild),
|
||||
|
||||
@@ -3,7 +3,7 @@ use async_trait::async_trait;
|
||||
use futures::future::join_all;
|
||||
use monitor_types::{
|
||||
entities::{
|
||||
deployment::BasicContainerInfo,
|
||||
deployment::ContainerSummary,
|
||||
server::{
|
||||
docker_image::ImageSummary, docker_network::DockerNetwork, stats::SystemInformation,
|
||||
Server, ServerActionState,
|
||||
@@ -334,7 +334,7 @@ impl Resolve<GetDockerContainers, RequestUser> for State {
|
||||
&self,
|
||||
GetDockerContainers { server_id }: GetDockerContainers,
|
||||
user: RequestUser,
|
||||
) -> anyhow::Result<Vec<BasicContainerInfo>> {
|
||||
) -> anyhow::Result<Vec<ContainerSummary>> {
|
||||
let server = self
|
||||
.get_server_check_permissions(&server_id, &user, PermissionLevel::Read)
|
||||
.await?;
|
||||
|
||||
@@ -58,7 +58,7 @@ impl Resolve<DeleteLoginSecret, RequestUser> for State {
|
||||
&self,
|
||||
DeleteLoginSecret { name }: DeleteLoginSecret,
|
||||
user: RequestUser,
|
||||
) -> anyhow::Result<()> {
|
||||
) -> anyhow::Result<DeleteLoginSecretResponse> {
|
||||
self.db
|
||||
.users
|
||||
.update_one(
|
||||
@@ -73,6 +73,6 @@ impl Resolve<DeleteLoginSecret, RequestUser> for State {
|
||||
)
|
||||
.await
|
||||
.context("failed at mongo update query")?;
|
||||
Ok(())
|
||||
Ok(DeleteLoginSecretResponse {})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use anyhow::{anyhow, Context};
|
||||
use bollard::{container::ListContainersOptions, Docker};
|
||||
use monitor_types::entities::{
|
||||
deployment::BasicContainerInfo,
|
||||
deployment::ContainerSummary,
|
||||
server::{docker_image::ImageSummary, docker_network::DockerNetwork},
|
||||
};
|
||||
|
||||
@@ -19,7 +19,7 @@ impl Default for DockerClient {
|
||||
}
|
||||
|
||||
impl DockerClient {
|
||||
pub async fn list_containers(&self) -> anyhow::Result<Vec<BasicContainerInfo>> {
|
||||
pub async fn list_containers(&self) -> anyhow::Result<Vec<ContainerSummary>> {
|
||||
let res = self
|
||||
.docker
|
||||
.list_containers(Some(ListContainersOptions::<String> {
|
||||
@@ -29,7 +29,7 @@ impl DockerClient {
|
||||
.await?
|
||||
.into_iter()
|
||||
.map(|s| {
|
||||
let info = BasicContainerInfo {
|
||||
let info = ContainerSummary {
|
||||
id: s.id.unwrap_or_default(),
|
||||
name: s
|
||||
.names
|
||||
@@ -47,7 +47,7 @@ impl DockerClient {
|
||||
};
|
||||
Ok::<_, anyhow::Error>(info)
|
||||
})
|
||||
.collect::<anyhow::Result<Vec<BasicContainerInfo>>>()?;
|
||||
.collect::<anyhow::Result<Vec<ContainerSummary>>>()?;
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use anyhow::{anyhow, Context};
|
||||
use monitor_types::{
|
||||
entities::{
|
||||
deployment::{BasicContainerInfo, Deployment, DockerContainerStats, TerminationSignal},
|
||||
deployment::{ContainerSummary, Deployment, DockerContainerStats, TerminationSignal},
|
||||
update::Log,
|
||||
},
|
||||
optional_string,
|
||||
@@ -14,12 +14,12 @@ use crate::{helpers::docker, state::State};
|
||||
//
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone, Request)]
|
||||
#[response(Vec<BasicContainerInfo>)]
|
||||
#[response(Vec<ContainerSummary>)]
|
||||
pub struct GetContainerList {}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Resolve<GetContainerList> for State {
|
||||
async fn resolve(&self, _: GetContainerList, _: ()) -> anyhow::Result<Vec<BasicContainerInfo>> {
|
||||
async fn resolve(&self, _: GetContainerList, _: ()) -> anyhow::Result<Vec<ContainerSummary>> {
|
||||
self.docker.list_containers().await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user