diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 85567e4..d8d5db0 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -1,7 +1,7 @@ name: "Build Images" on: release: - types: [published] + types: [ published ] # FIXME: these variables don't seem to work at all workflow_call: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 6e25c7d..69dc566 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -37,42 +37,42 @@ jobs: # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - - name: Checkout repository - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v4 - - if: matrix.language == 'go' - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: '1.21.4' + - if: matrix.language == 'go' + name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.4' - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v2 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v2 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 - # ℹ️ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 1e613fc..2ee76e1 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -1,5 +1,5 @@ name: go-test -on: [push] +on: [ push ] jobs: build: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2176535..06a077c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -10,25 +10,21 @@ jobs: goreleaser: runs-on: ubuntu-latest steps: - - - name: Checkout + - name: Checkout uses: actions/checkout@v4 with: fetch-depth: 0 - - - name: Docker Login + - name: Docker Login uses: docker/login-action@v3.0.0 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Go + - name: Set up Go uses: actions/setup-go@v4 with: go-version: '1.21.4' cache: true - - - name: Run GoReleaser + - name: Run GoReleaser uses: goreleaser/goreleaser-action@v5 if: success() && startsWith(github.ref, 'refs/tags/') with: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index b49ac35..b61dc4f 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,8 +5,7 @@ before: - go mod tidy - make build-ui builds: - - - env: + - env: - CGO_ENABLED=0 goos: - linux @@ -29,8 +28,7 @@ release: prerelease: auto mode: append archives: - - - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" + - name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}" dockers: - image_templates: - "drewhammond/chefbrowser:{{ .Tag }}" diff --git a/README.md b/README.md index 78ddf90..aa891f8 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,8 @@ I think the frontend could use some love. Set `app_mode = development` in your config file to enable developer mode. This mode does the following: -- Go Templates are loaded from the file system instead of embedded into the backend. They can be changed without recompiling. +- Go Templates are loaded from the file system instead of embedded into the backend. They can be changed without + recompiling. - CSS/JS links in the HTML are updated to point to the local Vite dev server for live reloading. Install UI dependencies and start the frontend development server: @@ -72,7 +73,7 @@ Access the dev server at http://localhost:8080. CSS/JS changes will trigger automatic rebuilds as long as you have the frontend development server running. ->Note: Go changes will not be live reloaded. Rebuild backend for changes to take effect. +> Note: Go changes will not be live reloaded. Rebuild backend for changes to take effect. ## TODO diff --git a/ui/bootstrap.js b/ui/bootstrap.js index 80a7d0d..feab4cb 100644 --- a/ui/bootstrap.js +++ b/ui/bootstrap.js @@ -1,6 +1,6 @@ import hljs from 'highlight.js/lib/core'; import DOMPurify from 'dompurify'; -import { marked } from 'marked'; +import {marked} from 'marked'; import dayjs from "dayjs"; window.dayjs = dayjs diff --git a/ui/index.html b/ui/index.html index 6b5a296..597ed46 100644 --- a/ui/index.html +++ b/ui/index.html @@ -1,13 +1,13 @@ - - - - Vite App - - - -
- - + + + + Vite App + + + +
+ + diff --git a/ui/main.js b/ui/main.js index ada3b43..4632c01 100644 --- a/ui/main.js +++ b/ui/main.js @@ -19,6 +19,7 @@ import erb from 'highlight.js/lib/languages/erb'; import yaml from 'highlight.js/lib/languages/yaml'; import json from 'highlight.js/lib/languages/json'; import bash from 'highlight.js/lib/languages/bash'; + hljs.registerLanguage('bash', bash); hljs.registerLanguage('ruby', ruby); hljs.registerLanguage('erb', erb); diff --git a/ui/src/js/code-highlighter.js b/ui/src/js/code-highlighter.js index 4f84a58..0679897 100644 --- a/ui/src/js/code-highlighter.js +++ b/ui/src/js/code-highlighter.js @@ -1,5 +1,5 @@ export function codeHighlighter() { - window.addEventListener('DOMContentLoaded', (event) => { - console.log('DOM fully loaded and parsed'); - }); + window.addEventListener('DOMContentLoaded', (event) => { + console.log('DOM fully loaded and parsed'); + }); } diff --git a/ui/src/js/day.js b/ui/src/js/day.js index 6b4b543..734038a 100644 --- a/ui/src/js/day.js +++ b/ui/src/js/day.js @@ -1,4 +1,3 @@ - import dayjs from 'dayjs/esm/index' // const dayjs = require('dayjs') diff --git a/ui/src/js/scroll-to-top.js b/ui/src/js/scroll-to-top.js index d6c1fdb..2e1cf97 100644 --- a/ui/src/js/scroll-to-top.js +++ b/ui/src/js/scroll-to-top.js @@ -1,4 +1,3 @@ - let scrollToTopBtn = document.getElementById("btn-scroll-to-top"); let fourViewports = window.innerHeight * 4; diff --git a/ui/src/scss/bootstrap.scss b/ui/src/scss/bootstrap.scss index 19aeee7..04e5b4d 100644 --- a/ui/src/scss/bootstrap.scss +++ b/ui/src/scss/bootstrap.scss @@ -2,6 +2,7 @@ // Selective bootstrap SCSS @import "~bootstrap/scss/mixins/banner"; + @include bsBanner(""); // Configuration diff --git a/ui/src/scss/custom.scss b/ui/src/scss/custom.scss index 6a30a83..d2d19cb 100644 --- a/ui/src/scss/custom.scss +++ b/ui/src/scss/custom.scss @@ -50,54 +50,54 @@ pre code.hljs { } .dark-mode-toggle > .form-check-input { - border-radius: 2em; + border-radius: 2em; } .dark-mode-toggle > label, input { - cursor: pointer; + cursor: pointer; } .cb-cookbook-version-badge { - background-color: var(--bs-tertiary-bg); + background-color: var(--bs-tertiary-bg); } $color-mode-type: data; @include color-mode(light) { - .cb-navbar, .cb-footer { - background-color: var(--bs-light); - } - .cb-search-btn { - border-color: var(--bs-success); - color: var(--bs-success); - } - - @import 'highlight.js/scss/stackoverflow-light'; + .cb-navbar, .cb-footer { + background-color: var(--bs-light); + } + .cb-search-btn { + border-color: var(--bs-success); + color: var(--bs-success); + } + + @import 'highlight.js/scss/stackoverflow-light'; } @include color-mode(dark) { - .cb-navbar, .cb-footer { - background-color: var(--bs-secondary-bg); - } - - .nav-link:hover, .nav-link:focus { - color: var(--bs-emphasis-color) - } - - .cb-search-btn { - border-color: var(--bs-tertiary-color); - color: var(--bs-tertiary-color); - } - - #enable-dark-mode { - background-color: var(--bs-tertiary-bg); - border-color: var(--bs-secondary-color); - } - - @import 'highlight.js/scss/base16/default-dark'; - .hljs-ln td.hljs-ln-numbers { - color: var(--bs-tertiary-color); - border-right-color: var(--bs-tertiary-color); - } + .cb-navbar, .cb-footer { + background-color: var(--bs-secondary-bg); + } + + .nav-link:hover, .nav-link:focus { + color: var(--bs-emphasis-color) + } + + .cb-search-btn { + border-color: var(--bs-tertiary-color); + color: var(--bs-tertiary-color); + } + + #enable-dark-mode { + background-color: var(--bs-tertiary-bg); + border-color: var(--bs-secondary-color); + } + + @import 'highlight.js/scss/base16/default-dark'; + .hljs-ln td.hljs-ln-numbers { + color: var(--bs-tertiary-color); + border-right-color: var(--bs-tertiary-color); + } } #btn-scroll-to-top { diff --git a/ui/templates/cookbook.html b/ui/templates/cookbook.html index 485a751..505e120 100644 --- a/ui/templates/cookbook.html +++ b/ui/templates/cookbook.html @@ -1,14 +1,14 @@ -{{define "content"}} -
- {{ include "partials/cookbook/header" }} -
-
-
- {{include "partials/cookbook_readme"}} -
-
- {{include "partials/cookbook_metadata"}} -
-
-{{end}} -{{define "active_tab" }}overview{{end}} +{{ define "content"}} +
+ {{ include "partials/cookbook/header" }} +
+
+
+ {{ include "partials/cookbook_readme"}} +
+
+ {{ include "partials/cookbook_metadata"}} +
+
+{{ end }} +{{ define "active_tab" }}overview{{ end }} diff --git a/ui/templates/cookbook_file.html b/ui/templates/cookbook_file.html index 5a8d602..e874595 100644 --- a/ui/templates/cookbook_file.html +++ b/ui/templates/cookbook_file.html @@ -1,20 +1,20 @@ -{{define "content"}} -
- {{ include "partials/cookbook/header" }} -
-
-
-

{{.path}}

-
-
{{ .file }}
-
- -
-
-{{end}} -{{define "active_tab" }}files{{end}} +{{ define "content"}} +
+ {{ include "partials/cookbook/header" }} +
+
+
+

{{.path}}

+
+
{{ .file }}
+
+ +
+
+{{ end }} +{{ define "active_tab" }}files{{ end }} diff --git a/ui/templates/cookbook_file_list.html b/ui/templates/cookbook_file_list.html index d331198..2a19101 100644 --- a/ui/templates/cookbook_file_list.html +++ b/ui/templates/cookbook_file_list.html @@ -1,11 +1,11 @@ -{{define "content"}} -
- {{ include "partials/cookbook/header" }} -
-
-
- {{include "partials/cookbook_file_list"}} -
-
-{{end}} -{{define "active_tab" }}files{{end}} +{{ define "content"}} +
+ {{ include "partials/cookbook/header" }} +
+
+
+ {{ include "partials/cookbook_file_list"}} +
+
+{{ end }} +{{ define "active_tab" }}files{{ end }} diff --git a/ui/templates/cookbook_recipes.html b/ui/templates/cookbook_recipes.html index 94e6e39..68e5f41 100644 --- a/ui/templates/cookbook_recipes.html +++ b/ui/templates/cookbook_recipes.html @@ -1,22 +1,23 @@ -{{define "content"}} -
- {{ include "partials/cookbook/header" }} -
-
-
- {{ if .recipes }} -

Recipes

- - {{ else}} - This cookbook does not contain any recipes. - {{ end }} -
-
-{{end}} -{{define "active_tab" }}recipes{{end}} +{{ define "content"}} +
+ {{ include "partials/cookbook/header" }} +
+
+
+ {{ if .recipes }} +

Recipes

+ + {{ else }} + This cookbook does not contain any recipes. + {{ end }} +
+
+{{ end }} +{{ define "active_tab" }}recipes{{ end }} diff --git a/ui/templates/cookbooks.html b/ui/templates/cookbooks.html index aeb885b..cd76b8e 100644 --- a/ui/templates/cookbooks.html +++ b/ui/templates/cookbooks.html @@ -1,16 +1,17 @@ {{ define "active_nav"}} - cookbooks -{{end}} -{{define "content"}} -

Cookbooks ({{ len .cookbooks }})

- -{{end}} +cookbooks +{{ end }} +{{ define "content"}} +

Cookbooks ({{ len .cookbooks }})

+ +{{ end }} diff --git a/ui/templates/databag_item_content.html b/ui/templates/databag_item_content.html index 52b1dc4..cc61778 100644 --- a/ui/templates/databag_item_content.html +++ b/ui/templates/databag_item_content.html @@ -1,32 +1,33 @@ -{{define "content"}} -

{{.databag}}::{{.item}}

-
- - -
-
+{{ define "content"}} +

{{.databag}}::{{.item}}

+
+ + +
+
-{{end}} +{{ end }} diff --git a/ui/templates/databag_items.html b/ui/templates/databag_items.html index f437da1..3f9c5e9 100644 --- a/ui/templates/databag_items.html +++ b/ui/templates/databag_items.html @@ -1,8 +1,8 @@ -{{define "content"}} -

{{.databag}}

- -{{end}} +{{ define "content"}} +

{{.databag}}

+ +{{ end }} diff --git a/ui/templates/databags.html b/ui/templates/databags.html index 0223964..9e882b0 100644 --- a/ui/templates/databags.html +++ b/ui/templates/databags.html @@ -1,8 +1,8 @@ -{{define "content"}} -

Data Bags ({{ len .databags }})

- -{{end}} +{{ define "content"}} +

Data Bags ({{ len .databags }})

+ +{{ end }} diff --git a/ui/templates/environment.html b/ui/templates/environment.html index 417c026..9dbfdd9 100644 --- a/ui/templates/environment.html +++ b/ui/templates/environment.html @@ -1,78 +1,79 @@ -{{define "content"}} -
-
-
-

{{.environment.Name}}

-

{{.environment.Description}}

-
-
- View - Nodes -
-
-
- {{ if .environment.CookbookVersions }} -

Cookbook Versions

- - {{ end }} +{{ define "content"}} +
+
+
+

{{.environment.Name}}

+

{{.environment.Description}}

+
+
+ View + Nodes +
+
+
+{{ if .environment.CookbookVersions }} +

Cookbook Versions

+ +{{ end }} - {{ if or .environment.DefaultAttributes .environment.OverrideAttributes }} -

Attributes

- -
-
-
- - -
-
-
-
-
- - -
-
-
-
+{{ if or .environment.DefaultAttributes .environment.OverrideAttributes }} +

Attributes

+ +
+
+
+ + +
+
+
+
+
+ + +
+
+
+
- {{ end }} -{{end}} +{{ end }} +{{ end }} diff --git a/ui/templates/environments.html b/ui/templates/environments.html index a79df19..678900d 100644 --- a/ui/templates/environments.html +++ b/ui/templates/environments.html @@ -1,8 +1,8 @@ -{{define "content"}} -

Environments ({{ len .environments }})

- -{{end}} +{{ define "content"}} +

Environments ({{ len .environments }})

+ +{{ end }} diff --git a/ui/templates/errors/404.html b/ui/templates/errors/404.html index 3edc451..0c428e6 100644 --- a/ui/templates/errors/404.html +++ b/ui/templates/errors/404.html @@ -1,4 +1,4 @@ {{ define "content" }} -

404!

-

{{ .message }}

+

404!

+

{{ .message }}

{{ end }} diff --git a/ui/templates/errors/500.html b/ui/templates/errors/500.html index efaad14..973b0d0 100644 --- a/ui/templates/errors/500.html +++ b/ui/templates/errors/500.html @@ -1,3 +1,3 @@ {{ define "content" }} -

Internal server error!

+

Internal server error!

{{ end }} diff --git a/ui/templates/group.html b/ui/templates/group.html index 114f175..33c9886 100644 --- a/ui/templates/group.html +++ b/ui/templates/group.html @@ -1,3 +1,3 @@ -{{define "content"}} -

{{.}}

-{{end}} +{{ define "content"}} +

{{.}}

+{{ end }} diff --git a/ui/templates/groups.html b/ui/templates/groups.html index afa3048..c4549fd 100644 --- a/ui/templates/groups.html +++ b/ui/templates/groups.html @@ -1,14 +1,14 @@ -{{define "content"}} -

Groups

- {{range $name, $url := .groups}} - {{.}} +{{ define "content"}} +

Groups

+{{ range $name, $url := .groups}} +{{.}} - {{ $url }} +{{ $url }} - {{end}} - -{{end}} +{{ end }} + +{{ end }} diff --git a/ui/templates/layouts/footer.html b/ui/templates/layouts/footer.html index 2e2f1c3..9dd83be 100644 --- a/ui/templates/layouts/footer.html +++ b/ui/templates/layouts/footer.html @@ -1,21 +1,25 @@ diff --git a/ui/templates/layouts/master.html b/ui/templates/layouts/master.html index cca51a7..da5aee2 100644 --- a/ui/templates/layouts/master.html +++ b/ui/templates/layouts/master.html @@ -1,73 +1,73 @@ - - - - {{ block "title" . }}{{ .title }} · Chef Browser{{end}} - - {{include "layouts/head"}} - - + + {{ include "layouts/head"}} + + -{{include "layouts/nav"}} +{{ include "layouts/nav"}}
-
- {{template "content" .}} -
+
+ {{ template "content" .}} +
-{{include "layouts/footer"}} -{{ block "footer_scripts" .}}{{end}} +{{ include "layouts/footer"}} +{{ block "footer_scripts" .}}{{ end }} diff --git a/ui/templates/layouts/nav.html b/ui/templates/layouts/nav.html index 88fd480..af06c63 100644 --- a/ui/templates/layouts/nav.html +++ b/ui/templates/layouts/nav.html @@ -1,46 +1,47 @@
- +
diff --git a/ui/templates/node.html b/ui/templates/node.html index b026633..3d4d8f3 100644 --- a/ui/templates/node.html +++ b/ui/templates/node.html @@ -1,6 +1,6 @@ -{{define "content"}} - {{ include "partials/node/header" }} +{{ define "content"}} +{{ include "partials/node/header" }} -

Attributes

- {{ include "partials/node/attributes" }} -{{end}} +

Attributes

+{{ include "partials/node/attributes" }} +{{ end }} diff --git a/ui/templates/nodes.html b/ui/templates/nodes.html index d63e9f8..481ecab 100644 --- a/ui/templates/nodes.html +++ b/ui/templates/nodes.html @@ -1,8 +1,8 @@ -{{define "content"}} -

Nodes ({{ len .nodes }})

- -{{end}} +{{ define "content"}} +

Nodes ({{ len .nodes }})

+ +{{ end }} diff --git a/ui/templates/partials/cookbook/header.html b/ui/templates/partials/cookbook/header.html index 3691374..21eccf2 100644 --- a/ui/templates/partials/cookbook/header.html +++ b/ui/templates/partials/cookbook/header.html @@ -1,63 +1,67 @@
-
-

- {{.cookbook.Metadata.Name}} -

-
-
- -
+
+

+ + {{.cookbook.Metadata.Name}} +

+
+
+ +
-

{{ .cookbook.Metadata.Description }}

+

{{ .cookbook.Metadata.Description }}

- +
diff --git a/ui/templates/partials/cookbook_file_list.html b/ui/templates/partials/cookbook_file_list.html index be69025..0b41ef5 100644 --- a/ui/templates/partials/cookbook_file_list.html +++ b/ui/templates/partials/cookbook_file_list.html @@ -1,60 +1,67 @@

Cookbook

{{ if .cookbook.Attributes }}

Attributes

{{ end }} {{ if .cookbook.Recipes }}

Recipes

{{ end }} {{ if .cookbook.Libraries }}

Libraries

{{ end }} {{ if .cookbook.Templates }}

Templates

{{ end }} {{ if .cookbook.Files }}

Files

{{ end }} {{ if .cookbook.Resources }}

Resources

{{ end }} diff --git a/ui/templates/partials/cookbook_metadata.html b/ui/templates/partials/cookbook_metadata.html index c6133c2..6f43882 100644 --- a/ui/templates/partials/cookbook_metadata.html +++ b/ui/templates/partials/cookbook_metadata.html @@ -1,49 +1,49 @@
-
-
Name
-
{{.metadata.Name}}
-
Description
-
{{.metadata.Description}}
-
Maintainer
-
{{.metadata.Maintainer}} <{{.metadata.MaintainerEmail}}>
-
License
-
{{.metadata.License}}
- {{ if .metadata.SourceUrl }} -
Source URL
-
{{.metadata.SourceUrl}}
- {{ end }} - {{ if .metadata.IssueUrl }} -
Issue URL
-
{{.metadata.IssueUrl}}
- {{ end }} -
Dependencies
-
-
    - {{ range $cookbook, $version := .metadata.Depends}} -
  • {{$cookbook}} {{$version}}
  • - {{end}} -
-
- {{ if .metadata.ChefVersion }} -
Required Chef Infra Client Version
-
{{ .metadata.ChefVersion}}
- {{ end }} - {{ if .metadata.Platforms }} -
Supported Platforms
-
-
    - {{ range $platform, $version := .metadata.Platforms}} -
  • {{$platform}} {{$version}}
  • - {{end}} -
-
- {{ end }} - {{ if .metadata.Gems }} -
Gems
-
- {{.metadata.Gems}} -
- {{ end }} -
+
+
Name
+
{{.metadata.Name}}
+
Description
+
{{.metadata.Description}}
+
Maintainer
+
{{.metadata.Maintainer}} <{{.metadata.MaintainerEmail}}>
+
License
+
{{.metadata.License}}
+ {{ if .metadata.SourceUrl }} +
Source URL
+
{{.metadata.SourceUrl}}
+ {{ end }} + {{ if .metadata.IssueUrl }} +
Issue URL
+
{{.metadata.IssueUrl}}
+ {{ end }} +
Dependencies
+
+
    + {{ range $cookbook, $version := .metadata.Depends}} +
  • {{$cookbook}} {{$version}}
  • + {{ end }} +
+
+ {{ if .metadata.ChefVersion }} +
Required Chef Infra Client Version
+
{{ .metadata.ChefVersion}}
+ {{ end }} + {{ if .metadata.Platforms }} +
Supported Platforms
+
+
    + {{ range $platform, $version := .metadata.Platforms}} +
  • {{$platform}} {{$version}}
  • + {{ end }} +
+
+ {{ end }} + {{ if .metadata.Gems }} +
Gems
+
+ {{.metadata.Gems}} +
+ {{ end }} +
diff --git a/ui/templates/partials/cookbook_readme.html b/ui/templates/partials/cookbook_readme.html index efb40cd..cf8c2f9 100644 --- a/ui/templates/partials/cookbook_readme.html +++ b/ui/templates/partials/cookbook_readme.html @@ -1,7 +1,7 @@
diff --git a/ui/templates/partials/node/attributes.html b/ui/templates/partials/node/attributes.html index a7fc253..630e034 100644 --- a/ui/templates/partials/node/attributes.html +++ b/ui/templates/partials/node/attributes.html @@ -1,87 +1,87 @@
-
-
- - -
-
-
-
-
- - -
-
-
-
-
- - -
-
-
-
-
- - -
-
-
-
-
- - -
-
-
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
+
+
+ + +
+
+
diff --git a/ui/templates/partials/node/header.html b/ui/templates/partials/node/header.html index 06106c7..606ff72 100644 --- a/ui/templates/partials/node/header.html +++ b/ui/templates/partials/node/header.html @@ -1,61 +1,63 @@
-

{{ .node.Name }} - {{ if index .node.AutomaticAttributes "ipaddress" }} - ({{ index .node.AutomaticAttributes "ipaddress" }}) - {{ end }} -

-
- -
+

{{ .node.Name }} + {{ if index .node.AutomaticAttributes "ipaddress" }} + ({{ index .node.AutomaticAttributes "ipaddress" }}) + {{ end }} +

+
+ +

- -
- - {{ if index .node.AutomaticAttributes "lsb" }} - {{ if index .node.AutomaticAttributes "lsb" "description" }} -
OS: {{ index .node.AutomaticAttributes "lsb" "description" }}
- {{ end }}{{ end }} - {{ if index .node.AutomaticAttributes "chef_packages"}} - {{ if index .node.AutomaticAttributes "chef_packages" "chef" }} - {{ if index .node.AutomaticAttributes "chef_packages" "chef" "version" }} -
Chef version: {{ index .node.AutomaticAttributes "chef_packages" "chef" "version" }}
- {{ end }}{{ end }}{{ end }} - {{ if index .node.AutomaticAttributes "ohai_time" }} -
Last chef run:
- - {{ end }} -
+ +
+ + {{ if index .node.AutomaticAttributes "lsb" }} + {{ if index .node.AutomaticAttributes "lsb" "description" }} +
OS: {{ index .node.AutomaticAttributes "lsb" "description" }} +
+ {{ end }}{{ end }} + {{ if index .node.AutomaticAttributes "chef_packages"}} + {{ if index .node.AutomaticAttributes "chef_packages" "chef" }} + {{ if index .node.AutomaticAttributes "chef_packages" "chef" "version" }} +
Chef version: + {{ index .node.AutomaticAttributes "chef_packages" "chef" "version" }}
+ {{ end }}{{ end }}{{ end }} + {{ if index .node.AutomaticAttributes "ohai_time" }} +
Last chef run:
+ + {{ end }} +
diff --git a/ui/templates/policy-group.html b/ui/templates/policy-group.html index cdf9bc3..a902e43 100644 --- a/ui/templates/policy-group.html +++ b/ui/templates/policy-group.html @@ -1,21 +1,21 @@ -{{define "content"}} -

{{ .name }}

- - - - - - - - - {{range $name, $revision := .policies}} - - - - - {{end }} - -
PolicyRevision
{{ $name }} - {{ $revision.revision_id }} -
-{{end}} +{{ define "content"}} +

{{ .name }}

+ + + + + + + + + {{ range $name, $revision := .policies}} + + + + + {{ end }} + +
PolicyRevision
{{ $name }} + {{ $revision.revision_id }} +
+{{ end }} diff --git a/ui/templates/policy-groups.html b/ui/templates/policy-groups.html index e293b6a..043734f 100644 --- a/ui/templates/policy-groups.html +++ b/ui/templates/policy-groups.html @@ -1,4 +1,4 @@ -{{define "content"}} -

Policy Groups

- {{ . }} -{{end}} +{{ define "content"}} +

Policy Groups

+{{ . }} +{{ end }} diff --git a/ui/templates/policy-revision.html b/ui/templates/policy-revision.html index 801c9f3..5417a4e 100644 --- a/ui/templates/policy-revision.html +++ b/ui/templates/policy-revision.html @@ -1,62 +1,62 @@ -{{define "content"}} -

{{ .name }}

-

{{ .revision }}

-
- +{{ define "content"}} +

{{ .name }}

+

{{ .revision }}

+
+ -

Cookbook Locks

- +

Cookbook Locks

+ -

Attributes

- -
-
-
- - - {{ range $index, $value := .policy.DefaultAttributes }} - - - - - {{ end }} - -
{{$index}}{{$value}}
-
-
-
-
- - - {{ range $index, $value := .policy.OverrideAttributes }} - - - - - {{ end }} - -
{{$index}}{{$value}}
-
-
-
-{{end}} +

Attributes

+ +
+
+
+ + + {{ range $index, $value := .policy.DefaultAttributes }} + + + + + {{ end }} + +
{{$index}}{{$value}}
+
+
+
+
+ + + {{ range $index, $value := .policy.OverrideAttributes }} + + + + + {{ end }} + +
{{$index}}{{$value}}
+
+
+
+{{ end }} diff --git a/ui/templates/policy.html b/ui/templates/policy.html index e00110a..123ec35 100644 --- a/ui/templates/policy.html +++ b/ui/templates/policy.html @@ -1,10 +1,10 @@ -{{define "content"}} -

{{ .name }}

- -{{end}} +{{ define "content"}} +

{{ .name }}

+ +{{ end }} diff --git a/ui/templates/role.html b/ui/templates/role.html index 68cd2dd..f05da44 100644 --- a/ui/templates/role.html +++ b/ui/templates/role.html @@ -1,75 +1,76 @@ -{{define "content"}} -
-
-
-

{{.role.Name}}

-

{{.role.Description}}

-
-
- View Nodes -
-
-
+{{ define "content"}} +
+
+
+

{{.role.Name}}

+

{{.role.Description}}

+
+
+ View + Nodes +
+
+
-

Run-List

- +

Run-List

+ -

Attributes

- -
-
-
- - -
-
-
-
-
- - -
-
-
-
+

Attributes

+ +
+
+
+ + +
+
+
+
+
+ + +
+
+
+
- -{{end}} + let flattenedAttrs; + for (const [attrClass, attrObj] of Object.entries(attrs)) { + let attrTbody = document.getElementById(`${attrClass}-tbody`) + let l = [] + flattenedAttrs = flattenJSON(attrObj, {}, '$.') + for (const property in flattenedAttrs) { + l.push(`${property}${flattenedAttrs[property]}`) + } + attrTbody.innerHTML = l.join('') + } + +{{ end }} diff --git a/ui/templates/roles.html b/ui/templates/roles.html index 4fe27e0..345e948 100644 --- a/ui/templates/roles.html +++ b/ui/templates/roles.html @@ -1,8 +1,8 @@ -{{define "content"}} -

Roles ({{ len .roles }})

- -{{end}} +{{ define "content"}} +

Roles ({{ len .roles }})

+ +{{ end }} diff --git a/ui/vite.config.js b/ui/vite.config.js index f0d16b2..f377c79 100644 --- a/ui/vite.config.js +++ b/ui/vite.config.js @@ -1,19 +1,20 @@ const path = require('path') -import { defineConfig } from 'vite' +import {defineConfig} from 'vite' + export default defineConfig({ - // root: path.resolve(__dirname, 'src'), + // root: path.resolve(__dirname, 'src'), - // must be set to the UI root - base: "", - appType: "custom", - resolve: { - alias: { - '~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'), - '~bootswatch': path.resolve(__dirname, 'node_modules/bootswatch'), - } - }, - build: { - // generate manifest.json in outDir - manifest: true, - }, + // must be set to the UI root + base: "", + appType: "custom", + resolve: { + alias: { + '~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'), + '~bootswatch': path.resolve(__dirname, 'node_modules/bootswatch'), + } + }, + build: { + // generate manifest.json in outDir + manifest: true, + }, })