Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
疯人忠
Cvat
提交
efa47a3a
C
Cvat
项目概览
疯人忠
/
Cvat
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
Cvat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
efa47a3a
编写于
7月 31, 2019
作者:
A
Artyom Zankevich
提交者:
Boris Sekachev
7月 31, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[NEW-UI] Delete task and pagination edge-cases (#599)
上级
f341419f
变更
30
隐藏空白更改
内联
并排
Showing
30 changed file
with
340 addition
and
53 deletion
+340
-53
cvat-ui/package.json
cvat-ui/package.json
+2
-0
cvat-ui/src/actions/auth.actions.ts
cvat-ui/src/actions/auth.actions.ts
+3
-1
cvat-ui/src/actions/tasks.actions.ts
cvat-ui/src/actions/tasks.actions.ts
+25
-3
cvat-ui/src/components/app/app.test.tsx
cvat-ui/src/components/app/app.test.tsx
+2
-0
cvat-ui/src/components/app/app.tsx
cvat-ui/src/components/app/app.tsx
+30
-17
cvat-ui/src/components/dashboard-page/content/dashboard-content.scss
.../components/dashboard-page/content/dashboard-content.scss
+0
-0
cvat-ui/src/components/dashboard-page/content/dashboard-content.test.tsx
...ponents/dashboard-page/content/dashboard-content.test.tsx
+2
-0
cvat-ui/src/components/dashboard-page/content/dashboard-content.tsx
...c/components/dashboard-page/content/dashboard-content.tsx
+4
-2
cvat-ui/src/components/dashboard-page/dashboard-page.scss
cvat-ui/src/components/dashboard-page/dashboard-page.scss
+0
-0
cvat-ui/src/components/dashboard-page/dashboard-page.test.tsx
...-ui/src/components/dashboard-page/dashboard-page.test.tsx
+3
-1
cvat-ui/src/components/dashboard-page/dashboard-page.tsx
cvat-ui/src/components/dashboard-page/dashboard-page.tsx
+6
-17
cvat-ui/src/components/dashboard-page/footer/dashboard-footer.scss
...rc/components/dashboard-page/footer/dashboard-footer.scss
+0
-0
cvat-ui/src/components/dashboard-page/footer/dashboard-footer.test.tsx
...omponents/dashboard-page/footer/dashboard-footer.test.tsx
+2
-0
cvat-ui/src/components/dashboard-page/footer/dashboard-footer.tsx
...src/components/dashboard-page/footer/dashboard-footer.tsx
+0
-0
cvat-ui/src/components/dashboard-page/header/dashboard-header.scss
...rc/components/dashboard-page/header/dashboard-header.scss
+0
-0
cvat-ui/src/components/dashboard-page/header/dashboard-header.test.tsx
...omponents/dashboard-page/header/dashboard-header.test.tsx
+2
-0
cvat-ui/src/components/dashboard-page/header/dashboard-header.tsx
...src/components/dashboard-page/header/dashboard-header.tsx
+0
-0
cvat-ui/src/components/login-page/login-page.scss
cvat-ui/src/components/login-page/login-page.scss
+0
-0
cvat-ui/src/components/login-page/login-page.test.tsx
cvat-ui/src/components/login-page/login-page.test.tsx
+3
-1
cvat-ui/src/components/login-page/login-page.tsx
cvat-ui/src/components/login-page/login-page.tsx
+10
-4
cvat-ui/src/components/page-not-found/page-not-found.scss
cvat-ui/src/components/page-not-found/page-not-found.scss
+0
-0
cvat-ui/src/components/page-not-found/page-not-found.test.tsx
...-ui/src/components/page-not-found/page-not-found.test.tsx
+3
-1
cvat-ui/src/components/page-not-found/page-not-found.tsx
cvat-ui/src/components/page-not-found/page-not-found.tsx
+3
-3
cvat-ui/src/components/register-page/register-page.scss
cvat-ui/src/components/register-page/register-page.scss
+10
-0
cvat-ui/src/components/register-page/register-page.test.tsx
cvat-ui/src/components/register-page/register-page.test.tsx
+11
-0
cvat-ui/src/components/register-page/register-page.tsx
cvat-ui/src/components/register-page/register-page.tsx
+188
-0
cvat-ui/src/index.tsx
cvat-ui/src/index.tsx
+4
-2
cvat-ui/src/store.ts
cvat-ui/src/store.ts
+14
-1
cvat-ui/src/utils/.gitkeep
cvat-ui/src/utils/.gitkeep
+0
-0
cvat-ui/src/utils/tasks-filter-dto.ts
cvat-ui/src/utils/tasks-filter-dto.ts
+13
-0
未找到文件。
cvat-ui/package.json
浏览文件 @
efa47a3a
...
...
@@ -10,6 +10,7 @@
"@types/react-dom"
:
"16.8.4"
,
"@types/react-redux"
:
"^7.1.1"
,
"@types/react-router-dom"
:
"^4.3.4"
,
"@types/redux-logger"
:
"^3.0.7"
,
"antd"
:
"^3.19.1"
,
"babel-plugin-import"
:
"^1.11.2"
,
"customize-cra"
:
"^0.2.12"
,
...
...
@@ -24,6 +25,7 @@
"react-router-dom"
:
"^5.0.1"
,
"react-scripts"
:
"3.0.1"
,
"redux"
:
"^4.0.3"
,
"redux-logger"
:
"^3.0.6"
,
"redux-thunk"
:
"^2.3.0"
,
"source-map-explorer"
:
"^1.8.0"
,
"typescript"
:
"3.4.5"
...
...
cvat-ui/src/actions/auth.actions.ts
浏览文件 @
efa47a3a
...
...
@@ -17,13 +17,15 @@ export const loginError = (error = {}) => (dispatch: any) => {
});
}
export
const
loginAsync
=
(
username
:
string
,
password
:
string
)
=>
{
export
const
loginAsync
=
(
username
:
string
,
password
:
string
,
history
:
any
)
=>
{
return
(
dispatch
:
any
)
=>
{
dispatch
(
login
());
return
(
window
as
any
).
cvat
.
server
.
login
(
username
,
password
).
then
(
(
authenticated
:
any
)
=>
{
localStorage
.
setItem
(
'
session
'
,
'
true
'
);
dispatch
(
loginSuccess
());
history
.
push
(
history
.
location
.
state
?
history
.
location
.
state
.
from
:
'
/dashboard
'
);
},
(
error
:
any
)
=>
{
dispatch
(
loginError
(
error
));
...
...
cvat-ui/src/actions/tasks.actions.ts
浏览文件 @
efa47a3a
import
queryString
from
'
query-string
'
;
import
setQueryObject
from
'
../utils/tasks-filter-dto
'
export
const
getTasks
=
()
=>
(
dispatch
:
any
,
getState
:
any
)
=>
{
dispatch
({
type
:
'
GET_TASKS
'
,
...
...
@@ -52,14 +57,31 @@ export const getTasksAsync = (queryObject = {}) => {
};
}
export
const
deleteTaskAsync
=
(
task
:
any
)
=>
{
return
(
dispatch
:
any
)
=>
{
export
const
deleteTaskAsync
=
(
task
:
any
,
history
:
any
)
=>
{
return
(
dispatch
:
any
,
getState
:
any
)
=>
{
dispatch
(
deleteTask
());
return
task
.
delete
().
then
(
(
deleted
:
any
)
=>
{
dispatch
(
deleteTaskSuccess
());
dispatch
(
getTasksAsync
());
const
state
=
getState
();
const
queryObject
=
{
page
:
state
.
tasksFilter
.
currentPage
,
search
:
state
.
tasksFilter
.
searchQuery
,
}
if
(
state
.
tasks
.
tasks
.
length
===
1
&&
state
.
tasks
.
tasksCount
!==
1
)
{
queryObject
.
page
=
queryObject
.
page
-
1
;
history
.
push
({
search
:
queryString
.
stringify
(
queryObject
)
});
}
else
if
(
state
.
tasks
.
tasksCount
===
1
)
{
dispatch
(
getTasksAsync
());
}
else
{
const
query
=
setQueryObject
(
queryObject
);
dispatch
(
getTasksAsync
(
query
));
}
},
(
error
:
any
)
=>
{
dispatch
(
deleteTaskError
(
error
));
...
...
cvat-ui/src/components/app/app.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
App
from
'
./app
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
App
/>,
div
);
...
...
cvat-ui/src/components/app/app.tsx
浏览文件 @
efa47a3a
...
...
@@ -2,34 +2,47 @@ import React, { PureComponent } from 'react';
import
{
BrowserRouter
as
Router
,
Route
,
Switch
,
Redirect
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
loginAsync
}
from
'
../../actions/auth.actions
'
;
import
Dashboard
from
'
../dashboard/dashboard
'
;
import
Login
from
'
../login/login
'
;
import
NotFound
from
'
../not-found/not-found
'
;
import
DashboardPage
from
'
../dashboard-page/dashboard-page
'
;
import
LoginPage
from
'
../login-page/login-page
'
;
import
RegisterPage
from
'
../register-page/register-page
'
;
import
PageNotFound
from
'
../page-not-found/page-not-found
'
;
import
'
./app.scss
'
;
class
App
extends
PureComponent
<
any
,
any
>
{
componentDidMount
()
{
// TODO: remove when proper login flow (with router) will be implemented
this
.
props
.
dispatch
(
loginAsync
(
process
.
env
.
REACT_APP_LOGIN
as
string
,
process
.
env
.
REACT_APP_PASSWORD
as
string
,
),
);
}
const
ProtectedRoute
=
({
component
:
Component
,
...
rest
}:
any
)
=>
{
return
(
<
Route
{
...
rest
}
render
=
{
(
props
)
=>
{
return
localStorage
.
getItem
(
'
session
'
)
?
(
<
Component
{
...
props
}
/>
)
:
(
<
Redirect
to
=
{
{
pathname
:
"
/login
"
,
state
:
{
from
:
props
.
location
,
},
}
}
/>
);
}
}
/>
);
};
class
App
extends
PureComponent
<
any
,
any
>
{
render
()
{
return
(
<
Router
>
<
Switch
>
<
Redirect
path
=
"/"
exact
to
=
"/dashboard"
/>
<
Route
path
=
"/dashboard"
component
=
{
Dashboard
}
/>
<
Route
path
=
"/login"
component
=
{
Login
}
/>
<
Route
component
=
{
NotFound
}
/>
<
ProtectedRoute
path
=
"/dashboard"
component
=
{
DashboardPage
}
/>
<
Route
path
=
"/login"
component
=
{
LoginPage
}
/>
<
Route
path
=
"/register"
component
=
{
RegisterPage
}
/>
<
Route
component
=
{
PageNotFound
}
/>
</
Switch
>
</
Router
>
);
...
...
cvat-ui/src/components/dashboard/content/dashboard-content.scss
→
cvat-ui/src/components/dashboard
-page
/content/dashboard-content.scss
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/dashboard/content/dashboard-content.test.tsx
→
cvat-ui/src/components/dashboard
-page
/content/dashboard-content.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
DashboardContent
from
'
./dashboard-content
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
DashboardContent
/>,
div
);
...
...
cvat-ui/src/components/dashboard/content/dashboard-content.tsx
→
cvat-ui/src/components/dashboard
-page
/content/dashboard-content.tsx
浏览文件 @
efa47a3a
import
React
,
{
Component
}
from
'
react
'
;
import
{
withRouter
}
from
'
react-router-dom
'
;
import
{
connect
}
from
'
react-redux
'
;
import
{
deleteTaskAsync
}
from
'
../../../actions/tasks.actions
'
;
...
...
@@ -120,7 +122,7 @@ class DashboardContent extends Component<any, any> {
okType
:
'
danger
'
,
centered
:
true
,
onOk
()
{
return
self
.
props
.
dispatch
(
deleteTaskAsync
(
task
));
return
self
.
props
.
dispatch
(
deleteTaskAsync
(
task
,
self
.
props
.
history
));
},
cancelText
:
'
No
'
,
onCancel
()
{
...
...
@@ -142,4 +144,4 @@ const mapStateToProps = (state: any) => {
return
state
.
tasks
;
};
export
default
connect
(
mapStateToProps
)(
DashboardContent
);
export
default
withRouter
(
connect
(
mapStateToProps
)(
DashboardContent
)
as
any
);
cvat-ui/src/components/dashboard
/dashboard
.scss
→
cvat-ui/src/components/dashboard
-page/dashboard-page
.scss
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/dashboard
/dashboard
.test.tsx
→
cvat-ui/src/components/dashboard
-page/dashboard-page
.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
Dashboard
from
'
./dashboard
'
;
import
Dashboard
from
'
./dashboard-page
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
...
...
cvat-ui/src/components/dashboard
/dashboard
.tsx
→
cvat-ui/src/components/dashboard
-page/dashboard-page
.tsx
浏览文件 @
efa47a3a
...
...
@@ -3,6 +3,8 @@ import { Location, Action } from 'history';
import
*
as
queryString
from
'
query-string
'
;
import
setQueryObject
from
'
../../utils/tasks-filter-dto
'
import
{
connect
}
from
'
react-redux
'
;
import
{
getTasksAsync
}
from
'
../../actions/tasks.actions
'
;
import
{
filterTasks
}
from
'
../../actions/tasks-filter.actions
'
;
...
...
@@ -13,7 +15,8 @@ import DashboardHeader from './header/dashboard-header';
import
DashboardContent
from
'
./content/dashboard-content
'
;
import
DashboardFooter
from
'
./footer/dashboard-footer
'
;
import
'
./dashboard.scss
'
;
import
'
./dashboard-page.scss
'
;
class
Dashboard
extends
PureComponent
<
any
,
any
>
{
componentDidMount
()
{
...
...
@@ -21,7 +24,7 @@ class Dashboard extends PureComponent<any, any> {
this
.
props
.
history
.
listen
((
location
:
Location
,
action
:
Action
)
=>
{
this
.
loadTasks
(
location
.
search
);
})
})
;
}
render
()
{
...
...
@@ -36,25 +39,11 @@ class Dashboard extends PureComponent<any, any> {
private
loadTasks
=
(
params
:
any
)
=>
{
const
query
=
queryString
.
parse
(
params
);
const
queryObject
=
this
.
setQueryObject
(
query
);
const
queryObject
=
setQueryObject
(
query
);
this
.
props
.
dispatch
(
filterTasks
(
queryObject
));
this
.
props
.
dispatch
(
getTasksAsync
(
queryObject
));
}
private
setQueryObject
=
(
params
:
{
search
?:
string
,
page
?:
string
}):
{
search
?:
string
,
page
?:
number
}
=>
{
const
queryObject
:
{
search
?:
string
,
page
?:
number
}
=
{};
if
(
params
[
'
search
'
])
{
queryObject
.
search
=
params
.
search
.
toString
();
}
if
(
params
[
'
page
'
])
{
queryObject
.
page
=
parseInt
(
params
.
page
);
}
return
queryObject
;
}
}
const
mapStateToProps
=
(
state
:
any
)
=>
{
...
...
cvat-ui/src/components/dashboard/footer/dashboard-footer.scss
→
cvat-ui/src/components/dashboard
-page
/footer/dashboard-footer.scss
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/dashboard/footer/dashboard-footer.test.tsx
→
cvat-ui/src/components/dashboard
-page
/footer/dashboard-footer.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
DashboardFooter
from
'
./dashboard-footer
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
DashboardFooter
/>,
div
);
...
...
cvat-ui/src/components/dashboard/footer/dashboard-footer.tsx
→
cvat-ui/src/components/dashboard
-page
/footer/dashboard-footer.tsx
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/dashboard/header/dashboard-header.scss
→
cvat-ui/src/components/dashboard
-page
/header/dashboard-header.scss
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/dashboard/header/dashboard-header.test.tsx
→
cvat-ui/src/components/dashboard
-page
/header/dashboard-header.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
DashboardHeader
from
'
./dashboard-header
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
DashboardHeader
/>,
div
);
...
...
cvat-ui/src/components/dashboard/header/dashboard-header.tsx
→
cvat-ui/src/components/dashboard
-page
/header/dashboard-header.tsx
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/login
/login
.scss
→
cvat-ui/src/components/login
-page/login-page
.scss
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/login
/login
.test.tsx
→
cvat-ui/src/components/login
-page/login-page
.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
Login
from
'
./login
'
;
import
Login
from
'
./login-page
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
...
...
cvat-ui/src/components/login
/login
.tsx
→
cvat-ui/src/components/login
-page/login-page
.tsx
浏览文件 @
efa47a3a
...
...
@@ -4,18 +4,24 @@ import { connect } from 'react-redux';
import
{
loginAsync
}
from
'
../../actions/auth.actions
'
;
import
{
Button
,
Icon
,
Input
,
Form
,
Col
,
Row
}
from
'
antd
'
;
import
'
./login.scss
'
;
import
Title
from
'
antd/lib/typography/Title
'
;
import
'
./login-page.scss
'
;
class
LoginForm
extends
PureComponent
<
any
,
any
>
{
componentWillMount
()
{
if
(
localStorage
.
getItem
(
'
session
'
))
{
this
.
props
.
history
.
push
(
'
/dashboard
'
);
}
}
render
()
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
return
(
<
Row
type
=
"flex"
justify
=
"center"
align
=
"middle"
>
<
Col
span
=
{
4
}
>
<
Col
xs
=
{
12
}
md
=
{
10
}
lg
=
{
8
}
xl
=
{
6
}
>
<
Form
className
=
"login-form"
onSubmit
=
{
this
.
onSubmit
}
>
<
Title
className
=
"login-form__title"
>
Login
</
Title
>
...
...
@@ -63,7 +69,7 @@ class LoginForm extends PureComponent<any, any> {
this
.
props
.
form
.
validateFields
((
error
:
any
,
values
:
any
)
=>
{
if
(
!
error
)
{
this
.
props
.
dispatch
(
loginAsync
(
values
.
username
,
values
.
password
))
this
.
props
.
dispatch
(
loginAsync
(
values
.
username
,
values
.
password
,
this
.
props
.
history
));
}
});
}
...
...
cvat-ui/src/components/
not-found/
not-found.scss
→
cvat-ui/src/components/
page-not-found/page-
not-found.scss
浏览文件 @
efa47a3a
文件已移动
cvat-ui/src/components/
not-found/
not-found.test.tsx
→
cvat-ui/src/components/
page-not-found/page-
not-found.test.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
NotFound
from
'
./not-found
'
;
import
NotFound
from
'
./page-not-found
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
...
...
cvat-ui/src/components/
not-found/
not-found.tsx
→
cvat-ui/src/components/
page-not-found/page-
not-found.tsx
浏览文件 @
efa47a3a
...
...
@@ -2,9 +2,9 @@ import React, { PureComponent } from 'react';
import
{
Empty
,
Button
}
from
'
antd
'
;
import
'
./not-found.scss
'
;
import
'
./
page-
not-found.scss
'
;
class
NotFound
extends
PureComponent
<
any
,
any
>
{
class
Page
NotFound
extends
PureComponent
<
any
,
any
>
{
render
()
{
return
(
<
Empty
className
=
"not-found"
description
=
"Page not found..."
>
...
...
@@ -16,4 +16,4 @@ class NotFound extends PureComponent<any, any> {
}
}
export
default
NotFound
;
export
default
Page
NotFound
;
cvat-ui/src/components/register-page/register-page.scss
0 → 100644
浏览文件 @
efa47a3a
.register-form
{
display
:
flex
;
flex-direction
:
column
;
justify-content
:
center
;
height
:
100vh
;
&
__title
{
}
}
cvat-ui/src/components/register-page/register-page.test.tsx
0 → 100644
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
RegisterPage
from
'
./register-page
'
;
it
(
'
renders without crashing
'
,
()
=>
{
const
div
=
document
.
createElement
(
'
div
'
);
ReactDOM
.
render
(<
RegisterPage
/>,
div
);
ReactDOM
.
unmountComponentAtNode
(
div
);
});
cvat-ui/src/components/register-page/register-page.tsx
0 → 100644
浏览文件 @
efa47a3a
import
React
,
{
PureComponent
}
from
'
react
'
;
import
{
connect
}
from
'
react-redux
'
;
// import { registerAsync } from '../../actions/auth.actions';
import
{
Button
,
Icon
,
Input
,
Form
,
Col
,
Row
}
from
'
antd
'
;
import
Title
from
'
antd/lib/typography/Title
'
;
import
'
./register-page.scss
'
;
class
RegisterForm
extends
PureComponent
<
any
,
any
>
{
constructor
(
props
:
any
)
{
super
(
props
);
this
.
state
=
{
confirmDirty
:
false
};
}
componentWillMount
()
{
if
(
localStorage
.
getItem
(
'
session
'
))
{
this
.
props
.
history
.
push
(
'
/dashboard
'
);
}
}
render
()
{
const
{
getFieldDecorator
}
=
this
.
props
.
form
;
return
(
<
Row
type
=
"flex"
justify
=
"center"
align
=
"middle"
>
<
Col
xs
=
{
12
}
md
=
{
10
}
lg
=
{
8
}
xl
=
{
6
}
>
<
Form
className
=
"register-form"
onSubmit
=
{
this
.
onSubmit
}
>
<
Title
className
=
"register-form__title"
>
Register
</
Title
>
<
Form
.
Item
>
{
getFieldDecorator
(
'
username
'
,
{
rules
:
[{
required
:
true
,
message
:
'
Please enter your username!
'
}],
})(
<
Input
prefix
=
{
<
Icon
type
=
"user"
/>
}
type
=
"text"
name
=
"username"
placeholder
=
"Username"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
>
{
getFieldDecorator
(
'
firstName
'
,
{
rules
:
[],
})(
<
Input
prefix
=
{
<
Icon
type
=
"idcard"
/>
}
type
=
"text"
name
=
"first-name"
placeholder
=
"First name"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
>
{
getFieldDecorator
(
'
lastName
'
,
{
rules
:
[],
})(
<
Input
prefix
=
{
<
Icon
type
=
"idcard"
/>
}
type
=
"text"
name
=
"last-name"
placeholder
=
"Last name"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
hasFeedback
>
{
getFieldDecorator
(
'
email
'
,
{
rules
:
[
{
type
:
'
email
'
,
message
:
'
The input is not valid email!
'
,
},
{
required
:
true
,
message
:
'
Please input your email!
'
,
},
],
})(
<
Input
prefix
=
{
<
Icon
type
=
"mail"
/>
}
type
=
"text"
name
=
"email"
placeholder
=
"Email"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
hasFeedback
>
{
getFieldDecorator
(
'
password
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
Please input your password!
'
,
},
{
validator
:
this
.
validateToNextPassword
,
},
],
})(
<
Input
.
Password
prefix
=
{
<
Icon
type
=
"lock"
/>
}
name
=
"password"
placeholder
=
"Password"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
hasFeedback
>
{
getFieldDecorator
(
'
passwordConfirmation
'
,
{
rules
:
[
{
required
:
true
,
message
:
'
Please confirm your password!
'
,
},
{
validator
:
this
.
compareToFirstPassword
,
},
],
})(
<
Input
.
Password
onBlur
=
{
this
.
handleConfirmBlur
}
prefix
=
{
<
Icon
type
=
"lock"
/>
}
name
=
"password-confirmation"
placeholder
=
"Password confirmation"
/>,
)
}
</
Form
.
Item
>
<
Form
.
Item
>
<
Button
type
=
"primary"
htmlType
=
"submit"
loading
=
{
this
.
props
.
isFetching
}
>
Register
</
Button
>
</
Form
.
Item
>
</
Form
>
</
Col
>
</
Row
>
);
}
private
handleConfirmBlur
=
(
event
:
any
)
=>
{
const
{
value
}
=
event
.
target
;
this
.
setState
({
confirmDirty
:
this
.
state
.
confirmDirty
||
!!
value
});
};
private
compareToFirstPassword
=
(
rule
:
any
,
value
:
string
,
callback
:
Function
)
=>
{
const
{
form
}
=
this
.
props
;
if
(
value
&&
value
!==
form
.
getFieldValue
(
'
password
'
))
{
callback
(
'
Two passwords that you enter are inconsistent!
'
);
}
else
{
callback
();
}
};
private
validateToNextPassword
=
(
rule
:
any
,
value
:
string
,
callback
:
Function
)
=>
{
const
{
form
}
=
this
.
props
;
if
(
value
&&
this
.
state
.
confirmDirty
)
{
form
.
validateFields
([
'
passwordConfirmation
'
],
{
force
:
true
});
}
callback
();
};
private
onSubmit
=
(
event
:
any
)
=>
{
event
.
preventDefault
();
this
.
props
.
form
.
validateFields
((
error
:
any
,
values
:
any
)
=>
{
if
(
!
error
)
{
// this.props.dispatch(registerAsync(values.username, values.password, this.props.history));
}
});
}
}
const
mapStateToProps
=
(
state
:
any
)
=>
{
return
state
.
authContext
;
};
export
default
Form
.
create
()(
connect
(
mapStateToProps
)(
RegisterForm
));
cvat-ui/src/index.tsx
浏览文件 @
efa47a3a
import
React
from
'
react
'
;
import
ReactDOM
from
'
react-dom
'
;
import
{
Provider
}
from
'
react-redux
'
import
{
Provider
}
from
'
react-redux
'
import
configureStore
from
'
./store
'
;
import
App
from
'
./components/app/app
'
;
import
*
as
serviceWorker
from
'
./serviceWorker
'
;
import
'
./index.scss
'
;
import
App
from
'
./components/app/app
'
;
ReactDOM
.
render
(
<
Provider
store
=
{
configureStore
()
}
>
...
...
cvat-ui/src/store.ts
浏览文件 @
efa47a3a
import
{
createStore
,
applyMiddleware
,
compose
}
from
'
redux
'
;
import
thunk
from
'
redux-thunk
'
;
import
{
createLogger
}
from
'
redux-logger
'
import
rootReducer
from
'
./reducers/root.reducer
'
;
export
default
function
configureStore
(
initialState
=
{})
{
const
logger
=
createLogger
({
collapsed
:
true
,
});
const
middlewares
=
[];
if
(
process
.
env
.
NODE_ENV
===
`development`
)
{
middlewares
.
push
(
logger
);
}
middlewares
.
push
(
thunk
);
return
createStore
(
rootReducer
,
initialState
,
compose
(
applyMiddleware
(
thunk
),
applyMiddleware
(
...
middlewares
),
(
window
as
any
).
__REDUX_DEVTOOLS_EXTENSION__
?
(
window
as
any
).
__REDUX_DEVTOOLS_EXTENSION__
({
trace
:
true
})
...
...
cvat-ui/src/utils/.gitkeep
已删除
100644 → 0
浏览文件 @
f341419f
cvat-ui/src/utils/tasks-filter-dto.ts
0 → 100644
浏览文件 @
efa47a3a
export
default
(
params
:
{
search
?:
string
,
page
?:
string
}):
{
search
?:
string
,
page
?:
number
}
=>
{
const
queryObject
:
{
search
?:
string
,
page
?:
number
}
=
{};
if
(
params
[
'
search
'
])
{
queryObject
.
search
=
params
.
search
.
toString
();
}
if
(
params
[
'
page
'
])
{
queryObject
.
page
=
parseInt
(
params
.
page
);
}
return
queryObject
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录