Skip to content

Commit

Permalink
Merge pull request #2735 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
nannan00 authored Jun 25, 2024
2 parents 23b1d7b + 094c71c commit 0275f21
Show file tree
Hide file tree
Showing 57 changed files with 2,142 additions and 3,189 deletions.
5 changes: 4 additions & 1 deletion frontend/build/paas-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ const GLOBAL_VAR = {
ENABLE_BK_NOTICE: process.env.ENABLE_BK_NOTICE || '',
BK_COMPONENT_API_URL: process.env.BK_COMPONENT_API_URL || '',
BK_DOCS_URL_PREFIX: process.env.BK_DOCS_URL_PREFIX || '',
BK_DOMAIN: process.env.BK_DOMAIN || ''
BK_DOMAIN: process.env.BK_DOMAIN || '',
BK_SHARED_RES_URL: process.env.BK_SHARED_RES_URL || '',
BK_APP_CODE: process.env.BK_APP_CODE || '',
VERSION: process.env.VERSION || ''
};

// APA 重定向回首页,由首页Route响应处理
Expand Down
10 changes: 9 additions & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<!-- <link rel="icon" href="{{ STATIC_URL }}/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="{{ STATIC_URL }}/images/favicon.ico" type="image/x-icon" /> -->
<link rel="icon" href="{{ STATIC_URL }}/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="{{ STATIC_URL }}/images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" type="image/x-icon" />
<meta charset="utf-8">
<title>权限中心 | 腾讯蓝鲸智云</title>
</head>
Expand All @@ -29,6 +31,9 @@
const ENABLE_BK_NOTICE = '{{ ENABLE_BK_NOTICE }}' || ''
const BK_DOMAIN = '{{ BK_DOMAIN }}' || ''
const BK_COMPONENT_API_URL = '{{ BK_COMPONENT_API_URL }}' || ''
const BK_SHARED_RES_URL = '{{ BK_SHARED_RES_URL }}' || ''
const BK_APP_CODE = '{{ BK_APP_CODE }}' || ''
const VERSION = '{{ VERSION }}' || ''
document.domain = '{{ SESSION_COOKIE_DOMAIN }}'
window.LOGIN_SERVICE_URL = LOGIN_SERVICE_URL
window.AJAX_URL_PREFIX = AJAX_URL_PREFIX
Expand All @@ -50,6 +55,9 @@
window.CE_URL = CE_URL
window.BK_DOMAIN = BK_DOMAIN
window.BK_COMPONENT_API_URL = BK_COMPONENT_API_URL
window.BK_SHARED_RES_URL = BK_SHARED_RES_URL
window.BK_APP_CODE = BK_APP_CODE
window.VERSION = VERSION
})()

function getLanguage () {
Expand Down
4 changes: 4 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,12 @@
"@babel/preset-env": "~7.4.5",
"@babel/register": "~7.4.4",
"@babel/runtime": "~7.4.5",
"@blueking/bkui-library": "0.0.0-beta.6",
"@blueking/functional-dependency": "0.0.1-beta.12",
"@blueking/login-modal": "^1.0.0",
"@blueking/notice-component-vue2": "^2.0.3",
"@blueking/platform-config": "^1.0.2",
"@blueking/sub-saas": "0.0.0-beta.7",
"@blueking/user-selector": "^1.0.14",
"@commitlint/cli": "~13.1.0",
"@commitlint/config-conventional": "~13.1.0",
Expand Down
94 changes: 81 additions & 13 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
v-if="!externalSystemsLayout.hideIamHeader"
@reload-page="handleRefreshPage"
:route-name="routeName"
:user-group-id="userGroupId">
</header-nav>
:user-group-id="userGroupId"
/>
<the-header
@reload-page="handleRefreshPage"
:route-name="routeName"
Expand All @@ -42,7 +42,8 @@
class="nav-layout"
:route-name="routeName"
@reload-page="reloadCurPage"
v-if="!externalSystemsLayout.hideIamSlider" />
v-if="!externalSystemsLayout.hideIamSlider"
/>
</template>
<main
:class="[
Expand All @@ -62,14 +63,29 @@
</div>
</main>
<!-- <app-auth ref="bkAuth"></app-auth> -->
<template v-if="!enableGroupInstanceSearch && needShowInstanceSearchRoute && noInstanceSearchData.show">
<FunctionalDependency
v-model="noInstanceSearchData.show"
:mode="noInstanceSearchData.mode"
:show-dialog="['dialog'].includes(noInstanceSearchData.mode)"
:title="noInstanceSearchData.title"
:functional-desc="noInstanceSearchData.functionalDesc"
:guide-title="noInstanceSearchData.guideTitle"
:guide-desc-list="noInstanceSearchData.guideDescList"
@gotoMore="handleMoreInfo(noInstanceSearchData.url)"
/>
</template>
</div>
</template>

<script>
// import Cookie from 'js-cookie';
import HeaderNav from '@/components/header-nav/index.vue';
import theHeader from '@/components/header/index.vue';
import theNav from '@/components/nav/index.vue';
import NoticeComponent from '@blueking/notice-component-vue2';
import FunctionalDependency from '@blueking/functional-dependency/vue2/index.umd.min.js';
import '@blueking/functional-dependency/vue2/vue2.css';
import '@blueking/notice-component-vue2/dist/style.css';
// import IamGuide from '@/components/iam-guide/index.vue';
import { existValue, formatI18nKey } from '@/common/util';
Expand All @@ -92,7 +108,8 @@
theHeader,
theNav,
HeaderNav,
NoticeComponent
NoticeComponent,
FunctionalDependency
},
data () {
return {
Expand All @@ -117,7 +134,18 @@
isRouterAlive: true,
showNoticeAlert: false,
noticeApi: `${window.AJAX_URL_PREFIX}/notice/announcements/`,
enableNotice: window.ENABLE_BK_NOTICE.toLowerCase() === 'true'
enableNotice: window.ENABLE_BK_NOTICE.toLowerCase() === 'true',
enableGroupInstanceSearch: window.ENABLE_GROUP_INSTANCE_SEARCH.toLowerCase() === 'true',
// 需要展示FunctionalDependency组件的页面
needShowInstanceSearchRoute: ['applyCustomPerm'],
noInstanceSearchData: {
show: false,
mode: '',
title: '',
functionalDesc: '',
guideTitle: '',
guideDescList: []
}
};
},
computed: {
Expand All @@ -135,6 +163,7 @@
this.routeName = to.name;
this.userGroupId = to.params.id;
this.$store.commit('updateRoute', from.name);
this.getRouteInstanceSearch({ routeName: to.name });
},
user: {
handler (value) {
Expand Down Expand Up @@ -168,22 +197,22 @@
if (!existValue('externalApp')) {
this.fetchVersionLog();
this.fetchNoviceGuide();
this.fetchUserGlobalConfig();
}
const isPoll = window.localStorage.getItem('isPoll');
if (isPoll) {
this.$store.commit('updateSync', true);
this.timer = setInterval(() => {
this.fetchSyncStatus();
}, 15000);
}
this.$once('hook:beforeDestroy', () => {
bus.$off('show-login-modal');
bus.$off('close-login-modal');
bus.$off('updatePoll');
bus.$off('nav-resize');
bus.$off('show-guide');
bus.$off('show-function-dependency');
});
},
mounted () {
Expand Down Expand Up @@ -222,12 +251,9 @@
if (guideMap[payload]) {
guideMap[payload]();
}
// if (payload === 'group') {
// this.groupGuideShow = true;
// }
// if (payload === 'process') {
// this.processGuideShow = true;
// }
});
bus.$on('show-function-dependency', (payload = {}) => {
this.getRouteInstanceSearch(payload);
});
},
methods: {
Expand Down Expand Up @@ -313,6 +339,13 @@
this.messageAdvancedError(e);
}
},
/**
* 获取用户全局配置
*/
async fetchUserGlobalConfig () {
await this.$store.dispatch('userGlobalConfig/getCurrentGlobalConfig');
},
// 是否存在key
existKey (value) {
Expand Down Expand Up @@ -342,6 +375,41 @@
handleShowAlertChange (isShow) {
console.log(isShow, '跑马灯回调');
this.showNoticeAlert = isShow;
},
handleMoreInfo (payload) {
window.open(`${window.BK_DOCS_URL_PREFIX}${payload}`);
},
getRouteInstanceSearch (payload = {}) {
const { show, routeName } = payload;
const routeMap = {
applyCustomPerm: () => {
this.noInstanceSearchData = Object.assign({}, {
show: show || false,
mode: 'dialog',
url: `/IAM//1.8/UserGuide/Feature/PermissionsApply.md`,
title: this.$t(`m.permApply['未启用用户组自动推荐功能']`),
functionalDesc: this.t(`m.permApply['该功能可以根据用户当前的权限需求,自动匹配相关的用户组']`),
guideTitle: this.$t(`m.permApply['如需启用该功能,请联系部署同学部署相关ES服务']`),
guideDescList: []
});
if (this.noInstanceSearchData.show) {
this.$nextTick(() => {
const buttonList = document.getElementsByClassName('fuctional-deps-button-text');
if (buttonList && buttonList.length > 0) {
const customButtonList = [this.$t(`m.common['了解更多']`), this.$t(`m.common['取消']`)];
for (let i = 0; i < buttonList.length; i++) {
buttonList[i].innerText = customButtonList[i];
}
}
});
}
}
};
if (routeMap[routeName]) {
return routeMap[routeName]();
}
}
}
};
Expand Down
Loading

0 comments on commit 0275f21

Please sign in to comment.