diff --git a/backend/app/api/v1/dashboard.go b/backend/app/api/v1/dashboard.go index c38db42e5..d15e4e345 100644 --- a/backend/app/api/v1/dashboard.go +++ b/backend/app/api/v1/dashboard.go @@ -2,6 +2,7 @@ package v1 import ( "errors" + "github.com/1Panel-dev/1Panel/backend/app/dto" "github.com/1Panel-dev/1Panel/backend/app/api/v1/helper" @@ -56,7 +57,7 @@ func (b *BaseApi) LoadDashboardBaseInfo(c *gin.Context) { // @Tags Dashboard // @Summary Load dashboard current info // @Description 获取首页实时数据 -// @Accept json、 +// @Accept json // @Param request body dto.DashboardReq true "request" // @Success 200 {object} dto.DashboardCurrent // @Security ApiKeyAuth diff --git a/backend/app/api/v1/runtime.go b/backend/app/api/v1/runtime.go index e4eef9e86..b6e5c608b 100644 --- a/backend/app/api/v1/runtime.go +++ b/backend/app/api/v1/runtime.go @@ -62,7 +62,7 @@ func (b *BaseApi) CreateRuntime(c *gin.Context) { // @Success 200 // @Security ApiKeyAuth // @Router /runtimes/del [post] -// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除网站 [name]","formatEN":"Delete website [name]"} +// @x-panel-log {"bodyKeys":["id"],"paramKeys":[],"BeforeFunctions":[],"formatZH":"删除运行环境 [name]","formatEN":"Delete runtime [name]"} func (b *BaseApi) DeleteRuntime(c *gin.Context) { var req request.RuntimeDelete if err := helper.CheckBindAndValidate(&req, c); err != nil { diff --git a/cmd/server/docs/docs.go b/cmd/server/docs/docs.go index 2d5684495..cf06e4b60 100644 --- a/cmd/server/docs/docs.go +++ b/cmd/server/docs/docs.go @@ -3872,8 +3872,8 @@ const docTemplate = `{ } } }, - "/dashboard/current/:ioOption/:netOption": { - "get": { + "/dashboard/current": { + "post": { "security": [ { "ApiKeyAuth": [] @@ -3889,18 +3889,13 @@ const docTemplate = `{ "summary": "Load dashboard current info", "parameters": [ { - "type": "string", "description": "request", - "name": "ioOption", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "request", - "name": "netOption", - "in": "path", - "required": true + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.DashboardReq" + } } ], "responses": { @@ -9130,8 +9125,8 @@ const docTemplate = `{ "bodyKeys": [ "id" ], - "formatEN": "Delete website [name]", - "formatZH": "删除网站 [name]", + "formatEN": "Delete runtime [name]", + "formatZH": "删除运行环境 [name]", "paramKeys": [] } } @@ -10808,7 +10803,7 @@ const docTemplate = `{ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.SearchWithPage" + "$ref": "#/definitions/dto.PageSnapshot" } } ], @@ -10822,6 +10817,39 @@ const docTemplate = `{ } } }, + "/settings/snapshot/size": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "获取系统快照大小", + "consumes": [ + "application/json" + ], + "tags": [ + "System Setting" + ], + "summary": "Load system snapshot size", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PageSnapshot" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/settings/snapshot/status": { "post": { "security": [ @@ -15591,6 +15619,12 @@ const docTemplate = `{ "dto.ClamCreate": { "type": "object", "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "description": { "type": "string" }, @@ -15689,6 +15723,12 @@ const docTemplate = `{ "dto.ClamUpdate": { "type": "object", "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "description": { "type": "string" }, @@ -15805,6 +15845,9 @@ const docTemplate = `{ "detailName": { "type": "string" }, + "fileName": { + "type": "string" + }, "name": { "type": "string" }, @@ -15876,6 +15919,12 @@ const docTemplate = `{ "from" ], "properties": { + "env": { + "type": "array", + "items": { + "type": "string" + } + }, "file": { "type": "string" }, @@ -15902,8 +15951,7 @@ const docTemplate = `{ "type": "object", "required": [ "name", - "operation", - "path" + "operation" ], "properties": { "name": { @@ -15912,9 +15960,11 @@ const docTemplate = `{ "operation": { "type": "string", "enum": [ + "up", "start", "stop", - "down" + "down", + "delete" ] }, "path": { @@ -15987,6 +16037,12 @@ const docTemplate = `{ "content": { "type": "string" }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, "name": { "type": "string" }, @@ -16162,6 +16218,7 @@ const docTemplate = `{ "operation": { "type": "string", "enum": [ + "up", "start", "stop", "restart", @@ -16309,6 +16366,12 @@ const docTemplate = `{ "type" ], "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "appID": { "type": "string" }, @@ -16383,9 +16446,16 @@ const docTemplate = `{ "required": [ "id", "name", - "spec" + "spec", + "type" ], "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "appID": { "type": "string" }, @@ -16432,6 +16502,9 @@ const docTemplate = `{ "spec": { "type": "string" }, + "type": { + "type": "string" + }, "url": { "type": "string" }, @@ -16557,6 +16630,9 @@ const docTemplate = `{ "dto.DashboardBase": { "type": "object", "properties": { + "SystemProxy": { + "type": "string" + }, "appInstalledNumber": { "type": "integer" }, @@ -16581,6 +16657,9 @@ const docTemplate = `{ "hostname": { "type": "string" }, + "ipv4Addr": { + "type": "string" + }, "kernelArch": { "type": "string" }, @@ -16705,6 +16784,26 @@ const docTemplate = `{ }, "uptime": { "type": "integer" + }, + "xpuData": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.XPUInfo" + } + } + } + }, + "dto.DashboardReq": { + "type": "object", + "properties": { + "ioOption": { + "type": "string" + }, + "netOption": { + "type": "string" + }, + "scope": { + "type": "string" } } }, @@ -18608,6 +18707,41 @@ const docTemplate = `{ } } }, + "dto.PageSnapshot": { + "type": "object", + "required": [ + "order", + "orderBy", + "page", + "pageSize" + ], + "properties": { + "info": { + "type": "string" + }, + "order": { + "type": "string", + "enum": [ + "null", + "ascending", + "descending" + ] + }, + "orderBy": { + "type": "string", + "enum": [ + "name", + "created_at" + ] + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + } + } + }, "dto.PasswordUpdate": { "type": "object", "required": [ @@ -19273,6 +19407,9 @@ const docTemplate = `{ "sslType" ], "properties": { + "autoRestart": { + "type": "string" + }, "cert": { "type": "string" }, @@ -19501,6 +19638,9 @@ const docTemplate = `{ "appStoreVersion": { "type": "string" }, + "autoRestart": { + "type": "string" + }, "bindAddress": { "type": "string" }, @@ -19925,6 +20065,32 @@ const docTemplate = `{ } } }, + "dto.XPUInfo": { + "type": "object", + "properties": { + "deviceID": { + "type": "integer" + }, + "deviceName": { + "type": "string" + }, + "memory": { + "type": "string" + }, + "memoryUsed": { + "type": "string" + }, + "memoryUtil": { + "type": "string" + }, + "power": { + "type": "string" + }, + "temperature": { + "type": "string" + } + } + }, "files.FileInfo": { "type": "object", "properties": { @@ -22434,6 +22600,9 @@ const docTemplate = `{ "proxyPass": { "type": "string" }, + "proxySSLName": { + "type": "string" + }, "replaces": { "type": "object", "additionalProperties": { @@ -22476,6 +22645,9 @@ const docTemplate = `{ "ID": { "type": "integer" }, + "disableLog": { + "type": "boolean" + }, "nameservers": { "type": "array", "items": { diff --git a/cmd/server/docs/swagger.json b/cmd/server/docs/swagger.json index c6bd7ff77..652a943b2 100644 --- a/cmd/server/docs/swagger.json +++ b/cmd/server/docs/swagger.json @@ -3866,8 +3866,8 @@ } } }, - "/dashboard/current/:ioOption/:netOption": { - "get": { + "/dashboard/current": { + "post": { "security": [ { "ApiKeyAuth": [] @@ -3883,18 +3883,13 @@ "summary": "Load dashboard current info", "parameters": [ { - "type": "string", "description": "request", - "name": "ioOption", - "in": "path", - "required": true - }, - { - "type": "string", - "description": "request", - "name": "netOption", - "in": "path", - "required": true + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.DashboardReq" + } } ], "responses": { @@ -9124,8 +9119,8 @@ "bodyKeys": [ "id" ], - "formatEN": "Delete website [name]", - "formatZH": "删除网站 [name]", + "formatEN": "Delete runtime [name]", + "formatZH": "删除运行环境 [name]", "paramKeys": [] } } @@ -10802,7 +10797,7 @@ "in": "body", "required": true, "schema": { - "$ref": "#/definitions/dto.SearchWithPage" + "$ref": "#/definitions/dto.PageSnapshot" } } ], @@ -10816,6 +10811,39 @@ } } }, + "/settings/snapshot/size": { + "post": { + "security": [ + { + "ApiKeyAuth": [] + } + ], + "description": "获取系统快照大小", + "consumes": [ + "application/json" + ], + "tags": [ + "System Setting" + ], + "summary": "Load system snapshot size", + "parameters": [ + { + "description": "request", + "name": "request", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dto.PageSnapshot" + } + } + ], + "responses": { + "200": { + "description": "OK" + } + } + } + }, "/settings/snapshot/status": { "post": { "security": [ @@ -15585,6 +15613,12 @@ "dto.ClamCreate": { "type": "object", "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "description": { "type": "string" }, @@ -15683,6 +15717,12 @@ "dto.ClamUpdate": { "type": "object", "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "description": { "type": "string" }, @@ -15799,6 +15839,9 @@ "detailName": { "type": "string" }, + "fileName": { + "type": "string" + }, "name": { "type": "string" }, @@ -15870,6 +15913,12 @@ "from" ], "properties": { + "env": { + "type": "array", + "items": { + "type": "string" + } + }, "file": { "type": "string" }, @@ -15896,8 +15945,7 @@ "type": "object", "required": [ "name", - "operation", - "path" + "operation" ], "properties": { "name": { @@ -15906,9 +15954,11 @@ "operation": { "type": "string", "enum": [ + "up", "start", "stop", - "down" + "down", + "delete" ] }, "path": { @@ -15981,6 +16031,12 @@ "content": { "type": "string" }, + "env": { + "type": "array", + "items": { + "type": "string" + } + }, "name": { "type": "string" }, @@ -16156,6 +16212,7 @@ "operation": { "type": "string", "enum": [ + "up", "start", "stop", "restart", @@ -16303,6 +16360,12 @@ "type" ], "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "appID": { "type": "string" }, @@ -16377,9 +16440,16 @@ "required": [ "id", "name", - "spec" + "spec", + "type" ], "properties": { + "alertCount": { + "type": "integer" + }, + "alertTitle": { + "type": "string" + }, "appID": { "type": "string" }, @@ -16426,6 +16496,9 @@ "spec": { "type": "string" }, + "type": { + "type": "string" + }, "url": { "type": "string" }, @@ -16551,6 +16624,9 @@ "dto.DashboardBase": { "type": "object", "properties": { + "SystemProxy": { + "type": "string" + }, "appInstalledNumber": { "type": "integer" }, @@ -16575,6 +16651,9 @@ "hostname": { "type": "string" }, + "ipv4Addr": { + "type": "string" + }, "kernelArch": { "type": "string" }, @@ -16699,6 +16778,26 @@ }, "uptime": { "type": "integer" + }, + "xpuData": { + "type": "array", + "items": { + "$ref": "#/definitions/dto.XPUInfo" + } + } + } + }, + "dto.DashboardReq": { + "type": "object", + "properties": { + "ioOption": { + "type": "string" + }, + "netOption": { + "type": "string" + }, + "scope": { + "type": "string" } } }, @@ -18602,6 +18701,41 @@ } } }, + "dto.PageSnapshot": { + "type": "object", + "required": [ + "order", + "orderBy", + "page", + "pageSize" + ], + "properties": { + "info": { + "type": "string" + }, + "order": { + "type": "string", + "enum": [ + "null", + "ascending", + "descending" + ] + }, + "orderBy": { + "type": "string", + "enum": [ + "name", + "created_at" + ] + }, + "page": { + "type": "integer" + }, + "pageSize": { + "type": "integer" + } + } + }, "dto.PasswordUpdate": { "type": "object", "required": [ @@ -19267,6 +19401,9 @@ "sslType" ], "properties": { + "autoRestart": { + "type": "string" + }, "cert": { "type": "string" }, @@ -19495,6 +19632,9 @@ "appStoreVersion": { "type": "string" }, + "autoRestart": { + "type": "string" + }, "bindAddress": { "type": "string" }, @@ -19919,6 +20059,32 @@ } } }, + "dto.XPUInfo": { + "type": "object", + "properties": { + "deviceID": { + "type": "integer" + }, + "deviceName": { + "type": "string" + }, + "memory": { + "type": "string" + }, + "memoryUsed": { + "type": "string" + }, + "memoryUtil": { + "type": "string" + }, + "power": { + "type": "string" + }, + "temperature": { + "type": "string" + } + } + }, "files.FileInfo": { "type": "object", "properties": { @@ -22428,6 +22594,9 @@ "proxyPass": { "type": "string" }, + "proxySSLName": { + "type": "string" + }, "replaces": { "type": "object", "additionalProperties": { @@ -22470,6 +22639,9 @@ "ID": { "type": "integer" }, + "disableLog": { + "type": "boolean" + }, "nameservers": { "type": "array", "items": { diff --git a/cmd/server/docs/swagger.yaml b/cmd/server/docs/swagger.yaml index 8a571e9c6..48c049edc 100644 --- a/cmd/server/docs/swagger.yaml +++ b/cmd/server/docs/swagger.yaml @@ -233,6 +233,10 @@ definitions: type: object dto.ClamCreate: properties: + alertCount: + type: integer + alertTitle: + type: string description: type: string infectedDir: @@ -297,6 +301,10 @@ definitions: type: object dto.ClamUpdate: properties: + alertCount: + type: integer + alertTitle: + type: string description: type: string id: @@ -371,6 +379,8 @@ definitions: properties: detailName: type: string + fileName: + type: string name: type: string secret: @@ -424,6 +434,10 @@ definitions: type: object dto.ComposeCreate: properties: + env: + items: + type: string + type: array file: type: string from: @@ -447,9 +461,11 @@ definitions: type: string operation: enum: + - up - start - stop - down + - delete type: string path: type: string @@ -458,7 +474,6 @@ definitions: required: - name - operation - - path type: object dto.ComposeTemplateCreate: properties: @@ -497,6 +512,10 @@ definitions: properties: content: type: string + env: + items: + type: string + type: array name: type: string path: @@ -614,6 +633,7 @@ definitions: type: array operation: enum: + - up - start - stop - restart @@ -713,6 +733,10 @@ definitions: type: object dto.CronjobCreate: properties: + alertCount: + type: integer + alertTitle: + type: string appID: type: string backupAccounts: @@ -765,6 +789,10 @@ definitions: type: object dto.CronjobUpdate: properties: + alertCount: + type: integer + alertTitle: + type: string appID: type: string backupAccounts: @@ -796,6 +824,8 @@ definitions: type: string spec: type: string + type: + type: string url: type: string website: @@ -804,6 +834,7 @@ definitions: - id - name - spec + - type type: object dto.CronjobUpdateStatus: properties: @@ -883,6 +914,8 @@ definitions: type: object dto.DashboardBase: properties: + SystemProxy: + type: string appInstalledNumber: type: integer cpuCores: @@ -899,6 +932,8 @@ definitions: type: integer hostname: type: string + ipv4Addr: + type: string kernelArch: type: string kernelVersion: @@ -982,6 +1017,19 @@ definitions: type: string uptime: type: integer + xpuData: + items: + $ref: '#/definitions/dto.XPUInfo' + type: array + type: object + dto.DashboardReq: + properties: + ioOption: + type: string + netOption: + type: string + scope: + type: string type: object dto.DatabaseCreate: properties: @@ -2278,6 +2326,31 @@ definitions: total: type: integer type: object + dto.PageSnapshot: + properties: + info: + type: string + order: + enum: + - "null" + - ascending + - descending + type: string + orderBy: + enum: + - name + - created_at + type: string + page: + type: integer + pageSize: + type: integer + required: + - order + - orderBy + - page + - pageSize + type: object dto.PasswordUpdate: properties: newPassword: @@ -2723,6 +2796,8 @@ definitions: type: object dto.SSLUpdate: properties: + autoRestart: + type: string cert: type: string domain: @@ -2882,6 +2957,8 @@ definitions: type: string appStoreVersion: type: string + autoRestart: + type: string bindAddress: type: string bindDomain: @@ -3161,6 +3238,23 @@ definitions: type: type: string type: object + dto.XPUInfo: + properties: + deviceID: + type: integer + deviceName: + type: string + memory: + type: string + memoryUsed: + type: string + memoryUtil: + type: string + power: + type: string + temperature: + type: string + type: object files.FileInfo: properties: content: @@ -4836,6 +4930,8 @@ definitions: type: string proxyPass: type: string + proxySSLName: + type: string replaces: additionalProperties: type: string @@ -4868,6 +4964,8 @@ definitions: properties: ID: type: integer + disableLog: + type: boolean nameservers: items: type: string @@ -7981,22 +8079,18 @@ paths: summary: Load os info tags: - Dashboard - /dashboard/current/:ioOption/:netOption: - get: + /dashboard/current: + post: consumes: - application/json description: 获取首页实时数据 parameters: - description: request - in: path - name: ioOption - required: true - type: string - - description: request - in: path - name: netOption + in: body + name: request required: true - type: string + schema: + $ref: '#/definitions/dto.DashboardReq' responses: "200": description: OK @@ -11310,8 +11404,8 @@ paths: BeforeFunctions: [] bodyKeys: - id - formatEN: Delete website [name] - formatZH: 删除网站 [name] + formatEN: Delete runtime [name] + formatZH: 删除运行环境 [name] paramKeys: [] /runtimes/node/modules: post: @@ -12368,7 +12462,7 @@ paths: name: request required: true schema: - $ref: '#/definitions/dto.SearchWithPage' + $ref: '#/definitions/dto.PageSnapshot' responses: "200": description: OK @@ -12379,6 +12473,26 @@ paths: summary: Page system snapshot tags: - System Setting + /settings/snapshot/size: + post: + consumes: + - application/json + description: 获取系统快照大小 + parameters: + - description: request + in: body + name: request + required: true + schema: + $ref: '#/definitions/dto.PageSnapshot' + responses: + "200": + description: OK + security: + - ApiKeyAuth: [] + summary: Load system snapshot size + tags: + - System Setting /settings/snapshot/status: post: consumes: