Skip to content
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

Merged
merged 16 commits into from
Dec 5, 2018
Merged

App mgmt pages #552

merged 16 commits into from
Dec 5, 2018

Conversation

liiil825
Copy link
Contributor

No description provided.

@codecov
Copy link

codecov bot commented Nov 26, 2018

Codecov Report

Merging #552 into master will increase coverage by 0.06%.
The diff coverage is 16.12%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
src/components/Base/Upload/index.jsx 3.5% <ø> (ø) ⬆️
src/components/Layout/index.js 0% <ø> (ø) ⬆️
src/utils/icons.js 100% <ø> (ø) ⬆️
src/components/Layout/index.jsx 0% <ø> (ø) ⬆️
src/components/Layout/Stepper/index.jsx 0% <0%> (ø)
src/components/Base/DocLink/index.jsx 71.42% <71.42%> (ø)
src/utils/sock-client.js 0% <0%> (ø) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 10c9ef3...720b331. Read the comment docs.

@sunnywx sunnywx removed the v0.4 label Nov 26, 2018
@liiil825 liiil825 changed the title [WIP] Add app and list [WIP] Add app page and list page Nov 27, 2018
@liiil825 liiil825 changed the title [WIP] Add app page and list page [WIP] Add app page and list of apps page Nov 27, 2018
@sunnywx sunnywx changed the title [WIP] Add app page and list of apps page [WIP] App mgmt pages Nov 27, 2018
@liiil825 liiil825 changed the title [WIP] App mgmt pages App mgmt pages Nov 29, 2018
@liiil825
Copy link
Contributor Author

liiil825 commented Dec 5, 2018

#516

const value = target.type === 'checkbox' ? target.checked : target.value;
const name = target.name;

this.props.valueChange(name, value);
Copy link
Contributor

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

Copy link
Contributor Author

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

const name = target.name;

this.props.valueChange(name, value);
this.props.onChange(event);
Copy link
Contributor

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

Copy link
Contributor Author

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 = '';
  };

Copy link
Contributor Author

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

import links from 'config/doc-link';

@translate()
export default class DocLink extends Component {
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

}
if (isExternal) {
if (!linkTo) {
console.error(
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

const {
t, to, name, children, className, isExternal
} = this.props;
let text = t(`LINK_${name}`);
Copy link
Contributor

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}

Copy link
Contributor Author

@liiil825 liiil825 Dec 5, 2018

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})

@@ -170,10 +170,9 @@ export default class Upload extends Component {
return (
<span
{...events}
className={classNames('upload', {
className={classNames(className, 'upload', {
Copy link
Contributor

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

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

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,
Copy link
Contributor

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

Copy link
Contributor Author

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({
Copy link
Contributor

@sunnywx sunnywx Dec 5, 2018

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

Copy link
Contributor Author

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) {
Copy link
Contributor

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 ? '..' : '..'

Copy link
Contributor Author

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}`;
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -12,5 +12,6 @@ export Card from './Card';

export SideNav from './SideNav';
export BreadCrumb from './BreadCrumb';
export LayoutStep from './Stepper';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

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);
Copy link
Contributor

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

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -0,0 +1,13 @@
const docUrl = 'https://docs.openpitrix.io';
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

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,
Copy link
Contributor

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.

Copy link
Contributor Author

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,
Copy link
Contributor

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

Copy link
Contributor Author

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'} />
Copy link
Contributor

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'

Copy link
Contributor Author

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 {
Copy link
Contributor

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 ?

Copy link
Contributor Author

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';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -0,0 +1,3 @@
import Loading from './index.jsx';
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@@ -16,12 +17,18 @@ export default class Loading extends Component {
};

render() {
const { className, isLoading, children } = this.props;
const {
className, grayColor, isLoading, children
Copy link
Contributor

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?

@sunnywx sunnywx merged commit 3c14060 into openpitrix:master Dec 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants