[dashboard] Add "Edit" button to all resources
Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
(cherry picked from commit a56fc00c5c)
This commit is contained in:
parent
760c732ed6
commit
21e7183375
2 changed files with 26 additions and 3 deletions
|
|
@ -102,6 +102,22 @@ func antdFlex(id string, gap float64, children []any) map[string]any {
|
|||
}
|
||||
}
|
||||
|
||||
func antdFlexSpaceBetween(id string, children []any) map[string]any {
|
||||
if id == "" {
|
||||
id = generateContainerID("auto", "flex")
|
||||
}
|
||||
|
||||
return map[string]any{
|
||||
"type": "antdFlex",
|
||||
"data": map[string]any{
|
||||
"id": id,
|
||||
"align": "center",
|
||||
"justify": "space-between",
|
||||
},
|
||||
"children": children,
|
||||
}
|
||||
}
|
||||
|
||||
func antdFlexVertical(id string, gap float64, children []any) map[string]any {
|
||||
// Auto-generate ID if not provided
|
||||
if id == "" {
|
||||
|
|
|
|||
|
|
@ -237,9 +237,16 @@ func createUnifiedFactory(config UnifiedResourceConfig, tabs []any, urlsToFetch
|
|||
"lineHeight": "24px",
|
||||
})
|
||||
|
||||
header := antdFlex(generateContainerID("header", "row"), float64(6), []any{
|
||||
badge,
|
||||
nameText,
|
||||
header := antdFlexSpaceBetween(generateContainerID("header", "row"), []any{
|
||||
antdFlex(generateContainerID("header", "title-text"), float64(6), []any{
|
||||
badge,
|
||||
nameText,
|
||||
}),
|
||||
antdLink(generateLinkID("header", "edit"),
|
||||
"Edit",
|
||||
fmt.Sprintf("/openapi-ui/{2}/{3}/forms/apis/{reqsJsonPath[0]['.apiVersion']['-']}/%s/{reqsJsonPath[0]['.metadata.name']['-']}",
|
||||
config.Plural),
|
||||
),
|
||||
})
|
||||
|
||||
// Add marginBottom style to header
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue