From c0d84fe024a753508fa17346f34b1f66128674bd Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Tue, 4 Jun 2024 21:09:10 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E9=93=BE=E6=8E=A5iframe=E5=B5=8C=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/share/manage/XpackShareManage.java | 14 +++++++++----- .../src/views/share/link/IframeError.vue | 9 +++++++++ .../src/views/share/link/ShareProxy.ts | 5 ++++- core/core-frontend/src/views/share/link/index.vue | 11 ++++++++++- .../share/request/XpackShareProxyRequest.java | 1 + .../api/xpack/share/vo/XpackShareProxyVO.java | 1 + 6 files changed, 34 insertions(+), 7 deletions(-) create mode 100644 core/core-frontend/src/views/share/link/IframeError.vue diff --git a/core/core-backend/src/main/java/io/dataease/share/manage/XpackShareManage.java b/core/core-backend/src/main/java/io/dataease/share/manage/XpackShareManage.java index 5a0584d040..5a809c11a7 100644 --- a/core/core-backend/src/main/java/io/dataease/share/manage/XpackShareManage.java +++ b/core/core-backend/src/main/java/io/dataease/share/manage/XpackShareManage.java @@ -14,12 +14,13 @@ import io.dataease.constant.AuthConstant; import io.dataease.constant.BusiResourceEnum; import io.dataease.exception.DEException; import io.dataease.license.config.XpackInteract; -import io.dataease.share.dao.auto.mapper.XpackShareMapper; -import io.dataease.utils.*; +import io.dataease.license.utils.LicenseUtil; import io.dataease.share.dao.auto.entity.XpackShare; +import io.dataease.share.dao.auto.mapper.XpackShareMapper; import io.dataease.share.dao.ext.mapper.XpackShareExtMapper; import io.dataease.share.dao.ext.po.XpackSharePO; import io.dataease.share.util.LinkTokenUtil; +import io.dataease.utils.*; import jakarta.annotation.Resource; import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.collections4.CollectionUtils; @@ -125,7 +126,6 @@ public class XpackShareManage { } - public IPage querySharePage(int goPage, int pageSize, VisualizationWorkbranchQueryRequest request) { Long uid = AuthUtils.getUser().getUserId(); QueryWrapper queryWrapper = new QueryWrapper<>(); @@ -174,7 +174,7 @@ public class XpackShareManage { return pos.stream().map(po -> new XpackShareGridVO( po.getShareId(), po.getResourceId(), po.getName(), po.getCreator().toString(), - po.getTime(), po.getExp(), 9,po.getExtFlag(),po.getType())).toList(); + po.getTime(), po.getExp(), 9, po.getExtFlag(), po.getType())).toList(); } private XpackShareManage proxy() { @@ -182,6 +182,10 @@ public class XpackShareManage { } public XpackShareProxyVO proxyInfo(XpackShareProxyRequest request) { + boolean inIframeError = request.isInIframe() && !LicenseUtil.licenseValid(); + if (inIframeError) { + return new XpackShareProxyVO(); + } QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("uuid", request.getUuid()); XpackShare xpackShare = xpackShareMapper.selectOne(queryWrapper); @@ -192,7 +196,7 @@ public class XpackShareManage { response.addHeader(AuthConstant.LINK_TOKEN_KEY, linkToken); Integer type = xpackShare.getType(); String typeText = (ObjectUtils.isNotEmpty(type) && type == 1) ? "dashboard" : "dataV"; - return new XpackShareProxyVO(xpackShare.getResourceId(), xpackShare.getCreator(), linkExp(xpackShare), pwdValid(xpackShare, request.getCiphertext()), typeText); + return new XpackShareProxyVO(xpackShare.getResourceId(), xpackShare.getCreator(), linkExp(xpackShare), pwdValid(xpackShare, request.getCiphertext()), typeText, inIframeError); } private boolean linkExp(XpackShare xpackShare) { diff --git a/core/core-frontend/src/views/share/link/IframeError.vue b/core/core-frontend/src/views/share/link/IframeError.vue new file mode 100644 index 0000000000..dc6373fc89 --- /dev/null +++ b/core/core-frontend/src/views/share/link/IframeError.vue @@ -0,0 +1,9 @@ + + diff --git a/core/core-frontend/src/views/share/link/ShareProxy.ts b/core/core-frontend/src/views/share/link/ShareProxy.ts index cc7461ee56..bb5041b201 100644 --- a/core/core-frontend/src/views/share/link/ShareProxy.ts +++ b/core/core-frontend/src/views/share/link/ShareProxy.ts @@ -1,5 +1,6 @@ import request from '@/config/axios' import { useCache } from '@/hooks/web/useCache' +import { isInIframe } from '@/utils/utils' const { wsCache } = useCache() export interface ProxyInfo { resourceId: string @@ -7,6 +8,7 @@ export interface ProxyInfo { exp?: boolean pwdValid?: boolean type: string + inIframeError: boolean } class ShareProxy { uuid: string @@ -28,7 +30,8 @@ class ShareProxy { } const uuid = this.uuid const url = '/share/proxyInfo' - const param = { uuid, ciphertext: null } + const inIframe = isInIframe() + const param = { uuid, ciphertext: null, inIframe } const ciphertext = wsCache.get(`link-${uuid}`) if (ciphertext) { param['ciphertext'] = ciphertext diff --git a/core/core-frontend/src/views/share/link/index.vue b/core/core-frontend/src/views/share/link/index.vue index 598474a3b2..57b591e575 100644 --- a/core/core-frontend/src/views/share/link/index.vue +++ b/core/core-frontend/src/views/share/link/index.vue @@ -1,6 +1,7 @@