diff --git a/web/console/helpers/reduceNetwork.ts b/web/console/helpers/reduceNetwork.ts
index 739af635c..477216bfb 100644
--- a/web/console/helpers/reduceNetwork.ts
+++ b/web/console/helpers/reduceNetwork.ts
@@ -23,15 +23,15 @@ import { parseQueryString } from './urlUtil';
import { getProjectName } from './appUtil';
/** 是否展示没有权限的弹窗 */
-export let Init_Forbiddent_Config = {
+export const Init_Forbiddent_Config = {
isShow: false,
message: ''
};
/** 获取当前的uuid */
export const uuid = () => {
- let s = [];
- let hexDigits = '0123456789abcdef';
+ const s = [];
+ const hexDigits = '0123456789abcdef';
for (let i = 0; i < 36; i++) {
s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
}
@@ -39,7 +39,7 @@ export const uuid = () => {
s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
s[8] = s[13] = s[18] = s[23] = '-';
- let uuid = s.join('');
+ const uuid = s.join('');
return uuid;
};
@@ -81,7 +81,7 @@ export const requestMethodForAction = (type: string) => {
update: Method.patch
};
- let method = mapMethod[type] ? mapMethod[type] : 'get';
+ const method = mapMethod[type] ? mapMethod[type] : 'get';
return method;
};
@@ -157,7 +157,8 @@ export const reduceNetworkRequest = async (
'Content-Type': 'application/json'
},
userDefinedHeader
- )
+ ),
+ timeout: 3 * 60 * 1000
};
if (data) {
@@ -178,7 +179,7 @@ export const reduceNetworkRequest = async (
});
throw error;
} else if (error.response === undefined) {
- let uuid =
+ const uuid =
error.config && error.config.headers && error.config.headers['X-Remote-Extra-RequestID']
? error.config.headers['X-Remote-Extra-RequestID']
: '';
@@ -194,7 +195,7 @@ export const reduceNetworkRequest = async (
}
// 处理回报请求
- let response = reduceNetworkResponse(rsp);
+ const response = reduceNetworkResponse(rsp);
return response;
};
diff --git a/web/console/src/modules/audit/components/AuditSettingDialog.tsx b/web/console/src/modules/audit/components/AuditSettingDialog.tsx
index b49f8a274..957c8e651 100644
--- a/web/console/src/modules/audit/components/AuditSettingDialog.tsx
+++ b/web/console/src/modules/audit/components/AuditSettingDialog.tsx
@@ -28,6 +28,7 @@ import { Base64 } from 'js-base64';
import { allActions } from '../actions';
import { configTest, updateStoreConfig, getStoreConfig } from '../WebAPI';
+import { t } from '@/tencent/tea-app/lib/i18n';
const { useState, useEffect, useReducer } = React;
@@ -280,7 +281,10 @@ export const AuditSetting = props => {
)}
/>
-
+
diff --git a/web/console/src/modules/cluster/actions/validatorActions.ts b/web/console/src/modules/cluster/actions/validatorActions.ts
index e8191412c..265280d12 100644
--- a/web/console/src/modules/cluster/actions/validatorActions.ts
+++ b/web/console/src/modules/cluster/actions/validatorActions.ts
@@ -53,9 +53,6 @@ export const validatorActions = {
if (!value) {
status = 2;
message = content + t('不能为空');
- } else if (value.length > 63) {
- status = 2;
- message = content + t('长度不能超过63个字符');
} else if (!reg.test(value)) {
status = 2;
message = content + t('格式不正确');
@@ -72,10 +69,14 @@ export const validatorActions = {
},
validateComputerLabelValue(Id) {
return (dispatch, getState) => {
- let { labelEdition } = getState().subRoot.computerState,
+ const { labelEdition } = getState().subRoot.computerState,
{ labels } = labelEdition,
eIndex = labels.findIndex(e => e.id === Id);
- let result = validatorActions._validateComputerLabelValue(labels[eIndex].value, 'value', labels[eIndex].disabled);
+ const result = validatorActions._validateComputerLabelValue(
+ labels[eIndex].value,
+ 'value',
+ labels[eIndex].disabled
+ );
labels[eIndex].v_value = result;
dispatch({
type: ActionType.UpdateLabelEdition,
@@ -85,10 +86,10 @@ export const validatorActions = {
},
validateComputerLabelKey(Id) {
return (dispatch, getState) => {
- let { labelEdition } = getState().subRoot.computerState,
+ const { labelEdition } = getState().subRoot.computerState,
{ labels } = labelEdition,
eIndex = labels.findIndex(e => e.id === Id);
- let result = validatorActions._validateComputerLabelValue(labels[eIndex].key, 'key', labels[eIndex].disabled);
+ const result = validatorActions._validateComputerLabelValue(labels[eIndex].key, 'key', labels[eIndex].disabled);
labels[eIndex].v_key = result;
dispatch({
type: ActionType.UpdateLabelEdition,
@@ -108,7 +109,7 @@ export const validatorActions = {
},
validateAllComputerLabel() {
return (dispatch, getState) => {
- let { labelEdition } = getState().subRoot.computerState,
+ const { labelEdition } = getState().subRoot.computerState,
{ labels } = labelEdition;
labels.forEach(label => {
dispatch(validatorActions.validateComputerLabelKey(label.id));
@@ -132,9 +133,6 @@ export const validatorActions = {
if (!value) {
status = 2;
message = content + t('不能为空');
- } else if (value.length > 63) {
- status = 2;
- message = content + t('长度不能超过63个字符');
} else if (!reg.test(value)) {
status = 2;
message = content + t('格式不正确');
@@ -151,10 +149,14 @@ export const validatorActions = {
},
validateComputerTaintValue(Id) {
return (dispatch, getState: GetState) => {
- let { taintEdition } = getState().subRoot.computerState,
+ const { taintEdition } = getState().subRoot.computerState,
{ taints } = taintEdition,
eIndex = taints.findIndex(e => e.id === Id);
- let result = validatorActions._validateComputerTaintValue(taints[eIndex].value, 'value', taints[eIndex].disabled);
+ const result = validatorActions._validateComputerTaintValue(
+ taints[eIndex].value,
+ 'value',
+ taints[eIndex].disabled
+ );
taints[eIndex].v_value = result;
dispatch({
type: ActionType.UpdateTaintEdition,
@@ -164,10 +166,10 @@ export const validatorActions = {
},
validateComputerTaintKey(Id) {
return (dispatch, getState) => {
- let { taintEdition } = getState().subRoot.computerState,
+ const { taintEdition } = getState().subRoot.computerState,
{ taints } = taintEdition,
eIndex = taints.findIndex(e => e.id === Id);
- let result = validatorActions._validateComputerTaintValue(taints[eIndex].key, 'key', taints[eIndex].disabled);
+ const result = validatorActions._validateComputerTaintValue(taints[eIndex].key, 'key', taints[eIndex].disabled);
taints[eIndex].v_key = result;
dispatch({
type: ActionType.UpdateTaintEdition,
@@ -187,7 +189,7 @@ export const validatorActions = {
},
validateAllComputerTaint() {
return (dispatch, getState) => {
- let { taintEdition } = getState().subRoot.computerState,
+ const { taintEdition } = getState().subRoot.computerState,
{ taints } = taintEdition;
taints.forEach(taint => {
dispatch(validatorActions.validateComputerTaintKey(taint.id));
@@ -219,8 +221,8 @@ export const validatorActions = {
},
validateClusterAllocationRatio(type?: string, value?: string) {
return (dispatch, getState: GetState) => {
- let { clusterAllocationRatioEdition } = getState().subRoot;
- let result = validatorActions._validateClusterAllocationRatio(+value);
+ const { clusterAllocationRatioEdition } = getState().subRoot;
+ const result = validatorActions._validateClusterAllocationRatio(+value);
let obj;
if (type === 'cpu') {
obj = {
@@ -239,7 +241,7 @@ export const validatorActions = {
},
validateAllClusterAllocationRatio() {
return (dispatch, getState: GetState) => {
- let {
+ const {
clusterAllocationRatioEdition: { isUseCpu, isUseMemory, cpuRatio, memoryRatio }
} = getState().subRoot;
isUseCpu && dispatch(validatorActions.validateClusterAllocationRatio('cpu', cpuRatio));
@@ -248,7 +250,7 @@ export const validatorActions = {
},
_validateAllClusterAllocationRatio(clusterAllocationRatioEdition: AllocationRatioEdition) {
let result = true;
- let { isUseCpu, isUseMemory, memoryRatio, cpuRatio } = clusterAllocationRatioEdition;
+ const { isUseCpu, isUseMemory, memoryRatio, cpuRatio } = clusterAllocationRatioEdition;
if (isUseCpu) {
result = result && validatorActions._validateClusterAllocationRatio(+cpuRatio).status === 1;
}
diff --git a/web/console/src/modules/cluster/components/resource/nodeManage/UpdateNodeLabelDialog.tsx b/web/console/src/modules/cluster/components/resource/nodeManage/UpdateNodeLabelDialog.tsx
index 837298a21..842ded530 100644
--- a/web/console/src/modules/cluster/components/resource/nodeManage/UpdateNodeLabelDialog.tsx
+++ b/web/console/src/modules/cluster/components/resource/nodeManage/UpdateNodeLabelDialog.tsx
@@ -33,11 +33,11 @@ const mapDispatchToProps = dispatch =>
@connect(state => state, mapDispatchToProps)
export class UpdateNodeLabelDialog extends React.Component {
render() {
- let { actions, route, subRoot, cluster } = this.props,
+ const { actions, route, subRoot, cluster } = this.props,
{ computerState } = subRoot,
{ updateNodeLabel, labelEdition } = computerState,
{ labels } = labelEdition;
- let canAdd = isEmpty(labels.filter(x => !x.key));
+ const canAdd = isEmpty(labels.filter(x => !x.key));
return (
{
{t('新增Label')}
- {t(
- '长度不超过63个字符,只能包含字母、数字及"-./",必须以字母或者数字开头结尾,且不能包含"kubernetes"保留字'
- )}
+ {t('只能包含字母、数字及"-./",必须以字母或者数字开头结尾,且不能包含"kubernetes"保留字')}
@@ -74,7 +72,7 @@ export class UpdateNodeLabelDialog extends React.Component {
}
/** 展示Label的选项 */
private _renderLabelList() {
- let { actions, subRoot } = this.props,
+ const { actions, subRoot } = this.props,
{ labels } = subRoot.computerState.labelEdition;
return labels.map((label, index) => {
return (
diff --git a/web/console/src/modules/cluster/models/MonitorPanel.tsx b/web/console/src/modules/cluster/models/MonitorPanel.tsx
index 2f1b19acf..516e19bad 100644
--- a/web/console/src/modules/cluster/models/MonitorPanel.tsx
+++ b/web/console/src/modules/cluster/models/MonitorPanel.tsx
@@ -186,13 +186,13 @@ const gpuMemFields = table => [
{
expr: `mean(k8s_${table}_gpu_memory_used)`,
alias: t('GPU内存使用量'),
- unit: t('块')
+ unit: 'MiB'
// thousands: 1024, valueLabels:valueLabels1024
},
{
expr: `mean(k8s_${table}_rate_gpu_memory_used_node)`,
- alias: t('GPU内存使用量(占节点)'),
- unit: t('块')
+ alias: t('GPU内存使用率(占节点)'),
+ unit: '%'
},
{
expr: `mean(k8s_${table}_rate_gpu_memory_used_request)`,
@@ -288,7 +288,7 @@ export const resourceMonitorFields = [
{
expr: 'mean(k8s_workload_gpu_memory_used)',
alias: t('GPU内存使用量'),
- unit: t('块')
+ unit: 'MiB'
// thousands: 1024, valueLabels:valueLabels1024
},
diff --git a/web/console/src/modules/notify/components/resourceEdition/EditResourceTemplate.tsx b/web/console/src/modules/notify/components/resourceEdition/EditResourceTemplate.tsx
index 495ed58e0..65a0415f8 100644
--- a/web/console/src/modules/notify/components/resourceEdition/EditResourceTemplate.tsx
+++ b/web/console/src/modules/notify/components/resourceEdition/EditResourceTemplate.tsx
@@ -20,7 +20,7 @@ import { t } from '@tencent/tea-app/lib/i18n';
import { Form } from '@tea/component/form';
import { Input } from '@tea/component/input';
import { onChange } from '../../schema/schemaUtil';
-import { Select } from '@tencent/tea-component';
+import { Select, Text } from '@tencent/tea-component';
import { EditResource } from './EditResource';
import { templateSchema } from '../../schema/templateSchema';
import { router } from '../../router';
@@ -79,14 +79,17 @@ export class EditResourceTemplate extends EditResource {
-
+ {mode === 'create' ? (
+
+ ) : (
+ {resource?.properties?.metadata?.properties?.namespace?.value ?? '-'}
+ )}
{this.renderFields(resource.properties.spec.properties[resource.properties.spec['pick']])}