From 38c64bd5da6f8f640b0cf9897dc395d1fc3d9683 Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Wed, 7 Aug 2024 15:36:14 +0800 Subject: [PATCH 1/7] fix: fix default ysk card position wrong --- utils/fixtures.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/fixtures.go b/utils/fixtures.go index f1cf366..4d480ef 100644 --- a/utils/fixtures.go +++ b/utils/fixtures.go @@ -34,7 +34,7 @@ var ( BodyList: nil, FooterActions: []ysk.YSKCardFooterAction{ { - Side: "Right", + Side: ysk.ActionPositionLeft, Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ @@ -61,7 +61,7 @@ var ( BodyList: nil, FooterActions: []ysk.YSKCardFooterAction{ { - Side: "Right", + Side: ysk.ActionPositionLeft, Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ @@ -88,7 +88,7 @@ var ( BodyList: nil, FooterActions: []ysk.YSKCardFooterAction{ { - Side: "Right", + Side: ysk.ActionPositionLeft, Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ @@ -121,7 +121,7 @@ var ( }, FooterActions: []ysk.YSKCardFooterAction{ { - Side: "Right", + Side: ysk.ActionPositionLeft, Style: "primary", Text: "更新所有", MessageBus: ysk.YSKCardMessageBusAction{ From b1f4e551e6fefb28da254ebf56700eeef69e73f5 Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Wed, 7 Aug 2024 16:40:15 +0800 Subject: [PATCH 2/7] wip --- utils/fixtures.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/fixtures.go b/utils/fixtures.go index 4d480ef..3918d64 100644 --- a/utils/fixtures.go +++ b/utils/fixtures.go @@ -92,8 +92,8 @@ var ( Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ - Key: "casaos-ui/casaos-ui:app:mircoapp_communicate", - Payload: "{'type':'file'}", + Key: "casaos-ui:open_files", + Payload: `{"url": "/modules/icewhale_files/#"}`, }, }, }, From 9970caf1812f6d1e970d3a29662ee2b93f649867 Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Wed, 7 Aug 2024 16:50:27 +0800 Subject: [PATCH 3/7] wip --- utils/fixtures.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/fixtures.go b/utils/fixtures.go index 3918d64..5fee7c5 100644 --- a/utils/fixtures.go +++ b/utils/fixtures.go @@ -39,7 +39,7 @@ var ( Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ Key: "casaos-ui/casaos-ui:app:mircoapp_communicate", - Payload: `{"access_id":"qWUS_pKWefbN-Bcxu3_nG","casaos_lang":"zh_cn","action":"open","peerType":"settings","name":"icewhale_settings","routerPath":"/storage"}`, + Payload: `{"action":"open","peerType":"settings","name":"icewhale_settings","routerPath":"/storage"}`, }, }, }, @@ -66,7 +66,7 @@ var ( Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ Key: "casaos-ui/casaos-ui:app:mircoapp_communicate", - Payload: `{"access_id":"1733L6fM4PHol8kRssFvK","casaos_lang":"zh_cn","action":"open","peerType":"settings","name":"icewhale_settings","routerPath":"/network"}`, + Payload: `{"action":"open","peerType":"settings","name":"icewhale_settings","routerPath":"/network"}`, }, }, }, From 2e6eb7ab47c6927ac136ede74e1612299957d32d Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Wed, 7 Aug 2024 16:53:22 +0800 Subject: [PATCH 4/7] wip --- utils/fixtures.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/fixtures.go b/utils/fixtures.go index 5fee7c5..e0dad39 100644 --- a/utils/fixtures.go +++ b/utils/fixtures.go @@ -34,7 +34,7 @@ var ( BodyList: nil, FooterActions: []ysk.YSKCardFooterAction{ { - Side: ysk.ActionPositionLeft, + Side: ysk.ActionPositionRight, Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ @@ -61,7 +61,7 @@ var ( BodyList: nil, FooterActions: []ysk.YSKCardFooterAction{ { - Side: ysk.ActionPositionLeft, + Side: ysk.ActionPositionRight, Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ @@ -88,7 +88,7 @@ var ( BodyList: nil, FooterActions: []ysk.YSKCardFooterAction{ { - Side: ysk.ActionPositionLeft, + Side: ysk.ActionPositionRight, Style: "primary", Text: "Learn more", MessageBus: ysk.YSKCardMessageBusAction{ @@ -121,7 +121,7 @@ var ( }, FooterActions: []ysk.YSKCardFooterAction{ { - Side: ysk.ActionPositionLeft, + Side: ysk.ActionPositionRight, Style: "primary", Text: "更新所有", MessageBus: ysk.YSKCardMessageBusAction{ From d2e58f27b257ee203662c2d12df91242f220de1b Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Thu, 8 Aug 2024 10:29:20 +0800 Subject: [PATCH 5/7] wip --- pkg/ysk/adapter.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/ysk/adapter.go b/pkg/ysk/adapter.go index 48a5857..ccdafb3 100644 --- a/pkg/ysk/adapter.go +++ b/pkg/ysk/adapter.go @@ -39,6 +39,11 @@ type YSKCard struct { Content YSKCardContent `json:"content"` } +func (ysk YSKCard) WithId(id string) YSKCard { + ysk.Id = id + return ysk +} + func (ysk YSKCard) WithTaskContent(TitleIcon, TitleText string) YSKCard { ysk.Content.TitleIcon = TitleIcon ysk.Content.TitleText = TitleText From ce570c0ebae367e249fe9521779cb86b30bd144c Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Thu, 8 Aug 2024 10:36:30 +0800 Subject: [PATCH 6/7] wip --- pkg/ysk/adapter.go | 24 +++++++++++++++--------- utils/fixtures.go | 4 ++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/pkg/ysk/adapter.go b/pkg/ysk/adapter.go index ccdafb3..5244d66 100644 --- a/pkg/ysk/adapter.go +++ b/pkg/ysk/adapter.go @@ -9,6 +9,7 @@ import ( ) type CartType string +type YSKCardIcon string const ( CardTypeTask CartType = "task" @@ -16,6 +17,13 @@ const ( CardTypeShortNote CartType = "short-notice" ) +const ( + FileIcon YSKCardIcon = "/modules/icewhale_files/appicon.svg" + DiskIcon YSKCardIcon = "" + ZimaIcon YSKCardIcon = "" + AppStoreIcon YSKCardIcon = "" +) + type RenderType string const ( @@ -44,7 +52,7 @@ func (ysk YSKCard) WithId(id string) YSKCard { return ysk } -func (ysk YSKCard) WithTaskContent(TitleIcon, TitleText string) YSKCard { +func (ysk YSKCard) WithTaskContent(TitleIcon YSKCardIcon, TitleText string) YSKCard { ysk.Content.TitleIcon = TitleIcon ysk.Content.TitleText = TitleText return ysk @@ -62,7 +70,7 @@ func (yskCard YSKCard) WithProgress(label string, progress int) YSKCard { } type YSKCardContent struct { - TitleIcon string `json:"titleIcon" gorm:"column:title_icon"` + TitleIcon YSKCardIcon `json:"titleIcon" gorm:"column:title_icon"` TitleText string `json:"titleText" gorm:"column:title_text"` BodyProgress *YSKCardProgress `json:"bodyProgress,omitempty" gorm:"serializer:json"` BodyIconWithText *YSKCardIconWithText `json:"bodyIconWithText,omitempty" gorm:"serializer:json"` @@ -89,14 +97,14 @@ type YSKCardProgress struct { } type YSKCardIconWithText struct { - Icon string `json:"icon"` - Description string `json:"description"` + Icon YSKCardIcon `json:"icon"` + Description string `json:"description"` } type YSKCardListItem struct { - Icon string `json:"icon"` - Description string `json:"description"` - RightText string `json:"rightText"` + Icon YSKCardIcon `json:"icon"` + Description string `json:"description"` + RightText string `json:"rightText"` } type YSKCardFooterAction struct { @@ -111,8 +119,6 @@ type YSKCardMessageBusAction struct { Payload string `json:"payload"` } -type YSKCardIcon = string - func ToCodegenYSKCard(card YSKCard) (codegen.YSKCard, error) { jsonBody, err := json.Marshal(card) if err != nil { diff --git a/utils/fixtures.go b/utils/fixtures.go index e0dad39..e9b39b9 100644 --- a/utils/fixtures.go +++ b/utils/fixtures.go @@ -78,11 +78,11 @@ var ( CardType: ysk.CardTypeLongNote, RenderType: ysk.RenderTypeCardIconTextNotice, Content: ysk.YSKCardContent{ - TitleIcon: "ZimaOS-Logo", + TitleIcon: ysk.FileIcon, TitleText: "File Management", BodyProgress: nil, BodyIconWithText: &ysk.YSKCardIconWithText{ - Icon: "file management", + Icon: ysk.FileIcon, Description: "Use Files to manage your data from different locations, such as your computer, phone, netdisk and server.", }, BodyList: nil, From 77b39fa02b8bd555786b4b4fe0dd63998aece0b2 Mon Sep 17 00:00:00 2001 From: CorrectRoadH Date: Thu, 8 Aug 2024 10:52:39 +0800 Subject: [PATCH 7/7] wip --- pkg/ysk/adapter.go | 7 ++++--- utils/fixtures.go | 32 +++++++++++++++++++++----------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/pkg/ysk/adapter.go b/pkg/ysk/adapter.go index 5244d66..5cf00f2 100644 --- a/pkg/ysk/adapter.go +++ b/pkg/ysk/adapter.go @@ -19,9 +19,10 @@ const ( const ( FileIcon YSKCardIcon = "/modules/icewhale_files/appicon.svg" - DiskIcon YSKCardIcon = "" - ZimaIcon YSKCardIcon = "" - AppStoreIcon YSKCardIcon = "" + DiskIcon YSKCardIcon = "/src/assets/img/storage/disk.png" + ZimaIcon YSKCardIcon = "/src/assets/img/zima.svg" + StorageIcon YSKCardIcon = "/src/assets/img/storage/storage.svg" + AppStoreIcon YSKCardIcon = "/src/assets/img/welcome/appstore.svg" ) type RenderType string diff --git a/utils/fixtures.go b/utils/fixtures.go index e9b39b9..ac6d1fd 100644 --- a/utils/fixtures.go +++ b/utils/fixtures.go @@ -10,7 +10,7 @@ var ( CardType: ysk.CardTypeTask, RenderType: ysk.RenderTypeCardTask, Content: ysk.YSKCardContent{ - TitleIcon: "jellyfin logo", + TitleIcon: ysk.AppStoreIcon, TitleText: "APP Installing", BodyProgress: &ysk.YSKCardProgress{}, BodyIconWithText: nil, @@ -24,11 +24,11 @@ var ( CardType: ysk.CardTypeLongNote, RenderType: ysk.RenderTypeCardIconTextNotice, Content: ysk.YSKCardContent{ - TitleIcon: "ZimaOS-Logo", + TitleIcon: ysk.ZimaIcon, TitleText: "Build data station", BodyProgress: nil, BodyIconWithText: &ysk.YSKCardIconWithText{ - Icon: "disk", + Icon: ysk.DiskIcon, Description: "For a data station with more storage capacity, it is recommended to add more hard drives.", }, BodyList: nil, @@ -51,11 +51,11 @@ var ( CardType: ysk.CardTypeLongNote, RenderType: ysk.RenderTypeCardIconTextNotice, Content: ysk.YSKCardContent{ - TitleIcon: "ZimaOS-Logo", + TitleIcon: ysk.ZimaIcon, TitleText: "Remote Access", BodyProgress: nil, BodyIconWithText: &ysk.YSKCardIconWithText{ - Icon: "remote access", + Icon: ysk.ZimaIcon, Description: "Configure Remote Access to access your home cloud remotely from anywhere.", }, BodyList: nil, @@ -105,7 +105,7 @@ var ( CardType: ysk.CardTypeShortNote, RenderType: ysk.RenderTypeCardListNotice, Content: ysk.YSKCardContent{ - TitleIcon: "app store logo", + TitleIcon: ysk.AppStoreIcon, TitleText: "有应用更新", BodyList: []ysk.YSKCardListItem{ { @@ -138,20 +138,30 @@ var ( CardType: ysk.CardTypeLongNote, RenderType: ysk.RenderTypeCardListNotice, Content: ysk.YSKCardContent{ - TitleIcon: "disk logo", - TitleText: "硬盘插入", + TitleIcon: ysk.ZimaIcon, + TitleText: "Found a new device", BodyList: []ysk.YSKCardListItem{ { - Icon: "disk", + Icon: ysk.StorageIcon, Description: "ZimaOS-HD", RightText: "2TB", }, { - Icon: "disk", + Icon: ysk.StorageIcon, Description: "Safe-Storage", RightText: "2TB", }, }, - FooterActions: nil, + FooterActions: []ysk.YSKCardFooterAction{ + { + Side: ysk.ActionPositionRight, + Style: "primary", + Text: "Manage", + MessageBus: ysk.YSKCardMessageBusAction{ + Key: "casaos-ui/casaos-ui:app:mircoapp_communicate", + Payload: `{"action":"open","peerType":"settings","name":"icewhale_settings","routerPath":"/storage"}`, + }, + }, + }, }, } )