opsmill / infrahub

Infrahub - A new approach to Infrastructure Management
https://opsmill.com/
GNU Affero General Public License v3.0
185 stars 8 forks source link

task: improve pretty printer for graphql editor #2786

Open james-m-henderson opened 5 months ago

james-m-henderson commented 5 months ago

Component

Frontend UI

Task Description

On the graphql editor, if asked to pretty print, it puts all of the arguments into one line, even if that line overflows.

This can make the graphql more difficult to read rather than easier.

This was noticed first with the InfraInterfaceL3Create mutation:

mutation {
  InfraInterfaceL3Create(
    data: {
      name: { value: "Ethernet9" }
      enabled: { value: true }
      description: { value: "new interface in branch" }
      device: { id: "ord1-edge1" }
      status: { id: "active" }
      speed: { value: 10000 }
      role: { id: "spare" }
    }
  ) {
    ok
    object {
      id
      name {
        value
      }
      description {
        value
      }
    }
  }
}

Before pretty print:

Screenshot 2024-03-28 at 10 20 00 AM

After pretty print:

Screenshot 2024-03-28 at 10 20 09 AM
bilalabbad commented 5 months ago

Hi ! Thanks for opening this issue :)

We're using GraphiQL as our GraphQL editor, and unfortunately, it doesn't currently allow us to customize the prettify function.

I agree that the current prettification is not the best. Maybe we can try to open an issue on their repository ?