Skip to content

Commit

Permalink
feat: 优化全局配置相关逻辑;全局配置增加本地开发 mock 接口 (#729)
Browse files Browse the repository at this point in the history
* 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: 体验问题修复

* feat: 修复基本信息编辑时,弹框中维护人员不显示的问题

* feat: 修复前端问题

* feat: 修复通知中心访问地址
# Reviewed, transaction id: 9800

* feat: 修复通知中心访问地址
# Reviewed, transaction id: 9823

* Merge remote-tracking branch 'base/master'
, # Reviewed, transaction id: 9890

* feat: 修复编辑基础信息弹框中维护人员不回显的问题
# Reviewed, transaction id: 10102

* feat: 修复编辑基础信息弹框中维护人员不回显的问题 (#703)

# Reviewed, transaction id: 10102

* feat: 修复编辑基础信息弹框中维护人员不回显的问题
# Reviewed, transaction id: 10119

* feat: 全局配置开发完成

* feat: 全局配置
# Reviewed, transaction id: 10271

* Merge remote-tracking branch 'base/master'
, # Reviewed, transaction id: 10480

* feat: 日志优化前端功能开发&&“校验并查看地址”展示的路径不全时没有tooltips&&发布记录:导航样式不对&&通过环境概览页面发布资源后,页面下方资源信息未更新

* Merge remote-tracking branch 'base/master'
, # Reviewed, transaction id: 10706

* feat: 1.14功能开发
# Reviewed, transaction id: 10707

* feat: 1.14功能开发

* feat: 修复基本信息编辑时,弹框中维护人员不显示的问题;获取全局配置 BK_APP_CODE 动态获取
# Reviewed, transaction id: 10785

* feat: 优化全局配置相关逻辑;全局配置增加本地开发 mock 接口
# Reviewed, transaction id: 10838

---------

Co-authored-by: lhzzforever <zly2576885332@163.com>
Co-authored-by: shuzhenyang <shuzhen.yang2@gientech.com>
Co-authored-by: 逍遥尊者 <46641918+lhzzforever@users.noreply.github.com>
Co-authored-by: wklken <wklken@gmail.com>
  • Loading branch information
5 people authored Jun 28, 2024
1 parent 89b1bca commit d94bad4
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 29 deletions.
1 change: 1 addition & 0 deletions src/dashboard-front/bk.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
return {
devServer: {
setupMiddlewares: mockServer,
host: 'dev-t.paas3-dev.bktencent.com',
client: {
overlay: false,
},
Expand Down
1 change: 1 addition & 0 deletions src/dashboard-front/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
var BK_DASHBOARD_CSRF_COOKIE_NAME = '<%= process.env.BK_DASHBOARD_CSRF_COOKIE_NAME %>'
var BK_LIST_USERS_API_URL = `${BK_COMPONENT_API_URL}/api/c/compapi/v2/usermanage/fs_list_users/` // 人员选择器接口地址,可选填
var BK_DOCS_URL_PREFIX_MARKDOWN = `${BK_DOCS_URL_PREFIX}/markdown/APIGateway`
var BK_APP_HOST = '<%= process.env.BK_APP_HOST %>'
</script>
</script>
</body>
Expand Down
38 changes: 38 additions & 0 deletions src/dashboard-front/mock-server/base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function sleep(sec) {
return new Promise((resolve) => {
setTimeout(resolve, sec * 1000);
});
};

const tableList = (app) => {
app.get('/bk_apigateway/base.js', (req, res) => {
// await sleep(10);
const callback = req.query.callback;
const data = {
bkAppCode: 'bk_apigateway', // appcode
name: 'API Gateway', // 站点的名称,通常显示在页面左上角,也会出现在网页title中
nameEn: 'API Gateway', // 站点的名称-英文
appLogo: '/static/images/APIgataway-c.png', // 站点logo
appLogoEn: '/static/images/APIgataway-en.png', // 站点logo
favicon: '/static/images/favicon.png', // 站点favicon
helperText: '联系 BK 助手',
helperTextEn: 'Contact BK Assistant',
helperLink: 'wxwork://message/?username=BK%E5%8A%A9%E6%89%8B',
brandImg: '/static/images/brand.png',
brandImgEn: '/static/images/brand.png',
brandName: '腾讯蓝鲸智云', // 品牌名,会用于拼接在站点名称后面显示在网页title中
brandNameEn: 'BlueKing', // 品牌名-英文
footerInfo: '[技术支持](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [社区论坛](https://bk.tencent.com/s-mart/community/) | [产品官网](https://bk.tencent.com/index/)', // 页脚的内容,仅支持 a 的 markdown 内容格式
footerInfoEn: '[Support](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [Forum](https://bk.tencent.com/s-mart/community/) | [Official](https://bk.tencent.com/index/)', // 页脚的内容-英文
footerCopyright: `Copyright © 2012-2024 Tencent BlueKing. All Rights Reserved. V1.0.0`, // 版本信息,包含变量,展示在页脚内容下方
};
if (callback){
res.type('text/javascript');
res.send(callback + '(' + JSON.stringify(data) + ')');
} else {
res.json(data);
}
});
};

module.exports = tableList;
5 changes: 3 additions & 2 deletions src/dashboard-front/mock-server/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = (middlewares, devServer) => {
devServer.app.use(require('cookie-parser')());
/** mock 接口 */
require('../paas-server/api/table')(devServer.app);
devServer.app.use(require('../paas-server/middleware/user'));
// require('../paas-server/api/table')(devServer.app);
// devServer.app.use(require('../paas-server/middleware/user'));
require('./base')(devServer.app);
return middlewares;
};
2 changes: 1 addition & 1 deletion src/dashboard-front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@blueking/login-modal": "^1.0.3",
"@blueking/notice-component": "^2.0.2",
"@blueking/release-note": "^0.0.1-beta.7",
"@blueking/platform-config": "^1.0.1",
"@blueking/platform-config": "^1.0.3",
"art-template": "^4.13.2",
"bkui-vue": "1.0.3-beta.58",
"connect-history-api-fallback": "^2.0.0",
Expand Down
21 changes: 15 additions & 6 deletions src/dashboard-front/src/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ import en from 'bkui-vue/dist/locale/en.esm';
// @ts-ignore
import NoticeComponent from '@blueking/notice-component';
import '@blueking/notice-component/dist/style.css';
// @ts-ignore
import UserInfo from '@/components/user-info.vue';
// @ts-ignore
import ProductInfo from '@/components/product-info.vue';
// @ts-ignore
import LanguageToggle from '@/components/language-toggle.vue';
// import AppAuth from '@/components/auth/index.vue';
import mitt from '@/common/event-bus';
Expand All @@ -83,7 +81,10 @@ import { useSidebar } from '@/hooks';
// @ts-ignore
import { getPlatformConfig, setShortcutIcon, setDocumentTitle } from '@blueking/platform-config';
// @ts-ignore
import logoSvg from '@/images/APIgataway-en.png';
import logoSvg from '@/images/APIgataway-c.png';
// @ts-ignore
import logoSvgEn from '@/images/APIgataway-en.png';
import { isChinese } from '@/language/i18n';
import constantConfig from '@/constant/config';
const { initSidebarFormData, isSidebarClosed } = useSidebar();
Expand All @@ -108,7 +109,9 @@ const bkuiLocale = computed(() => {
const websiteConfig = ref<any>({});
const getWebsiteConfig = async () => {
const bkSharedResUrl = window.BK_SHARED_RES_URL;
const bkSharedResUrl = window.BK_NODE_ENV === 'development'
? window.BK_DASHBOARD_FE_URL
: window.BK_SHARED_RES_URL;
if (bkSharedResUrl) {
const url = bkSharedResUrl?.endsWith('/') ? bkSharedResUrl : `${bkSharedResUrl}/`;
Expand All @@ -117,6 +120,12 @@ const getWebsiteConfig = async () => {
websiteConfig.value = await getPlatformConfig(constantConfig.SITE_CONFIG);
}
console.log('websiteConfig', websiteConfig.value);
if (websiteConfig.value.i18n) {
websiteConfig.value.i18n.appLogo = websiteConfig.value[isChinese ? 'appLogo' : 'appLogoEn'];
}
setShortcutIcon(websiteConfig.value?.favicon);
setDocumentTitle(websiteConfig.value?.i18n);
common.setWebsiteConfig(websiteConfig.value);
Expand All @@ -125,7 +134,7 @@ getWebsiteConfig();
const appLogo = computed(() => {
// 如果未获取到配置,使用默认logo
const src = websiteConfig.value?.appLogo || logoSvg;
const src = websiteConfig.value?.i18n?.appLogo || (isChinese ? logoSvg : logoSvgEn);
return src;
});
Expand Down
20 changes: 4 additions & 16 deletions src/dashboard-front/src/constant/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,29 +130,17 @@ export default {
name: 'API Gateway', // 站点的名称,通常显示在页面左上角,也会出现在网页title中
nameEn: 'API Gateway', // 站点的名称-英文
appLogo: isChinese ? '/static/images/APIgataway-c.png' : '/static/images/APIgataway-en.png', // 站点logo
appLogoEn: '/static/images/APIgataway-en.png', // 站点logo
favicon: '/static/images/favicon.png', // 站点favicon
helperText: '联系 BK 助手',
helperTextEn: 'Contact BK Assistant',
helperLink: 'wxwork://message/?username=BK%E5%8A%A9%E6%89%8B',
brandImg: 'https://bkrepo.paas3-dev.bktencent.com/generic/blueking/bk-config/bk_cmdb/brand.png?preview=true',
brandImgEn: 'https://bkrepo.paas3-dev.bktencent.com/generic/blueking/bk-config/bk_cmdb/brand.png?preview=true',
brandImg: '/static/images/brand.png',
brandImgEn: '/static/images/brand.png',
brandName: '腾讯蓝鲸智云', // 品牌名,会用于拼接在站点名称后面显示在网页title中
brandNameEn: '腾讯蓝鲸智云', // 品牌名-英文
brandNameEn: 'BlueKing', // 品牌名-英文
footerInfo: '[技术支持](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [社区论坛](https://bk.tencent.com/s-mart/community/) | [产品官网](https://bk.tencent.com/index/)', // 页脚的内容,仅支持 a 的 markdown 内容格式
footerInfoEn: '[Support](https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true) | [Forum](https://bk.tencent.com/s-mart/community/) | [Official](https://bk.tencent.com/index/)', // 页脚的内容-英文
footerCopyright: `Copyright © 2012-${curYear} Tencent BlueKing. All Rights Reserved. V${BK_APIGATEWAY_VERSION}`, // 版本信息,包含变量,展示在页脚内容下方

footerInfoHTML: '<a target="_blank" class="link-item" href="https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true">技术支持</a> | <a target="_blank" class="link-item" href="https://bk.tencent.com/s-mart/community/">社区论坛</a> | <a target="_blank" class="link-item" href="https://bk.tencent.com/index/">产品官网</a>',
footerInfoHTMLEn: '<a target="_blank" class="link-item" href="https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true">Support</a> | <a target="_blank" class="link-item" href="https://bk.tencent.com/s-mart/community/">Forum</a> | <a target="_blank" class="link-item" href="https://bk.tencent.com/index/">Official</a>',
footerCopyrightContent: `Copyright © 2012-${curYear} Tencent BlueKing. All Rights Reserved. V${BK_APIGATEWAY_VERSION}`,

// 需要国际化的字段,根据当前语言cookie自动匹配,页面中应该优先使用这里的字段
i18n: {
name: 'API Gateway',
helperText: '联系 BK 助手',
brandImg: 'https://bkrepo.paas3-dev.bktencent.com/generic/blueking/bk-config/bk_cmdb/brand.png?preview=true',
brandName: '腾讯蓝鲸智云',
footerInfoHTML: '<a target="_blank" class="link-item" href="https://wpa1.qq.com/KziXGWJs?_type=wpa&qidian=true">技术支持</a> | <a target="_blank" class="link-item" href="https://bk.tencent.com/s-mart/community/">社区论坛</a> | <a target="_blank" class="link-item" href="https://bk.tencent.com/index/">产品官网</a>',
},
},
};
Binary file added src/dashboard-front/static/images/brand.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/dashboard-front/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ declare interface Window {
SEND_CHAT_API: string
BK_SHARED_RES_URL: string
BK_APP_CODE: string
BK_NODE_ENV: string
}

declare module "*.svg" {
Expand Down
8 changes: 4 additions & 4 deletions src/dashboard-front/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1120,10 +1120,10 @@
resolved "https://registry.npmjs.org/@blueking/notice-component/-/notice-component-2.0.2.tgz"
integrity sha512-wAky90ATlMEdnwBHe1LAxR/8gEF8xMpHKgOhgxpZ7MU2YRjgHRmv2grzlc3MNFVK9ziBc7+yJPYLrqJbi5+btw==

"@blueking/platform-config@^1.0.1":
version "1.0.2"
resolved "https://registry.npmjs.org/@blueking/platform-config/-/platform-config-1.0.2.tgz"
integrity sha512-ai4x5Ru0gcucSuxpE9gha7S/lIsU0RsGchrHRPUrbbR8OujzC1X6KmUcRoJDZ4m3gghAUvWQFArkheL+o41v0Q==
"@blueking/platform-config@^1.0.3":
version "1.0.3"
resolved "https://registry.npmjs.org/@blueking/platform-config/-/platform-config-1.0.3.tgz"
integrity sha512-eNTX+Uy8wzjAEfCJJ8OZAWwiyhFr9KseGt9OIg7AR448Qgpgd0qNDgEJeSKEsuUIonZOt9oIw2nXvcZyY8dGLg==
dependencies:
xss "^1.0.15"

Expand Down

0 comments on commit d94bad4

Please sign in to comment.