Skip to content

Commit

Permalink
lint fix and removed commented out code
Browse files Browse the repository at this point in the history
  • Loading branch information
Skarlso committed Dec 24, 2024
1 parent 1579441 commit fa6cb55
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 57 deletions.
33 changes: 1 addition & 32 deletions pkg/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,6 @@ func (p *Parser) ParseProperties(version string, file io.Writer, properties map[
p.indent += 2
p.inArray = true

// we need to not output a `\n` if there are no more properties to parse.
//if p.onlyRequired && !slices.Contains(requiredFields, k) {
// p.indent -= 2
// w.write(file, " {}\n")
// p.inArray = false // no longer in an array...
//
// continue
//}
//if p.onlyRequired && p.emptyAfterTrimRequired(properties[k].Items.Schema.Properties, properties[k].Items.Schema.Required) {
// p.indent -= 2
// w.write(file, " {}\n")
// p.inArray = false // no longer in an array...
//
// continue
//}

if err := p.ParseProperties(version, file, properties[k].Items.Schema.Properties, properties[k].Items.Schema.Required); err != nil {
return err
}
Expand Down Expand Up @@ -185,22 +169,7 @@ func (p *Parser) ParseProperties(version string, file io.Writer, properties map[
w.write(file, " {}\n")
} else {
p.indent += 2
//if p.onlyRequired && p.emptyAfterTrimRequired(
// properties[k].AdditionalProperties.Schema.Properties,
// properties[k].AdditionalProperties.Schema.Required) {
// p.indent -= 2
// w.write(file, " {}\n")
//
// continue
//}
//if p.onlyRequired && !slices.Contains(requiredFields, k) {
// p.indent -= 2
// w.write(file, " {}\n")
//
// continue
//}

//w.write(file, "\n")

// This will eventually end up in case len(properties[k].Properties) > 0: hence, we don't need
// an empty check in here. That would be redundant.
if err := p.ParseProperties(
Expand Down
12 changes: 6 additions & 6 deletions wasm/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ func (v *detailsView) Render() app.UI {
// `Pre` isn't allowed to have anything other than CODE inside.
return app.Div().Body(
app.Div().Class("form-check").Body(
app.Label().Class("form-check-label").For(fmt.Sprintf("enable-comments-%s", v.version.Version)).Body(app.Text("Enable comments on YAML output")),
app.Input().Class("form-check-input").Type("checkbox").ID(fmt.Sprintf("enable-comments-%s", v.version.Version)).OnClick(v.OnCheckComment),
app.Label().Class("form-check-label").For("enable-comments-"+v.version.Version).Body(app.Text("Enable comments on YAML output")),
app.Input().Class("form-check-input").Type("checkbox").ID("enable-comments-"+v.version.Version).OnClick(v.OnCheckComment),
),
app.Div().Class("form-check").Body(
app.Label().Class("form-check-label").For(fmt.Sprintf("enable-minimal-%s", v.version.Version)).Body(app.Text("Enable minimal required YAML output")),
app.Input().Class("form-check-input").Type("checkbox").ID(fmt.Sprintf("enable-minimal-%s", v.version.Version)).OnClick(v.OnCheckMinimal),
app.Label().Class("form-check-label").For("enable-minimal-"+v.version.Version).Body(app.Text("Enable minimal required YAML output")),
app.Input().Class("form-check-input").Type("checkbox").ID("enable-minimal-"+v.version.Version).OnClick(v.OnCheckMinimal),
),
app.Pre().Body(
app.Div().ID("yaml-sample-"+v.version.Version).Body(app.If(v.renderErr != nil, func() app.UI {
Expand All @@ -77,7 +77,7 @@ func (v *detailsView) Render() app.UI {
)
}

func (v *detailsView) OnCheckComment(ctx app.Context, _ app.Event) {
func (v *detailsView) OnCheckComment(_ app.Context, _ app.Event) {
v.comment = !v.comment
content, err := v.version.generateYAMLDetails(v.comment, v.minimal)
if err != nil {
Expand All @@ -90,7 +90,7 @@ func (v *detailsView) OnCheckComment(ctx app.Context, _ app.Event) {
v.content = content
}

func (v *detailsView) OnCheckMinimal(ctx app.Context, _ app.Event) {
func (v *detailsView) OnCheckMinimal(_ app.Context, _ app.Event) {
v.minimal = !v.minimal
content, err := v.version.generateYAMLDetails(v.comment, v.minimal)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions wasm/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ func (i *index) Render() app.UI {
// Prevent double rendering components.
if i.isMounted {
return app.Main().Body(
//app.Script().Src("https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"),
//app.Script().Src("https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"),
// app.Script().Src("https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/components/prism-core.min.js"),
// app.Script().Src("https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/plugins/autoloader/prism-autoloader.min.js"),
app.Div().Class("container").Body(func() app.UI {
if i.err != nil {
return app.Div().Class("container").Body(&header{titleOnClick: i.NavBackOnClick, hidden: true}, i.buildError())
Expand Down
10 changes: 5 additions & 5 deletions wasm/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@
<meta charset="UTF-8">
<meta name="author" content="Gergely Brautigam">
<meta name="description" content>
<meta name="theme-color" content="#2d2c2c">
<meta content="#2d2c2c" name="theme-color">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta property="og:url" content="https://">
<meta property="og:title" content="Preview CRDs">
<meta property="og:description" content>
<meta content property="og:description">
<meta property="og:type" content="website">
<meta property="og:image" content="https://">
<title>Preview CRDs</title>
<link rel="icon" href="https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.svg">
<link rel="apple-touch-icon" href="/web/img/logo.png">
<link href="/web/img/logo.png" rel="apple-touch-icon">
<link rel="manifest" href="/manifest.webmanifest">
<link href="/app.css" type="text/css" rel="stylesheet">
<link href="/web/css/alert.css" type="text/css" rel="stylesheet">
Expand Down Expand Up @@ -56,8 +56,8 @@
</head>
<body>
<main></main>
<aside class="goapp-app-info" id="app-wasm-loader">
<img id="app-wasm-loader-icon" class="goapp-logo goapp-spin" alt="wasm loader icon" src="/web/img/logo.png">
<aside id="app-wasm-loader" class="goapp-app-info">
<img class="goapp-logo goapp-spin" alt="wasm loader icon" src="/web/img/logo.png" id="app-wasm-loader-icon">
<p id="app-wasm-loader-label" class="goapp-label">0%</p>
</aside>
</body>
Expand Down
2 changes: 1 addition & 1 deletion wasm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func main() {
},
Styles: []string{
"web/css/alert.css",
//"https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-twilight.min.css",
// "https://cdnjs.cloudflare.com/ajax/libs/prism/1.29.0/themes/prism-twilight.min.css",
"https://cdn.jsdelivr.net/npm/[email protected]/css/halfmoon.min.css",
"https://cdn.jsdelivr.net/npm/[email protected]/css/cores/halfmoon.modern.css",
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css",
Expand Down
22 changes: 11 additions & 11 deletions wasm/share.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<!doctype html>
<html data-bs-core="modern" data-bs-theme="dark" lang="en">
<html lang="en" data-bs-core="modern" data-bs-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="author" content="Gergely Brautigam">
<meta name="description" content>
<meta name="theme-color" content="#2d2c2c">
<meta content="#2d2c2c" name="theme-color">
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta property="og:url" content="https:///share">
<meta property="og:title" content="Preview CRDs">
<meta property="og:description" content>
<meta content="website" property="og:type">
<meta property="og:image" content="https://">
<meta content property="og:description">
<meta property="og:type" content="website">
<meta content="https://" property="og:image">
<title>Preview CRDs</title>
<link rel="icon" href="https://raw.githubusercontent.com/maxence-charriere/go-app/master/docs/web/icon.svg">
<link href="/web/img/logo.png" rel="apple-touch-icon">
<link rel="apple-touch-icon" href="/web/img/logo.png">
<link rel="manifest" href="/manifest.webmanifest">
<link href="/app.css" type="text/css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="/web/css/alert.css">
<link href="/web/css/alert.css" type="text/css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/halfmoon.min.css" type="text/css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/css/cores/halfmoon.modern.css" type="text/css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/css/cores/halfmoon.modern.css" type="text/css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" type="text/css" rel="stylesheet">
<script src="/wasm_exec.js" defer></script>
<script defer src="/wasm_exec.js"></script>
<script defer src="/app.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.11/clipboard.min.js"></script>
Expand Down Expand Up @@ -55,13 +55,13 @@
</style>
</head>
<body>
<div class="alert alert-danger" role="alert">
<div role="alert" class="alert alert-danger">
<span class="closebtn">×</span>
<h4 class="alert-heading">Oops!</h4>
url parameter has to be define in the following format: /share?url=https://example.com/crd.yaml
</div>
<aside id="app-wasm-loader" class="goapp-app-info">
<img id="app-wasm-loader-icon" class="goapp-logo goapp-spin" alt="wasm loader icon" src="/web/img/logo.png">
<img class="goapp-logo goapp-spin" alt="wasm loader icon" src="/web/img/logo.png" id="app-wasm-loader-icon">
<p id="app-wasm-loader-label" class="goapp-label">0%</p>
</aside>
</body>
Expand Down
Binary file modified wasm/web/app.wasm
Binary file not shown.

0 comments on commit fa6cb55

Please sign in to comment.