diff --git a/.github/workflows/ui-lint.yml b/.github/workflows/ui-lint.yml index 8644cc822..163e778aa 100644 --- a/.github/workflows/ui-lint.yml +++ b/.github/workflows/ui-lint.yml @@ -24,3 +24,5 @@ jobs: run: cd ui && yarn check-style - name: Lint run: cd ui && yarn lint + - name: build + run: cd ui && yarn build diff --git a/internal/dashboard/business/oceanbase/obcluster.go b/internal/dashboard/business/oceanbase/obcluster.go index f471db438..a72dda13a 100644 --- a/internal/dashboard/business/oceanbase/obcluster.go +++ b/internal/dashboard/business/oceanbase/obcluster.go @@ -503,10 +503,11 @@ func buildOBClusterTopology(topology []param.ZoneTopology) []apitypes.OBZoneTopo topo.Tolerations = make([]corev1.Toleration, 0) for _, kv := range zone.Tolerations { toleration := corev1.Toleration{ - Key: kv.Key, - Operator: corev1.TolerationOpEqual, - Value: kv.Value, - Effect: corev1.TaintEffectNoSchedule, + Key: kv.Key, + Operator: corev1.TolerationOperator(kv.Operator), + Value: kv.Value, + Effect: corev1.TaintEffect(kv.Effect), + TolerationSeconds: kv.TolerationSeconds, } topo.Tolerations = append(topo.Tolerations, toleration) } diff --git a/internal/dashboard/model/common/common.go b/internal/dashboard/model/common/common.go index 1767661cb..9434616bd 100644 --- a/internal/dashboard/model/common/common.go +++ b/internal/dashboard/model/common/common.go @@ -13,13 +13,13 @@ See the Mulan PSL v2 for more details. package common type KVPair struct { - Key string `json:"key"` - Value string `json:"value"` + Key string `json:"key" binding:"required"` + Value string `json:"value" binding:"required"` } type ResourceSpec struct { - Cpu int64 `json:"cpu"` - MemoryGB int64 `json:"memory"` + Cpu int64 `json:"cpu" binding:"required"` + MemoryGB int64 `json:"memory" binding:"required"` } type StorageSpec struct { @@ -28,8 +28,9 @@ type StorageSpec struct { } type SelectorExpression struct { - Key string `json:"key"` - Operator string `json:"operator,omitempty"` + Key string `json:"key" binding:"required"` + // Enum: In, NotIn, Exists, DoesNotExist + Operator string `json:"operator,omitempty" binding:"required"` Values []string `json:"values,omitempty"` } @@ -38,15 +39,17 @@ type AffinityType string type AffinitySpec struct { SelectorExpression `json:",inline"` // Enum: NODE, POD, POD_ANTI - Type AffinityType `json:"type"` + Type AffinityType `json:"type" binding:"required"` Weight int32 `json:"weight,omitempty"` Preferred bool `json:"preferred,omitempty"` } type TolerationSpec struct { - KVPair `json:",inline"` - Operator string `json:"operator"` - Effect string `json:"effect"` + KVPair `json:",inline"` + // Enum: Exists, Equal + Operator string `json:"operator" binding:"required"` + // Enum: PreferNoSchedule, NoSchedule, NoExecute + Effect string `json:"effect" binding:"required"` TolerationSeconds *int64 `json:"tolerationSeconds,omitempty"` } diff --git a/internal/dashboard/model/param/obcluster_param.go b/internal/dashboard/model/param/obcluster_param.go index ee92ef954..b9fc021de 100644 --- a/internal/dashboard/model/param/obcluster_param.go +++ b/internal/dashboard/model/param/obcluster_param.go @@ -18,17 +18,17 @@ import ( ) type ZoneTopology struct { - Zone string `json:"zone"` - Replicas int `json:"replicas"` + Zone string `json:"zone" binding:"required"` + Replicas int `json:"replicas" binding:"required"` NodeSelector []common.KVPair `json:"nodeSelector,omitempty"` Tolerations []common.TolerationSpec `json:"tolerations,omitempty"` Affinities []common.AffinitySpec `json:"affinities,omitempty"` } type OBServerStorageSpec struct { - Data common.StorageSpec `json:"data"` - RedoLog common.StorageSpec `json:"redoLog"` - Log common.StorageSpec `json:"log"` + Data common.StorageSpec `json:"data" binding:"required"` + RedoLog common.StorageSpec `json:"redoLog" binding:"required"` + Log common.StorageSpec `json:"log" binding:"required"` } type MonitorStorageSpec struct { @@ -36,14 +36,14 @@ type MonitorStorageSpec struct { } type OBServerSpec struct { - Image string `json:"image"` - Resource common.ResourceSpec `json:"resource"` - Storage *OBServerStorageSpec `json:"storage"` + Image string `json:"image" binding:"required"` + Resource common.ResourceSpec `json:"resource" binding:"required"` + Storage *OBServerStorageSpec `json:"storage" binding:"required"` } type MonitorSpec struct { - Image string `json:"image"` - Resource common.ResourceSpec `json:"resource"` + Image string `json:"image" binding:"required"` + Resource common.ResourceSpec `json:"resource" binding:"required"` } type NFSVolumeSpec struct { @@ -52,30 +52,30 @@ type NFSVolumeSpec struct { } type CreateOBClusterParam struct { - Namespace string `json:"namespace"` - Name string `json:"name"` - ClusterName string `json:"clusterName"` - ClusterId int64 `json:"clusterId"` - RootPassword string `json:"rootPassword"` + Namespace string `json:"namespace" binding:"required"` + Name string `json:"name" binding:"required"` + ClusterName string `json:"clusterName" binding:"required"` + ClusterId int64 `json:"clusterId" binding:"required"` + RootPassword string `json:"rootPassword" binding:"required"` Topology []ZoneTopology `json:"topology"` - OBServer *OBServerSpec `json:"observer"` + OBServer *OBServerSpec `json:"observer" binding:"required"` Monitor *MonitorSpec `json:"monitor"` Parameters []common.KVPair `json:"parameters"` BackupVolume *NFSVolumeSpec `json:"backupVolume"` - Mode common.ClusterMode `json:"mode"` + Mode common.ClusterMode `json:"mode" binding:"required"` // Enum: express_oltp, express_oltp, olap, kv, htap, express_oltp_perf - Scenario string `json:"scenario"` + Scenario string `json:"scenario" binding:"required"` DeletionProtection bool `json:"deletionProtection"` PvcIndependent bool `json:"pvcIndependent"` } type UpgradeOBClusterParam struct { - Image string `json:"image"` + Image string `json:"image" binding:"required"` } type ScaleOBServerParam struct { - Replicas int `json:"replicas"` + Replicas int `json:"replicas" binding:"required"` } type K8sObjectIdentity struct { diff --git a/internal/dashboard/model/param/obtenant_param.go b/internal/dashboard/model/param/obtenant_param.go index 158e5b463..296c17f68 100644 --- a/internal/dashboard/model/param/obtenant_param.go +++ b/internal/dashboard/model/param/obtenant_param.go @@ -34,7 +34,7 @@ type CreateOBTenantParam struct { Source *TenantSourceSpec `json:"source,omitempty"` // Enum: express_oltp, express_oltp, olap, kv, htap, express_oltp_perf - Scenario string `json:"scenario"` + Scenario string `json:"scenario" binding:"required"` DeletionProtection bool `json:"deletionProtection"` Parameters []common.KVPair `json:"parameters"` Variables []common.KVPair `json:"variables"` diff --git a/ui/src/pages/Cluster/Detail/Overview/BasicInfo.tsx b/ui/src/pages/Cluster/Detail/Overview/BasicInfo.tsx index 78e167402..f40e9d41a 100644 --- a/ui/src/pages/Cluster/Detail/Overview/BasicInfo.tsx +++ b/ui/src/pages/Cluster/Detail/Overview/BasicInfo.tsx @@ -47,10 +47,16 @@ const nodeSelectorColumns: ColumnsType = [ { title: 'Values', dataIndex: 'values', + render(value: string[] | undefined) { + return value?.join(', ') || '-'; + }, }, { title: 'Weight', dataIndex: 'weight', + render(value: number | undefined) { + return value || '-'; + }, }, ]; @@ -78,6 +84,9 @@ const tolerationColumns: ColumnsType = [ { title: 'Value', dataIndex: 'value', + render(value: string | undefined) { + return value || '-'; + }, }, { title: 'Effect', @@ -308,7 +317,7 @@ export default function BasicInfo({ {topologyRendering.nodeSelectors.length > 0 && ( <> - + Node Selector 0 && ( <> - + Pod Affinity
0 && ( <> - + Tolerations