Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
deepu105 committed Aug 26, 2023
1 parent 154495e commit 81308b9
Show file tree
Hide file tree
Showing 30 changed files with 44 additions and 65 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
.vscode/*
!.vscode/launch.json
.idea/*
rustc-ice-*
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ run:

## Run clippy
lint:
@find . | grep '\./src/.*\.rs$$' | xargs touch && cargo clippy --all-targets --workspace
cargo clippy --all --all-features --all-targets --workspace -- -D warnings

## Fix lint
lint-fix:
Expand Down
3 changes: 1 addition & 2 deletions src/app/contexts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use tui::{
Frame,
};

use super::{models::AppResource, ActiveBlock, App};
use crate::{
network::Network,
ui::{
Expand All @@ -18,8 +19,6 @@ use crate::{
},
};

use super::{models::AppResource, ActiveBlock, App};

#[derive(Clone, Default)]
pub struct KubeContext {
pub name: String,
Expand Down
3 changes: 1 addition & 2 deletions src/app/cronjobs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::batch::v1::CronJob, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::batch::v1::CronJob, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/daemonsets.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::apps::v1::DaemonSet, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::apps::v1::DaemonSet, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/deployments.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::apps::v1::Deployment, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::apps::v1::Deployment, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
5 changes: 2 additions & 3 deletions src/app/dynamic.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use anyhow::anyhow;
use async_trait::async_trait;
use k8s_openapi::chrono::Utc;
use kube::{
core::DynamicObject,
discovery::{ApiResource, Scope},
Api, ResourceExt,
};

use anyhow::anyhow;
use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/ingress.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use async_trait::async_trait;
use k8s_openapi::{
api::networking::v1::{Ingress, IngressBackend, IngressRule, IngressStatus},
chrono::Utc,
};

use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/jobs.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::batch::v1::Job, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::batch::v1::Job, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
10 changes: 6 additions & 4 deletions src/app/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ use kube::{
};
use kubectl_view_allocations::{
extract_allocatable_from_nodes, extract_allocatable_from_pods,
extract_utilizations_from_pod_metrics, make_qualifiers, metrics::PodMetrics, Resource,
extract_utilizations_from_pod_metrics, make_qualifiers,
metrics::{PodMetrics, Usage},
qty::Qty,
tree::provide_prefix,
Resource,
};
use kubectl_view_allocations::{metrics::Usage, qty::Qty, tree::provide_prefix};
use serde::{Deserialize, Serialize};
use tokio::sync::MutexGuard;
use tui::{
Expand All @@ -19,6 +22,7 @@ use tui::{
Frame,
};

use super::{models::AppResource, utils, ActiveBlock, App};
use crate::{
network::Network,
ui::utils::{
Expand All @@ -27,8 +31,6 @@ use crate::{
},
};

use super::{models::AppResource, utils, ActiveBlock, App};

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct NodeMetrics {
metadata: kube::api::ObjectMeta,
Expand Down
3 changes: 1 addition & 2 deletions src/app/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ use tui::{
Frame,
};

use crate::network::Network;

use super::{ActiveBlock, App, Route};
use crate::network::Network;

#[async_trait]
pub trait AppResource {
Expand Down
3 changes: 1 addition & 2 deletions src/app/network_policies.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::vec;

use k8s_openapi::{api::networking::v1::NetworkPolicy, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::networking::v1::NetworkPolicy, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
5 changes: 2 additions & 3 deletions src/app/nodes.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use anyhow::anyhow;
use async_trait::async_trait;
use k8s_openapi::{
api::core::v1::{Node, Pod},
chrono::Utc,
Expand All @@ -8,9 +10,6 @@ use kube::{
Api,
};
use tokio::sync::MutexGuard;

use anyhow::anyhow;
use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/ns.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use k8s_openapi::api::core::v1::Namespace;

use anyhow::anyhow;
use async_trait::async_trait;
use k8s_openapi::api::core::v1::Namespace;
use kube::{api::ListParams, Api};
use tui::{
backend::Backend,
Expand Down
3 changes: 1 addition & 2 deletions src/app/pods.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
use async_trait::async_trait;
use k8s_openapi::{
api::core::v1::{
Container, ContainerPort, ContainerState, ContainerStateWaiting, ContainerStatus, Pod, PodSpec,
PodStatus,
},
chrono::Utc,
};

use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/pvcs.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use async_trait::async_trait;
use k8s_openapi::{
api::core::v1::PersistentVolumeClaim, apimachinery::pkg::api::resource::Quantity, chrono::Utc,
};

use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/pvs.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use async_trait::async_trait;
use k8s_openapi::{
api::core::v1::PersistentVolume, apimachinery::pkg::api::resource::Quantity, chrono::Utc,
};

use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/replicasets.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::apps::v1::ReplicaSet, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::apps::v1::ReplicaSet, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/replication_controllers.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::collections::BTreeMap;

use k8s_openapi::{api::core::v1::ReplicationController, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::core::v1::ReplicationController, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/roles.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use async_trait::async_trait;
use k8s_openapi::{
api::rbac::v1::{ClusterRole, ClusterRoleBinding, Role, RoleBinding},
chrono::Utc,
};

use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/secrets.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use std::collections::BTreeMap;

use k8s_openapi::{api::core::v1::Secret, chrono::Utc, ByteString};

use async_trait::async_trait;
use k8s_openapi::{api::core::v1::Secret, chrono::Utc, ByteString};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/serviceaccounts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::core::v1::ServiceAccount, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::core::v1::ServiceAccount, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/statefulsets.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::apps::v1::StatefulSet, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::apps::v1::StatefulSet, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/storageclass.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use k8s_openapi::{api::storage::v1::StorageClass, chrono::Utc};

use async_trait::async_trait;
use k8s_openapi::{api::storage::v1::StorageClass, chrono::Utc};
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
3 changes: 1 addition & 2 deletions src/app/svcs.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use async_trait::async_trait;
use k8s_openapi::{
api::core::v1::{Service, ServicePort},
chrono::Utc,
};

use async_trait::async_trait;
use tui::{
backend::Backend,
layout::{Constraint, Rect},
Expand Down
1 change: 0 additions & 1 deletion src/app/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use k8s_openapi::{
apimachinery::pkg::apis::meta::v1::Time,
chrono::{DateTime, Duration, Utc},
};

use kube::{Resource, ResourceExt};

pub fn sanitize_obj<K: Resource>(mut obj: K) -> K {
Expand Down
4 changes: 2 additions & 2 deletions src/banner.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub const BANNER: &str = r#" _ ______ _
pub const BANNER: &str = r" _ ______ _
| |/ / _ \ __ _ ___| |__
| ' /| | | |/ _` / __| '_ \
| . \| |_| | (_| \__ \ | | |
|_|\_\____/ \__,_|___/_| |_|
"#;
";
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use std::{
};

use anyhow::{anyhow, Result};

use app::App;
use banner::BANNER;
use clap::Parser;
Expand Down
17 changes: 9 additions & 8 deletions src/network/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ pub(crate) mod stream;
use core::convert::TryFrom;
use std::{fmt, sync::Arc};

use anyhow::{anyhow, Result};
use k8s_openapi::NamespaceResourceScope;
use kube::{
api::ListParams, config::Kubeconfig, discovery::verbs, Api, Client, Discovery,
Resource as ApiResource,
};
use serde::de::DeserializeOwned;
use tokio::sync::Mutex;

use crate::app::{
configmaps::ConfigMapResource,
contexts,
Expand Down Expand Up @@ -30,14 +39,6 @@ use crate::app::{
svcs::SvcResource,
ActiveBlock, App,
};
use anyhow::{anyhow, Result};
use k8s_openapi::NamespaceResourceScope;
use kube::{
api::ListParams, config::Kubeconfig, discovery::verbs, Api, Client, Discovery,
Resource as ApiResource,
};
use serde::de::DeserializeOwned;
use tokio::sync::Mutex;

#[derive(Debug, Eq, PartialEq)]
pub enum IoEvent {
Expand Down
3 changes: 1 addition & 2 deletions src/ui/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ use tui::{
Frame,
};

use crate::app::{models::StatefulTable, ActiveBlock, App};

use super::HIGHLIGHT;
use crate::app::{models::StatefulTable, ActiveBlock, App};
// Utils

pub static COPY_HINT: &str = "| copy <c>";
Expand Down

0 comments on commit 81308b9

Please sign in to comment.