Skip to content

Commit

Permalink
mod: fix bug (#155)
Browse files Browse the repository at this point in the history
fix: fix style
  • Loading branch information
hetao92 authored Mar 24, 2022
1 parent d77ab37 commit c7fcc76
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 22 deletions.
4 changes: 1 addition & 3 deletions app/components/CSVPreviewLink/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ interface IProps {
const CSVPreviewLink = (props: IProps) => {
const { onMapping, file: { content }, children, btnType, selected } = props;
const [visible, setVisible] = useState(false);
const [actived, setActived] = useState(selected || false);
const handleLinkClick = e => {
e.stopPropagation();
setVisible(true);
Expand All @@ -26,7 +25,6 @@ const CSVPreviewLink = (props: IProps) => {
const handleMapping = index => {
onMapping && onMapping(index);
setVisible(false);
setActived(true);
};
const columns = content.length
? content[0].map((_, index) => {
Expand Down Expand Up @@ -69,7 +67,7 @@ const CSVPreviewLink = (props: IProps) => {
</div>
</div>}
>
<Button type="link" className={classNames('btn-preview', { 'primary-btn': btnType === 'default', actived })} onClick={handleLinkClick}>
<Button type="link" className={classNames('btn-preview', { 'primary-btn': btnType === 'default', 'actived': selected })} onClick={handleLinkClick}>
{children}
</Button>
</Popover>
Expand Down
5 changes: 4 additions & 1 deletion app/config/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
"readFailed": "{total} read failed",
"selectFile": "Select bind source file",
"addTag": "Add Tag",
"selectTag": "Select Tag",
"selectEdge": "Select Edge Type",
"config": "Task Config",
"parseFailed": "File parsing failed",
"uploadTemplate": "Drag & drop the YAML configuration file to this area",
Expand Down Expand Up @@ -221,7 +223,8 @@
"length": "Length",
"selectVidTypeTip": "Please select the type",
"csvDownload": "Export CSV File",
"pngDownload": "Export PNG File"
"pngDownload": "Export PNG File",
"rebuildSuccess": "{names} rebuild successfully"
},
"menu": {
"use": "Use Manual",
Expand Down
5 changes: 4 additions & 1 deletion app/config/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@
"readFailed": "{total}读取失败",
"selectFile": "选择绑定文件",
"addTag": "添加 Tag",
"selectTag": "选择 Tag",
"selectEdge": "选择 Edge 类型",
"config": "任务配置",
"parseFailed": "文件解析失败",
"uploadTemplate": "将 YAML 配置文件拖放到该区域",
Expand Down Expand Up @@ -221,7 +223,8 @@
"length": "长度",
"selectVidTypeTip": "选择 Vid 类型",
"csvDownload": "导出 CSV",
"pngDownload": " 导出 PNG"
"pngDownload": " 导出 PNG",
"rebuildSuccess": "{names}重建完成"
},
"menu": {
"use": "使用手册",
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Console/OutputBox/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
width: 100%;
height: 65px;
border-top: 1px solid #E0E0E0;
font-family: PingFangSC-Regular, serif;
font-family: Roboto-Regular, serif;
font-size: 16px;
color: @darkBlue;
letter-spacing: 1.48px;
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Console/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const SEMICOLON_REG = /((?:[^;'"]*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*')[^;'"]*)+)|
const getHistory = () => {
const value: string | null = localStorage.getItem('history');
if (value && value !== 'undefined' && value !== 'null') {
return JSON.parse(value).slice(-15);
return JSON.parse(value).slice(0, 15);
}
return [];
};
Expand Down
2 changes: 2 additions & 0 deletions app/pages/Import/FileUpload/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
.operation {
button {
width: 70px;
padding-left: 0;
justify-content: flex-start;
}
button:not(:last-child) {
margin-right: 15px;
Expand Down
6 changes: 4 additions & 2 deletions app/pages/Import/TaskCreate/SchemaConfig/EdgeConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CloseOutlined } from '@ant-design/icons';
import { observer } from 'mobx-react-lite';
import { useStore } from '@app/stores';
import CSVPreviewLink from '@app/components/CSVPreviewLink';
import classNames from 'classnames';
const Option = Select.Option;

interface IProps {
Expand Down Expand Up @@ -71,8 +72,9 @@ const EdgeConfig = (configProps: IProps) => {
<span className="label">Edge Type</span>
<Select
bordered={false}
className="tag-select"
value={type}
className={classNames('tag-select', { 'no-value': !type })}
placeholder={intl.get('import.selectEdge')}
value={type || null}
dropdownMatchSelectWidth={false}
onChange={value => handleEdgeChange(configIndex, value)}
>
Expand Down
6 changes: 4 additions & 2 deletions app/pages/Import/TaskCreate/SchemaConfig/TagConfig/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { CloseOutlined } from '@ant-design/icons';
import { observer } from 'mobx-react-lite';
import { useStore } from '@app/stores';
import CSVPreviewLink from '@app/components/CSVPreviewLink';
import classNames from 'classnames';
const Option = Select.Option;

interface IProps {
Expand Down Expand Up @@ -72,8 +73,9 @@ const VerticesConfig = (props: IProps) => {
<span className="label">Tag</span>
<Select
bordered={false}
className="tag-select"
value={tag.name}
className={classNames('tag-select', { 'no-value': !tag.name })}
placeholder={intl.get('import.selectTag')}
value={tag.name || null}
dropdownMatchSelectWidth={false}
onChange={value => handleTagChange(configIndex, tagIndex, value)}
>
Expand Down
10 changes: 10 additions & 0 deletions app/pages/Import/TaskCreate/SchemaConfig/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
color: @darkBlue;
}
.btn-preview {
font-family: Roboto-Regular, sans-serif;
font-weight: bold;
color: @blue;
&.actived {
Expand Down Expand Up @@ -47,6 +48,15 @@
align-items: center;
.tag-select {
min-width: 60px;
.ant-select-selection-item {
font-family: Roboto-Bold, sans-serif;
}
.ant-select-selection-placeholder {
color: @blue;
}
&.no-value .ant-select-arrow svg {
fill: @blue;
}
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion app/pages/Import/TaskCreate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ const TaskCreate = () => {
updateSpaceInfo(space);
};

const initTaskDir = async () => {
const dir = await getTaskDir();
if(dir) {
const count = dir.split('/').pop();
updateBasicConfig('taskName', `task-${count}`);
}
};
useEffect(() => {
getTaskDir();
initTaskDir();
getSpaces();
if(currentSpace) {
updateSpaceInfo(currentSpace);
Expand Down
4 changes: 3 additions & 1 deletion app/pages/Import/TaskList/TemplateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TemplateModal = (props: IProps) => {
if(typeof parseContent === 'object') {
const _taskDir = taskDir.endsWith('/') ? taskDir : taskDir + '/';
const _uploadDir = uploadDir.endsWith('/') ? uploadDir : uploadDir + '/';
parseContent.logPath = `${_taskDir}/import.log`;
parseContent.logPath = `${_taskDir}import.log`;
parseContent.files?.forEach(file => {
if(!files.includes(file.path)) {
message.error(intl.get('import.fileNotExist', { name: file.path }));
Expand All @@ -52,7 +52,9 @@ const TemplateModal = (props: IProps) => {
file.failDataPath = _taskDir + `err/${file.failDataPath || 'err.log'}`;
});
setConfig(JSON.stringify(parseContent, null, 2));
const count = taskDir.split('/').pop();
form.setFieldsValue({
name: `task-${count}`,
content: JSON.stringify(parseContent, null, 2),
});
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Login/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
font-weight: 700;
margin-bottom: 70px;
text-align: center;
font-family: Futura-Bold, serif;
font-family: Roboto-Bold, serif;
font-size: 24px;
}
}
Expand Down
4 changes: 2 additions & 2 deletions app/pages/MainPage/Header/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
.nebula-logo {
display: flex;
align-items: center;
font-family: Gilroy-Heavy, serif;
font-family: Roboto-Black, serif;
font-size: 22px;
line-height: 26px;
color: #FFFFFF;
margin-right: 10px;
}
.main-menu {
flex: auto;
font-family: Roboto, serif;
font-family: Roboto-Regular, serif;
font-style: normal;
font-size: 16px;
.nav-link {
Expand Down
3 changes: 3 additions & 0 deletions app/pages/Schema/SchemaConfig/Create/CommonCreate/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
height: 0;
min-height: 0;
}
.item-string-length.ant-form-item-has-success .ant-form-item-explain {
display: none;
}
.label {
font-family: Roboto-Bold;
}
Expand Down
3 changes: 3 additions & 0 deletions app/pages/Schema/SchemaConfig/Edit/CommonEdit/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
height: 0;
min-height: 0;
}
.item-string-length.ant-form-item-has-success .ant-form-item-explain {
display: none;
}
.label {
font-family: Roboto-Bold;
}
Expand Down
16 changes: 12 additions & 4 deletions app/pages/Schema/SchemaConfig/List/Index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const IndexList = () => {
const getData = async () => {
setLoading(true);
await getIndexList(indexType);
await getRebuildData(indexType);
await getRebuildData(indexType, rebuildList);
setSearchVal('');
setLoading(false);
};
Expand All @@ -64,15 +64,23 @@ const IndexList = () => {
}
};

const getRebuildData = async (type: IndexType) => {
const checkIsFinished = (data, raw) => {
const finished = raw?.filter(i => !data.includes(i));
if(finished?.length > 0) {
message.success(intl.get('schema.rebuildSuccess', { names: finished.join(', ') }));
}
};
const getRebuildData = async (type: IndexType, raw) => {
rebuildTimer.current && clearTimeout(rebuildTimer.current);
const data = await getRebuildIndexes(type);
if (data && data.length > 0) {
checkIsFinished(data, raw);
setRebuildList(data);
rebuildTimer.current = setTimeout(() => {
getRebuildData(type);
getRebuildData(type, data);
}, 2000);
} else {
checkIsFinished([], raw);
setRebuildList([]);
rebuildTimer.current && clearTimeout(rebuildTimer.current);
}
Expand All @@ -85,7 +93,7 @@ const IndexList = () => {
name,
});
if (res.code === 0) {
getRebuildData(type);
getRebuildData(type, rebuildList);
}
};
const columns = useMemo(() => [
Expand Down
2 changes: 1 addition & 1 deletion app/pages/Schema/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.schema-page {
padding: 25px 0;
.schema-header {
font-family: Roboto;
font-family: Roboto-Regular;
font-weight: bold;
font-size: 18px;
padding-bottom: 12px;
Expand Down
1 change: 1 addition & 0 deletions app/stores/import.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class ImportStore {
this.update({
taskDir,
});
return taskDir;
}
};

Expand Down
2 changes: 1 addition & 1 deletion app/utils/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const handleKeyword = (name: string) => {
};

export const handleEscape = (name: string) =>
name.replaceAll(/\\/gm, '\\\\').replaceAll('`', '\\`');
name.replace(/\\/gm, '\\\\').replace(/`/gm, '\\`');

export const handleVidStringName = (name: string, spaceVidType?: string) => {
if (spaceVidType && spaceVidType === 'INT64') {
Expand Down

0 comments on commit c7fcc76

Please sign in to comment.