From 54283f6d3c569d2e77e5a68007c88a57dd2b4ad5 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Mon, 21 Jul 2025 11:21:54 +0200 Subject: [PATCH 1/2] add schema definition for uiConfig --- internal/config/schema.go | 151 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) diff --git a/internal/config/schema.go b/internal/config/schema.go index 37d662a..7ea8d18 100644 --- a/internal/config/schema.go +++ b/internal/config/schema.go @@ -119,6 +119,157 @@ var configSchema = ` "required": ["apiAllowedIPs"] }` +var uiConfigSchema = ` + { + "type": "object", + "properties": { + "jobList": { + "description": "Job list defaults. Applies to user- and jobs views.", + "type": "object", + "properties": { + "usePaging": { + "description": "If classic paging is used instead of continuous scrolling by default.", + "type": "boolean" + }, + "showFootprint": { + "description": "If footprint bars are shown as first column by default.", + "type": "boolean" + } + } + }, + "nodeList": { + "description": "Node list defaults. Applies to node list view.", + "type": "object", + "properties": { + "usePaging": { + "description": "If classic paging is used instead of continuous scrolling by default.", + "type": "boolean" + } + } + }, + "jobView": { + "description": "Job view defaults.", + "type": "object", + "properties": { + "showPolarPlot": { + "description": "If the job metric footprints polar plot is shown by default.", + "type": "boolean" + }, + "showFootprint": { + "description": "If the annotated job metric footprint bars are shown by default.", + "type": "boolean" + }, + "showRoofline": { + "description": "If the job roofline plot is shown by default.", + "type": "boolean" + }, + "showStatTable": { + "description": "If the job metric statistics table is shown by default.", + "type": "boolean" + } + } + }, + "metricConfig": { + "description": "Global initial metric selections for primary views of all clusters.", + "type": "object", + "properties": { + "jobListMetrics": { + "description": "Initial metrics shown for new users in job lists (User and jobs view).", + "type": "array", + "items": { + "type": "string" + } + }, + "jobViewPlotMetrics": { + "description": "Initial metrics shown for new users as job view metric plots.", + "type": "array", + "items": { + "type": "string" + } + }, + "jobViewTableMetrics": { + "description": "Initial metrics shown for new users in job view statistics table.", + "type": "array", + "items": { + "type": "string" + } + }, + "clusters": { + "description": "Overrides for global defaults by cluster and subcluster.", + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The name of the cluster.", + "type": "string" + }, + "subClusters" { + "description": "The array of overrides per subcluster.", + "type":"array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The name of the subcluster.", + "type": "string" + }, + "jobListMetrics": { + "description": "Initial metrics shown for new users in job lists (User and jobs view) for subcluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "jobViewPlotMetrics": { + "description": "Initial metrics shown for new users as job view timeplots for subcluster.", + "type": "array", + "items": { + "type": "string" + } + }, + "jobViewTableMetrics": { + "description": "Initial metrics shown for new users in job view statistics table for subcluster.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + } + } + } + } + }, + "plotConfiguration": { + "description": "Initial settings for plot render options.", + "type": "object", + "properties": { + "colorBackground": { + "description": "If the metric plot backgrounds are initially colored by threshold limits.", + "type": "boolean" + }, + "plotsPerRow": { + "description": "How many plots are initially rendered in per row. Applies to job, single node, and analysis views.", + "type": "integer" + }, + "lineWidth": { + "description": "Initial thickness of rendered plotlines. Applies to metric plot, job compare plot and roofline.", + "type": "integer" + }, + "colorScheme": { + "description": "Initial colorScheme to be used for metric plots.", + "type": "array", + "items": { + "type": "string" + } + } + } + } + }` + var clustersSchema = ` { "type": "array", From 7a54e2cfb3c4afeaad13f7adfbceb6e3d03dc3a3 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Mon, 21 Jul 2025 11:37:05 +0200 Subject: [PATCH 2/2] add required and minItems flags to uiConfigSchema --- internal/config/schema.go | 194 +++++++++++++++++++++----------------- 1 file changed, 105 insertions(+), 89 deletions(-) diff --git a/internal/config/schema.go b/internal/config/schema.go index 7ea8d18..b55833f 100644 --- a/internal/config/schema.go +++ b/internal/config/schema.go @@ -135,7 +135,8 @@ var uiConfigSchema = ` "description": "If footprint bars are shown as first column by default.", "type": "boolean" } - } + }, + "required": ["usePaging", "showFootprint"] }, "nodeList": { "description": "Node list defaults. Applies to node list view.", @@ -145,7 +146,8 @@ var uiConfigSchema = ` "description": "If classic paging is used instead of continuous scrolling by default.", "type": "boolean" } - } + }, + "required": ["usePaging"] }, "jobView": { "description": "Job view defaults.", @@ -167,7 +169,8 @@ var uiConfigSchema = ` "description": "If the job metric statistics table is shown by default.", "type": "boolean" } - } + }, + "required": ["showFootprint"] }, "metricConfig": { "description": "Global initial metric selections for primary views of all clusters.", @@ -177,21 +180,24 @@ var uiConfigSchema = ` "description": "Initial metrics shown for new users in job lists (User and jobs view).", "type": "array", "items": { - "type": "string" + "type": "string", + "minItems": 1 } }, "jobViewPlotMetrics": { "description": "Initial metrics shown for new users as job view metric plots.", "type": "array", "items": { - "type": "string" + "type": "string", + "minItems": 1 } }, "jobViewTableMetrics": { "description": "Initial metrics shown for new users in job view statistics table.", "type": "array", "items": { - "type": "string" + "type": "string", + "minItems": 1 } }, "clusters": { @@ -218,29 +224,37 @@ var uiConfigSchema = ` "description": "Initial metrics shown for new users in job lists (User and jobs view) for subcluster.", "type": "array", "items": { - "type": "string" + "type": "string", + "minItems": 1 } }, "jobViewPlotMetrics": { "description": "Initial metrics shown for new users as job view timeplots for subcluster.", "type": "array", "items": { - "type": "string" + "type": "string", + "minItems": 1 } }, "jobViewTableMetrics": { "description": "Initial metrics shown for new users in job view statistics table for subcluster.", "type": "array", "items": { - "type": "string" + "type": "string", + "minItems": 1 } } - } + }, + "required": ["name"], + "minItems": 1 } } - } + }, + "required": ["name", "subClusters"], + "minItems": 1 } - } + }, + "required": ["jobListMetrics", "jobViewPlotMetrics", "jobViewTableMetrics"] } }, "plotConfiguration": { @@ -266,85 +280,87 @@ var uiConfigSchema = ` "type": "string" } } - } + }, + "required": ["colorBackground", "plotsPerRow", "lineWidth"] } }` var clustersSchema = ` - { - "type": "array", - "items": { - "type": "object", - "properties": { - "name": { - "description": "The name of the cluster.", - "type": "string" - }, - "metricDataRepository": { - "description": "Type of the metric data repository for this cluster", - "type": "object", - "properties": { - "kind": { - "type": "string", - "enum": ["influxdb", "prometheus", "cc-metric-store", "test"] - }, - "url": { - "type": "string" - }, - "token": { - "type": "string" - } - }, - "required": ["kind", "url"] - }, - "filterRanges": { - "description": "This option controls the slider ranges for the UI controls of numNodes, duration, and startTime.", - "type": "object", - "properties": { - "numNodes": { - "description": "UI slider range for number of nodes", - "type": "object", - "properties": { - "from": { - "type": "integer" - }, - "to": { - "type": "integer" - } - }, - "required": ["from", "to"] - }, - "duration": { - "description": "UI slider range for duration", - "type": "object", - "properties": { - "from": { - "type": "integer" - }, - "to": { - "type": "integer" - } - }, - "required": ["from", "to"] - }, - "startTime": { - "description": "UI slider range for start time", - "type": "object", - "properties": { - "from": { - "type": "string", - "format": "date-time" - }, - "to": { - "type": "null" - } - }, - "required": ["from", "to"] - } - }, - "required": ["numNodes", "duration", "startTime"] - } + { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { + "description": "The name of the cluster.", + "type": "string" }, - "required": ["name", "metricDataRepository", "filterRanges"], - "minItems": 1 - }}` + "metricDataRepository": { + "description": "Type of the metric data repository for this cluster", + "type": "object", + "properties": { + "kind": { + "type": "string", + "enum": ["influxdb", "prometheus", "cc-metric-store", "test"] + }, + "url": { + "type": "string" + }, + "token": { + "type": "string" + } + }, + "required": ["kind", "url"] + }, + "filterRanges": { + "description": "This option controls the slider ranges for the UI controls of numNodes, duration, and startTime.", + "type": "object", + "properties": { + "numNodes": { + "description": "UI slider range for number of nodes", + "type": "object", + "properties": { + "from": { + "type": "integer" + }, + "to": { + "type": "integer" + } + }, + "required": ["from", "to"] + }, + "duration": { + "description": "UI slider range for duration", + "type": "object", + "properties": { + "from": { + "type": "integer" + }, + "to": { + "type": "integer" + } + }, + "required": ["from", "to"] + }, + "startTime": { + "description": "UI slider range for start time", + "type": "object", + "properties": { + "from": { + "type": "string", + "format": "date-time" + }, + "to": { + "type": "null" + } + }, + "required": ["from", "to"] + } + }, + "required": ["numNodes", "duration", "startTime"] + } + }, + "required": ["name", "metricDataRepository", "filterRanges"], + "minItems": 1 + } + }`