Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ant-design-pro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
duanledexianxianxian
ant-design-pro
Commits
494a4681
Commit
494a4681
authored
Jun 25, 2018
by
ιεΈ
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Authorized circular reference
parent
422c7207
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
30 deletions
+32
-30
package.json
package.json
+4
-5
src/components/Authorized/CheckPermissions.js
src/components/Authorized/CheckPermissions.js
+1
-1
src/components/Authorized/PromiseRender.js
src/components/Authorized/PromiseRender.js
+1
-1
src/components/Authorized/index.js
src/components/Authorized/index.js
+2
-23
src/components/Authorized/renderAuthorize.js
src/components/Authorized/renderAuthorize.js
+24
-0
No files found.
package.json
View file @
494a4681
...
@@ -23,9 +23,7 @@
...
@@ -23,9 +23,7 @@
"dependencies"
:
{
"dependencies"
:
{
"
@antv/data-set
"
:
"
^0.8.0
"
,
"
@antv/data-set
"
:
"
^0.8.0
"
,
"
@babel/polyfill
"
:
"
^7.0.0-beta.36
"
,
"
@babel/polyfill
"
:
"
^7.0.0-beta.36
"
,
"
antd
"
:
"
^3.4.3
"
,
"
antd
"
:
"
3.6.4
"
,
"
babel-plugin-transform-decorators-legacy
"
:
"
^1.3.4
"
,
"
babel-runtime
"
:
"
^6.9.2
"
,
"
bizcharts
"
:
"
^3.1.10
"
,
"
bizcharts
"
:
"
^3.1.10
"
,
"
bizcharts-plugin-slider
"
:
"
^2.0.1
"
,
"
bizcharts-plugin-slider
"
:
"
^2.0.1
"
,
"
classnames
"
:
"
^2.2.5
"
,
"
classnames
"
:
"
^2.2.5
"
,
...
@@ -53,11 +51,12 @@
...
@@ -53,11 +51,12 @@
"
babel-eslint
"
:
"
^8.1.2
"
,
"
babel-eslint
"
:
"
^8.1.2
"
,
"
babel-plugin-dva-hmr
"
:
"
^0.4.1
"
,
"
babel-plugin-dva-hmr
"
:
"
^0.4.1
"
,
"
babel-plugin-import
"
:
"
^1.6.7
"
,
"
babel-plugin-import
"
:
"
^1.6.7
"
,
"
babel-plugin-transform-decorators-legacy
"
:
"
^1.3.4
"
,
"
babel-plugin-module-resolver
"
:
"
^3.1.1
"
,
"
babel-plugin-module-resolver
"
:
"
^3.1.1
"
,
"
cross-env
"
:
"
^5.1.1
"
,
"
cross-env
"
:
"
^5.1.1
"
,
"
cross-port-killer
"
:
"
^1.0.1
"
,
"
cross-port-killer
"
:
"
^1.0.1
"
,
"
enzyme
"
:
"
^3.1.0
"
,
"
enzyme
"
:
"
^3.1.0
"
,
"
eslint
"
:
"
^
4.14
.0
"
,
"
eslint
"
:
"
^
5.0
.0
"
,
"
eslint-config-airbnb
"
:
"
^17.0.0
"
,
"
eslint-config-airbnb
"
:
"
^17.0.0
"
,
"
eslint-config-prettier
"
:
"
^2.9.0
"
,
"
eslint-config-prettier
"
:
"
^2.9.0
"
,
"
eslint-plugin-babel
"
:
"
^5.1.0
"
,
"
eslint-plugin-babel
"
:
"
^5.1.0
"
,
...
@@ -73,7 +72,7 @@
...
@@ -73,7 +72,7 @@
"
prettier
"
:
"
1.13.5
"
,
"
prettier
"
:
"
1.13.5
"
,
"
pro-download
"
:
"
^1.0.1
"
,
"
pro-download
"
:
"
^1.0.1
"
,
"
redbox-react
"
:
"
^1.5.0
"
,
"
redbox-react
"
:
"
^1.5.0
"
,
"
regenerator-runtime
"
:
"
^0.1
1.1
"
,
"
regenerator-runtime
"
:
"
^0.1
2.0
"
,
"
roadhog
"
:
"
^2.4.2
"
,
"
roadhog
"
:
"
^2.4.2
"
,
"
roadhog-api-doc
"
:
"
^1.0.3
"
,
"
roadhog-api-doc
"
:
"
^1.0.3
"
,
"
stylelint
"
:
"
^9.2.1
"
,
"
stylelint
"
:
"
^9.2.1
"
,
...
...
src/components/Authorized/CheckPermissions.js
View file @
494a4681
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
PromiseRender
from
'
./PromiseRender
'
;
import
PromiseRender
from
'
./PromiseRender
'
;
import
{
CURRENT
}
from
'
./
index
'
;
import
{
CURRENT
}
from
'
./
renderAuthorize
'
;
function
isPromise
(
obj
)
{
function
isPromise
(
obj
)
{
return
(
return
(
...
...
src/components/Authorized/PromiseRender.js
View file @
494a4681
...
@@ -44,7 +44,7 @@ export default class PromiseRender extends React.PureComponent {
...
@@ -44,7 +44,7 @@ export default class PromiseRender extends React.PureComponent {
};
};
render
()
{
render
()
{
const
Component
=
this
.
state
.
component
;
const
{
component
:
Component
}
=
this
.
state
;
return
Component
?
(
return
Component
?
(
<
Component
{...
this
.
props
}
/
>
<
Component
{...
this
.
props
}
/
>
)
:
(
)
:
(
...
...
src/components/Authorized/index.js
View file @
494a4681
...
@@ -2,31 +2,10 @@ import Authorized from './Authorized';
...
@@ -2,31 +2,10 @@ import Authorized from './Authorized';
import
AuthorizedRoute
from
'
./AuthorizedRoute
'
;
import
AuthorizedRoute
from
'
./AuthorizedRoute
'
;
import
Secured
from
'
./Secured
'
;
import
Secured
from
'
./Secured
'
;
import
check
from
'
./CheckPermissions.js
'
;
import
check
from
'
./CheckPermissions.js
'
;
import
renderAuthorize
from
'
./renderAuthorize
'
;
/* eslint-disable import/no-mutable-exports */
let
CURRENT
=
'
NULL
'
;
Authorized
.
Secured
=
Secured
;
Authorized
.
Secured
=
Secured
;
Authorized
.
AuthorizedRoute
=
AuthorizedRoute
;
Authorized
.
AuthorizedRoute
=
AuthorizedRoute
;
Authorized
.
check
=
check
;
Authorized
.
check
=
check
;
/**
export
default
renderAuthorize
(
Authorized
);
* use authority or getAuthority
* @param {string|()=>String} currentAuthority
*/
const
renderAuthorize
=
currentAuthority
=>
{
if
(
currentAuthority
)
{
if
(
currentAuthority
.
constructor
.
name
===
'
Function
'
)
{
CURRENT
=
currentAuthority
();
}
if
(
currentAuthority
.
constructor
.
name
===
'
String
'
)
{
CURRENT
=
currentAuthority
;
}
}
else
{
CURRENT
=
'
NULL
'
;
}
return
Authorized
;
};
export
{
CURRENT
};
export
default
renderAuthorize
;
src/components/Authorized/renderAuthorize.js
0 β 100644
View file @
494a4681
/* eslint-disable import/no-mutable-exports */
let
CURRENT
=
'
NULL
'
;
/**
* use authority or getAuthority
* @param {string|()=>String} currentAuthority
*/
const
renderAuthorize
=
Authorized
=>
{
return
currentAuthority
=>
{
if
(
currentAuthority
)
{
if
(
currentAuthority
.
constructor
.
name
===
'
Function
'
)
{
CURRENT
=
currentAuthority
();
}
if
(
currentAuthority
.
constructor
.
name
===
'
String
'
)
{
CURRENT
=
currentAuthority
;
}
}
else
{
CURRENT
=
'
NULL
'
;
}
return
Authorized
;
};
};
export
{
CURRENT
};
export
default
Authorized
=>
renderAuthorize
(
Authorized
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment