diff --git a/assets/js/components/Config/Markdown.vue b/assets/js/components/Config/Markdown.vue
new file mode 100644
index 000000000..33cdfe202
--- /dev/null
+++ b/assets/js/components/Config/Markdown.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
diff --git a/assets/js/components/Config/MeterModal.vue b/assets/js/components/Config/MeterModal.vue
index cd50ddaad..74257bd2e 100644
--- a/assets/js/components/Config/MeterModal.vue
+++ b/assets/js/components/Config/MeterModal.vue
@@ -65,6 +65,7 @@
Loading ...
+
-
+ Loading ...
+
p.Advanced);
},
+ description() {
+ return this.template?.Requirements?.Description;
+ },
apiData() {
const data = {
template: this.templateName,
@@ -402,6 +409,7 @@ export default {
},
async loadTemplate() {
this.template = null;
+ this.loadingTemplate = true;
try {
const opts = {
params: {
@@ -414,6 +422,7 @@ export default {
} catch (e) {
console.error(e);
}
+ this.loadingTemplate = false;
},
applyDefaultsFromTemplate() {
const params = this.template?.Params || [];
@@ -496,3 +505,4 @@ export default {
padding-right: 0;
}
+import type MarkdownVue from "./Markdown.vue";
diff --git a/package-lock.json b/package-lock.json
index 701e9c1cf..8e8bbb6bd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -40,6 +40,7 @@
"prettier-plugin-toml": "^2.0.1",
"rollup-plugin-visualizer": "^5.8.3",
"smoothscroll-polyfill": "^0.4.4",
+ "snarkdown": "^2.0.0",
"typescript": "^5.2.2",
"vite": "^5.1.1",
"vite-plugin-toml": "^0.7.0",
@@ -8795,6 +8796,12 @@
"tslib": "^2.0.3"
}
},
+ "node_modules/snarkdown": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/snarkdown/-/snarkdown-2.0.0.tgz",
+ "integrity": "sha512-MgL/7k/AZdXCTJiNgrO7chgDqaB9FGM/1Tvlcenenb7div6obaDATzs16JhFyHHBGodHT3B7RzRc5qk8pFhg3A==",
+ "license": "MIT"
+ },
"node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
diff --git a/package.json b/package.json
index ec60fb586..b04865dda 100644
--- a/package.json
+++ b/package.json
@@ -47,6 +47,7 @@
"prettier-plugin-toml": "^2.0.1",
"rollup-plugin-visualizer": "^5.8.3",
"smoothscroll-polyfill": "^0.4.4",
+ "snarkdown": "^2.0.0",
"typescript": "^5.2.2",
"vite": "^5.1.1",
"vite-plugin-toml": "^0.7.0",
diff --git a/util/templates/types.go b/util/templates/types.go
index c95838f58..b6e597b4b 100644
--- a/util/templates/types.go
+++ b/util/templates/types.go
@@ -131,6 +131,19 @@ func (t *TextLanguage) MarshalJSON() (out []byte, err error) {
return json.Marshal(s)
}
+func (r Requirements) MarshalJSON() ([]byte, error) {
+ mu.Lock()
+ custom := struct {
+ EVCC []string `json:",omitempty"`
+ Description string `json:",omitempty"`
+ }{
+ EVCC: r.EVCC,
+ Description: r.Description.String(encoderLanguage),
+ }
+ mu.Unlock()
+ return json.Marshal(custom)
+}
+
// Requirements
type Requirements struct {
EVCC []string // EVCC requirements, e.g. sponsorship
@@ -247,7 +260,7 @@ type TemplateDefinition struct {
Covers []string `json:",omitempty"` // list of covered outdated template names
Products []Product `json:",omitempty"` // list of products this template is compatible with
Capabilities []string `json:",omitempty"`
- Requirements Requirements `json:"-"`
+ Requirements Requirements `json:",omitempty"`
Linked []LinkedTemplate `json:",omitempty"` // a list of templates that should be processed as part of the guided setup
Params []Param `json:",omitempty"`
Render string `json:"-"` // rendering template