Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
CorrectRoadH committed Aug 5, 2024
1 parent 44e97b8 commit 1078fdc
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 13 deletions.
24 changes: 22 additions & 2 deletions api/message_bus/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -755,11 +755,13 @@ components:

YSKCardContent:
type: object
x-go-type: ysk.YSKCardContent
# x-go-type: ysk.YSKCardContent
# x-go-import:
# name: ysk
# path: github.com/IceWhaleTech/ZimaOS/ysk

required:
- "titleIcon"
- "titleText"
properties:
titleIcon:
$ref: "#/components/schemas/YSKCardIcon"
Expand All @@ -781,6 +783,9 @@ components:

YSKCardProgress:
type: object
required:
- "label"
- "value"
properties:
label:
type: string
Expand All @@ -791,6 +796,9 @@ components:

YSKCardIconWithText:
type: object
required:
- "icon"
- "description"
properties:
icon:
$ref: "#/components/schemas/YSKCardIcon"
Expand All @@ -800,6 +808,10 @@ components:

YSKCardListItem:
type: object
required:
- "icon"
- "description"
- "rightText"
properties:
icon:
$ref: "#/components/schemas/YSKCardIcon"
Expand All @@ -812,6 +824,11 @@ components:

YSKCardFooterAction:
type: object
required:
- "side"
- "style"
- "text"
- "messageBus"
properties:
side:
type: string
Expand All @@ -827,6 +844,9 @@ components:

YSKCardMessageBusAction:
type: object
required:
- "key"
- "payload"
properties:
key:
type: string
Expand Down
2 changes: 1 addition & 1 deletion pkg/ysk/ysk.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func DeleteCard(ctx context.Context, cardID string, publish func(context.Context

func TaskWithProgress(card codegen.YSKCard, label string, progress int) codegen.YSKCard {
if card.Content.BodyProgress != nil {
card.Content.BodyProgress = &YSKCardProgress{
card.Content.BodyProgress = &codegen.YSKCardProgress{
Label: label,
Value: progress,
}
Expand Down
31 changes: 22 additions & 9 deletions pkg/ysk/ysk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ func TestUpdateProgress(t *testing.T) {
Id: "task:application:install",
CardType: codegen.YSKCardCardTypeTask,
RenderType: codegen.YSKCardRenderTypeTask,
Content: ysk.YSKCardContent{
Content: codegen.YSKCardContent{
TitleIcon: "jellyfin logo",
TitleText: "APP Installing",
BodyProgress: &ysk.YSKCardProgress{},
BodyProgress: &codegen.YSKCardProgress{},
BodyIconWithText: nil,
BodyList: nil,
FooterActions: nil,
Expand All @@ -40,13 +40,26 @@ func TestNoticeDiskInsert(t *testing.T) {
Id: "long-notice:disk:insert",
CardType: codegen.YSKCardCardTypeLongNotice,
RenderType: codegen.YSKCardRenderTypeListNotice,
Content: ysk.YSKCardContent{
TitleIcon: "jellyfin logo",
TitleText: "APP Installing",
BodyProgress: nil,
BodyIconWithText: nil,
BodyList: nil,
FooterActions: nil,
Content: codegen.YSKCardContent{
TitleIcon: "ZimaOS-Logo",
TitleText: "创建数据工作站",
BodyProgress: nil,
BodyIconWithText: &codegen.YSKCardIconWithText{
Icon: "disk",
Description: "通过添加硬盘驱动器或固态硬盘来增强你的个人主机,并建立自己的个人数据中心。",
},
BodyList: nil,
FooterActions: &[]codegen.YSKCardFooterAction{
{
Side: "Right",
Style: "primary",
Text: "创建数据工作站",
MessageBus: codegen.YSKCardMessageBusAction{
Key: "open:disk:insert",
Payload: "{'type':'disk'}",
},
},
},
},
}
err := ysk.NewYSKCard(context.Background(), DiskInsertNotice, nil)
Expand Down
1 change: 0 additions & 1 deletion route/ysk.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ func (r *APIRoute) DeleteYskCard(ctx echo.Context, id string) error {
panic("unimplemented")
}

// GetYskCard implements codegen.ServerInterface.
func (r *APIRoute) GetYskCard(ctx echo.Context) error {
panic("unimplemented")
}

0 comments on commit 1078fdc

Please sign in to comment.