Skip to content

Commit

Permalink
chore(update): deps and api
Browse files Browse the repository at this point in the history
  • Loading branch information
linhandev committed Feb 10, 2023
1 parent 8b323fe commit b3c1518
Show file tree
Hide file tree
Showing 10 changed files with 1,889 additions and 683 deletions.
2 changes: 0 additions & 2 deletions cypress/support/label.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,8 @@ export const labelIt = {
name: `Tour project ${projectId}, ${clear ? 'clear' : 'wont clear'} anns`,
func: () => {
label.to(projectId, projectType, skipAnnTest);
// cy.wait(1000);
for (var idx = 1; idx < taskCount; idx++) {
if (clear) label.clear();
console.log('asdf', skipAnnTest, idx, taskCount - 1, skipAnnTest || idx != taskCount - 1);
label.next(projectType, skipAnnTest || idx == taskCount - 1);
}
if (clear) label.clear();
Expand Down
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,17 @@
"@ant-design/pro-table": "^2.61.0",
"@babel/core": "^7.0.0-0",
"@types/react-color": "^3.0.6",
"@typescript-eslint/eslint-plugin": "^5.51.0",
"@umijs/route-utils": "^2.0.0",
"ahooks": "^3.7.1",
"antd": "^4.23.5",
"browserslist": "^4.21.3",
"classnames": "^2.3.0",
"dva-core": "^1.6.0-0",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-unicorn": "^45.0.2",
"jsdom": ">=10.0.0",
"konva": "^8.3.2",
"loader-utils": "^3.2.0",
Expand Down Expand Up @@ -88,11 +93,11 @@
"devDependencies": {
"@ant-design/pro-cli": "^2.1.0",
"@types/express": "^4.17.0",
"@types/history": "^4.7.0",
"@types/jest": "^26.0.0",
"@types/history": "^5.0.0",
"@types/jest": "^29.4.0",
"@types/lodash": "^4.14.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
"@types/react": "18.0.27",
"@types/react-dom": "18.0.10",
"@types/react-helmet": "^6.1.0",
"@umijs/fabric": "^2.8.0",
"@umijs/plugin-blocks": "^2.2.0",
Expand All @@ -107,14 +112,14 @@
"cross-port-killer": "^1.3.0",
"detect-installer": "^1.0.0",
"enzyme": "^3.11.0",
"eslint": "^7.32.0",
"eslint": "^8.33.0",
"express": "^4.17.0",
"jsdom-global": "^3.0.0",
"lint-staged": "^10.0.0",
"lint-staged": "13.1.1",
"prettier": "^2.5.0",
"puppeteer-core": "^8.0.0",
"stylelint": "^14.0.0",
"stylelint-config-standard": "^25.0.0",
"puppeteer-core": "19.6.3",
"stylelint": "15.0.0",
"stylelint-config-standard": "30.0.1",
"typescript": "^4.9.4",
"umi-serve": "^1.9.10"
},
Expand Down
1 change: 0 additions & 1 deletion src/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ if (window.location.hostname == 'paddlecv-sig.github.io') {
} else {
const port = process.env.NODE_ENV == 'development' ? '17995' : window.location.port;
localStorage.setItem('basePath', `http://${window.location.hostname}:${port}/api`);
// console.log('asdf', process.env, `http://${window.location.hostname}:${port}/api`);
}

/**
Expand Down
35 changes: 18 additions & 17 deletions src/components/PPCreator/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
import React, { useState, useEffect } from 'react';
import { Col, Form, Input, Button, Radio, Row, Spin, Tree, message } from 'antd';
import type { TreeDataNode, DirectoryTreeProps } from 'antd';
Expand All @@ -7,7 +6,7 @@ import Title from 'antd/lib/typography/Title';
import { history } from 'umi';
import styles from './index.less';
import serviceUtils from '@/services/serviceUtils';
import { createInfo, camel2snake, snake2camel, sampleApi, IntlInit } from '@/services/utils';
import { createInfo, camel2snake, IntlInit } from '@/services/utils';
import { ProjectUtils } from '@/services/utils';
import { IntlInitJsx } from '@/components/PPIntl';
// import { render } from 'react-dom';
Expand Down Expand Up @@ -63,6 +62,7 @@ const PPCreator: React.FC<PPCreatorProps> = (props) => {
const taskCategory = query?.taskCategory;
const projects = ProjectUtils(useState);
const [loading, setLoading] = useState<boolean>(false);
/* eslint-disable-next-line @typescript-eslint/no-unused-vars */
const [sampleFiles, setSampleFiles] = useState<TreeDataNode[]>([]);
const [importOptions, setImportOptions] = useState<ImportOption[]>([]);
const [reload, setReload] = useState<number>(0);
Expand All @@ -71,22 +71,20 @@ const PPCreator: React.FC<PPCreatorProps> = (props) => {
const [form] = Form.useForm();

const renderImportOptions = () => {
console.log('asdf');
const options: object[] = [];
for (const option of importOptions) {
let display = true;
for (const idx in option.showAfter) {
const condition = option.showAfter[idx];
for (const condition of option.showAfter) {
// const condition = option.showAfter[idx];
if (form.getFieldValue(condition[0]) != condition[1]) display = false;
console.log('asdf', form.getFieldValue(condition[0]), condition[1]);
}
console.log('asdf', display);
if (projectId) display = display && option.allowEdit; // if editing project settings, only show allowEdit questions

if (display)
options.push(
<Form.Item
name={option.label}
label={intl(option.label)}
label={intlJsx(option.label)}
labelCol={{ span: 6 }}
wrapperCol={{ span: 16 }}
style={{ fontSize: '1.5rem' }}
Expand Down Expand Up @@ -119,16 +117,11 @@ const PPCreator: React.FC<PPCreatorProps> = (props) => {
};
useEffect(() => {
if (taskCategory)
projects.getImportOptions(taskCategory).then((res) => {
for (const option of res)
if (option.label == 'labelFormat') option.choices?.unshift(['noLabel', '']);
setImportOptions(res);
});
projects.getOptions('import', taskCategory).then((res) => setImportOptions(res));
}, [taskCategory]);

const saveProject = (values: any) => {
setLoading(true);
console.log('values', values);
if (!projectId) {
projects
.create({
Expand All @@ -148,9 +141,17 @@ const PPCreator: React.FC<PPCreatorProps> = (props) => {
history.push(`/${camel2snake(props.taskCategory)}?projectId=${project.projectId}`);
});
} else {
projects.update(projectId, { ...values, otherSettings: otherSettings }).then(() => {
history.push(`/project_overview?projectId=${projectId}`);
});
projects
.update(projectId, {
name: values.name,
dataDir: values.dataDir,
description: values.description,
taskCategoryId: createInfo[props.taskCategory].id,
allOptions: values,
})
.then(() => {
history.push(`/project_overview?projectId=${projectId}`);
});
}
};

Expand Down
38 changes: 2 additions & 36 deletions src/pages/Classification/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const Page: React.FC = () => {
const model = ModelUtils(useState, baseUrl);

function postProjectChanged() {
if (project.curr?.labelFormat == 'single_class') label.setOneHot(true);
if (project.curr?.otherSettings?.clasSubCatg == 'singleClass') label.setOneHot(true);
}
const getBase64Image = (img?: HTMLImageElement) => {
console.log('getBase64Image', img);
Expand Down Expand Up @@ -315,9 +315,6 @@ const Page: React.FC = () => {
annotations={annotation.all}
/>
</div>
{/* <div className="pblock">
<PPProgress task={task} project={project} />
</div> */}
<div
className="pblock"
style={{
Expand Down Expand Up @@ -361,43 +358,12 @@ const Page: React.FC = () => {
message.info(intl('preNext'));
}
task.nextTask();
page?.current?.setDragEndPos({
x: 0,
y: 0,
});
page?.current?.setDragEndPos({ x: 0, y: 0 });
}}
>
{tbIntl('nextTask')}
</div>
</div>
{/* <div
className="prevTask"
onClick={() => {
if (!label.activeIds.size) {
message.info(intl('preNext'));
}
task.prevTask();
page?.current?.setDragEndPos({
x: 0,
y: 0,
});
}}
data-test-id={'prevTask'}
/>
<div
className="nextTask"
onClick={() => {
if (!label.activeIds.size) {
message.info(intl('preNext'));
}
task.nextTask();
page?.current?.setDragEndPos({
x: 0,
y: 0,
});
}}
data-test-id={'nextTask'}
/> */}
</Spin>
</div>
<PPToolBar disLoc="right">
Expand Down
6 changes: 3 additions & 3 deletions src/services/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ export const ProjectUtils = (useState: UseStateType) => {
const [finished, setFinished] = useState<number>();
const splitIntl = IntlInitJsx('component.PPSplitDatasetModal');

function getImportOptions(projectType: string) {
return projectApi.getImportOptions(projectType);
function getOptions(imOrExport: string, projectType: string) {
return projectApi.getOptions(projectType, imOrExport);
}

async function splitDataset(props: { train: number; val: number; test: number }) {
Expand Down Expand Up @@ -321,7 +321,7 @@ export const ProjectUtils = (useState: UseStateType) => {
predict,
setAllPredicted,
splitDataset,
getImportOptions,
getOptions,
};
};

Expand Down
Loading

0 comments on commit b3c1518

Please sign in to comment.