Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Remove unused project list filtering #832

Merged
merged 2 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
remove filter flag
  • Loading branch information
jonaro00 committed Apr 28, 2023
commit ec7c2808f56c16eb9189932a737d32767c3ae315
6 changes: 1 addition & 5 deletions cargo-shuttle/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,7 @@ pub enum ProjectCommand {
idle_minutes: u64,
},
/// List all projects belonging to the calling account
List {
#[arg(long)]
/// Return projects filtered by a given project status
filter: Option<String>,
},
List,
}

#[derive(Parser, Clone, Debug)]
Expand Down
9 changes: 0 additions & 9 deletions cargo-shuttle/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,6 @@ impl Client {
self.get(path).await
}

// pub async fn get_projects_list_filtered(
// &self,
// filter: String,
// ) -> Result<Vec<project::Response>> {
// let path = format!("/projects/{filter}");

// self.get(path).await
// }

pub async fn delete_project(&self, project: &ProjectName) -> Result<project::Response> {
let path = format!("/projects/{}", project.as_str());

Expand Down
24 changes: 4 additions & 20 deletions cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod provisioner_server;
use indicatif::ProgressBar;
use shuttle_common::claims::{ClaimService, InjectPropagation};
use shuttle_common::models::deployment::get_deployments_table;
use shuttle_common::models::project::{State, IDLE_MINUTES};
use shuttle_common::models::project::IDLE_MINUTES;
use shuttle_common::models::resource::get_resources_table;
use shuttle_common::project::ProjectName;
use shuttle_common::resource;
Expand Down Expand Up @@ -127,9 +127,7 @@ impl Shuttle {
Command::Project(ProjectCommand::Status { follow }) => {
self.project_status(&self.client()?, follow).await
}
Command::Project(ProjectCommand::List { filter }) => {
self.projects_list(&self.client()?, filter).await
}
Command::Project(ProjectCommand::List) => self.projects_list(&self.client()?).await,
Command::Project(ProjectCommand::Stop) => self.project_delete(&self.client()?).await,
}
.map(|_| CommandOutcome::Ok)
Expand Down Expand Up @@ -986,22 +984,8 @@ impl Shuttle {
Ok(())
}

async fn projects_list(&self, client: &Client, filter: Option<String>) -> Result<()> {
let projects = match filter {
Some(filter) => {
if let Ok(_filter) = State::from_str(filter.trim()) {
// TODO: gateway/api -> get_projects_list_with_filter
bail!("Project status filtering is currently disabled.");
// client
// .get_projects_list_filtered(filter.to_string())
// .await?
} else {
bail!("That's not a valid project status!");
}
}
None => client.get_projects_list().await?,
};

async fn projects_list(&self, client: &Client) -> Result<()> {
let projects = client.get_projects_list().await?;
let projects_table = project::get_table(&projects);

println!("{projects_table}");
Expand Down
18 changes: 0 additions & 18 deletions gateway/src/api/latest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,6 @@ async fn get_projects_list(
Ok(AxumJson(projects))
}

// async fn get_projects_list_with_filter(
// State(RouterState { service, .. }): State<RouterState>,
// User { name, .. }: User,
// Path(project_status): Path<String>,
// ) -> Result<AxumJson<Vec<project::Response>>, Error> {
// let projects = service
// .iter_user_projects_detailed_filtered(name.clone(), project_status)
// .await?
// .into_iter()
// .map(|project| project::Response {
// name: project.0.to_string(),
// state: project.1.into(),
// })
// .collect();

// Ok(AxumJson(projects))
// }

#[instrument(skip_all, fields(%project))]
#[utoipa::path(
post,
Expand Down