From 18bf17fe14141d581e52b7b59ad38d6cbeebf9b2 Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Mon, 26 Aug 2024 18:08:01 +0800 Subject: [PATCH 1/2] Refine cover image display for attachment list --- api-docs/openapi/v3_0/aggregated.json | 843 +++++++++++++++++- .../v3_0/apis_console.api_v1alpha1.json | 6 + .../v3_0/apis_extension.api_v1alpha1.json | 801 ++++++++++++++++- .../openapi/v3_0/apis_uc.api_v1alpha1.json | 6 + .../contents/attachments/AttachmentList.vue | 5 +- .../components/AttachmentDetailModal.vue | 5 +- .../CoreSelectorProvider.vue | 11 +- .../api-client/src/.openapi-generator/FILES | 10 + ui/packages/api-client/src/api.ts | 3 + .../src/api/local-thumbnail-v1alpha1-api.ts | 665 ++++++++++++++ .../src/api/thumbnail-v1alpha1-api.ts | 665 ++++++++++++++ .../src/api/thumbnail-v1alpha1-public-api.ts | 165 ++++ .../src/models/attachment-status.ts | 6 + ui/packages/api-client/src/models/index.ts | 7 + .../src/models/local-thumbnail-list.ts | 81 ++ .../src/models/local-thumbnail-spec.ts | 70 ++ .../src/models/local-thumbnail-status.ts | 39 + .../api-client/src/models/local-thumbnail.ts | 63 ++ .../api-client/src/models/thumbnail-list.ts | 81 ++ .../api-client/src/models/thumbnail-spec.ts | 58 ++ .../api-client/src/models/thumbnail.ts | 54 ++ 21 files changed, 3570 insertions(+), 74 deletions(-) create mode 100644 ui/packages/api-client/src/api/local-thumbnail-v1alpha1-api.ts create mode 100644 ui/packages/api-client/src/api/thumbnail-v1alpha1-api.ts create mode 100644 ui/packages/api-client/src/api/thumbnail-v1alpha1-public-api.ts create mode 100644 ui/packages/api-client/src/models/local-thumbnail-list.ts create mode 100644 ui/packages/api-client/src/models/local-thumbnail-spec.ts create mode 100644 ui/packages/api-client/src/models/local-thumbnail-status.ts create mode 100644 ui/packages/api-client/src/models/local-thumbnail.ts create mode 100644 ui/packages/api-client/src/models/thumbnail-list.ts create mode 100644 ui/packages/api-client/src/models/thumbnail-spec.ts create mode 100644 ui/packages/api-client/src/models/thumbnail.ts diff --git a/api-docs/openapi/v3_0/aggregated.json b/api-docs/openapi/v3_0/aggregated.json index 5a6dd3ca99..b491544c22 100644 --- a/api-docs/openapi/v3_0/aggregated.json +++ b/api-docs/openapi/v3_0/aggregated.json @@ -6918,6 +6918,48 @@ ] } }, + "/apis/api.storage.halo.run/v1alpha1/thumbnails/-/via-uri": { + "get": { + "description": "Get thumbnail by URI", + "operationId": "GetThumbnailByUri", + "parameters": [ + { + "description": "The URI of the image", + "in": "query", + "name": "uri", + "required": true, + "schema": { + "type": "string" + } + }, + { + "description": "The width of the thumbnail", + "in": "query", + "name": "width", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "default": { + "content": { + "*/*": { + "schema": { + "type": "string", + "format": "binary" + } + } + }, + "description": "default response" + } + }, + "tags": [ + "ThumbnailV1alpha1Public" + ] + } + }, "/apis/auth.halo.run/v1alpha1/authproviders": { "get": { "description": "List AuthProvider", @@ -13415,6 +13457,243 @@ ] } }, + "/apis/storage.halo.run/v1alpha1/localthumbnails": { + "get": { + "description": "List LocalThumbnail", + "operationId": "listLocalThumbnail", + "parameters": [ + { + "description": "Page number. Default is 0.", + "in": "query", + "name": "page", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Size number. Default is 0.", + "in": "query", + "name": "size", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Label selector. e.g.: hidden!\u003dtrue", + "in": "query", + "name": "labelSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Field selector. e.g.: metadata.name\u003d\u003dhalo", + "in": "query", + "name": "fieldSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.", + "in": "query", + "name": "sort", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnailList" + } + } + }, + "description": "Response localthumbnails" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "post": { + "description": "Create LocalThumbnail", + "operationId": "createLocalThumbnail", + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Fresh localthumbnail" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response localthumbnails created just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + } + }, + "/apis/storage.halo.run/v1alpha1/localthumbnails/{name}": { + "delete": { + "description": "Delete LocalThumbnail", + "operationId": "deleteLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Response localthumbnail deleted just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "get": { + "description": "Get LocalThumbnail", + "operationId": "getLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response single localthumbnail" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "patch": { + "description": "Patch LocalThumbnail", + "operationId": "patchLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/JsonPatch" + } + } + } + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response localthumbnail patched just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "put": { + "description": "Update LocalThumbnail", + "operationId": "updateLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Updated localthumbnail" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response localthumbnails updated just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + } + }, "/apis/storage.halo.run/v1alpha1/policies": { "get": { "description": "List Policy", @@ -13722,46 +14001,283 @@ } }, "tags": [ - "PolicyTemplateV1alpha1" + "PolicyTemplateV1alpha1" + ] + }, + "post": { + "description": "Create PolicyTemplate", + "operationId": "createPolicyTemplate", + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Fresh policytemplate" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response policytemplates created just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + } + }, + "/apis/storage.halo.run/v1alpha1/policytemplates/{name}": { + "delete": { + "description": "Delete PolicyTemplate", + "operationId": "deletePolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Response policytemplate deleted just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + }, + "get": { + "description": "Get PolicyTemplate", + "operationId": "getPolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response single policytemplate" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + }, + "patch": { + "description": "Patch PolicyTemplate", + "operationId": "patchPolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/JsonPatch" + } + } + } + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response policytemplate patched just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + }, + "put": { + "description": "Update PolicyTemplate", + "operationId": "updatePolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Updated policytemplate" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response policytemplates updated just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + } + }, + "/apis/storage.halo.run/v1alpha1/thumbnails": { + "get": { + "description": "List Thumbnail", + "operationId": "listThumbnail", + "parameters": [ + { + "description": "Page number. Default is 0.", + "in": "query", + "name": "page", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Size number. Default is 0.", + "in": "query", + "name": "size", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Label selector. e.g.: hidden!\u003dtrue", + "in": "query", + "name": "labelSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Field selector. e.g.: metadata.name\u003d\u003dhalo", + "in": "query", + "name": "fieldSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.", + "in": "query", + "name": "sort", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/ThumbnailList" + } + } + }, + "description": "Response thumbnails" + } + }, + "tags": [ + "ThumbnailV1alpha1" ] }, "post": { - "description": "Create PolicyTemplate", - "operationId": "createPolicyTemplate", + "description": "Create Thumbnail", + "operationId": "createThumbnail", "requestBody": { "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Fresh policytemplate" + "description": "Fresh thumbnail" }, "responses": { "200": { "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response policytemplates created just now" + "description": "Response thumbnails created just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] } }, - "/apis/storage.halo.run/v1alpha1/policytemplates/{name}": { + "/apis/storage.halo.run/v1alpha1/thumbnails/{name}": { "delete": { - "description": "Delete PolicyTemplate", - "operationId": "deletePolicyTemplate", + "description": "Delete Thumbnail", + "operationId": "deleteThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -13772,19 +14288,19 @@ ], "responses": { "200": { - "description": "Response policytemplate deleted just now" + "description": "Response thumbnail deleted just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] }, "get": { - "description": "Get PolicyTemplate", - "operationId": "getPolicyTemplate", + "description": "Get Thumbnail", + "operationId": "getThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -13798,23 +14314,23 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response single policytemplate" + "description": "Response single thumbnail" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] }, "patch": { - "description": "Patch PolicyTemplate", - "operationId": "patchPolicyTemplate", + "description": "Patch Thumbnail", + "operationId": "patchThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -13837,23 +14353,23 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response policytemplate patched just now" + "description": "Response thumbnail patched just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] }, "put": { - "description": "Update PolicyTemplate", - "operationId": "updatePolicyTemplate", + "description": "Update Thumbnail", + "operationId": "updateThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -13866,26 +14382,26 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Updated policytemplate" + "description": "Updated thumbnail" }, "responses": { "200": { "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response policytemplates updated just now" + "description": "Response thumbnails updated just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] } }, @@ -15225,6 +15741,12 @@ "permalink": { "type": "string", "description": "Permalink of attachment.\nIf it is in local storage, the public URL will be set.\nIf it is in s3 storage, the Object URL will be set.\n" + }, + "thumbnails": { + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, @@ -18188,6 +18710,145 @@ }, "description": "A chunk of items." }, + "LocalThumbnail": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "type": "object", + "properties": { + "apiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "spec": { + "$ref": "#/components/schemas/LocalThumbnailSpec" + }, + "status": { + "$ref": "#/components/schemas/LocalThumbnailStatus" + } + } + }, + "LocalThumbnailList": { + "required": [ + "first", + "hasNext", + "hasPrevious", + "items", + "last", + "page", + "size", + "total", + "totalPages" + ], + "type": "object", + "properties": { + "first": { + "type": "boolean", + "description": "Indicates whether current page is the first page." + }, + "hasNext": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "hasPrevious": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "items": { + "type": "array", + "description": "A chunk of items.", + "items": { + "$ref": "#/components/schemas/LocalThumbnail" + } + }, + "last": { + "type": "boolean", + "description": "Indicates whether current page is the last page." + }, + "page": { + "type": "integer", + "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "size": { + "type": "integer", + "description": "Size of each page. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "total": { + "type": "integer", + "description": "Total elements.", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "description": "Indicates total pages.", + "format": "int64" + } + } + }, + "LocalThumbnailSpec": { + "required": [ + "filePath", + "imageSignature", + "imageUri", + "size", + "thumbSignature", + "thumbnailUri" + ], + "type": "object", + "properties": { + "filePath": { + "type": "string" + }, + "imageSignature": { + "minLength": 1, + "type": "string" + }, + "imageUri": { + "minLength": 1, + "type": "string" + }, + "size": { + "type": "string", + "enum": [ + "S", + "M", + "L", + "XL" + ] + }, + "thumbSignature": { + "minLength": 1, + "type": "string" + }, + "thumbnailUri": { + "minLength": 1, + "type": "string" + } + } + }, + "LocalThumbnailStatus": { + "type": "object", + "properties": { + "phase": { + "type": "string", + "enum": [ + "PENDING", + "SUCCEEDED", + "FAILED" + ] + } + } + }, "LoginHistory": { "required": [ "loginAt", @@ -22620,6 +23281,120 @@ } } }, + "Thumbnail": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "type": "object", + "properties": { + "apiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "spec": { + "$ref": "#/components/schemas/ThumbnailSpec" + } + } + }, + "ThumbnailList": { + "required": [ + "first", + "hasNext", + "hasPrevious", + "items", + "last", + "page", + "size", + "total", + "totalPages" + ], + "type": "object", + "properties": { + "first": { + "type": "boolean", + "description": "Indicates whether current page is the first page." + }, + "hasNext": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "hasPrevious": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "items": { + "type": "array", + "description": "A chunk of items.", + "items": { + "$ref": "#/components/schemas/Thumbnail" + } + }, + "last": { + "type": "boolean", + "description": "Indicates whether current page is the last page." + }, + "page": { + "type": "integer", + "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "size": { + "type": "integer", + "description": "Size of each page. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "total": { + "type": "integer", + "description": "Total elements.", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "description": "Indicates total pages.", + "format": "int64" + } + } + }, + "ThumbnailSpec": { + "required": [ + "imageSignature", + "imageUri", + "size", + "thumbnailUri" + ], + "type": "object", + "properties": { + "imageSignature": { + "minLength": 1, + "type": "string" + }, + "imageUri": { + "minLength": 1, + "type": "string" + }, + "size": { + "type": "string", + "enum": [ + "S", + "M", + "L", + "XL" + ] + }, + "thumbnailUri": { + "minLength": 1, + "type": "string" + } + } + }, "TotpAuthLinkResponse": { "type": "object", "properties": { diff --git a/api-docs/openapi/v3_0/apis_console.api_v1alpha1.json b/api-docs/openapi/v3_0/apis_console.api_v1alpha1.json index f763704278..8483de34f7 100644 --- a/api-docs/openapi/v3_0/apis_console.api_v1alpha1.json +++ b/api-docs/openapi/v3_0/apis_console.api_v1alpha1.json @@ -3393,6 +3393,12 @@ "permalink": { "type": "string", "description": "Permalink of attachment.\nIf it is in local storage, the public URL will be set.\nIf it is in s3 storage, the Object URL will be set.\n" + }, + "thumbnails": { + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, diff --git a/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json b/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json index 8015200160..92018c3729 100644 --- a/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json +++ b/api-docs/openapi/v3_0/apis_extension.api_v1alpha1.json @@ -7127,6 +7127,243 @@ ] } }, + "/apis/storage.halo.run/v1alpha1/localthumbnails": { + "get": { + "description": "List LocalThumbnail", + "operationId": "listLocalThumbnail", + "parameters": [ + { + "description": "Page number. Default is 0.", + "in": "query", + "name": "page", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Size number. Default is 0.", + "in": "query", + "name": "size", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Label selector. e.g.: hidden!\u003dtrue", + "in": "query", + "name": "labelSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Field selector. e.g.: metadata.name\u003d\u003dhalo", + "in": "query", + "name": "fieldSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.", + "in": "query", + "name": "sort", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnailList" + } + } + }, + "description": "Response localthumbnails" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "post": { + "description": "Create LocalThumbnail", + "operationId": "createLocalThumbnail", + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Fresh localthumbnail" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response localthumbnails created just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + } + }, + "/apis/storage.halo.run/v1alpha1/localthumbnails/{name}": { + "delete": { + "description": "Delete LocalThumbnail", + "operationId": "deleteLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Response localthumbnail deleted just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "get": { + "description": "Get LocalThumbnail", + "operationId": "getLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response single localthumbnail" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "patch": { + "description": "Patch LocalThumbnail", + "operationId": "patchLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/JsonPatch" + } + } + } + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response localthumbnail patched just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + }, + "put": { + "description": "Update LocalThumbnail", + "operationId": "updateLocalThumbnail", + "parameters": [ + { + "description": "Name of localthumbnail", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Updated localthumbnail" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/LocalThumbnail" + } + } + }, + "description": "Response localthumbnails updated just now" + } + }, + "tags": [ + "LocalThumbnailV1alpha1" + ] + } + }, "/apis/storage.halo.run/v1alpha1/policies": { "get": { "description": "List Policy", @@ -7434,46 +7671,283 @@ } }, "tags": [ - "PolicyTemplateV1alpha1" + "PolicyTemplateV1alpha1" + ] + }, + "post": { + "description": "Create PolicyTemplate", + "operationId": "createPolicyTemplate", + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Fresh policytemplate" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response policytemplates created just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + } + }, + "/apis/storage.halo.run/v1alpha1/policytemplates/{name}": { + "delete": { + "description": "Delete PolicyTemplate", + "operationId": "deletePolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Response policytemplate deleted just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + }, + "get": { + "description": "Get PolicyTemplate", + "operationId": "getPolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response single policytemplate" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + }, + "patch": { + "description": "Patch PolicyTemplate", + "operationId": "patchPolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "application/json-patch+json": { + "schema": { + "$ref": "#/components/schemas/JsonPatch" + } + } + } + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response policytemplate patched just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + }, + "put": { + "description": "Update PolicyTemplate", + "operationId": "updatePolicyTemplate", + "parameters": [ + { + "description": "Name of policytemplate", + "in": "path", + "name": "name", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Updated policytemplate" + }, + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/PolicyTemplate" + } + } + }, + "description": "Response policytemplates updated just now" + } + }, + "tags": [ + "PolicyTemplateV1alpha1" + ] + } + }, + "/apis/storage.halo.run/v1alpha1/thumbnails": { + "get": { + "description": "List Thumbnail", + "operationId": "listThumbnail", + "parameters": [ + { + "description": "Page number. Default is 0.", + "in": "query", + "name": "page", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Size number. Default is 0.", + "in": "query", + "name": "size", + "schema": { + "type": "integer", + "format": "int32" + } + }, + { + "description": "Label selector. e.g.: hidden!\u003dtrue", + "in": "query", + "name": "labelSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Field selector. e.g.: metadata.name\u003d\u003dhalo", + "in": "query", + "name": "fieldSelector", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "description": "Sorting criteria in the format: property,(asc|desc). Default sort order is ascending. Multiple sort criteria are supported.", + "in": "query", + "name": "sort", + "schema": { + "type": "array", + "items": { + "type": "string" + } + } + } + ], + "responses": { + "200": { + "content": { + "*/*": { + "schema": { + "$ref": "#/components/schemas/ThumbnailList" + } + } + }, + "description": "Response thumbnails" + } + }, + "tags": [ + "ThumbnailV1alpha1" ] }, "post": { - "description": "Create PolicyTemplate", - "operationId": "createPolicyTemplate", + "description": "Create Thumbnail", + "operationId": "createThumbnail", "requestBody": { "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Fresh policytemplate" + "description": "Fresh thumbnail" }, "responses": { "200": { "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response policytemplates created just now" + "description": "Response thumbnails created just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] } }, - "/apis/storage.halo.run/v1alpha1/policytemplates/{name}": { + "/apis/storage.halo.run/v1alpha1/thumbnails/{name}": { "delete": { - "description": "Delete PolicyTemplate", - "operationId": "deletePolicyTemplate", + "description": "Delete Thumbnail", + "operationId": "deleteThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -7484,19 +7958,19 @@ ], "responses": { "200": { - "description": "Response policytemplate deleted just now" + "description": "Response thumbnail deleted just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] }, "get": { - "description": "Get PolicyTemplate", - "operationId": "getPolicyTemplate", + "description": "Get Thumbnail", + "operationId": "getThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -7510,23 +7984,23 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response single policytemplate" + "description": "Response single thumbnail" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] }, "patch": { - "description": "Patch PolicyTemplate", - "operationId": "patchPolicyTemplate", + "description": "Patch Thumbnail", + "operationId": "patchThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -7549,23 +8023,23 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response policytemplate patched just now" + "description": "Response thumbnail patched just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] }, "put": { - "description": "Update PolicyTemplate", - "operationId": "updatePolicyTemplate", + "description": "Update Thumbnail", + "operationId": "updateThumbnail", "parameters": [ { - "description": "Name of policytemplate", + "description": "Name of thumbnail", "in": "path", "name": "name", "required": true, @@ -7578,26 +8052,26 @@ "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Updated policytemplate" + "description": "Updated thumbnail" }, "responses": { "200": { "content": { "*/*": { "schema": { - "$ref": "#/components/schemas/PolicyTemplate" + "$ref": "#/components/schemas/Thumbnail" } } }, - "description": "Response policytemplates updated just now" + "description": "Response thumbnails updated just now" } }, "tags": [ - "PolicyTemplateV1alpha1" + "ThumbnailV1alpha1" ] } }, @@ -8099,6 +8573,12 @@ "permalink": { "type": "string", "description": "Permalink of attachment.\nIf it is in local storage, the public URL will be set.\nIf it is in s3 storage, the Object URL will be set.\n" + }, + "thumbnails": { + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, @@ -9556,6 +10036,145 @@ } } }, + "LocalThumbnail": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "type": "object", + "properties": { + "apiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "spec": { + "$ref": "#/components/schemas/LocalThumbnailSpec" + }, + "status": { + "$ref": "#/components/schemas/LocalThumbnailStatus" + } + } + }, + "LocalThumbnailList": { + "required": [ + "first", + "hasNext", + "hasPrevious", + "items", + "last", + "page", + "size", + "total", + "totalPages" + ], + "type": "object", + "properties": { + "first": { + "type": "boolean", + "description": "Indicates whether current page is the first page." + }, + "hasNext": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "hasPrevious": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "items": { + "type": "array", + "description": "A chunk of items.", + "items": { + "$ref": "#/components/schemas/LocalThumbnail" + } + }, + "last": { + "type": "boolean", + "description": "Indicates whether current page is the last page." + }, + "page": { + "type": "integer", + "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "size": { + "type": "integer", + "description": "Size of each page. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "total": { + "type": "integer", + "description": "Total elements.", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "description": "Indicates total pages.", + "format": "int64" + } + } + }, + "LocalThumbnailSpec": { + "required": [ + "filePath", + "imageSignature", + "imageUri", + "size", + "thumbSignature", + "thumbnailUri" + ], + "type": "object", + "properties": { + "filePath": { + "type": "string" + }, + "imageSignature": { + "minLength": 1, + "type": "string" + }, + "imageUri": { + "minLength": 1, + "type": "string" + }, + "size": { + "type": "string", + "enum": [ + "S", + "M", + "L", + "XL" + ] + }, + "thumbSignature": { + "minLength": 1, + "type": "string" + }, + "thumbnailUri": { + "minLength": 1, + "type": "string" + } + } + }, + "LocalThumbnailStatus": { + "type": "object", + "properties": { + "phase": { + "type": "string", + "enum": [ + "PENDING", + "SUCCEEDED", + "FAILED" + ] + } + } + }, "LoginHistory": { "required": [ "loginAt", @@ -12405,6 +13024,120 @@ } } }, + "Thumbnail": { + "required": [ + "apiVersion", + "kind", + "metadata", + "spec" + ], + "type": "object", + "properties": { + "apiVersion": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "metadata": { + "$ref": "#/components/schemas/Metadata" + }, + "spec": { + "$ref": "#/components/schemas/ThumbnailSpec" + } + } + }, + "ThumbnailList": { + "required": [ + "first", + "hasNext", + "hasPrevious", + "items", + "last", + "page", + "size", + "total", + "totalPages" + ], + "type": "object", + "properties": { + "first": { + "type": "boolean", + "description": "Indicates whether current page is the first page." + }, + "hasNext": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "hasPrevious": { + "type": "boolean", + "description": "Indicates whether current page has previous page." + }, + "items": { + "type": "array", + "description": "A chunk of items.", + "items": { + "$ref": "#/components/schemas/Thumbnail" + } + }, + "last": { + "type": "boolean", + "description": "Indicates whether current page is the last page." + }, + "page": { + "type": "integer", + "description": "Page number, starts from 1. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "size": { + "type": "integer", + "description": "Size of each page. If not set or equal to 0, it means no pagination.", + "format": "int32" + }, + "total": { + "type": "integer", + "description": "Total elements.", + "format": "int64" + }, + "totalPages": { + "type": "integer", + "description": "Indicates total pages.", + "format": "int64" + } + } + }, + "ThumbnailSpec": { + "required": [ + "imageSignature", + "imageUri", + "size", + "thumbnailUri" + ], + "type": "object", + "properties": { + "imageSignature": { + "minLength": 1, + "type": "string" + }, + "imageUri": { + "minLength": 1, + "type": "string" + }, + "size": { + "type": "string", + "enum": [ + "S", + "M", + "L", + "XL" + ] + }, + "thumbnailUri": { + "minLength": 1, + "type": "string" + } + } + }, "User": { "required": [ "apiVersion", diff --git a/api-docs/openapi/v3_0/apis_uc.api_v1alpha1.json b/api-docs/openapi/v3_0/apis_uc.api_v1alpha1.json index 61b7a8896b..7b39276dac 100644 --- a/api-docs/openapi/v3_0/apis_uc.api_v1alpha1.json +++ b/api-docs/openapi/v3_0/apis_uc.api_v1alpha1.json @@ -934,6 +934,12 @@ "permalink": { "type": "string", "description": "Permalink of attachment.\nIf it is in local storage, the public URL will be set.\nIf it is in s3 storage, the Object URL will be set.\n" + }, + "thumbnails": { + "type": "object", + "additionalProperties": { + "type": "string" + } } } }, diff --git a/ui/console-src/modules/contents/attachments/AttachmentList.vue b/ui/console-src/modules/contents/attachments/AttachmentList.vue index 17fe87a414..bb601a7f55 100644 --- a/ui/console-src/modules/contents/attachments/AttachmentList.vue +++ b/ui/console-src/modules/contents/attachments/AttachmentList.vue @@ -509,7 +509,10 @@ watch( v-if="isImage(attachment.spec.mediaType)" :key="attachment.metadata.name" :alt="attachment.spec.displayName" - :src="attachment.status?.permalink" + :src=" + attachment.status?.thumbnails?.S || + attachment.status?.permalink + " classes="pointer-events-none object-cover group-hover:opacity-75 transform-gpu" >