Skip to content

Commit

Permalink
Merge pull request #2245 from hLinx/hotfix_3.6.x
Browse files Browse the repository at this point in the history
Hotfix 3.6.x
  • Loading branch information
hLinx authored Jul 19, 2023
2 parents b44bd68 + 9691ac0 commit 10819e2
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/components/app-select/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<input
class="app-name"
readonly
:value="`${scopeName} (${scopeId})`"
:value="scopeId ? `${scopeName} (${scopeId})` : ''"
@keydown.down.prevent="handleStep('next')"
@keydown.enter.prevent="handleSelect"
@keydown.up.prevent="handleStep('prev')">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
- 算式(如 `+n` 或 `*n`)只允许出现在末位
- 不允许出现 `0`
- 含义说明
- ` n`
- ` n`
`n` 必须为整型数值,代表具体多少台
- `n%`
- `n%`
`n` 必须为整型数值,代表总量的百分之n台(遇小数点则向上取整)
- `+n`
- `+n`
代表每次在前一批数量的基础上增加n台
- `*n`
代表每次在前一批数量的基础上乘于n台
- `*n`
代表每次在前一批数量的基础上乘以n台

### 示例展示
当你有100台主机要处理时:
Expand All @@ -40,9 +40,9 @@
滚动策略:5 *2
分批结果:第一批5台,第二批10台,第三批20台,第四批40台,第五批25台
(第五批应为40*2=80台,但由于剩余主机不够,所以获取余量全部)
或者
滚动策略:5 +10
分批结果:第一批5台,第二批15台,第三批25台,第四批35台,第五批20台
(第五批应为35+10=45台,但由于剩余主机不够,所以获取余量全部)
Expand All @@ -52,7 +52,7 @@
方法一
滚动策略:20%
策略说明:每批次取总量百分之20,所以总批次一定为5批
方法二
滚动策略:10 20 20 20 100%
策略说明:第一批10台,第二批20台,第三批20台,第四批20台,第五批全部
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/domain/service/app-manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
},
fetchWholeAppList() {
return AppManageSource.getWholeAppList()
.then(({ data }) => Object.freeze(data));
.then(({ data }) => data);
},
favorApp(params) {
return AppManageSource.updateFavorApp(params)
Expand Down
15 changes: 9 additions & 6 deletions src/frontend/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* IN THE SOFTWARE.
*/

import _ from 'lodash';
import Vue from 'vue';

import createRouter from '@router';
Expand Down Expand Up @@ -139,14 +140,16 @@ entryTask.add((context) => {
entryTask.add(context => AppService.fetchWholeAppList().then((data) => {
context.appList = data.data;
if (!context.scopeType || !context.scopeId) {
const [
{
// 没有指定业务,默认选择第一个有权限的业务
const firstHasPermissionApp = _.find([...context.appList], item => item.hasPermission);
if (firstHasPermissionApp) {
const {
scopeType,
scopeId,
},
] = data.data;
context.scopeType = scopeType;
context.scopeId = scopeId;
} = firstHasPermissionApp;
context.scopeType = scopeType;
context.scopeId = scopeId;
}
}
}));

Expand Down
10 changes: 6 additions & 4 deletions src/frontend/src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export default ({ appList, isAdmin, scopeType, scopeId }) => {
// scope 是有有权限查看
let hasScopePermission = false;

const noScope = !scopeType && !scopeId;

const appInfo = appList.find(_ => _.scopeType === scopeType && _.scopeId === scopeId);
// scope 存在于业务列表中——有效的 scope
if (appInfo) {
Expand All @@ -106,7 +108,7 @@ export default ({ appList, isAdmin, scopeType, scopeId }) => {
children: systemManageRoute,
},
{
path: `/${scopeType}/${scopeId}`,
path: noScope ? '/' : `/${scopeType}/${scopeId}`,
component: Entry,
redirect: {
name: 'home',
Expand Down Expand Up @@ -141,10 +143,10 @@ export default ({ appList, isAdmin, scopeType, scopeId }) => {
},
];

if (!isValidScope) {
renderPageWithComponent(routes[1], NotFound);
} else if (!hasScopePermission) {
if (noScope || !hasScopePermission) {
renderPageWithComponent(routes[1], BusinessPermission);
} else if (!isValidScope) {
renderPageWithComponent(routes[1], NotFound);
}

// admin用户拥有系统设置功能
Expand Down
45 changes: 45 additions & 0 deletions src/frontend/src/views/404.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,53 @@
alt=""
src="/static/images/404.png">
<p>{{ $t('没找到页面!') }}</p>
<div>
<p v-if="$i18n.locale === 'en-US'">
The page you are trying to access does not exist, will redirect to
<router-link :to="{ name: 'home' }">
Homepage
</router-link>
in
<span style="font-weight: bold;">{{ timeout }}</span>
seconds.
</p>
<p v-else>
<span>你访问的页面不存在,将在</span>
<span style="font-weight: bold;">{{ timeout }}</span>
<span>秒后重定向到</span>
<router-link :to="{ name: 'home' }">
首页
</router-link>
<span>。</span>
</p>
</div>
</div>
</template>
<script>
export default {
data() {
return {
timeout: 4,
};
},
created() {
this.goHome();
},
methods: {
goHome() {
if (this.timeout === 1) {
this.$router.replace({
name: 'home',
});
return;
}
this.timeout = this.timeout - 1;
setTimeout(this.goHome, 1000);
},
},
};
</script>

<style scoped lang="postcss">
.exception-box {
margin: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@

const params = {
timeRange: 30,
countPageTotal: false,
};
if (this.recordOperator) {
params.operator = this.recordOperator;
Expand Down

0 comments on commit 10819e2

Please sign in to comment.