Skip to content

Commit

Permalink
Merge pull request #2953 from buildkite/move-static-graphql-nav
Browse files Browse the repository at this point in the history
Move static graphql navigation out of generation script
  • Loading branch information
dannymidnight authored Sep 6, 2024
2 parents 72ad2a7 + e91b17a commit af01af2
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 164 deletions.
2 changes: 1 addition & 1 deletion config/initializers/nav.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
.find { |item| item["name"] == "APIs" }["children"]
.find { |item| item["name"] == "GraphQL" }

graphql_nav_item["children"] = YAML.load_file(File.join(Rails.root, 'data', 'nav_graphql.yml'))
graphql_nav_item["children"].concat(YAML.load_file(File.join(Rails.root, 'data', 'nav_graphql.yml')))

config.default_nav = Nav.new(nav_data)
end
35 changes: 34 additions & 1 deletion data/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,40 @@
- name: "Suites"
path: "apis/rest-api/teams/suites"
- name: "GraphQL"
children: []
children:
- name: Overview
path: apis/graphql-api
- name: Console and CLI tutorial
path: apis/graphql/graphql-tutorial
- name: Cookbook
children:
- name: Overview
path: apis/graphql/graphql-cookbook
- name: Agents
path: apis/graphql/cookbooks/agents
- name: Artifacts
path: apis/graphql/cookbooks/artifacts
- name: Builds
path: apis/graphql/cookbooks/builds
- name: Clusters
path: apis/graphql/cookbooks/clusters
- name: Jobs
path: apis/graphql/cookbooks/jobs
- name: Packages
path: apis/graphql/cookbooks/packages
- name: Pipelines
path: apis/graphql/cookbooks/pipelines
- name: Pipeline templates
path: apis/graphql/cookbooks/pipeline-templates
- name: Rules
path: apis/graphql/cookbooks/rules
- name: Organizations
path: apis/graphql/cookbooks/organizations
- name: Teams
path: apis/graphql/cookbooks/teams
- name: Limits
path: apis/graphql/graphql-resource-limits

- name: "Webhooks"
children:
- name: "Overview"
Expand Down
32 changes: 0 additions & 32 deletions data/nav_graphql.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,5 @@
# This file is generated by scripts/generate_graphql_api_content.rb. DO NOT EDIT.
---
- name: Overview
path: apis/graphql-api
- name: Console and CLI tutorial
path: apis/graphql/graphql-tutorial
- name: Cookbook
children:
- name: Overview
path: apis/graphql/graphql-cookbook
- name: Agents
path: apis/graphql/cookbooks/agents
- name: Artifacts
path: apis/graphql/cookbooks/artifacts
- name: Builds
path: apis/graphql/cookbooks/builds
- name: Clusters
path: apis/graphql/cookbooks/clusters
- name: Jobs
path: apis/graphql/cookbooks/jobs
- name: Packages
path: apis/graphql/cookbooks/packages
- name: Pipelines
path: apis/graphql/cookbooks/pipelines
- name: Pipeline templates
path: apis/graphql/cookbooks/pipeline-templates
- name: Rules
path: apis/graphql/cookbooks/rules
- name: Organizations
path: apis/graphql/cookbooks/organizations
- name: Teams
path: apis/graphql/cookbooks/teams
- name: Limits
path: apis/graphql/graphql-resource-limits
- name: Queries
children:
- name: agent
Expand Down
65 changes: 0 additions & 65 deletions scripts/graphql_api_content/nav_data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,6 @@ def convert_to_nav_items(type_set, sub_dir = nil)

def generate_graphql_nav_data(type_sets)
[
{
"name" => "Overview",
"path" => "apis/graphql-api"
},
{
"name" => "Console and CLI tutorial",
"path" => "apis/graphql/graphql-tutorial"
},
{
"name" => "Cookbook",
"children" => [
{
"name" => "Overview",
"path" => "apis/graphql/graphql-cookbook"
},
{
"name" => "Agents",
"path" => "apis/graphql/cookbooks/agents"
},
{
"name" => "Artifacts",
"path" => "apis/graphql/cookbooks/artifacts"
},
{
"name" => "Builds",
"path" => "apis/graphql/cookbooks/builds"
},
{
"name" => "Clusters",
"path" => "apis/graphql/cookbooks/clusters"
},
{
"name" => "Jobs",
"path" => "apis/graphql/cookbooks/jobs"
},
{
"name" => "Packages",
"path" => "apis/graphql/cookbooks/packages"
},
{
"name" => "Pipelines",
"path" => "apis/graphql/cookbooks/pipelines"
},
{
"name" => "Pipeline templates",
"path" => "apis/graphql/cookbooks/pipeline-templates"
},
{
"name" => "Rules",
"path" => "apis/graphql/cookbooks/rules"
},
{
"name" => "Organizations",
"path" => "apis/graphql/cookbooks/organizations"
},
{
"name" => "Teams",
"path" => "apis/graphql/cookbooks/teams"
}
]
},
{
"name" => "Limits",
"path" => "apis/graphql/graphql-resource-limits"
},
{
"name" => "Queries",
"children" => convert_to_nav_items(type_sets["query_types"], "query")
Expand Down
65 changes: 0 additions & 65 deletions spec/scripts/graphql_api_content/nav_data_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -294,71 +294,6 @@
it "generates nav data correctly" do
expect(generate_graphql_nav_data(type_sets)).to eq(
[
{
"name" => "Overview",
"path" => "apis/graphql-api"
},
{
"name" => "Console and CLI tutorial",
"path" => "apis/graphql/graphql-tutorial"
},
{
"name" => "Cookbook",
"children" => [
{
"name" => "Overview",
"path" => "apis/graphql/graphql-cookbook"
},
{
"name" => "Agents",
"path" => "apis/graphql/cookbooks/agents"
},
{
"name" => "Artifacts",
"path" => "apis/graphql/cookbooks/artifacts"
},
{
"name" => "Builds",
"path" => "apis/graphql/cookbooks/builds"
},
{
"name" => "Clusters",
"path" => "apis/graphql/cookbooks/clusters"
},
{
"name" => "Jobs",
"path" => "apis/graphql/cookbooks/jobs"
},
{
"name" => "Packages",
"path" => "apis/graphql/cookbooks/packages"
},
{
"name" => "Pipelines",
"path" => "apis/graphql/cookbooks/pipelines"
},
{
"name" => "Pipeline templates",
"path" => "apis/graphql/cookbooks/pipeline-templates"
},
{
"name" => "Rules",
"path" => "apis/graphql/cookbooks/rules"
},
{
"name" => "Organizations",
"path" => "apis/graphql/cookbooks/organizations"
},
{
"name" => "Teams",
"path" => "apis/graphql/cookbooks/teams"
}
]
},
{
"name" => "Limits",
"path" => "apis/graphql/graphql-resource-limits"
},
{
"name" => "Queries",
"children" => [
Expand Down

0 comments on commit af01af2

Please sign in to comment.