Skip to content

Commit 2b74a12

Browse files
authored
feat: Implement app guide module (#5115)
* add user task table * update desktop guide * desktop guide done * delete Deprecated API * support verifyAppToken * update desktop prisma * launchpad guide * update db * add desktop api * db guide done * update launchpad api * appstore done * update * fix desktop autolaunch * fix desktop refresh * update * update desktop * fix password login * fix fontweight * desktop add check * update db * update desktop * checkDeductionBalanceAndCreateTasks * update deploy * update check * update task title
1 parent 351e761 commit 2b74a12

File tree

100 files changed

+3111
-1001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3111
-1001
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
-- CreateEnum
2+
CREATE TYPE "TaskType" AS ENUM ('LAUNCHPAD', 'COSTCENTER', 'DATABASE', 'DESKTOP', 'APPSTORE');
3+
4+
-- CreateEnum
5+
CREATE TYPE "TaskStatus" AS ENUM ('NOT_COMPLETED', 'COMPLETED');
6+
7+
-- CreateTable
8+
CREATE TABLE "Task" (
9+
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
10+
"title" STRING NOT NULL,
11+
"description" STRING NOT NULL,
12+
"reward" INT8 NOT NULL,
13+
"order" INT4 NOT NULL,
14+
"isActive" BOOL NOT NULL DEFAULT true,
15+
"isNewUserTask" BOOL NOT NULL DEFAULT false,
16+
"taskType" "TaskType" NOT NULL,
17+
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
18+
"updatedAt" TIMESTAMPTZ(3) NOT NULL,
19+
20+
CONSTRAINT "Task_pkey" PRIMARY KEY ("id")
21+
);
22+
23+
-- CreateTable
24+
CREATE TABLE "UserTask" (
25+
"id" UUID NOT NULL DEFAULT gen_random_uuid(),
26+
"userUid" UUID NOT NULL,
27+
"taskId" UUID NOT NULL,
28+
"status" "TaskStatus" NOT NULL,
29+
"rewardStatus" "TaskStatus" NOT NULL,
30+
"completedAt" TIMESTAMP(3) NOT NULL,
31+
"createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
32+
"updatedAt" TIMESTAMPTZ(3) NOT NULL,
33+
34+
CONSTRAINT "UserTask_pkey" PRIMARY KEY ("id")
35+
);
36+
37+
-- CreateIndex
38+
CREATE INDEX "UserTask_taskId_idx" ON "UserTask"("taskId");
39+
40+
-- CreateIndex
41+
CREATE UNIQUE INDEX "UserTask_userUid_taskId_key" ON "UserTask"("userUid", "taskId");

frontend/desktop/prisma/global/schema.prisma

+45
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ model User {
102102
newMergeUserTransactionInfo MergeUserTransactionInfo[] @relation("newUser")
103103
DeleteUserTransactionInfo DeleteUserTransactionInfo?
104104
deleteUserLog DeleteUserLog?
105+
userTasks UserTask[]
105106
}
106107

107108
model Transfer {
@@ -323,3 +324,47 @@ enum UserStatus {
323324
LOCK_USER
324325
DELETE_USER
325326
}
327+
328+
model Task {
329+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
330+
title String
331+
description String
332+
reward BigInt
333+
order Int
334+
isActive Boolean @default(true)
335+
isNewUserTask Boolean @default(false)
336+
taskType TaskType
337+
createdAt DateTime @default(now()) @db.Timestamptz(3)
338+
updatedAt DateTime @updatedAt @db.Timestamptz(3)
339+
userTasks UserTask[]
340+
}
341+
342+
model UserTask {
343+
id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
344+
userUid String @db.Uuid
345+
taskId String @db.Uuid
346+
status TaskStatus
347+
rewardStatus TaskStatus
348+
completedAt DateTime
349+
createdAt DateTime @default(now()) @db.Timestamptz(3)
350+
updatedAt DateTime @updatedAt @db.Timestamptz(3)
351+
352+
user User @relation(fields: [userUid], references: [uid])
353+
task Task @relation(fields: [taskId], references: [id])
354+
355+
@@unique([userUid, taskId])
356+
@@index([taskId])
357+
}
358+
359+
enum TaskType {
360+
LAUNCHPAD
361+
COSTCENTER
362+
DATABASE
363+
DESKTOP
364+
APPSTORE
365+
}
366+
367+
enum TaskStatus {
368+
NOT_COMPLETED
369+
COMPLETED
370+
}

frontend/desktop/public/locales/en/common.json

+20-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
"and": "and",
1515
"app_info": "App Info",
1616
"app_launchpad": "App Launchpad",
17+
"application_desktop": "Application desktop",
18+
"application_desktop_tips": "Installed application portal",
1719
"avatar": "Avatar",
1820
"balance": "Balance",
1921
"bind": "Bind",
@@ -29,6 +31,7 @@
2931
"charge": "Charge",
3032
"click_anywhere_to_continue": "Click on any blank space to continue",
3133
"click_on_any_shadow_to_skip": "Click on any shadow to skip",
34+
"completed": "Finish",
3235
"completed_the_deployment_of_an_nginx_for_the_first_time": "Completed the deployment of an nginx for the first time",
3336
"confirm": "Confirm",
3437
"confirm_again": "confirm again",
@@ -74,6 +77,9 @@
7477
"gift_amount": "Reward {{amount}} balance.",
7578
"github": "Github",
7679
"google": "Google",
80+
"guide_applaunchpad": "Quickly deploy applications without cumbersome configuration",
81+
"guide_dbprovider": "Create multiple databases in seconds to meet different application needs",
82+
"guide_objectstorage": "Massive storage space, almost bare metal speed experience",
7783
"handle": "Handle",
7884
"have_read": "Have read",
7985
"healthy_pod": "Healthy Pod: {{count}}",
@@ -128,6 +134,7 @@
128134
"new_email": "New email",
129135
"new_phone": "New mobile number",
130136
"newpassword": "New Password",
137+
"newuser_benefit": "Benefits",
131138
"next": "Next",
132139
"next_time": "Next",
133140
"nickname": "Nickname",
@@ -199,11 +206,13 @@
199206
"scan_with_wechat": "Scan with WeChat",
200207
"sealos_copilot": "Sealos Copilot",
201208
"sealos_document": "Sealos Document",
209+
"sealos_newcomer_benefits": "Sealos Newbie Benefits",
202210
"search_apps": "Search Apps",
203211
"select_amount": "Select Amount",
204212
"service_agreement": "Service Agreement",
205213
"spend": "spend",
206214
"start_immediately": "Start",
215+
"start_now": "Go Now",
207216
"start_your_sealos_journey": "Start your Sealos journey",
208217
"status": "Status",
209218
"storage": "Storage",
@@ -224,19 +233,29 @@
224233
"user_name": "User Name",
225234
"username": "Username",
226235
"username_tips": "Username must be 3-16 characters, including letters, numbers",
236+
"usertask": {
237+
"task_appstore_desc": "Provides prefabricated multiple types of application and tool templates, click to install, and automatically deploy",
238+
"task_appstore_title": "App Store",
239+
"task_database_desc": "Distributed storage, compatible with multi-language ecology, no need to build complex multi-node architecture by yourself",
240+
"task_database_title": "Create DataBase",
241+
"task_launchpad_desc": "Create a container cluster with one click, automatically deploy container applications, and provide intranet/extranet access addresses",
242+
"task_launchpad_title": "Deploy App"
243+
},
227244
"verification_code_login": "with Phone",
228245
"verifyCode_invalid": "Verification code format is incorrect",
229246
"verify_code_tips": "6-digit Verification Code",
230247
"verify_password": "Verify password",
231248
"verifycode": "verification",
232249
"view_discount_rules": "View recharge discount rules.",
250+
"view_later": "Talk to You later",
233251
"waiting": "Waiting",
234252
"warning": "Warning",
235253
"wechat": "Wechat",
236254
"work_order": "Work Order",
237255
"year": "Year",
256+
"you_can_complete_the_following_operations": "You can do the following",
238257
"you_can_use_the_kubectl_command_directly_from_the_terminal": "You can use the kubectl command directly from the terminal",
239258
"you_can_view_fees_through_the_fee_center": "You can view fees through the fee center",
240259
"you_have_not_purchased_the_license": "You have not purchased the License",
241260
"yuan": "Yuan"
242-
}
261+
}

frontend/desktop/public/locales/zh/common.json

+20-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"amount_forecast": "根据近一天消耗金额进行预测",
1414
"and": "",
1515
"app_info": "应用信息",
16+
"application_desktop": "应用桌面",
17+
"application_desktop_tips": "已安装应用入口",
1618
"avatar": "头像",
1719
"balance": "余额",
1820
"bind": "绑定",
@@ -28,6 +30,7 @@
2830
"charge": "充值",
2931
"click_anywhere_to_continue": "点击任意空白继续",
3032
"click_on_any_shadow_to_skip": "点击任意阴影跳过",
33+
"completed": "完成",
3134
"completed_the_deployment_of_an_nginx_for_the_first_time": "部署一个 nginx ,首次完成 将",
3235
"confirm": "确认",
3336
"confirm_again": "再次确认",
@@ -71,6 +74,9 @@
7174
"gift_amount": "赠送 {{amount}} 余额.",
7275
"github": "Github",
7376
"google": "Google",
77+
"guide_applaunchpad": "快速部署应用,无需繁琐配置",
78+
"guide_dbprovider": "多种数据库秒级创建,满足不同应用需求",
79+
"guide_objectstorage": "海量存储空间,近乎裸机的速度体验",
7480
"handle": "操作",
7581
"have_read": "已读",
7682
"healthy_pod": "健康 Pod: {{count}}",
@@ -124,6 +130,7 @@
124130
"new_email": "新电子邮箱",
125131
"new_phone": "新手机号",
126132
"newpassword": "新密码",
133+
"newuser_benefit": "新手福利",
127134
"next": "下一步",
128135
"next_time": "下次吧",
129136
"nickname": "昵称",
@@ -194,11 +201,13 @@
194201
"rename": "重命名",
195202
"scan_with_wechat": "微信扫码支付",
196203
"sealos_copilot": "Sealos 小助理",
204+
"sealos_newcomer_benefits": "Sealos 新手福利",
197205
"search_apps": "搜索应用",
198206
"select_amount": "选择金额",
199207
"service_agreement": "服务协议",
200208
"spend": "",
201209
"start_immediately": "立即开始",
210+
"start_now": "立即前往",
202211
"start_your_sealos_journey": "开始您的 Sealos 之旅",
203212
"status": "状态",
204213
"storage": "存储",
@@ -217,19 +226,29 @@
217226
"user_name": "用户名",
218227
"username": "用户名",
219228
"username_tips": "用户名为3-16位的英文或数字的字符",
229+
"usertask": {
230+
"task_launchpad_desc": "一键创建容器集群,自动化 部署容器应用,并提供内 网/外网访问地址",
231+
"task_launchpad_title": "部署应用",
232+
"task_database_desc": "分布式存储,兼容多语言生态,无须自行构建复杂的多节点架构",
233+
"task_database_title": "创建数据库",
234+
"task_appstore_desc": "提供预制的多类型应用、工具模板,点击安装,自动部署",
235+
"task_appstore_title": "应用商店"
236+
},
220237
"verification_code_login": "手机号登录",
221238
"verifyCode_invalid": "验证码格式不对",
222239
"verify_code_tips": "6位验证码",
223240
"verify_password": "确认密码",
224241
"verifycode": "验证码",
225242
"view_discount_rules": "查看优惠规则",
243+
"view_later": "稍后再说",
226244
"waiting": "等待中",
227245
"warning": "警告",
228246
"wechat": "微信",
229247
"work_order": "工单",
230248
"year": "",
249+
"you_can_complete_the_following_operations": "您可以完成以下操作",
231250
"you_can_use_the_kubectl_command_directly_from_the_terminal": "您可通过终端直接使用 kubectl 命令",
232251
"you_can_view_fees_through_the_fee_center": "您可通过费用中心查看费用",
233252
"you_have_not_purchased_the_license": "您还没有购买 License",
234253
"yuan": ""
235-
}
254+
}

frontend/desktop/src/api/platform.ts

+9-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88
CommonClientConfigType,
99
TNotification
1010
} from '@/types';
11-
import { AccountCRD } from '@/types/user';
11+
import { UserTask } from '@/types/task';
1212

1313
// handle baidu
1414
export const uploadConvertData = ({ newType, bdVid }: { newType: number[]; bdVid?: string }) => {
@@ -24,12 +24,16 @@ export const uploadConvertData = ({ newType, bdVid }: { newType: number[]; bdVid
2424
});
2525
};
2626

27-
export const updateDesktopGuide = () => {
28-
return request.post('/api/account/updateGuide');
27+
export const getUserTasks = () => {
28+
return request.get<UserTask[]>('/api/account/getTasks');
2929
};
3030

31-
export const getUserAccount = () => {
32-
return request.get<AccountCRD>('/api/account/getAccount');
31+
export const checkUserTask = () => {
32+
return request.get('/api/account/checkTask');
33+
};
34+
35+
export const updateTask = (taskId: string) => {
36+
return request.post('/api/account/updateTask', { taskId });
3337
};
3438

3539
export const getAppConfig = () => {

frontend/desktop/src/components/desktop_content/apps.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export default function Apps() {
109109
gap={`${gridSpacing}px`}
110110
templateColumns={`repeat(auto-fill, minmax(${appWidth}px, 1fr))`}
111111
templateRows={`repeat(auto-fit, ${appHeight}px)`}
112+
className="apps-container"
112113
>
113114
{paginatedApps &&
114115
paginatedApps.map((item: TApp, index) => (
@@ -121,9 +122,9 @@ export default function Apps() {
121122
userSelect="none"
122123
cursor={'pointer'}
123124
onClick={(e) => handleDoubleClick(e, item)}
125+
className={item.key}
124126
>
125127
<Box
126-
className={item.key}
127128
w="60px"
128129
h="60px"
129130
p={'8px'}

0 commit comments

Comments
 (0)