diff --git a/docs/sources/developers/kinds/core/preferences/schema-reference.md b/docs/sources/developers/kinds/core/preferences/schema-reference.md index 16058084094..e5ac35187cd 100644 --- a/docs/sources/developers/kinds/core/preferences/schema-reference.md +++ b/docs/sources/developers/kinds/core/preferences/schema-reference.md @@ -21,7 +21,7 @@ The user or team frontend preferences | Property | Type | Required | Default | Description | |------------|---------------------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `metadata` | [object](#metadata) | **Yes** | | metadata contains embedded CommonMetadata and can be extended with custom string fields
TODO: use CommonMetadata instead of redefining here; currently needs to be defined here
without external reference as using the CommonMetadata reference breaks thema codegen. | -| `spec` | [object](#spec) | **Yes** | | | +| `spec` | [object](#spec) | **Yes** | | Spec defines user, team or org Grafana preferences
swagger:model Preferences | | `status` | [object](#status) | **Yes** | | | ### Metadata @@ -69,6 +69,9 @@ extraFields is reserved for any fields that are pulled from the API server metad ### Spec +Spec defines user, team or org Grafana preferences +swagger:model Preferences + | Property | Type | Required | Default | Description | |---------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------| | `cookiePreferences` | [CookiePreferences](#cookiepreferences) | No | | | diff --git a/kinds/preferences/preferences_kind.cue b/kinds/preferences/preferences_kind.cue index b6f189178c2..0eddc16cbef 100644 --- a/kinds/preferences/preferences_kind.cue +++ b/kinds/preferences/preferences_kind.cue @@ -8,6 +8,8 @@ description: "The user or team frontend preferences" lineage: schemas: [{ version: [0, 0] schema: { + // Spec defines user, team or org Grafana preferences + // swagger:model Preferences spec: { // UID for the home dashboard homeDashboardUID?: string diff --git a/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts b/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts index d240e057545..033e4233d4b 100644 --- a/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts +++ b/packages/grafana-schema/src/raw/preferences/x/preferences_types.gen.ts @@ -21,6 +21,10 @@ export interface CookiePreferences { performance?: Record; } +/** + * Spec defines user, team or org Grafana preferences + * swagger:model Preferences + */ export interface Preferences { /** * Cookie preferences diff --git a/pkg/kinds/preferences/preferences_spec_gen.go b/pkg/kinds/preferences/preferences_spec_gen.go index 803e588e8c4..1c28568cfbc 100644 --- a/pkg/kinds/preferences/preferences_spec_gen.go +++ b/pkg/kinds/preferences/preferences_spec_gen.go @@ -22,7 +22,8 @@ type QueryHistoryPreference struct { HomeTab *string `json:"homeTab,omitempty"` } -// Spec defines model for Spec. +// Spec defines user, team or org Grafana preferences +// swagger:model Preferences type Spec struct { CookiePreferences *CookiePreferences `json:"cookiePreferences,omitempty"` diff --git a/public/api-enterprise-spec.json b/public/api-enterprise-spec.json index 79486c5f879..225181bc987 100644 --- a/public/api-enterprise-spec.json +++ b/public/api-enterprise-spec.json @@ -5592,6 +5592,38 @@ } } }, + "Preferences": { + "description": "Spec defines user, team or org Grafana preferences", + "type": "object", + "properties": { + "cookiePreferences": { + "$ref": "#/definitions/CookiePreferences" + }, + "homeDashboardUID": { + "description": "UID for the home dashboard", + "type": "string" + }, + "language": { + "description": "Selected language (beta)", + "type": "string" + }, + "queryHistory": { + "$ref": "#/definitions/QueryHistoryPreference" + }, + "theme": { + "description": "Theme light, dark, empty is default", + "type": "string" + }, + "timezone": { + "description": "The timezone selection\nTODO: this should use the timezone defined in common", + "type": "string" + }, + "weekStart": { + "description": "WeekStart day of the week (sunday, monday, etc)", + "type": "string" + } + } + }, "PrometheusRemoteWriteTargetJSON": { "type": "object", "properties": { @@ -5777,8 +5809,10 @@ }, "QueryHistoryPreference": { "type": "object", + "title": "QueryHistoryPreference defines model for QueryHistoryPreference.", "properties": { "homeTab": { + "description": "HomeTab one of: '' | 'query' | 'starred';", "type": "string" } } @@ -6670,38 +6704,6 @@ "type": "integer", "format": "int64" }, - "Spec": { - "type": "object", - "title": "Spec defines model for Spec.", - "properties": { - "cookiePreferences": { - "$ref": "#/definitions/CookiePreferences" - }, - "homeDashboardUID": { - "description": "UID for the home dashboard", - "type": "string" - }, - "language": { - "description": "Selected language (beta)", - "type": "string" - }, - "queryHistory": { - "$ref": "#/definitions/QueryHistoryPreference" - }, - "theme": { - "description": "Theme light, dark, empty is default", - "type": "string" - }, - "timezone": { - "description": "The timezone selection\nTODO: this should use the timezone defined in common", - "type": "string" - }, - "weekStart": { - "description": "WeekStart day of the week (sunday, monday, etc)", - "type": "string" - } - } - }, "State": { "type": "string" }, @@ -8574,7 +8576,7 @@ "getPreferencesResponse": { "description": "", "schema": { - "$ref": "#/definitions/Spec" + "$ref": "#/definitions/Preferences" } }, "getPublicAnnotationsResponse": { diff --git a/public/api-merged.json b/public/api-merged.json index b185e0e232b..ea32b47d8f3 100644 --- a/public/api-merged.json +++ b/public/api-merged.json @@ -16832,6 +16832,38 @@ } } }, + "Preferences": { + "description": "Spec defines user, team or org Grafana preferences", + "type": "object", + "properties": { + "cookiePreferences": { + "$ref": "#/definitions/CookiePreferences" + }, + "homeDashboardUID": { + "description": "UID for the home dashboard", + "type": "string" + }, + "language": { + "description": "Selected language (beta)", + "type": "string" + }, + "queryHistory": { + "$ref": "#/definitions/QueryHistoryPreference" + }, + "theme": { + "description": "Theme light, dark, empty is default", + "type": "string" + }, + "timezone": { + "description": "The timezone selection\nTODO: this should use the timezone defined in common", + "type": "string" + }, + "weekStart": { + "description": "WeekStart day of the week (sunday, monday, etc)", + "type": "string" + } + } + }, "PrometheusRemoteWriteTargetJSON": { "type": "object", "properties": { @@ -17251,8 +17283,10 @@ }, "QueryHistoryPreference": { "type": "object", + "title": "QueryHistoryPreference defines model for QueryHistoryPreference.", "properties": { "homeTab": { + "description": "HomeTab one of: '' | 'query' | 'starred';", "type": "string" } } @@ -18806,38 +18840,6 @@ } } }, - "Spec": { - "type": "object", - "title": "Spec defines model for Spec.", - "properties": { - "cookiePreferences": { - "$ref": "#/definitions/CookiePreferences" - }, - "homeDashboardUID": { - "description": "UID for the home dashboard", - "type": "string" - }, - "language": { - "description": "Selected language (beta)", - "type": "string" - }, - "queryHistory": { - "$ref": "#/definitions/QueryHistoryPreference" - }, - "theme": { - "description": "Theme light, dark, empty is default", - "type": "string" - }, - "timezone": { - "description": "The timezone selection\nTODO: this should use the timezone defined in common", - "type": "string" - }, - "weekStart": { - "description": "WeekStart day of the week (sunday, monday, etc)", - "type": "string" - } - } - }, "State": { "type": "string" }, @@ -21748,7 +21750,7 @@ "getPreferencesResponse": { "description": "(empty)", "schema": { - "$ref": "#/definitions/Spec" + "$ref": "#/definitions/Preferences" } }, "getPublicAnnotationsResponse": { diff --git a/public/openapi3.json b/public/openapi3.json index 5624e4b4d33..b6773c3f9ab 100644 --- a/public/openapi3.json +++ b/public/openapi3.json @@ -1011,7 +1011,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Spec" + "$ref": "#/components/schemas/Preferences" } } }, @@ -7839,6 +7839,38 @@ }, "type": "object" }, + "Preferences": { + "description": "Spec defines user, team or org Grafana preferences", + "properties": { + "cookiePreferences": { + "$ref": "#/components/schemas/CookiePreferences" + }, + "homeDashboardUID": { + "description": "UID for the home dashboard", + "type": "string" + }, + "language": { + "description": "Selected language (beta)", + "type": "string" + }, + "queryHistory": { + "$ref": "#/components/schemas/QueryHistoryPreference" + }, + "theme": { + "description": "Theme light, dark, empty is default", + "type": "string" + }, + "timezone": { + "description": "The timezone selection\nTODO: this should use the timezone defined in common", + "type": "string" + }, + "weekStart": { + "description": "WeekStart day of the week (sunday, monday, etc)", + "type": "string" + } + }, + "type": "object" + }, "PrometheusRemoteWriteTargetJSON": { "properties": { "data_source_uid": { @@ -8259,9 +8291,11 @@ "QueryHistoryPreference": { "properties": { "homeTab": { + "description": "HomeTab one of: '' | 'query' | 'starred';", "type": "string" } }, + "title": "QueryHistoryPreference defines model for QueryHistoryPreference.", "type": "object" }, "QueryHistoryResponse": { @@ -9812,38 +9846,6 @@ "title": "A Span defines a continuous sequence of buckets.", "type": "object" }, - "Spec": { - "properties": { - "cookiePreferences": { - "$ref": "#/components/schemas/CookiePreferences" - }, - "homeDashboardUID": { - "description": "UID for the home dashboard", - "type": "string" - }, - "language": { - "description": "Selected language (beta)", - "type": "string" - }, - "queryHistory": { - "$ref": "#/components/schemas/QueryHistoryPreference" - }, - "theme": { - "description": "Theme light, dark, empty is default", - "type": "string" - }, - "timezone": { - "description": "The timezone selection\nTODO: this should use the timezone defined in common", - "type": "string" - }, - "weekStart": { - "description": "WeekStart day of the week (sunday, monday, etc)", - "type": "string" - } - }, - "title": "Spec defines model for Spec.", - "type": "object" - }, "State": { "type": "string" },