From 6dad9339345950263340955182380e9777dde937 Mon Sep 17 00:00:00 2001 From: Han-Ya-Jun <1581532052@qq.com> Date: Mon, 27 May 2024 18:06:04 +0800 Subject: [PATCH 1/7] fix(stage): fix upgrade 1.13 --- .../apigateway/apigateway/apis/web/stage/serializers.py | 1 + src/dashboard/apigateway/apigateway/biz/released_resource.py | 2 ++ .../apigateway/apigateway/tests/biz/test_released_resource.py | 1 + 3 files changed, 4 insertions(+) diff --git a/src/dashboard/apigateway/apigateway/apis/web/stage/serializers.py b/src/dashboard/apigateway/apigateway/apis/web/stage/serializers.py index 7a9212df1..2a01ea0fe 100644 --- a/src/dashboard/apigateway/apigateway/apis/web/stage/serializers.py +++ b/src/dashboard/apigateway/apigateway/apis/web/stage/serializers.py @@ -91,6 +91,7 @@ def get_resource_version(self, obj): return { "version": self.context["stage_release"].get(obj.id, {}).get("resource_version", {}).get("version", ""), "id": self.context["stage_release"].get(obj.id, {}).get("resource_version_id", 0), + "schema_version": self.context["stage_release"].get(obj.id, {}).get("resource_version_schema_version", ""), } def get_publish_id(self, obj): diff --git a/src/dashboard/apigateway/apigateway/biz/released_resource.py b/src/dashboard/apigateway/apigateway/biz/released_resource.py index 2649fc926..3ed026dfe 100644 --- a/src/dashboard/apigateway/apigateway/biz/released_resource.py +++ b/src/dashboard/apigateway/apigateway/biz/released_resource.py @@ -121,6 +121,7 @@ def get_stage_release(gateway, stage_ids=None): "resource_version__name", "resource_version__title", "resource_version__version", + "resource_version__schema_version", "updated_time", "updated_by", ) @@ -136,6 +137,7 @@ def get_stage_release(gateway, stage_ids=None): if release["resource_version__version"] != "" else release["resource_version__title"] }, + "resource_version_schema_version": release["resource_version__schema_version"], "resource_version_display": release["resource_version__version"], "release_by": release["updated_by"], } diff --git a/src/dashboard/apigateway/apigateway/tests/biz/test_released_resource.py b/src/dashboard/apigateway/apigateway/tests/biz/test_released_resource.py index ed586ddb8..e4444f563 100644 --- a/src/dashboard/apigateway/apigateway/tests/biz/test_released_resource.py +++ b/src/dashboard/apigateway/apigateway/tests/biz/test_released_resource.py @@ -145,6 +145,7 @@ def test_get_stage_release(self, fake_gateway): "resource_version": { "version": "1.0.1", }, + "resource_version_schema_version": "1.0", "release_by": "test", }, }, From 6496686ec3a5682694d4db07fee1206ed72e0461 Mon Sep 17 00:00:00 2001 From: wklken Date: Tue, 28 May 2024 10:16:00 +0800 Subject: [PATCH 2/7] feat(fe/constant): add UPGRADE_TO_113_TIP to fe constant/config.ts --- src/dashboard-front/src/constant/config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/dashboard-front/src/constant/config.ts b/src/dashboard-front/src/constant/config.ts index f9ab302f7..95d9b674e 100644 --- a/src/dashboard-front/src/constant/config.ts +++ b/src/dashboard-front/src/constant/config.ts @@ -117,5 +117,8 @@ export default { // 调用API USER_API: `${BK_DOCS_URL_PREFIX_MARKDOWN}/apigateway/use-api/use-apigw-api.md`, + + // 升级到 1.13 的指引说明 + UPGRADE_TO_113_TIP: "", }, }; From 5e505c55c73095a521b83a12e7f6601794a94e70 Mon Sep 17 00:00:00 2001 From: Han-Ya-Jun <1581532052@qq.com> Date: Tue, 28 May 2024 11:09:35 +0800 Subject: [PATCH 3/7] feat(resource_version): add schema_version --- .../apigateway/apis/web/resource_version/serializers.py | 1 + .../apigateway/apigateway/apis/web/resource_version/views.py | 4 +++- .../tests/apis/web/resource_version/test_serializers.py | 5 ++++- .../apigateway/tests/apis/web/resource_version/test_views.py | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dashboard/apigateway/apigateway/apis/web/resource_version/serializers.py b/src/dashboard/apigateway/apigateway/apis/web/resource_version/serializers.py index 1ae0615d9..9159b3323 100644 --- a/src/dashboard/apigateway/apigateway/apis/web/resource_version/serializers.py +++ b/src/dashboard/apigateway/apigateway/apis/web/resource_version/serializers.py @@ -115,6 +115,7 @@ class ResourceVersionListOutputSLZ(serializers.Serializer): released_stages = serializers.SerializerMethodField(help_text="已发布的环境列表") sdk_count = serializers.SerializerMethodField(help_text="生成skd数量") version = serializers.SerializerMethodField(help_text="版本号") + schema_version = serializers.CharField(help_text="资源版本协议版本:1.0/2.0") comment = serializers.CharField(help_text="版本日志") created_time = serializers.DateTimeField(help_text="创建时间") diff --git a/src/dashboard/apigateway/apigateway/apis/web/resource_version/views.py b/src/dashboard/apigateway/apigateway/apis/web/resource_version/views.py index 07ae7358b..9d6e4fd92 100644 --- a/src/dashboard/apigateway/apigateway/apis/web/resource_version/views.py +++ b/src/dashboard/apigateway/apigateway/apis/web/resource_version/views.py @@ -76,7 +76,9 @@ def list(self, request, *args, **kwargs): queryset = ResourceVersion.objects.filter(gateway=request.gateway) if query: queryset = queryset.filter(version__icontains=query) - data = queryset.values("id", "version", "comment", "name", "title", "created_time").order_by("-id") + data = queryset.values("id", "version", "schema_version", "comment", "name", "title", "created_time").order_by( + "-id" + ) page = self.paginate_queryset(data) resource_version_ids = [rv["id"] for rv in page] diff --git a/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_serializers.py b/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_serializers.py index 7108e5c19..aa3f7c975 100644 --- a/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_serializers.py +++ b/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_serializers.py @@ -52,7 +52,9 @@ def test_to_representation(self): created_time=arrow.get("2019-01-01 12:30:00").datetime, ) - queryset = ResourceVersion.objects.filter(gateway=gateway).values("id", "version", "comment", "created_time") + queryset = ResourceVersion.objects.filter(gateway=gateway).values( + "id", "version", "schema_version", "comment", "created_time" + ) slz = serializers.ResourceVersionListOutputSLZ( instance=queryset, @@ -77,6 +79,7 @@ def test_to_representation(self): { "id": resource_version.id, "version": resource_version.version, + "schema_version": resource_version.schema_version, "comment": resource_version.comment, "sdk_count": 0, "released_stages": [ diff --git a/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_views.py b/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_views.py index 213d02b46..73a3337c5 100644 --- a/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_views.py +++ b/src/dashboard/apigateway/apigateway/tests/apis/web/resource_version/test_views.py @@ -72,6 +72,7 @@ def test_list(self, request_view, fake_gateway): { "id": resource_version.id, "version": resource_version.version, + "schema_version": resource_version.schema_version, "comment": resource_version.comment, "sdk_count": 1, "created_time": dummy_time.str, From 9ce750cb57454a4048be557862487d2315fc372a Mon Sep 17 00:00:00 2001 From: wklken Date: Wed, 29 May 2024 10:31:25 +0800 Subject: [PATCH 4/7] feat(src/dashboard-front): add new env BK_APP_CODE and BK_REPO_URL (#667) --- src/dashboard-front/index.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dashboard-front/index.html b/src/dashboard-front/index.html index c1006b2b9..172431a74 100644 --- a/src/dashboard-front/index.html +++ b/src/dashboard-front/index.html @@ -18,10 +18,12 @@ var BK_APIGATEWAY_VERSION = '<%= process.env.BK_APIGATEWAY_VERSION %>' || '1.1.1' var BK_DOMAIN = '<%= process.env.BK_DOMAIN %>' var BK_LOGIN_URL = '<%= process.env.BK_LOGIN_URL %>' + var BK_APP_CODE = '<%= process.env.BK_APP_CODE %>' var BK_DEFAULT_TEST_APP_CODE = '<%= process.env.BK_DEFAULT_TEST_APP_CODE %>' var BK_API_RESOURCE_URL_TMPL = '<%= process.env.BK_API_RESOURCE_URL_TMPL %>' var BK_COMPONENT_API_URL = '<%= process.env.BK_COMPONENT_API_URL %>' var BK_DOCS_URL_PREFIX = '<%= process.env.BK_DOCS_URL_PREFIX %>' + var BK_REPO_URL = '<%= process.env.BK_REPO_URL %>' var BK_DASHBOARD_FE_URL = '<%= process.env.BK_DASHBOARD_FE_URL %>' var BK_DASHBOARD_URL = '<%= process.env.BK_DASHBOARD_URL %>' var BK_DASHBOARD_CSRF_COOKIE_NAME = '<%= process.env.BK_DASHBOARD_CSRF_COOKIE_NAME %>' From 7b08c12c4a60be2c99843006214e19a6d37b1633 Mon Sep 17 00:00:00 2001 From: ielgnaw Date: Wed, 29 May 2024 14:58:39 +0800 Subject: [PATCH 5/7] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=20eslint=20?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#668)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 优化变量管理取消按钮的交互 * fix: 去掉log * fix: 体验问题修复 * Merge branch 'master' of https://github.com/ielgnaw/blueking-apigateway , # Reviewed, transaction id: 4320 * feat: 修复前端问题 # Reviewed, transaction id: 4385 * feat: 修复前端问题 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 4417 * feat: 修复前端问题 # Reviewed, transaction id: 4424 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 4460 * feat: 修复前端问题 # Reviewed, transaction id: 4462 * feat: 前端 去掉无用的全局变量 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 4474 * fix: 流水日志和统计报表清空搜索条件时增加loading态 * fix: 【APIgateway1.13 】鼠标hover时无法查看到全部标签 * feat: 修复前端问题 # Reviewed, transaction id: 4501 * fix: 资源文档--底部按钮吸附&编辑器高度随分辨率变化 * fix: 新建资源页面 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 4530 * feat: 切换语言 # Reviewed, transaction id: 4532 * fix: 【APIgateway1.13 】这里前端应该要有个校验 NIT * fix: 修复体验问题 * fix: 【APIgateway1.13 】展开蓝鲸应用ID后无任何数据 * fix: 整改权限审批模块业务交互 * Merge branch 'master' of https://github.com/ielgnaw/blueking-apigateway , # Reviewed, transaction id: 4651 * Merge branch 'master' of https://github.com/ielgnaw/blueking-apigateway , # Reviewed, transaction id: 4651 , # Reviewed, transaction id: 4652 * fix: 权限审批添加漏缺的全部驳回代码 * fix: 权限审批添加类型和展开子项表格默认全选 * fix: 操作记录在1440 的屏幕下会换行 * fix: 修复体验问题 * fix: 修复环境概览详情缩小到1024像素布局混乱 * fix: 吸底样式不对 * fix: 修改路由名称 * fix: 创建资源时这里是激活输入框出现 tooltip,不是给名称添加tooltip 有间距,参照设计稿 * fix: 修复meunu菜单展开icon太小 * fix: 操作记录列表根据屏幕大小自适应 * feat: 修复前端问题 * fix: 修复体验问题 * feat: 修复前端体验问题 # Reviewed, transaction id: 4961 * fix: 提交国际化 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 5017 * feat: 修复前端问题 # Reviewed, transaction id: 5018 * feat: 国际化问题 # Reviewed, transaction id: 5042 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 5084 * feat: 修复前端问题 # Reviewed, transaction id: 5102 * feat: 修复前端问题 # Reviewed, transaction id: 5117 * feat: 修复前端问题 # Reviewed, transaction id: 5195 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5205 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5206 * feat: 修复前端问题 # Reviewed, transaction id: 5227 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 5345 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5346 * feat: 修复前端问题 # Reviewed, transaction id: 5348 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 5483 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 5629 * feat: 前端版本日志 # Reviewed, transaction id: 5675 * feat: 【APIgateway1.13 】发布失败的日志点进去,时间超长 # Reviewed, transaction id: 5703 * fix: 修复体验问题 * feat: 修复前端问题 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5928 * feat: 文案修改 # Reviewed, transaction id: 5951 * feat: 修复前端问题 # Reviewed, transaction id: 6015 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 6094 * feat: 修复前端问题 # Reviewed, transaction id: 6095 * feat: 修复前端问题 # Reviewed, transaction id: 6197 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6198 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6198 , # Reviewed, transaction id: 6199 * fix: 修复体验问题 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 6414 * fix: 修复体验问题 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6617 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6617 , # Reviewed, transaction id: 6619 * feat: 修复无法登出的问题 # Reviewed, transaction id: 6626 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 6763 * fix: 体验问题修复 * fix: 修复体验问题 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 7052 * fix: 修复体验问题 * fix: 修复体验问题 * fix: 修复体验问题 * feat: 【必须】点击编辑后,光标应该落在输入框内,需要支持回车 与 鼠标失焦都能保存 # Reviewed, transaction id: 7357 * fix: 修复体验问题 * fix: 修复体验问题 * fix: 修复体验问题 * feature: 小窗登录iframe方式改为window.open * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 7793 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 7802 * feat: 修复 新建资源页面,环境配置中的超时时间是 30 秒,但添加资源时变成了 0 秒,数据未同步 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 7804 * fix: 修复体验问题 * fix: 修复体验问题 * fix: 变量管理 编辑时才显示增加删除按钮 * feat: 国际化 * feat: 国际化 * feat: 国际化 * feat: 修复插件管理问题 * feat: 退出登录加上 is_from_logout 参数 * fix: 体验问题修复 * feat: 修复前端问题 * feat: eslint 问题 --------- Co-authored-by: lhzzforever Co-authored-by: shuzhenyang Co-authored-by: 逍遥尊者 <46641918+lhzzforever@users.noreply.github.com> --- src/dashboard-front/.eslintignore | 1 + src/dashboard-front/.eslintrc.js | 6 + src/dashboard-front/package.json | 5 +- .../setting/comps/version-sideslider.vue | 1 - .../src/views/resource/setting/detail.vue | 3 +- .../overview/comps/release-sideslider.vue | 1 - .../overview/detail-mode/resource-info.vue | 4 +- src/dashboard-front/tsconfig.json | 1 + src/dashboard-front/yarn.lock | 962 ++++++++++-------- 9 files changed, 544 insertions(+), 440 deletions(-) diff --git a/src/dashboard-front/.eslintignore b/src/dashboard-front/.eslintignore index 93591a7c7..1a3d7d028 100644 --- a/src/dashboard-front/.eslintignore +++ b/src/dashboard-front/.eslintignore @@ -11,3 +11,4 @@ src/views/permission/record/index.vue src/views/permission/apply/index.vue src/assets/** *bak* +src/views/resource/setting/detail.vue diff --git a/src/dashboard-front/.eslintrc.js b/src/dashboard-front/.eslintrc.js index 42060264f..548d6f152 100644 --- a/src/dashboard-front/.eslintrc.js +++ b/src/dashboard-front/.eslintrc.js @@ -1,10 +1,16 @@ module.exports = { root: true, extends: ['@blueking/eslint-config-bk/tsvue3'], + parser: 'vue-eslint-parser', parserOptions: { project: './tsconfig.eslint.json', tsconfigRootDir: __dirname, sourceType: 'module', + parser: '@typescript-eslint/parser', + ecmaFeatures: { + jsx: true, + }, + ecmaVersion: 13, }, rules: { 'no-param-reassign': 0, diff --git a/src/dashboard-front/package.json b/src/dashboard-front/package.json index af2d92d72..3346bd3f8 100644 --- a/src/dashboard-front/package.json +++ b/src/dashboard-front/package.json @@ -50,7 +50,7 @@ "request": "^2.88.2", "semver": "^7.6.0", "transliteration": "^2.3.5", - "vue": "^3.2.41", + "vue": "^3.4.27", "vue-i18n": "^9.5.0", "vue-router": "^4.1.6" }, @@ -84,7 +84,8 @@ "sass": "^1.52.3", "sass-loader": "^13.0.0", "ts-loader": "^9.5.1", - "typescript": "^4.8.4" + "typescript": "5.4.5", + "vue-eslint-parser": "^9.4.2" }, "engines": { "node": ">= 14.16.1", diff --git a/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue b/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue index 42f81d410..17da80272 100644 --- a/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue +++ b/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue @@ -188,7 +188,6 @@ import { getStageList, } from '@/http'; import versionDiff from '@/components/version-diff/index.vue'; -import CustomDialog from '@/components/custom-dialog/index.vue'; const route = useRoute(); const router = useRouter(); diff --git a/src/dashboard-front/src/views/resource/setting/detail.vue b/src/dashboard-front/src/views/resource/setting/detail.vue index 7e5f0af74..0c34f72f5 100644 --- a/src/dashboard-front/src/views/resource/setting/detail.vue +++ b/src/dashboard-front/src/views/resource/setting/detail.vue @@ -66,7 +66,7 @@ + @click="copy(formData?.labels?.map((item: any) => item.name)?.join(','))"> @@ -731,6 +731,7 @@ const handleConfirmTime = () => { timeOutValue.value = ''; handleEditSave(); }; + const renderTimeOutLabel = () => { return (
diff --git a/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue b/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue index b5aaafef4..6323ce646 100644 --- a/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue +++ b/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue @@ -183,7 +183,6 @@ + + diff --git a/src/dashboard-front/src/components/version-release-note.vue b/src/dashboard-front/src/components/version-release-note.vue new file mode 100644 index 000000000..81fa20d2c --- /dev/null +++ b/src/dashboard-front/src/components/version-release-note.vue @@ -0,0 +1,139 @@ + + + + + diff --git a/src/dashboard-front/src/hooks/index.ts b/src/dashboard-front/src/hooks/index.ts index e021738e6..38a203fec 100644 --- a/src/dashboard-front/src/hooks/index.ts +++ b/src/dashboard-front/src/hooks/index.ts @@ -5,3 +5,4 @@ export * from './use-global'; export * from './use-date-picker'; export * from './user-chart-log'; export * from './sidebar'; +export * from './use-stage-data'; diff --git a/src/dashboard-front/src/hooks/use-stage-data.ts b/src/dashboard-front/src/hooks/use-stage-data.ts new file mode 100644 index 000000000..47e1bb972 --- /dev/null +++ b/src/dashboard-front/src/hooks/use-stage-data.ts @@ -0,0 +1,43 @@ +import { computed } from 'vue'; +import { getStageList } from '@/http'; +import { useStage } from '@/store'; +import { useRoute } from 'vue-router'; + +export const useGetStageList = () => { + const stage = useStage(); + const route = useRoute(); + const apigwId = computed(() => +route.params.id); + + const getStagesStatus = async () => { + if (!apigwId.value) return; + const res = await getStageList(apigwId.value); + + let notUpdatedStages = res?.filter((item: any) => { + if (item.status === 1 && item.resource_version?.schema_version === '1.0') { + return true; + } + }); + notUpdatedStages = notUpdatedStages?.map((item: any) => item?.name); + + let exist2 = false; + for (let i = 0; i < res?.length; i++) { + const item = res[i]; + if (item.schema_version === '2.0') { + exist2 = true; + break; + } + } + + stage.setNotUpdatedStages(notUpdatedStages); + stage.setExist2(exist2); + + return { + notUpdatedStages, + exist2, + }; + }; + + return { + getStagesStatus, + }; +}; diff --git a/src/dashboard-front/src/language/lang.ts b/src/dashboard-front/src/language/lang.ts index 152f93dc4..4c34649ee 100644 --- a/src/dashboard-front/src/language/lang.ts +++ b/src/dashboard-front/src/language/lang.ts @@ -1430,6 +1430,18 @@ const lang: ILANG = { '标签修改成功': ['Label modified successfully'], '删除标签成功': ['Label deleted successfully'], '--': ['--'], + '去发布': ['Go to Publish'], + '生成版本并发布': ['Build the version and publish it'], + 'API 网关 1.13 版本现已发布,为避免插件、后端服务等信息在页面修改后但实际并未生效的问题,请尽快生成并发布新版本至所有环境。': ['API Gateway version 1.13 has been released. In order to avoid the problem that plug-ins, back-end services and other information are modified on the page but do not take effect, please generate and release the new version to all environments as soon as possible.'], + 'API 网关 1.13 版本发布说明': ['API Gateway version 1.13 Release description'], + '为保证网关数据一致性,你需要执行以下步骤:': ['To ensure gateway data consistency, you need to perform the following steps:'], + '1. 为当前网关生成新的版本': ['1. Generate a new version for the current gateway'], + '2. 将新版本发布至所有环境': ['2. Release the new version to all environments'], + '目前尚未更新的环境:': ['Environments that have not yet been updated:'], + '查看操作指引': ['View operation instructions'], + '请尽快更新,以避免插件、后端服务等信息在页面修改后但实际并未生效的问题。': ['Please update as soon as possible to avoid problems such as plug-ins and back-end services that do not take effect after the page changes.'], + 'API 网关在 2024-05-30 推出了 1.13 大版本更新。新版本中引入了后端服务,并将访问策略转换为插件形式,同时优化了环境、资源与插件之间的绑定关系。': ['API Gateway has released major version 1.13 update in 2024-05-30. The new version introduces back-end services, transforms access policies into plug-ins, and optimizes the binding relationships between environments, resources, and plug-ins.'], + '老版本,未包含后端服务等信息,发布可能会导致数据不一致,谨慎使用': ['The release of the earlier version, which does not contain information such as back-end services, may result in data inconsistency'], '蓝鲸应用认证,用户认证': ['BlueKing app authentication, User Verified'], '确认回滚': ['Acknowledge rollback'], '发布后,将回滚至 {version} 版本': ['When published, it is rolled back to the {version} version'], diff --git a/src/dashboard-front/src/store/stage.ts b/src/dashboard-front/src/store/stage.ts index 5f9b2855e..fa24a831d 100644 --- a/src/dashboard-front/src/store/stage.ts +++ b/src/dashboard-front/src/store/stage.ts @@ -9,6 +9,8 @@ export const useStage = defineStore('stage', { }, curStageId: -1, stageMainLoading: false, + notUpdatedStages: [], // 当前网关下未更新的环境列表 + exist2: false, // 当前网关下是否有schema_version = 2.0 的资源 }), getters: { defaultStage(state) { @@ -17,6 +19,12 @@ export const useStage = defineStore('stage', { realStageMainLoading(state) { return state.stageMainLoading; }, + getNotUpdatedStages(state) { + return state.notUpdatedStages; + }, + getExist2(state) { + return state.exist2; + }, }, actions: { setStageList(data: any[]) { @@ -25,5 +33,11 @@ export const useStage = defineStore('stage', { setStageMainLoading(loading: boolean) { this.stageMainLoading = loading; }, + setNotUpdatedStages(data: any[]) { + this.notUpdatedStages = data; + }, + setExist2(data: boolean) { + this.exist2 = data; + }, }, }); diff --git a/src/dashboard-front/src/views/main.vue b/src/dashboard-front/src/views/main.vue index b293f22b2..98e91df2b 100644 --- a/src/dashboard-front/src/views/main.vue +++ b/src/dashboard-front/src/views/main.vue @@ -81,7 +81,9 @@ /> -
+ + +
+ +
@@ -108,11 +112,13 @@ import { ref, watch, onMounted, onBeforeUnmount } from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { createMenuData } from '@/common/menu'; -import { useGetApiList, useSidebar } from '@/hooks'; -import { useCommon, usePermission } from '@/store'; +import { useGetApiList, useSidebar, useGetStageList } from '@/hooks'; +import { useCommon, usePermission, useStage } from '@/store'; import { getPermissionApplyList, getGatewaysDetail } from '@/http'; import mitt from '@/common/event-bus'; import { cloneDeep } from 'lodash'; +import versionReleaseNote from '@/components/version-release-note.vue'; +import tipsPublishBar from '@/components/tips-publish-bar.vue'; const { initSidebarFormData, isSidebarClosed } = useSidebar(); const route = useRoute(); @@ -122,6 +128,11 @@ const common = useCommon(); const permission = usePermission(); const filterData = ref({ name: '' }); const apigwSelect = ref(); + +const stage = useStage(); +const versionReleaseNoteRef = ref(); +const { getStagesStatus } = useGetStageList(); + // 获取网关数据方法 const { getGatewaysListData, @@ -159,6 +170,13 @@ const handleSetApigwDeatail = async () => { common.setCurApigwData(curApigwDataDetail); }; +const getStages = async () => { + const res = await getStagesStatus(); + if (res?.notUpdatedStages?.length) { + versionReleaseNoteRef.value?.show(); + } +}; + const needMenu = ref(true); const menuData = ref([]); const pageName = ref(''); @@ -247,6 +265,18 @@ const handleBack = () => { router.back(); }; +watch( + () => apigwId.value, + (v) => { + if (v) { + setTimeout(() => { + getStages(); + }, 200); + } + }, + { immediate: true }, +); + onMounted(async () => { // 处理其他页面离开页面前是否会出现提示框的判断 mitt.on('on-leave-page-change', (payload: Record) => { @@ -394,6 +424,7 @@ onMounted(async () => { // box-shadow: 0 3px 4px rgba(64,112,203,0.05882); box-shadow: 0 3px 4px 0 #0000000a; height: 52px; + box-sizing: border-box; margin-right: auto; color: #313238; font-size: 16px; diff --git a/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue b/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue index 17da80272..13cb969e7 100644 --- a/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue +++ b/src/dashboard-front/src/views/resource/setting/comps/version-sideslider.vue @@ -187,6 +187,7 @@ import { resourceVersionsDiff, getStageList, } from '@/http'; +import { useGetStageList } from '@/hooks'; import versionDiff from '@/components/version-diff/index.vue'; const route = useRoute(); @@ -194,7 +195,7 @@ const router = useRouter(); const apigwId = computed(() => +route.params.id); const { t } = useI18n(); - +const { getStagesStatus } = useGetStageList(); const emit = defineEmits(['done']); // const resourceVersion = computed(() => { @@ -281,6 +282,7 @@ const handleBuildVersion = async () => { dialogShow.value = true; await createResourceVersion(apigwId.value, formData); emit('done'); + getStagesStatus(); createError.value = false; } catch (e) { createError.value = true; diff --git a/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue b/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue index 6323ce646..3e54c5b3c 100644 --- a/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue +++ b/src/dashboard-front/src/views/stage/overview/comps/release-sideslider.vue @@ -27,9 +27,9 @@ v-else theme="info" :title=" - chooseAssets?.resource_version.version ? + chooseAssets?.resource_version?.version ? t('当前版本号: {version},于 {created_time} 发布成功; 资源更新成功后, 需发布到指定的环境, 方可生效', { - version: chooseAssets?.resource_version.version, + version: chooseAssets?.resource_version?.version, created_time: chooseAssets?.release.created_time }) : t('资源更新成功后, 需发布到指定的环境, 方可生效')" @@ -47,8 +47,8 @@

- {{ t('发布的资源版本( 当前版本:{version}', { version: chooseAssets?.resource_version.version || '--' }) }} - @@ -190,13 +199,13 @@ import { useRoute, useRouter } from 'vue-router'; import versionDiff from '@/components/version-diff/index.vue'; import logDetails from '@/components/log-details/index.vue'; import { Message, InfoBox } from 'bkui-vue'; -import { useSidebar } from '@/hooks'; +import { useSidebar, useGetStageList } from '@/hooks'; import dayjs from 'dayjs'; const route = useRoute(); const router = useRouter(); const { initSidebarFormData, isSidebarClosed/* , isBackDialogShow */ } = useSidebar(); - +const { getStagesStatus } = useGetStageList(); const apigwId = computed(() => +route.params.id); const { t } = useI18n(); @@ -355,6 +364,17 @@ const handlePublish = async () => { } }; +const handleReleaseSuccess = () => { + emit('release-success'); + getStagesStatus(); +}; + +const handleReleaseDoing = () => { + setTimeout(() => { + getStagesStatus(); + }, 3000); +}; + // 显示侧边栏 const showReleaseSideslider = () => { const params = { @@ -463,14 +483,13 @@ watch( () => isShow.value, async (val) => { if (val) { + await getStageData(); + await getResourceVersions(); if (props.currentAssets?.id) { formData.stage_id = props.currentAssets.id; chooseAssets.value = props.currentAssets; } - await getResourceVersions(); - await getStageData(); - if (props.version?.id) { const curVersion = versionList.value.find((item: any) => item.id === props.version?.id); if (curVersion) { @@ -631,4 +650,8 @@ defineExpose({ color: #FF9C01; } } +.version-tips { + color: #979ba5; + margin-left: 4px; +} From 95e104fe3d1ab3244653c2f1fb2d5db77c0746c9 Mon Sep 17 00:00:00 2001 From: ielgnaw Date: Thu, 30 May 2024 10:20:36 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=E5=89=8D=E7=AB=AF=E9=9C=80?= =?UTF-8?q?=E6=B1=82=20(#670)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Merge branch 'master' of https://github.com/ielgnaw/blueking-apigateway , # Reviewed, transaction id: 4320 * feat: 修复前端问题 # Reviewed, transaction id: 4385 * feat: 修复前端问题 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 4417 * feat: 修复前端问题 # Reviewed, transaction id: 4424 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 4460 * feat: 修复前端问题 # Reviewed, transaction id: 4462 * feat: 前端 去掉无用的全局变量 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 4474 * fix: 流水日志和统计报表清空搜索条件时增加loading态 * fix: 【APIgateway1.13 】鼠标hover时无法查看到全部标签 * feat: 修复前端问题 # Reviewed, transaction id: 4501 * fix: 资源文档--底部按钮吸附&编辑器高度随分辨率变化 * fix: 新建资源页面 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 4530 * feat: 切换语言 # Reviewed, transaction id: 4532 * fix: 【APIgateway1.13 】这里前端应该要有个校验 NIT * fix: 修复体验问题 * fix: 【APIgateway1.13 】展开蓝鲸应用ID后无任何数据 * fix: 整改权限审批模块业务交互 * Merge branch 'master' of https://github.com/ielgnaw/blueking-apigateway , # Reviewed, transaction id: 4651 * Merge branch 'master' of https://github.com/ielgnaw/blueking-apigateway , # Reviewed, transaction id: 4651 , # Reviewed, transaction id: 4652 * fix: 权限审批添加漏缺的全部驳回代码 * fix: 权限审批添加类型和展开子项表格默认全选 * fix: 操作记录在1440 的屏幕下会换行 * fix: 修复体验问题 * fix: 修复环境概览详情缩小到1024像素布局混乱 * fix: 吸底样式不对 * fix: 修改路由名称 * fix: 创建资源时这里是激活输入框出现 tooltip,不是给名称添加tooltip 有间距,参照设计稿 * fix: 修复meunu菜单展开icon太小 * fix: 操作记录列表根据屏幕大小自适应 * feat: 修复前端问题 * fix: 修复体验问题 * feat: 修复前端体验问题 # Reviewed, transaction id: 4961 * fix: 提交国际化 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 5017 * feat: 修复前端问题 # Reviewed, transaction id: 5018 * feat: 国际化问题 # Reviewed, transaction id: 5042 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 5084 * feat: 修复前端问题 # Reviewed, transaction id: 5102 * feat: 修复前端问题 # Reviewed, transaction id: 5117 * feat: 修复前端问题 # Reviewed, transaction id: 5195 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5205 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5206 * feat: 修复前端问题 # Reviewed, transaction id: 5227 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 5345 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5346 * feat: 修复前端问题 # Reviewed, transaction id: 5348 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 5483 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 5629 * feat: 前端版本日志 # Reviewed, transaction id: 5675 * feat: 【APIgateway1.13 】发布失败的日志点进去,时间超长 # Reviewed, transaction id: 5703 * fix: 修复体验问题 * feat: 修复前端问题 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 5928 * feat: 文案修改 # Reviewed, transaction id: 5951 * feat: 修复前端问题 # Reviewed, transaction id: 6015 * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 6094 * feat: 修复前端问题 # Reviewed, transaction id: 6095 * feat: 修复前端问题 # Reviewed, transaction id: 6197 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6198 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6198 , # Reviewed, transaction id: 6199 * fix: 修复体验问题 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 6414 * fix: 修复体验问题 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6617 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 6617 , # Reviewed, transaction id: 6619 * feat: 修复无法登出的问题 # Reviewed, transaction id: 6626 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 6763 * fix: 体验问题修复 * fix: 修复体验问题 * fix: 体验问题修复 * feat: 修复前端问题 # Reviewed, transaction id: 7052 * fix: 修复体验问题 * fix: 修复体验问题 * fix: 修复体验问题 * feat: 【必须】点击编辑后,光标应该落在输入框内,需要支持回车 与 鼠标失焦都能保存 # Reviewed, transaction id: 7357 * fix: 修复体验问题 * fix: 修复体验问题 * fix: 修复体验问题 * feature: 小窗登录iframe方式改为window.open * fix: 修复体验问题 * feat: 修复前端问题 # Reviewed, transaction id: 7793 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 7802 * feat: 修复 新建资源页面,环境配置中的超时时间是 30 秒,但添加资源时变成了 0 秒,数据未同步 * Merge remote-tracking branch 'base/master' , # Reviewed, transaction id: 7804 * fix: 修复体验问题 * fix: 修复体验问题 * fix: 变量管理 编辑时才显示增加删除按钮 * feat: 国际化 * feat: 国际化 * feat: 国际化 * feat: 修复插件管理问题 * feat: 退出登录加上 is_from_logout 参数 * fix: 体验问题修复 * feat: 修复前端问题 * feat: eslint 问题 * fix: 体验问题修复 * fix: 修复体验问题 * fix: 体验问题修复 --------- Co-authored-by: shuzhenyang Co-authored-by: lhzzforever Co-authored-by: 逍遥尊者 <46641918+lhzzforever@users.noreply.github.com> --- src/dashboard-front/src/components/tips-publish-bar.vue | 6 +++--- src/dashboard-front/src/hooks/use-stage-data.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dashboard-front/src/components/tips-publish-bar.vue b/src/dashboard-front/src/components/tips-publish-bar.vue index 03480e759..ba3b7b491 100644 --- a/src/dashboard-front/src/components/tips-publish-bar.vue +++ b/src/dashboard-front/src/components/tips-publish-bar.vue @@ -13,10 +13,10 @@ class="guide"> {{ t('查看操作指引') }} - + {{ t('生成版本并发布') }} - + {{ t('去发布') }}

@@ -100,7 +100,7 @@ watch( box-sizing: border-box; } :deep(.bk-alert-wraper) { - padding: 4px 10px; + padding: 7px 10px; display: flex; align-items: center; } diff --git a/src/dashboard-front/src/hooks/use-stage-data.ts b/src/dashboard-front/src/hooks/use-stage-data.ts index 47e1bb972..903f779bb 100644 --- a/src/dashboard-front/src/hooks/use-stage-data.ts +++ b/src/dashboard-front/src/hooks/use-stage-data.ts @@ -22,7 +22,7 @@ export const useGetStageList = () => { let exist2 = false; for (let i = 0; i < res?.length; i++) { const item = res[i]; - if (item.schema_version === '2.0') { + if (item.resource_version.schema_version === '2.0') { exist2 = true; break; }