feat: Show diagnostics in yaml instead of json (#1550)

* feat: Show diagnostics in YAML instead of JSON

* Adding missing semicolon
This commit is contained in:
Dermot Duffy
2024-09-21 12:54:38 -07:00
committed by GitHub
parent b46ea36265
commit 5481c5956c
6 changed files with 22 additions and 7 deletions
+1 -1
View File
@@ -39,7 +39,7 @@ Explain what the issue is, and how things should look/behave. If possible provid
On the card, hold down the Frigate menu button for a few seconds then paste the diagnostics below: On the card, hold down the Frigate menu button for a few seconds then paste the diagnostics below:
--> -->
```json ```yaml
``` ```
+2
View File
@@ -30,6 +30,7 @@
"embla-carousel": "^8.1.4", "embla-carousel": "^8.1.4",
"embla-carousel-wheel-gestures": "^8.0.1", "embla-carousel-wheel-gestures": "^8.0.1",
"home-assistant-js-websocket": "^9.4.0", "home-assistant-js-websocket": "^9.4.0",
"js-yaml": "^4.1.0",
"keycharm": "^0.4.0", "keycharm": "^0.4.0",
"lit": "^3.1.4", "lit": "^3.1.4",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
@@ -61,6 +62,7 @@
"@rollup/plugin-terser": "^0.4.4", "@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.6", "@rollup/plugin-typescript": "^11.1.6",
"@semantic-release/github": "^10.3.3", "@semantic-release/github": "^10.3.3",
"@types/js-yaml": "^4",
"@types/lodash-es": "^4.17.12", "@types/lodash-es": "^4.17.12",
"@types/masonry-layout": "^4.2.8", "@types/masonry-layout": "^4.2.8",
"@typescript-eslint/eslint-plugin": "^7.13.0", "@typescript-eslint/eslint-plugin": "^7.13.0",
+6 -2
View File
@@ -22,11 +22,15 @@ export class FrigateCardDiagnostics extends LitElement {
this._diagnostics = await getDiagnostics(this.hass, this.rawConfig); this._diagnostics = await getDiagnostics(this.hass, this.rawConfig);
} }
protected render(): TemplateResult | void { protected shouldUpdate(): boolean {
if (!this._diagnostics) { if (!this._diagnostics) {
this._fetchDiagnostics().then(() => this.requestUpdate()); this._fetchDiagnostics().then(() => this.requestUpdate());
return; return false;
} }
return true;
}
protected render(): TemplateResult | void {
return renderMessage({ return renderMessage({
message: localize('error.diagnostics'), message: localize('error.diagnostics'),
type: 'diagnostics', type: 'diagnostics',
+3 -2
View File
@@ -1,3 +1,4 @@
import yaml from 'js-yaml';
import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit'; import { CSSResultGroup, html, LitElement, TemplateResult, unsafeCSS } from 'lit';
import { customElement, property } from 'lit/decorators.js'; import { customElement, property } from 'lit/decorators.js';
import { ClassInfo, classMap } from 'lit/directives/class-map.js'; import { ClassInfo, classMap } from 'lit/directives/class-map.js';
@@ -42,8 +43,8 @@ export class FrigateCardMessage extends LitElement {
: ''}` : ''}`
: ''} : ''}
</span> </span>
${this.context && typeof this.context !== 'string' ${this.context && typeof this.context === 'object'
? html`<pre>${JSON.stringify(this.context, null, 2)}</pre>` ? html`<pre>${yaml.dump(this.context)}</pre>`
: ''} : ''}
</div> </div>
</div> </div>
+1 -2
View File
@@ -57,6 +57,5 @@ div.message div.icon {
.message pre { .message pre {
margin-top: 20px; margin-top: 20px;
white-space: pre-wrap; overflow-x: scroll;
word-break: break-all;
} }
+9
View File
@@ -2088,6 +2088,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@types/js-yaml@npm:^4":
version: 4.0.9
resolution: "@types/js-yaml@npm:4.0.9"
checksum: 10c0/24de857aa8d61526bbfbbaa383aa538283ad17363fcd5bb5148e2c7f604547db36646440e739d78241ed008702a8920665d1add5618687b6743858fae00da211
languageName: node
linkType: hard
"@types/json5@npm:^0.0.29": "@types/json5@npm:^0.0.29":
version: 0.0.29 version: 0.0.29
resolution: "@types/json5@npm:0.0.29" resolution: "@types/json5@npm:0.0.29"
@@ -5131,6 +5138,7 @@ __metadata:
"@rollup/plugin-typescript": "npm:^11.1.6" "@rollup/plugin-typescript": "npm:^11.1.6"
"@semantic-release/github": "npm:^10.3.3" "@semantic-release/github": "npm:^10.3.3"
"@types/bluebird": "npm:^3.5.42" "@types/bluebird": "npm:^3.5.42"
"@types/js-yaml": "npm:^4"
"@types/lodash-es": "npm:^4.17.12" "@types/lodash-es": "npm:^4.17.12"
"@types/masonry-layout": "npm:^4.2.8" "@types/masonry-layout": "npm:^4.2.8"
"@typescript-eslint/eslint-plugin": "npm:^7.13.0" "@typescript-eslint/eslint-plugin": "npm:^7.13.0"
@@ -5148,6 +5156,7 @@ __metadata:
eslint-config-prettier: "npm:^9.1.0" eslint-config-prettier: "npm:^9.1.0"
eslint-plugin-import: "npm:^2.29.1" eslint-plugin-import: "npm:^2.29.1"
home-assistant-js-websocket: "npm:^9.4.0" home-assistant-js-websocket: "npm:^9.4.0"
js-yaml: "npm:^4.1.0"
jsdom: "npm:^21.1.2" jsdom: "npm:^21.1.2"
keycharm: "npm:^0.4.0" keycharm: "npm:^0.4.0"
lit: "npm:^3.1.4" lit: "npm:^3.1.4"