-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App mgmt pages #552
App mgmt pages #552
Conversation
Codecov Report
@@ Coverage Diff @@
## master #552 +/- ##
==========================================
+ Coverage 16.17% 16.23% +0.06%
==========================================
Files 96 98 +2
Lines 1533 1595 +62
Branches 327 341 +14
==========================================
+ Hits 248 259 +11
- Misses 1230 1281 +51
Partials 55 55
Continue to review full report at Codecov.
|
ecf2de8
to
4751aba
Compare
4751aba
to
1ef96a1
Compare
src/components/Base/Input/input.jsx
Outdated
const value = target.type === 'checkbox' ? target.checked : target.value; | ||
const name = target.name; | ||
|
||
this.props.valueChange(name, value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valueChange is redundant, you only need onChange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want a function pass name and it do not affect before
src/components/Base/Input/input.jsx
Outdated
const name = target.name; | ||
|
||
this.props.valueChange(name, value); | ||
this.props.onChange(event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you get target value, using this.props.onChange(value)
is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@action
valueChange = (name, value) => {
this.attribute[name] = value;
if (this.attribute.name) {
this.disableNextStep = false;
} else {
this.disableNextStep = true;
}
this.errorMessage = '';
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
valueChange pass the name param, I can use a generic function to change the store value
src/components/Base/Link/index.jsx
Outdated
import links from 'config/doc-link'; | ||
|
||
@translate() | ||
export default class DocLink extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the component name is DocLink
, you should name this file name as DocLink
too. Also the name is conflict with react-dom Link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/components/Base/Link/index.jsx
Outdated
} | ||
if (isExternal) { | ||
if (!linkTo) { | ||
console.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no need render, just throw Error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/components/Base/Link/index.jsx
Outdated
const { | ||
t, to, name, children, className, isExternal | ||
} = this.props; | ||
let text = t(`LINK_${name}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add t()
here, since you compare text with LINK_${name}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want a default text from it props of name
to t(LINK_${name})
src/components/Base/Upload/index.jsx
Outdated
@@ -170,10 +170,9 @@ export default class Upload extends Component { | |||
return ( | |||
<span | |||
{...events} | |||
className={classNames('upload', { | |||
className={classNames(className, 'upload', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
className placed at last is better, since it's a override style
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -0,0 +1,244 @@ | |||
import React, { Component } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
filename is wrong, just rename it as InfiniteScroll/index.jsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
|
||
export default class InfiniteScroll extends Component { | ||
static propTypes = { | ||
children: PropTypes.node.isRequired, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add children here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
children: PropTypes.node, | ||
className: PropTypes.string, | ||
name: PropTypes.string, | ||
store: PropTypes.shape({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name store
is not good, rename it as stepOption
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
const { steps, activeStep } = store; | ||
const width = `${activeStep * 100 / steps}%`; | ||
let className = 'headerStepNotFinished'; | ||
if (activeStep > steps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor it to
const className = activeStep > step ? '..' : '..'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
return null; | ||
} | ||
|
||
const NAME = `STEPPER_FOOTER_${name.toLocaleUpperCase()}_${activeStep}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't set variable name like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/components/Layout/index.js
Outdated
@@ -12,5 +12,6 @@ export Card from './Card'; | |||
|
|||
export SideNav from './SideNav'; | |||
export BreadCrumb from './BreadCrumb'; | |||
export LayoutStep from './Stepper'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using name Stepper
is ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/components/Layout/index.jsx
Outdated
pageTitle | ||
} = this.props; | ||
|
||
const { isNormal, isDev, isAdmin } = this.props.user; | ||
const hasMenu = (isDev || isAdmin) && !isHome; | ||
const paths = ['/dashboard', '/profile', '/ssh_keys', '/dev/apps']; | ||
const isCenterPage = Boolean(pageTitle); // detail page, only one level menu | ||
const hasSubNav = hasMenu && !isCenterPage && !paths.includes(match.path); | ||
const hasSubNav = !noSubMenu && hasMenu && !isCenterPage && !paths.includes(match.path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hasMenu
should check before noSubMenu
:
hasMenu && !noSubMenu
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@@ -0,0 +1,37 @@ | |||
import React, { Component, Fragment } from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can be removed, duplicate with Loading/index.jsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/config/doc-link.js
Outdated
@@ -0,0 +1,13 @@ | |||
const docUrl = 'https://docs.openpitrix.io'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs link is a global conf, can be placed at src/config/index.js
, or server/local_config.yml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to separate version
, lang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@observer | ||
export default class CreateAppCard extends Component { | ||
static propTypes = { | ||
appCreateStore: PropTypes.object, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this appCreateStore
is no need. External store will be passed down to this component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
export default class CreateAppCard extends Component { | ||
static propTypes = { | ||
appCreateStore: PropTypes.object, | ||
children: PropTypes.node, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to add children
prop, since it's implicit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
size={20} | ||
/> | ||
)} | ||
<Icon name={icon} size={48} className={styles.icon} type={'light'} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor it to type='light'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
import styles from './index.scss'; | ||
|
||
@withRouter | ||
export default class Loading extends Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this component name is Loading
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I forget rename it ...
import { withRouter } from 'react-router'; | ||
import _ from 'lodash'; | ||
|
||
import { getPastTime } from 'src/utils'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place utils after user-defined components
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/components/Loading/index.js
Outdated
@@ -0,0 +1,3 @@ | |||
import Loading from './index.jsx'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/components/Loading/index.jsx
Outdated
@@ -16,12 +17,18 @@ export default class Loading extends Component { | |||
}; | |||
|
|||
render() { | |||
const { className, isLoading, children } = this.props; | |||
const { | |||
className, grayColor, isLoading, children |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the name grayColor
is not good. What does that mean?
No description provided.