Remove field validation

Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
Felix Cornelius 2024-11-19 22:34:47 +01:00 committed by GitHub
parent 48d8f980fc
commit d08383d759
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,11 +5,10 @@ import useWidgetAPI from "utils/proxy/use-widget-api";
export default function Component({ service }) { export default function Component({ service }) {
const { widget } = service; const { widget } = service;
// Limits fields to available statuses if (!widget.fields) {
const validFields = ["apps", "synced", "outOfSync", "healthy", "progressing", "degraded", "suspended", "missing"]; widget.fields = ["apps", "synced", "outOfSync", "healthy"];
widget.fields = widget.fields?.filter((field) => validFields.includes(field)); }
// Limits max number of displayed fields
const MAX_ALLOWED_FIELDS = 4; const MAX_ALLOWED_FIELDS = 4;
if (widget.fields?.length > MAX_ALLOWED_FIELDS) { if (widget.fields?.length > MAX_ALLOWED_FIELDS) {
widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS); widget.fields = widget.fields.slice(0, MAX_ALLOWED_FIELDS);