Skip to content

Commit

Permalink
feat(breaking changes!) more info on card and column status
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasepe committed Jan 19, 2024
1 parent 1c1ffb3 commit 7230dd8
Show file tree
Hide file tree
Showing 15 changed files with 282 additions and 182 deletions.
18 changes: 7 additions & 11 deletions apis/ui/cardtemplates/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type CardInfo struct {
type Card struct {
Title string `json:"title"`

Content string `json:"content"`
Expand All @@ -21,33 +21,29 @@ type CardInfo struct {

// +optional
Tags string `json:"tags,omitempty"`
}

type AppInfo struct {
CardInfo `json:",inline"`

// +optional
Actions []*core.API `json:"actions,omitempty"`

// +optional
AllowedActions []string `json:"allowedActions,omitempty"`
}

// CardTemplate is a template for a Krateo UI Card widget.
type CardTemplateSpec struct {
// +optional
Iterator *string `json:"iterator,omitempty"`

// App is the card info
App AppInfo `json:"app"`
// CardTemplateInfo is the card template info
CardTemplateInfo Card `json:"app"`

// APIList list of api calls.
// +optional
APIList []*core.API `json:"api,omitempty"`
}

type CardTemplateStatus struct {
Cards []*CardInfo `json:"cards,omitempty"`

// +optional
AllowedActions []string `json:"allowedActions,omitempty"`
Cards []*Card `json:"cards,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
40 changes: 12 additions & 28 deletions apis/ui/cardtemplates/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions apis/ui/columns/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@ package v1alpha1

import (
"github.com/krateoplatformops/krateo-bff/apis/core"
"github.com/krateoplatformops/krateo-bff/apis/ui/cardtemplates/v1alpha1"
cardtemplatesv1alpha1 "github.com/krateoplatformops/krateo-bff/apis/ui/cardtemplates/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

type Content struct {
CardTemplateList []v1alpha1.CardTemplate `json:"cardTemplateList"`
}

type App struct {
// +optional
Props map[string]string `json:"props,omitempty"`
Expand All @@ -25,9 +21,8 @@ type ColumnSpec struct {
}

type ColumnStatus struct {
// Cards list of card templates.
// +optional
Cards []*v1alpha1.CardInfo `json:"cards,omitempty"`
Cards []*cardtemplatesv1alpha1.Card `json:"cards,omitempty"`
}

// +kubebuilder:object:root=true
Expand Down
28 changes: 3 additions & 25 deletions apis/ui/columns/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 42 additions & 1 deletion crds/layout.ui.krateo.io_columns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,50 @@ spec:
status:
properties:
cards:
description: Cards list of card templates.
items:
properties:
actions:
items:
description: API contains external api call info.
properties:
dependOn:
type: string
endpointRef:
description: A Reference to a named object.
properties:
name:
description: Name of the referenced object.
type: string
namespace:
description: Namespace of the referenced object.
type: string
required:
- name
- namespace
type: object
headers:
items:
type: string
type: array
krateoGateway:
type: boolean
name:
type: string
path:
type: string
payload:
type: string
verb:
default: GET
type: string
required:
- name
type: object
type: array
allowedActions:
items:
type: string
type: array
color:
type: string
content:
Expand Down
52 changes: 47 additions & 5 deletions crds/widgets.ui.krateo.io_cardtemplates.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ spec:
type: object
type: array
app:
description: App is the card info
description: CardTemplateInfo is the card template info
properties:
actions:
items:
Expand Down Expand Up @@ -118,6 +118,10 @@ spec:
- name
type: object
type: array
allowedActions:
items:
type: string
type: array
color:
type: string
content:
Expand All @@ -141,13 +145,51 @@ spec:
type: object
status:
properties:
allowedActions:
items:
type: string
type: array
cards:
items:
properties:
actions:
items:
description: API contains external api call info.
properties:
dependOn:
type: string
endpointRef:
description: A Reference to a named object.
properties:
name:
description: Name of the referenced object.
type: string
namespace:
description: Namespace of the referenced object.
type: string
required:
- name
- namespace
type: object
headers:
items:
type: string
type: array
krateoGateway:
type: boolean
name:
type: string
path:
type: string
payload:
type: string
verb:
default: GET
type: string
required:
- name
type: object
type: array
allowedActions:
items:
type: string
type: array
color:
type: string
content:
Expand Down
Loading

0 comments on commit 7230dd8

Please sign in to comment.