Skip to content

Commit

Permalink
Merge pull request #1976 from TencentBlueKing/develop
Browse files Browse the repository at this point in the history
v1.10.0
  • Loading branch information
zhu327 authored May 11, 2023
2 parents 5cd501b + 4baded0 commit 1e4f884
Show file tree
Hide file tree
Showing 958 changed files with 82,355 additions and 25,357 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ jobs:
pip install -r saas/requirements_dev.txt
- name: Lint with flake8
run: pflake8 --config=saas/pyproject.toml saas
- name: Lint with bandit
run: bandit -c saas/pyproject.toml -r saas
- name: Lint with mypy
run: mypy --config-file=saas/pyproject.toml saas
- name: Test with pytest
Expand Down
34 changes: 22 additions & 12 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@
})()

function getLanguage () {
const cookieList = document.cookie.split(';')
const CUR_LANGUAGE_DATA = cookieList.find(item => item.includes('blueking_language'))
let CUR_LANGUAGE = 'zh-cn'
if (CUR_LANGUAGE_DATA) {
CUR_LANGUAGE = CUR_LANGUAGE_DATA.split('=')[1] || 'zh-cn'
}
// const cookieList = document.cookie.split(';')
// const CUR_LANGUAGE_DATA = cookieList.find(item => item.includes('blueking_language'))
// let CUR_LANGUAGE = 'zh-cn'
// if (CUR_LANGUAGE_DATA) {
// CUR_LANGUAGE = CUR_LANGUAGE_DATA.split('=')[1] || 'zh-cn'
// }
let CUR_LANGUAGE = getCookie('blueking_language') ||'zh-cn'
// 英文 兼容处理
if (['en', 'en-US', 'en-us'].includes(CUR_LANGUAGE)) {
CUR_LANGUAGE = 'en'
Expand All @@ -64,13 +65,22 @@
return CUR_LANGUAGE
}

window.onload = function () {
let ta = document.createElement('script')
ta.src = '//tajs.qq.com/stats?sId=64878578'
ta.defer = 'defer'
let s = document.getElementsByTagName('script')[0]
s.parentNode.insertBefore(ta, s)
function getCookie (name) {
const data = document.cookie.split(';');
const params = {};
for (let i = 0; i < data.length; i++) {
params[data[i].split('=')[0].replace(/\s/, '')] = data[i].split('=')[1];
}
return params[name];
}

// window.onload = function () {
// let ta = document.createElement('script')
// ta.src = '//tajs.qq.com/stats?sId=64878578'
// ta.defer = 'defer'
// let s = document.getElementsByTagName('script')[0]
// s.parentNode.insertBefore(ta, s)
// }
</script>
<script src="{{ STATIC_URL }}/lib.bundle.js"></script>
</body>
Expand Down
157 changes: 133 additions & 24 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,47 +1,68 @@
<template>
<div id="app" :class="systemCls">
<iam-guide
<div id="app"
:class="[
systemCls,
{ 'external-system-layout': externalSystemsLayout.userGroup.groupDetail.setMainLayoutHeight },
{ 'external-app-layout': $route.name === 'addMemberBoundary' }
]">
<!-- <iam-guide
v-if="groupGuideShow"
type="create_group"
direction="left"
:style="groupGuideStyle"
:flag="groupGuideShow"
:content="$t(`m.guide['创建用户组']`)" />
:content="$t(`m.guide['创建用户组']`)" /> -->
<iam-guide
v-if="processGuideShow"
type="set_group_approval_process"
direction="left"
:style="processGuideStyle"
:flag="processGuideShow"
:content="$t(`m.guide['创建审批流程']`)" />
<header-nav @reload-page="handleRefreshPage"
<header-nav
v-if="!externalSystemsLayout.hideIamHeader"
@reload-page="handleRefreshPage"
:route-name="routeName"
:user-group-id="userGroupId">
</header-nav>
<the-header @reload-page="handleRefreshPage"
:route-name="routeName"
:user-group-id="userGroupId"
v-if="isRouterAlive">
</the-header>
<the-nav class="nav-layout" @reload-page="reloadCurPage"></the-nav>
<main class="main-layout" :class="layoutCls"
/>
<the-nav class="nav-layout"
@reload-page="reloadCurPage"
v-if="!externalSystemsLayout.hideIamSlider" />
<main
:class="[
'main-layout',
layoutCls,
{ 'external-main-layout': externalSystemsLayout.userGroup.groupDetail.setMainLayoutHeight }
]"
v-bkloading="{ isLoading: mainContentLoading, opacity: 1, zIndex: 1000 }">
<div ref="mainScroller" class="main-scroller" v-if="isShowPage">
<div ref="mainScroller"
:class="[
'main-scroller',
{ 'external-main-scroller': externalSystemsLayout.userGroup.groupDetail.setMainLayoutHeight }
]"
v-if="isShowPage">
<router-view class="views-layout" :key="routerKey" v-show="!mainContentLoading"></router-view>
</div>
</main>
<app-auth ref="bkAuth"></app-auth>
</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 IamGuide from '@/components/iam-guide/index.vue';
import { existValue, getCookie } from '@/common/util';
import { bus } from '@/common/bus';
import { mapGetters } from 'vuex';
import { afterEach } from '@/router';
import { kebabCase } from 'lodash';
export default {
name: 'app',
provide () {
Expand All @@ -67,18 +88,19 @@
left: '270px'
},
processGuideStyle: {
position: 'absolute',
top: '342px',
left: '270px'
},
processGuideShow: false,
processGuideShow: true,
groupGuideShow: false,
routeName: '',
userGroupId: '',
isRouterAlive: true
};
},
computed: {
...mapGetters(['mainContentLoading', 'user'])
...mapGetters(['mainContentLoading', 'user', 'externalSystemsLayout'])
},
watch: {
'$route' (to, from) {
Expand All @@ -89,24 +111,37 @@
},
user: {
handler (value) {
if (['rating_manager', 'system_manager'].includes(value.role.type)) {
this.processGuideStyle.top = '305px';
}
if (value.role.type === 'super_manager') {
this.processGuideStyle.top = '255px';
}
const roleMap = {
super_manager: () => {
this.processGuideStyle.top = '255px';
},
system_manager: () => {
this.processGuideStyle.top = '305px';
},
rating_manager: () => {
this.processGuideStyle.top = '385px';
},
subset_manager: () => {
this.processGuideStyle.top = '305px';
}
};
return roleMap[value.role.type] ? roleMap[value.role.type]() : '';
},
immediate: true,
deep: true
}
},
created () {
const platform = window.navigator.platform.toLowerCase();
window.CUR_LANGUAGE = getCookie('blueking_language') || 'zh-cn';
this.$i18n.locale = window.CUR_LANGUAGE;
if (platform.indexOf('win') === 0) {
this.systemCls = 'win';
}
this.fetchVersionLog();
this.fetchNoviceGuide();
if (!existValue('externalApp')) {
this.fetchVersionLog();
this.fetchNoviceGuide();
}
const isPoll = window.localStorage.getItem('isPoll');
if (isPoll) {
Expand Down Expand Up @@ -146,12 +181,23 @@
this.processGuideStyle.left = flag ? '270px' : '90px';
});
bus.$on('show-guide', payload => {
if (payload === 'group') {
this.groupGuideShow = true;
}
if (payload === 'process') {
this.processGuideShow = true;
const guideMap = {
group: () => {
this.groupGuideShow = true;
},
process: () => {
this.processGuideShow = true;
}
};
if (guideMap[payload]) {
guideMap[payload]();
}
// if (payload === 'group') {
// this.groupGuideShow = true;
// }
// if (payload === 'process') {
// this.processGuideShow = true;
// }
});
},
methods: {
Expand Down Expand Up @@ -241,7 +287,33 @@
ellipsisCopy: true
});
}
},
// 是否存在key
existKey (value) {
// 1、url截取?之后的字符串(不包含?)
const pathSearch = window.location.search.substr(1);
const result = [];
// 2、以&为界截取参数键值对
const paramItems = pathSearch.split('&');
// 3、将键值对形式的参数存入数组
for (let i = 0; i < paramItems.length; i++) {
const paramKey = paramItems[i].split('=')[0];
const paramValue = paramItems[i].split('=')[1];
result.push({
key: paramKey,
value: paramValue
});
}
// 4、遍历key值
for (let j = 0; j < result.length; j++) {
if (result[j].value === value) {
return true;
}
}
return false;
}
}
};
</script>
Expand Down Expand Up @@ -273,4 +345,41 @@
min-width: 1120px;
padding: 24px;
}
.external-system-layout {
height: calc(100% - 1px) !important;
}
.external-main-scroller, .external-main-layout {
height: 100%;
}
.add-member-boundary-container {
.external-main-scroller {
overflow: hidden;
}
}
.single-hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.external-app-layout {
min-width: 0 !important;
max-width: 900px !important;
}
.user-selector .user-selector-selected .user-selector-selected-clear {
line-height: 20px !important;
}
.flex-between {
display: flex;
align-items: center;
justify-content: space-between;
}
</style>
Loading

0 comments on commit 1e4f884

Please sign in to comment.