-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into event-hooks
- Loading branch information
Showing
621 changed files
with
7,967 additions
and
933 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "app/.repos/kong-plugins"] | ||
path = app/.repos/kong-plugins | ||
url = https://github.com/Kong/docs-plugin-toolkit.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule kong-plugins
added at
0000e4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
import { createApp } from "vue"; | ||
import APISpec from "~/javascripts/apps/APISpec.vue"; | ||
import { BindOncePlugin } from "vue-bind-once"; | ||
import "@kong/spec-renderer-dev/dist/style.css"; | ||
|
||
if (document.getElementById("api-spec") !== null) { | ||
const app = createApp(APISpec); | ||
app.use(BindOncePlugin); | ||
app.mount("#api-spec"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
class Hub { | ||
constructor() { | ||
this.filters = document.getElementById("filters"); | ||
this.plugins = document.querySelectorAll("[data-card='plugin']"); | ||
|
||
this.deploymentTopologies = this.filters.querySelectorAll( | ||
'input[name="deployment-topology"]' | ||
); | ||
this.categories = this.filters.querySelectorAll('input[name="category"]'); | ||
|
||
this.deploymentValues = []; | ||
this.categoryValues = []; | ||
|
||
this.addEventListeners(); | ||
} | ||
|
||
addEventListeners() { | ||
const checkboxes = [...this.deploymentTopologies, ...this.categories]; | ||
checkboxes.forEach((checkbox) => { | ||
checkbox.addEventListener("change", () => this.onChange()); | ||
}); | ||
} | ||
|
||
onChange() { | ||
this.deploymentValues = this.getValues(this.deploymentTopologies); | ||
this.categoryValues = this.getValues(this.categories); | ||
|
||
this.filterPlugins(); | ||
} | ||
|
||
getValues(filterGroup) { | ||
return Array.from(filterGroup) | ||
.filter((checkbox) => checkbox.checked) | ||
.map((checkbox) => checkbox.value); | ||
} | ||
|
||
filterPlugins() { | ||
this.plugins.forEach((plugin) => { | ||
const matchesDeploymentTopology = this.filterBy( | ||
plugin, | ||
this.deploymentTopologies, | ||
"deploymentTopology" | ||
); | ||
const matchesCategory = this.filterBy( | ||
plugin, | ||
this.categories, | ||
"category" | ||
); | ||
|
||
const showPlugin = matchesDeploymentTopology && matchesCategory; | ||
|
||
plugin.classList.toggle("hidden", !showPlugin); | ||
}); | ||
|
||
this.toggleCategoriesIfEmpty(); | ||
} | ||
|
||
toggleCategoriesIfEmpty() { | ||
this.categories.forEach((cat) => { | ||
const category = document.getElementById(cat.value); | ||
const showCategory = category.querySelectorAll( | ||
'[data-card="plugin"]:not(.hidden)' | ||
).length; | ||
|
||
category.classList.toggle("hidden", !showCategory); | ||
}); | ||
} | ||
|
||
filterBy(plugin, filterGroup, dataAttribute) { | ||
const checkedValues = Array.from(filterGroup) | ||
.filter((checkbox) => checkbox.checked) | ||
.map((checkbox) => checkbox.value); | ||
|
||
const dataValues = plugin.dataset[dataAttribute]?.split(",") || []; | ||
return ( | ||
checkedValues.length === 0 || | ||
checkedValues.some((value) => dataValues.includes(value)) | ||
); | ||
} | ||
} | ||
|
||
// Initialize the Hub once the DOM is fully loaded | ||
document.addEventListener("DOMContentLoaded", () => new Hub()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { createApp } from "vue"; | ||
import PluginSchema from "~/javascripts/apps/PluginSchema.vue"; | ||
import "@kong/spec-renderer-dev/dist/style.css"; | ||
|
||
if (document.getElementById("schema") !== null) { | ||
const app = createApp(PluginSchema); | ||
app.mount("#schema"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<template> | ||
<div> | ||
<SchemaRenderer | ||
v-if="schema" | ||
:schema="schema" | ||
:exampleVisible="false" | ||
:headerVisible="false" | ||
/> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { SchemaRenderer } from '@kong/spec-renderer-dev' | ||
const schema = window.schema; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.