Skip to content

Commit e8d8683

Browse files
committed
mod: update version
1 parent 15c95f4 commit e8d8683

File tree

11 files changed

+70
-61
lines changed

11 files changed

+70
-61
lines changed

app/config/rules.tsx

+31-24
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,67 @@
11
import React from 'react';
22
import { Translation } from '@vesoft-inc/i18n';
3-
import { MAX_COMMENT_BYTES, NAME_REGEX, POSITIVE_INTEGER_REGEX } from '@app/utils/constant';
3+
import { MAX_COMMENT_BYTES, POSITIVE_INTEGER_REGEX } from '@app/utils/constant';
44
import { getByteLength } from '@app/utils/function';
5+
56
export const hostRulesFn = () => [
67
{
78
required: true,
8-
message: <Translation formatMessage={'formRules.hostRequired'} />,
9+
message: <Translation>
10+
{intl => intl.get('formRules.hostRequired')}
11+
</Translation>,
912
},
1013
];
1114

1215
export const usernameRulesFn = () => [
1316
{
1417
required: true,
15-
message: <Translation formatMessage={'formRules.usernameRequired'} />,
18+
message: <Translation>
19+
{intl => intl.get('formRules.usernameRequired')}
20+
</Translation>,
1621
},
1722
];
1823

1924
export const passwordRulesFn = () => [
2025
{
2126
required: true,
22-
message: <Translation formatMessage={'formRules.passwordRequired'} />,
27+
message: <Translation>
28+
{intl => intl.get('formRules.passwordRequired')}
29+
</Translation>,
2330
},
2431
];
2532

26-
export const nameRulesFn = () => {
27-
const version = sessionStorage.getItem('nebulaVersion');
28-
const nameRequired = [
29-
{
30-
required: true,
31-
message: <Translation formatMessage={'formRules.nameRequired'} />,
32-
},
33-
];
34-
const nameValidate = [
35-
{
36-
pattern: NAME_REGEX,
37-
message: <Translation formatMessage={'formRules.nameValidate'} />,
38-
},
39-
];
40-
return version?.startsWith('v2') ? [...nameRequired, ...nameValidate] : nameRequired;
41-
};
33+
export const nameRulesFn = () => [
34+
{
35+
required: true,
36+
message: <Translation>
37+
{intl => intl.get('formRules.nameRequired')}
38+
</Translation>,
39+
}
40+
];
4241

4342
export const numberRulesFn = () => [
4443
{
4544
pattern: POSITIVE_INTEGER_REGEX,
46-
message: <Translation formatMessage={'formRules.numberRequired'} />,
45+
message: <Translation>
46+
{intl => intl.get('formRules.numberRequired')}
47+
</Translation>,
4748
},
4849
];
4950

5051
export const replicaRulesFn = (activeMachineNum) => [
5152
{
5253
pattern: POSITIVE_INTEGER_REGEX,
53-
message: <Translation formatMessage={'formRules.numberRequired'} />,
54+
message: <Translation>
55+
{intl => intl.get('formRules.numberRequired')}
56+
</Translation>,
5457
},
5558
{
5659
validator(_rule, value, callback) {
5760
if (value && Number(value) > activeMachineNum) {
5861
callback(
59-
<Translation formatMessage={'formRules.replicaLimit'} options={{ number: activeMachineNum }} />
62+
<Translation>
63+
{intl => intl.get('formRules.replicaLimit', { number: activeMachineNum })}
64+
</Translation>
6065
);
6166
}
6267
callback();
@@ -70,6 +75,8 @@ export const stringByteRulesFn = () => [
7075
if (byteLength <= MAX_COMMENT_BYTES) {
7176
return Promise.resolve();
7277
}
73-
return Promise.reject(<Translation formatMessage={'formRules.maxBytes'} options={{ 'max': MAX_COMMENT_BYTES }} />);
78+
return Promise.reject(<Translation>
79+
{intl => intl.get('formRules.maxBytes', { max: MAX_COMMENT_BYTES })}
80+
</Translation>);
7481
} }
7582
];

app/pages/Welcome/index.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ export interface ModuleItem {
2525
withOrder?: boolean;
2626
}
2727

28+
const { intl } = getI18n();
29+
2830
export const getModuleList = (): ModuleItem[] => {
29-
const { intl } = getI18n();
3031
return [
3132
{
3233
icon: 'icon-studio-nav-schema',
@@ -82,7 +83,6 @@ export interface DocItem {
8283
}
8384

8485
export const getDocList = (): DocItem[] => {
85-
const { intl } = getI18n();
8686
return [
8787
{
8888
title: intl.get('doc.getStarted'),
@@ -105,7 +105,6 @@ export const getDocList = (): DocItem[] => {
105105
export const shouldAlwaysShowWelcome = () => localStorage.getItem('showWelcome') !== 'false';
106106

107107
const getDatasetList = (): DatasetItem[] => {
108-
const { intl } = getI18n();
109108
return [
110109
{
111110
type: 'starter',

app/stores/console.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { v4 as uuidv4 } from 'uuid';
44
import { message } from 'antd';
55
import { getI18n } from '@vesoft-inc/i18n';
66

7+
const { intl } = getI18n();
8+
79
export const splitQuery = (query: string) => {
810
const _query = query.split('\n');
911
const result = _query.reduce((acc, cur) => {
@@ -111,7 +113,6 @@ export class ConsoleStore {
111113
});
112114
};
113115
saveFavorite = async (content: string) => {
114-
const { intl } = getI18n();
115116
const res = await service.saveFavorite({ content }, {
116117
trackEventConfig: {
117118
category: 'console',
@@ -123,7 +124,6 @@ export class ConsoleStore {
123124
}
124125
};
125126
deleteFavorite = async (id?: string) => {
126-
const { intl } = getI18n();
127127
const res = id !== undefined ? await service.deleteFavorite(id) : await service.deleteAllFavorites();
128128
if(res.code === 0) {
129129
message.success(intl.get('common.deleteSuccess'));

app/stores/files.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import service from '@app/config/service';
33
import { message } from 'antd';
44
import { getI18n } from '@vesoft-inc/i18n';
55
import { StudioFile } from '@app/interfaces/import';
6+
const { intl } = getI18n();
67

78
export class FilesStore {
89
fileList: any[] = [];
@@ -41,7 +42,6 @@ export class FilesStore {
4142
};
4243

4344
deleteFile = async (name: string) => {
44-
const { intl } = getI18n();
4545
const res: any = await service.deteleFile({
4646
filename: name,
4747
});

app/stores/graph.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import { makeRoundPosition, updateEdgeMap, updateTagMap } from '@app/config/expl
1111
import TwoGraph from './twoGraph';
1212
import { getRootStore } from '.';
1313
const excludesProperty = ['twoGraph', 'graph', 'canvas', 'width', 'height', 'loading'];
14+
const { intl } = getI18n();
15+
1416
export class GraphStore {
1517
nowDataMap: IDataMap = {};
1618
nodes = observable.set([] as NodeObject[], { deep: false });
@@ -367,7 +369,6 @@ export class GraphStore {
367369
};
368370

369371
checkVertexesExist = async (payload) => {
370-
const { intl } = getI18n();
371372
const { preAddVertexes, inputIds, expand } = payload;
372373
const preAddIds = preAddVertexes.map((i) => String(i.id));
373374
const {

app/stores/schema.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
getIndexCreateGQL,
1111
} from '@app/utils/gql';
1212
import { message } from 'antd';
13+
const { intl } = getI18n();
14+
1315

1416
const initialSchemaData = {
1517
edgeTypes: [],
@@ -771,7 +773,6 @@ export class SchemaStore {
771773
edges: [],
772774
indexes: [],
773775
};
774-
const { intl } = getI18n();
775776
try {
776777
const errMsg = await this.switchSpace(space);
777778
if(errMsg) {

app/stores/sketchModel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { uniqBy } from 'lodash';
1515
import { MAX_COMMENT_BYTES } from '@app/utils/constant';
1616
import { getByteLength } from '@app/utils/function';
1717
import { trackEvent } from '@app/utils/stat';
18+
const { intl } = getI18n();
1819

1920
interface IHoveringItem {
2021
data: ISketchNode | ISketchEdge;
@@ -98,7 +99,6 @@ export class SketchStore {
9899

99100
validateSchema = async () => {
100101
const data = await this.editor?.schema?.getData();
101-
const { intl } = getI18n();
102102
const { nodes, lines } = data;
103103
const nodesValid = nodes.reduce((flag, node) => this.validate(node, 'node') && flag, true);
104104
const edgesValid = lines.reduce((flag, line) => this.validate(line, 'edge') && flag, true);

app/utils/http.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ export enum HttpResCode {
1818
ErrUnknown = 90004000,
1919
}
2020

21+
const { intl } = getI18n();
22+
2123
const service = axios.create({
2224
transformResponse: [
2325
data => {
@@ -46,7 +48,6 @@ service.interceptors.response.use(
4648
return response.data;
4749
},
4850
(error: any) => {
49-
const { intl } = getI18n();
5051
if (error.response?.status) {
5152
const res = error.response.data || {};
5253
if(res.code !== 0 && res.message) {

config/webpack.base.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const webpack = require('webpack');
33
const AntdDayjsWebpackPlugin = require('antd-dayjs-webpack-plugin');
44
const HtmlWebpackPlugin = require('html-webpack-plugin');
55
const CopyPlugin = require('copy-webpack-plugin');
6-
const Package = require('../package.json')
6+
const Package = require('../package.json');
77

88
const commonConfig = {
99
entry: {

0 commit comments

Comments
 (0)