Chore: Fix times in schemas (#64906)

* Fix times in schemas

* Fix frontend lints
This commit is contained in:
Selene 2023-03-21 10:42:19 +01:00 committed by GitHub
parent 9ca01cc070
commit 1328a32a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 57 additions and 36 deletions

View File

@ -24,8 +24,8 @@ system account
| `role` | string | **Yes** | OrgRole is a Grafana Organization Role which can be 'Viewer', 'Editor', 'Admin'.<br/>Possible values are: `Admin`, `Editor`, `Viewer`. |
| `tokens` | integer | **Yes** | Tokens is the number of active tokens for the service account.<br/>Tokens are used to authenticate the service account against Grafana. |
| `accessControl` | map[string]boolean | No | AccessControl metadata associated with a given resource. |
| `created` | integer | No | Created indicates when the service account was created. |
| `created` | string | No | Created indicates when the service account was created. |
| `teams` | string[] | No | Teams is a list of teams the service account belongs to. |
| `updated` | integer | No | Updated indicates when the service account was updated. |
| `updated` | string | No | Updated indicates when the service account was updated. |

View File

@ -15,12 +15,12 @@ A team is a named grouping of Grafana users to which access control rules may be
| Property | Type | Required | Description |
|-----------------|--------------------|----------|----------------------------------------------------------|
| `created` | integer | **Yes** | Created indicates when the team was created. |
| `created` | string | **Yes** | Created indicates when the team was created. |
| `memberCount` | integer | **Yes** | MemberCount is the number of the team members. |
| `name` | string | **Yes** | Name of the team. |
| `orgId` | integer | **Yes** | OrgId is the ID of an organisation the team belongs to. |
| `permission` | integer | **Yes** | Possible values are: `0`, `1`, `2`, `4`. |
| `updated` | integer | **Yes** | Updated indicates when the team was updated. |
| `updated` | string | **Yes** | Updated indicates when the team was updated. |
| `accessControl` | map[string]boolean | No | AccessControl metadata associated with a given resource. |
| `avatarUrl` | string | No | AvatarUrl is the team's avatar URL. |
| `email` | string | No | Email of the team. |

View File

@ -1,6 +1,9 @@
package kind
import "strings"
import (
"strings"
"time"
)
name: "LibraryPanel"
maturity: "experimental"
@ -52,8 +55,8 @@ lineage: seqs: [
folderUid: string @grafanamaturity(ToMetadata="sys")
connectedDashboards: int64
created: string @grafanamaturity(ToMetadata="sys") // time.Time in golang
updated: string @grafanamaturity(ToMetadata="sys") // time.Time in golang
created: string & time.Time
updated: string & time.Time
createdBy: #LibraryElementDTOMetaUser @grafanamaturity(ToMetadata="sys")
updatedBy: #LibraryElementDTOMetaUser @grafanamaturity(ToMetadata="sys")

View File

@ -1,5 +1,7 @@
package kind
import "time"
name: "ServiceAccount"
maturity: "merged"
description: "system account"
@ -35,9 +37,9 @@ lineage: seqs: [
// Teams is a list of teams the service account belongs to.
teams?: [...string] @grafanamaturity(ToMetadata="sys")
// Created indicates when the service account was created.
created?: int64 @grafanamaturity(ToMetadata="sys")
created?: string & time.Time
// Updated indicates when the service account was updated.
updated?: int64 @grafanamaturity(ToMetadata="sys")
updated?: string & time.Time
// OrgRole is a Grafana Organization Role which can be 'Viewer', 'Editor', 'Admin'.
#OrgRole: "Admin" | "Editor" | "Viewer" @cuetsy(kind="type")

View File

@ -1,5 +1,7 @@
package kind
import "time"
name: "Team"
maturity: "merged"
description: "A team is a named grouping of Grafana users to which access control rules may be assigned."
@ -26,9 +28,9 @@ lineage: seqs: [
[string]: bool @grafanamaturity(ToMetadata="sys")
}
// Created indicates when the team was created.
created: int64 @grafanamaturity(ToMetadata="sys")
created: string & time.Time
// Updated indicates when the team was updated.
updated: int64 @grafanamaturity(ToMetadata="sys")
updated: string & time.Time
#Permission: 0 | 1 | 2 | 4 @cuetsy(kind="enum",memberNames="Member|Viewer|Editor|Admin")
},

View File

@ -26,7 +26,7 @@ export interface ServiceAccount {
/**
* Created indicates when the service account was created.
*/
created?: number;
created?: string;
/**
* ID is the unique identifier of the service account in the database.
*/
@ -63,7 +63,7 @@ export interface ServiceAccount {
/**
* Updated indicates when the service account was updated.
*/
updated?: number;
updated?: string;
}
export const defaultServiceAccount: Partial<ServiceAccount> = {

View File

@ -27,7 +27,7 @@ export interface Team {
/**
* Created indicates when the team was created.
*/
created: number;
created: string;
/**
* Email of the team.
*/
@ -51,5 +51,5 @@ export interface Team {
/**
* Updated indicates when the team was updated.
*/
updated: number;
updated: string;
}

View File

@ -35,6 +35,7 @@ spec:
format: int64
type: integer
created:
format: date-time
type: string
createdBy:
properties:
@ -55,6 +56,7 @@ spec:
folderUid:
type: string
updated:
format: date-time
type: string
updatedBy:
properties:

View File

@ -10,14 +10,18 @@
package librarypanel
import (
"time"
)
// LibraryElementDTOMeta defines model for LibraryElementDTOMeta.
type LibraryElementDTOMeta struct {
ConnectedDashboards int64 `json:"connectedDashboards"`
Created string `json:"created"`
Created time.Time `json:"created"`
CreatedBy LibraryElementDTOMetaUser `json:"createdBy"`
FolderName string `json:"folderName"`
FolderUid string `json:"folderUid"`
Updated string `json:"updated"`
Updated time.Time `json:"updated"`
UpdatedBy LibraryElementDTOMetaUser `json:"updatedBy"`
}

View File

@ -34,8 +34,8 @@ spec:
type: string
created:
description: Created indicates when the service account was created.
format: int64
type: integer
format: date-time
type: string
id:
description: ID is the unique identifier of the service account in the database.
format: int64
@ -73,8 +73,8 @@ spec:
type: integer
updated:
description: Updated indicates when the service account was updated.
format: int64
type: integer
format: date-time
type: string
required:
- id
- orgId

View File

@ -10,6 +10,10 @@
package serviceaccount
import (
"time"
)
// Defines values for OrgRole.
const (
OrgRoleAdmin OrgRole = "Admin"
@ -30,7 +34,7 @@ type ServiceAccount struct {
AvatarUrl string `json:"avatarUrl"`
// Created indicates when the service account was created.
Created *int64 `json:"created,omitempty"`
Created *time.Time `json:"created,omitempty"`
// ID is the unique identifier of the service account in the database.
Id int64 `json:"id"`
@ -58,5 +62,5 @@ type ServiceAccount struct {
Tokens int64 `json:"tokens"`
// Updated indicates when the service account was updated.
Updated *int64 `json:"updated,omitempty"`
Updated *time.Time `json:"updated,omitempty"`
}

View File

@ -32,8 +32,8 @@ spec:
type: string
created:
description: Created indicates when the team was created.
format: int64
type: integer
format: date-time
type: string
email:
description: Email of the team.
type: string
@ -58,8 +58,8 @@ spec:
type: integer
updated:
description: Updated indicates when the team was updated.
format: int64
type: integer
format: date-time
type: string
required:
- orgId
- name

View File

@ -10,6 +10,10 @@
package team
import (
"time"
)
// Defines values for Permission.
const (
PermissionN0 Permission = 0
@ -30,7 +34,7 @@ type Team struct {
AvatarUrl *string `json:"avatarUrl,omitempty"`
// Created indicates when the team was created.
Created int64 `json:"created"`
Created time.Time `json:"created"`
// Email of the team.
Email *string `json:"email,omitempty"`
@ -46,5 +50,5 @@ type Team struct {
Permission Permission `json:"permission"`
// Updated indicates when the team was updated.
Updated int64 `json:"updated"`
Updated time.Time `json:"updated"`
}

View File

@ -878,7 +878,7 @@
0
],
"description": "A standalone panel",
"grafanaMaturityCount": 10,
"grafanaMaturityCount": 8,
"lineageIsGroup": false,
"links": {
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/core/librarypanel/schema-reference",
@ -1492,7 +1492,7 @@
0
],
"description": "system account",
"grafanaMaturityCount": 9,
"grafanaMaturityCount": 7,
"lineageIsGroup": false,
"links": {
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/core/serviceaccount/schema-reference",
@ -1642,7 +1642,7 @@
0
],
"description": "A team is a named grouping of Grafana users to which access control rules may be assigned.",
"grafanaMaturityCount": 7,
"grafanaMaturityCount": 5,
"lineageIsGroup": false,
"links": {
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/core/team/schema-reference",

View File

@ -18,9 +18,9 @@ export const getMockTeam = (i = 1, overrides = {}): Team => {
memberCount: i,
permission: TeamPermissionLevel.Member,
accessControl: { isEditor: false },
created: 0,
created: '',
orgId: 0,
updated: 0,
updated: '',
...overrides,
};
};

View File

@ -14,9 +14,9 @@ const loadingTeam = {
memberCount: 0,
permission: TeamPermissionLevel.Member,
accessControl: { isEditor: false },
created: 0,
created: '',
orgId: 0,
updated: 0,
updated: '',
};
export function buildNavModel(team: Team): NavModelItem {