Skip to content

Commit

Permalink
server: improve warning message for graphman graphql api and clean up…
Browse files Browse the repository at this point in the history
… code
  • Loading branch information
shiyasmohd committed Dec 26, 2024
1 parent dd1e299 commit 8bdc003
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions server/graphman/src/entities/warning_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ pub struct CompletedWithWarnings {
}

impl CompletedWithWarnings {
/// Returns a response with success & message.
pub fn new(msg: Vec<String>) -> Self {
Self { warnings: msg }
pub fn new(warnings: Vec<String>) -> Self {
Self { warnings }
}
}
2 changes: 1 addition & 1 deletion server/graphman/src/resolvers/deployment_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl DeploymentMutation {
let mirror = catalog::Mirror::primary_only(ctx.primary_pool);
let count = mirror.assignments(&node)?.len();
if count == 1 {
let warning_msg = format!("warning: this is the only deployment assigned to '{}'. Are you sure it is spelled correctly?",node.as_str());
let warning_msg = format!("This is the only deployment assigned to '{}'. Please make sure that the node ID is spelled correctly.",node.as_str());
Ok(ReassignResponse::CompletedWithWarnings(
CompletedWithWarnings::new(vec![warning_msg]),
))
Expand Down
2 changes: 1 addition & 1 deletion server/graphman/tests/deployment_mutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ fn graphql_can_unassign_deployments() {

let subgraph_node_id = send_graphql_request(
json!({
"query": r#"query Deployment {
"query": r#"{
deployment {
info(deployment: { hash: "subgraph_1" }) {
nodeId
Expand Down

0 comments on commit 8bdc003

Please sign in to comment.