Skip to content

Commit

Permalink
fix: Remove unused project list filtering (#832)
Browse files Browse the repository at this point in the history
* fix: Project filtering is disabled

* remove filter flag

---------

Signed-off-by: jonaro00 <54029719+jonaro00@users.noreply.github.com>
  • Loading branch information
jonaro00 authored Apr 28, 2023
1 parent 18108fb commit c34b0f2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 50 deletions.
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
22 changes: 4 additions & 18 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,20 +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()) {
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

0 comments on commit c34b0f2

Please sign in to comment.