diff --git a/src/components/DetailTabs/index.jsx b/src/components/DetailTabs/index.jsx
index 4815a516..20d43f72 100644
--- a/src/components/DetailTabs/index.jsx
+++ b/src/components/DetailTabs/index.jsx
@@ -37,14 +37,14 @@ export default class DetailTabs extends Component {
return nextState.curTab !== this.state.curTab;
}
- handleChange = tab => {
- this.setState({ curTab: tab });
- };
-
componentDidUpdate() {
this.props.changeTab(this.state.curTab);
}
+ handleChange = tab => {
+ this.setState({ curTab: tab });
+ };
+
render() {
const { tabs, t } = this.props;
const { curTab } = this.state;
diff --git a/src/components/Header/index.jsx b/src/components/Header/index.jsx
index 144eeaca..41125b51 100644
--- a/src/components/Header/index.jsx
+++ b/src/components/Header/index.jsx
@@ -27,7 +27,7 @@ class Header extends Component {
onSearch = async value => {
const { appStore, history, isHome } = this.props;
const pushUrl = isHome ? `/apps/search/${value}` : `/store/search/${value}`;
- this.props.history.push(pushUrl);
+ history.push(pushUrl);
await appStore.fetchAll({ search_word: value });
appStore.homeApps = appStore.apps;
};
@@ -134,13 +134,23 @@ class Header extends Component {
-
+
{this.renderMenus()}
{this.renderMenuBtns()}
-
+
{t('UPGRADE_PROVIDER')}
diff --git a/src/components/Layout/Dialog/index.jsx b/src/components/Layout/Dialog/index.jsx
index 0f64076e..142f3595 100644
--- a/src/components/Layout/Dialog/index.jsx
+++ b/src/components/Layout/Dialog/index.jsx
@@ -51,7 +51,12 @@ export default class Dialog extends React.PureComponent {
{...rest}
>
-
diff --git a/src/components/Layout/Portal/Dev/index.jsx b/src/components/Layout/Portal/Dev/index.jsx
index 90260219..a8dab3f7 100644
--- a/src/components/Layout/Portal/Dev/index.jsx
+++ b/src/components/Layout/Portal/Dev/index.jsx
@@ -1,6 +1,4 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import classnames from 'classnames';
export default class DevPortal extends React.Component {
static propTypes = {};
diff --git a/src/components/Layout/Portal/Normal/index.jsx b/src/components/Layout/Portal/Normal/index.jsx
index c0762386..7c85302a 100644
--- a/src/components/Layout/Portal/Normal/index.jsx
+++ b/src/components/Layout/Portal/Normal/index.jsx
@@ -1,6 +1,4 @@
import React from 'react';
-import PropTypes from 'prop-types';
-import classnames from 'classnames';
export default class NormalPortal extends React.Component {
static propTypes = {};
diff --git a/src/components/Layout/SideNav/index.jsx b/src/components/Layout/SideNav/index.jsx
index 257cb52e..7e4bcdbe 100644
--- a/src/components/Layout/SideNav/index.jsx
+++ b/src/components/Layout/SideNav/index.jsx
@@ -60,7 +60,7 @@ class SideNav extends React.Component {
}
becomeDeveloper = isNormal => {
- const { rootStore } = this.props;
+ const { rootStore, location } = this.props;
rootStore.updateUser({
changedRole: isNormal ? '' : 'user'
});
diff --git a/src/components/Layout/index.jsx b/src/components/Layout/index.jsx
index 5538c17e..a906ed31 100644
--- a/src/components/Layout/index.jsx
+++ b/src/components/Layout/index.jsx
@@ -3,9 +3,7 @@ import PropTypes from 'prop-types';
import { withRouter } from 'react-router-dom';
import classnames from 'classnames';
import { inject } from 'mobx-react';
-import {
- noop, clone, isEmpty, get
-} from 'lodash';
+import { noop, isEmpty } from 'lodash';
import { Notification, Icon } from 'components/Base';
import Loading from 'components/Loading';
diff --git a/src/components/MenuLayer/index.jsx b/src/components/MenuLayer/index.jsx
index 9add6486..2723bff0 100644
--- a/src/components/MenuLayer/index.jsx
+++ b/src/components/MenuLayer/index.jsx
@@ -1,11 +1,11 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
-import { Link } from 'react-router-dom';
+import { Link, withRouter } from 'react-router-dom';
import { observer, inject } from 'mobx-react';
import { translate } from 'react-i18next';
-import { Popover, Icon } from 'components/Base';
+import { Icon } from 'components/Base';
import { userMeuns } from 'components/Layout/SideNav/navMap';
import styles from './index.scss';
@@ -17,17 +17,17 @@ import styles from './index.scss';
user: rootStore.user
}))
@observer
-export default class MenuLayer extends Component {
+class MenuLayer extends Component {
static propTypes = {
className: PropTypes.string
};
becomeDeveloper = isNormal => {
- const { rootStore } = this.props;
+ const { rootStore, history } = this.props;
rootStore.updateUser({
changedRole: isNormal ? '' : 'user'
});
- location.href = '/dashboard';
+ history.push('/dashboard');
};
render() {
@@ -93,3 +93,4 @@ export default class MenuLayer extends Component {
);
}
}
+export default withRouter(MenuLayer);
diff --git a/src/components/Statistics/index.jsx b/src/components/Statistics/index.jsx
index 8f0f127c..38fca091 100644
--- a/src/components/Statistics/index.jsx
+++ b/src/components/Statistics/index.jsx
@@ -1,6 +1,5 @@
import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
-import classnames from 'classnames';
import { translate } from 'react-i18next';
import { Icon } from 'components/Base';
diff --git a/src/components/TdName/index.jsx b/src/components/TdName/index.jsx
index 91e3350d..b11280db 100644
--- a/src/components/TdName/index.jsx
+++ b/src/components/TdName/index.jsx
@@ -36,7 +36,7 @@ export default class TdName extends React.Component {
const { noCopy, t } = this.props;
if (!noCopy) {
- this.clipboard = new ClipboardJS(this.refs.copyBtn);
+ this.clipboard = new ClipboardJS(this.copyBtn);
this.clipboard.on('success', e => {
this.props.rootStore.notify({
@@ -112,7 +112,9 @@ export default class TdName extends React.Component {
{
+ this.copyBtn = node;
+ }}
>
diff --git a/src/pages/AppDetail/Body/QingCloud/index.jsx b/src/pages/AppDetail/Body/QingCloud/index.jsx
index 291eacd0..f8b536ac 100644
--- a/src/pages/AppDetail/Body/QingCloud/index.jsx
+++ b/src/pages/AppDetail/Body/QingCloud/index.jsx
@@ -72,7 +72,8 @@ export default class QingCloud extends React.Component {
};
renderSlider() {
- let { currentPic, pictures = [] } = this.props;
+ const { currentPic } = this.props;
+ let { pictures = [] } = this.props;
if (typeof pictures === 'string') {
pictures = pictures.split(',').map(v => v.trim());
}
diff --git a/src/pages/Dashboard/Apps/Add/RepoList/index.jsx b/src/pages/Dashboard/Apps/Add/RepoList/index.jsx
index e35d0839..14ff73d9 100644
--- a/src/pages/Dashboard/Apps/Add/RepoList/index.jsx
+++ b/src/pages/Dashboard/Apps/Add/RepoList/index.jsx
@@ -1,10 +1,9 @@
-import React, { PureComponent, Fragment } from 'react';
+import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { capitalize } from 'lodash';
import { translate } from 'react-i18next';
-import { ucfirst } from 'utils/string';
import { Icon } from 'components/Base';
import styles from './index.scss';
diff --git a/src/pages/Dashboard/Apps/Add/index.jsx b/src/pages/Dashboard/Apps/Add/index.jsx
index f389d677..3c2b09bf 100644
--- a/src/pages/Dashboard/Apps/Add/index.jsx
+++ b/src/pages/Dashboard/Apps/Add/index.jsx
@@ -34,7 +34,7 @@ export default class AppAdd extends Component {
}
setCreateStep = step => {
- const { appStore } = this.props;
+ const { appStore, history } = this.props;
const { setCreateStep, createStep } = appStore;
window.scroll({ top: 0, behavior: 'smooth' });
@@ -44,8 +44,7 @@ export default class AppAdd extends Component {
if (step) {
setCreateStep(step);
} else {
- // eslint-disable-next-line
- history.back();
+ history.goBack();
}
};
@@ -229,14 +228,14 @@ export default class AppAdd extends Component {
}
render() {
- const { t } = this.props;
+ const { t, history } = this.props;
const { createStep } = this.props.appStore;
return (
-
diff --git a/src/pages/Dashboard/Apps/Deploy/index.jsx b/src/pages/Dashboard/Apps/Deploy/index.jsx
index 4b30f6c4..67842b96 100644
--- a/src/pages/Dashboard/Apps/Deploy/index.jsx
+++ b/src/pages/Dashboard/Apps/Deploy/index.jsx
@@ -1,4 +1,4 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import { observer, inject } from 'mobx-react';
import classnames from 'classnames';
@@ -52,7 +52,8 @@ export default class AppDeploy extends Component {
}
const repoProviders = _.get(repoStore.repoDetail, 'providers', []);
- const isK8s = (appDeployStore.isK8s = repoProviders.includes('kubernetes'));
+ const isK8s = repoProviders.includes('kubernetes');
+ appDeployStore.isK8s = isK8s;
// fetch runtimes
await appDeployStore.fetchRuntimes({
@@ -146,7 +147,7 @@ export default class AppDeploy extends Component {
};
getFormDataByKey = (keyPrefix = '') => {
- const formData = getFormData(this.refs.deployForm);
+ const formData = getFormData(this.deployForm);
if (!keyPrefix) {
return formData;
@@ -175,7 +176,8 @@ export default class AppDeploy extends Component {
nodesConf,
(res, val, key) => {
const [role, meter] = key.split('.');
- (res[role] || (res[role] = {}))[meter] = keysShouldBeNumber.indexOf(meter) > -1 ? parseInt(val) : val;
+ res[role] = res[role] || {};
+ res[role][meter] = keysShouldBeNumber.indexOf(meter) > -1 ? parseInt(val) : val;
},
{}
);
@@ -375,7 +377,9 @@ export default class AppDeploy extends Component {
className={styles.createForm}
method="post"
onSubmit={this.handleSubmit}
- ref="deployForm"
+ ref={node => {
+ this.deployForm = node;
+ }}
>
{this.renderBody()}
diff --git a/src/pages/Dashboard/Apps/Detail/DetailBlock/index.jsx b/src/pages/Dashboard/Apps/Detail/DetailBlock/index.jsx
index 51dcbd7e..2d761fde 100644
--- a/src/pages/Dashboard/Apps/Detail/DetailBlock/index.jsx
+++ b/src/pages/Dashboard/Apps/Detail/DetailBlock/index.jsx
@@ -8,9 +8,6 @@ import { ProviderName } from 'components/TdName';
import { Image, Button } from 'components/Base';
import Status from 'components/Status';
import CopyId from 'components/DetailCard/CopyId';
-import {
- Grid, Section, Card, Panel
-} from 'components/Layout';
import { mappingStatus } from 'utils';
import styles from './index.scss';
diff --git a/src/pages/Dashboard/Apps/Detail/index.jsx b/src/pages/Dashboard/Apps/Detail/index.jsx
index 53c2540b..7fe788da 100644
--- a/src/pages/Dashboard/Apps/Detail/index.jsx
+++ b/src/pages/Dashboard/Apps/Detail/index.jsx
@@ -117,10 +117,12 @@ export default class AppDetail extends Component {
appVersionStore.isLoading = true;
appVersionStore.uploadFile = base64Str;
appVersionStore.packageName = file.name;
- setTimeout(() => (appVersionStore.isLoading = false), 1000);
+ setTimeout(() => {
+ appVersionStore.isLoading = false;
+ }, 1000);
};
- createVersion = (base64Str, file) => {
+ createVersion = base64Str => {
const { appVersionStore } = this.props;
appVersionStore.currentVersion = {};
appVersionStore.uploadFile = base64Str;
@@ -412,9 +414,7 @@ export default class AppDetail extends Component {
}
const { appDetail } = appStore;
- const {
- isNormal, isDev, isAdmin, role
- } = user;
+ const { isDev, role } = user;
const editStatus = ['draft', 'rejected'];
const isDisabled = !editStatus.includes(currentVersion.status)
|| !isDev
diff --git a/src/pages/Dashboard/Apps/Review/index.jsx b/src/pages/Dashboard/Apps/Review/index.jsx
index 582cb656..74d26fb2 100644
--- a/src/pages/Dashboard/Apps/Review/index.jsx
+++ b/src/pages/Dashboard/Apps/Review/index.jsx
@@ -1,20 +1,9 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
-import { Link } from 'react-router-dom';
import { translate } from 'react-i18next';
-import classnames from 'classnames';
-
-import {
- Icon,
- Button,
- Table,
- Popover,
- Select,
- Modal,
- Image
-} from 'components/Base';
+
+import { Table } from 'components/Base';
import Layout, {
- Dialog,
Grid,
Row,
Section,
diff --git a/src/pages/Dashboard/Apps/index.jsx b/src/pages/Dashboard/Apps/index.jsx
index 367aaf30..430c1990 100644
--- a/src/pages/Dashboard/Apps/index.jsx
+++ b/src/pages/Dashboard/Apps/index.jsx
@@ -1,10 +1,8 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { Link } from 'react-router-dom';
import { translate } from 'react-i18next';
-import {
- filter, get, orderBy, capitalize
-} from 'lodash';
+import { get, orderBy } from 'lodash';
import {
Icon,
@@ -143,7 +141,7 @@ export default class Apps extends Component {
renderHandleMenu = item => {
const { user, t } = this.props;
- const { showDeleteApp, showModifyAppCate } = this.props.appStore;
+ const { showModifyAppCate } = this.props.appStore;
const { isAdmin } = user;
let itemMenu = null,
deployEntry = null;
@@ -259,7 +257,7 @@ export default class Apps extends Component {
} = appStore;
const { repos } = repoStore;
const { users } = userStore;
- const { isNormal, isDev, isAdmin } = user;
+ const { isDev, isAdmin } = user;
const urlFront = isAdmin ? '/store/' : '/dashboard/app/';
let columns = [
diff --git a/src/pages/Dashboard/Audit/Record/index.jsx b/src/pages/Dashboard/Audit/Record/index.jsx
index e50b8b0a..f7c7149c 100644
--- a/src/pages/Dashboard/Audit/Record/index.jsx
+++ b/src/pages/Dashboard/Audit/Record/index.jsx
@@ -1,22 +1,13 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { Link } from 'react-router-dom';
import { translate } from 'react-i18next';
import classnames from 'classnames';
-import {
- Icon,
- Button,
- Table,
- Popover,
- Select,
- Modal,
- Image
-} from 'components/Base';
+import { Icon, Button, Image } from 'components/Base';
import Layout, {
- Dialog, Grid, Row, Section, Card
+ Grid, Row, Section, Card
} from 'components/Layout';
-import { getObjName, mappingStatus, getFilterObj } from 'utils';
import { records } from './record';
import styles from './index.scss';
@@ -42,7 +33,7 @@ export default class AuditRecord extends Component {
}
render() {
- const { appVersionStore, appStore, t } = this.props;
+ const { appStore } = this.props;
const { appDetail } = appStore;
const statusMap = {
notStarted: '未开始',
diff --git a/src/pages/Dashboard/Categories/Detail/index.jsx b/src/pages/Dashboard/Categories/Detail/index.jsx
index c92800a6..3701c1d6 100644
--- a/src/pages/Dashboard/Categories/Detail/index.jsx
+++ b/src/pages/Dashboard/Categories/Detail/index.jsx
@@ -1,19 +1,13 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { Link } from 'react-router-dom';
import { get } from 'lodash';
import { translate } from 'react-i18next';
import {
- Icon,
- Input,
- Table,
- Pagination,
- Popover,
- Modal
+ Icon, Input, Table, Popover, Modal
} from 'components/Base';
import Layout, {
- BackBtn,
Dialog,
Grid,
Section,
@@ -29,8 +23,6 @@ import TimeShow from 'components/TimeShow';
import CategoryCard from 'components/DetailCard/CategoryCard';
import { getObjName, mappingStatus } from 'utils';
-import styles from './index.scss';
-
@translate()
@inject(({ rootStore }) => ({
categoryStore: rootStore.categoryStore,
diff --git a/src/pages/Dashboard/Categories/index.jsx b/src/pages/Dashboard/Categories/index.jsx
index 1dae8845..c304b1b1 100644
--- a/src/pages/Dashboard/Categories/index.jsx
+++ b/src/pages/Dashboard/Categories/index.jsx
@@ -1,4 +1,4 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { Link } from 'react-router-dom';
import classnames from 'classnames';
@@ -6,11 +6,9 @@ import { throttle } from 'lodash';
import { translate } from 'react-i18next';
import {
- Input, Button, Popover, Icon, Modal
+ Input, Popover, Icon, Modal
} from 'components/Base';
-import Layout, {
- Dialog, Grid, Section, BreadCrumb
-} from 'components/Layout';
+import Layout, { Dialog, BreadCrumb } from 'components/Layout';
import AppImages from 'components/AppImages';
import Toolbar from 'components/Toolbar';
import { getScrollTop } from 'utils';
@@ -185,7 +183,7 @@ export default class Categories extends Component {
- {defaultCategories.map((data, index) => (
+ {defaultCategories.map(data => (
- {/*
@@ -123,7 +121,6 @@ export default class Profile extends Component {
type="password"
maxLength={50}
required
- ref={input => (this.input = input)}
/>
@@ -134,14 +131,13 @@ export default class Profile extends Component {
type="password"
maxLength={50}
required
- ref={input => (this.input = input)}
/>
{t('Modify')}
- history.back()}>{t('Cancel')}
+ history.goBack()}>{t('Cancel')}
);
diff --git a/src/pages/Purchased/index.jsx b/src/pages/Purchased/index.jsx
index 1f45c5ef..86caec8d 100644
--- a/src/pages/Purchased/index.jsx
+++ b/src/pages/Purchased/index.jsx
@@ -1,4 +1,4 @@
-import React, { Component, Fragment } from 'react';
+import React, { Component } from 'react';
import { observer, inject } from 'mobx-react';
import { Link } from 'react-router-dom';
import _, { capitalize } from 'lodash';
@@ -6,10 +6,10 @@ import { translate } from 'react-i18next';
import classNames from 'classnames';
import {
- Icon, Button, Table, Popover, Image
+ Icon, Table, Popover, Image
} from 'components/Base';
import Layout, {
- Dialog, Grid, Row, Section, Card
+ Dialog, Grid, Section, Card
} from 'components/Layout';
import Status from 'components/Status';
import Toolbar from 'components/Toolbar';
diff --git a/src/pages/Runtimes/index.jsx b/src/pages/Runtimes/index.jsx
index 50e4a7fe..36a160ac 100644
--- a/src/pages/Runtimes/index.jsx
+++ b/src/pages/Runtimes/index.jsx
@@ -4,7 +4,7 @@ import { observer, inject } from 'mobx-react';
import { translate } from 'react-i18next';
import classNames from 'classnames';
-import { Icon, Button, Popover } from 'components/Base';
+import { Icon, Popover } from 'components/Base';
import Layout, { Dialog, BreadCrumb } from 'components/Layout';
import { ProviderName } from 'components/TdName';
@@ -22,6 +22,17 @@ export default class Runtimes extends Component {
currentType: 'all'
};
+ componentWillMount() {
+ const { runtimeStore, clusterStore } = this.props;
+
+ runtimeStore.runtimes = runtimeStore.runtimes.filter(
+ rt => rt.status !== 'deleted'
+ );
+
+ runtimeStore.reset();
+ clusterStore.reset();
+ }
+
async componentDidMount() {
const { runtimeStore, clusterStore } = this.props;
@@ -31,15 +42,6 @@ export default class Runtimes extends Component {
});
}
- componentWillMount() {
- const { runtimeStore, clusterStore } = this.props;
-
- runtimeStore.runtimes = runtimeStore.runtimes.filter(rt => rt.status !== 'deleted');
-
- runtimeStore.reset();
- clusterStore.reset();
- }
-
selectType = async (value, flag) => {
if (flag) {
return;
@@ -62,11 +64,17 @@ export default class Runtimes extends Component {
return (
- {t('View detail')}
+
+ {t('View detail')}
+
{detail.status !== 'deleted' && (
- {t('Modify Runtime')}
- showDeleteRuntime(detail.runtime_id)}>{t('Delete')}
+
+ {t('Modify Runtime')}
+
+ showDeleteRuntime(detail.runtime_id)}>
+ {t('Delete')}
+
)}
@@ -95,7 +103,10 @@ export default class Runtimes extends Component {
return (
-
+
{runtime.name}
{runtime.description}
@@ -103,7 +114,10 @@ export default class Runtimes extends Component {
- {t('Cloud Provider')}
-
-
+
@@ -112,7 +126,13 @@ export default class Runtimes extends Component {
- {t('Clusters')}
- - {clusters.filter(cluster => runtime.runtime_id === cluster.runtime_id).length}
+ -
+ {
+ clusters.filter(
+ cluster => runtime.runtime_id === cluster.runtime_id
+ ).length
+ }
+
@@ -147,8 +167,11 @@ export default class Runtimes extends Component {
{types.map(type => (
this.selectType(type.value, type.value === currentType)}
+ className={classNames({
+ [styles.active]: type.value === currentType
+ })}
+ onClick={() => this.selectType(type.value, type.value === currentType)
+ }
>
{type.name}
diff --git a/src/pages/SSHKeys/index.jsx b/src/pages/SSHKeys/index.jsx
index 08852a02..0ea55c3f 100644
--- a/src/pages/SSHKeys/index.jsx
+++ b/src/pages/SSHKeys/index.jsx
@@ -5,21 +5,12 @@ import { translate } from 'react-i18next';
import { get } from 'lodash';
import {
- Table,
- Popover,
- Radio,
- Button,
- Input,
- Select,
- Icon,
- Modal
+ Table, Popover, Button, Input, Icon, Modal
} from 'components/Base';
import Layout, {
CreateResource,
Dialog,
- Panel,
Grid,
- Row,
Section,
Card
} from 'components/Layout';
@@ -67,7 +58,7 @@ export default class SSHKeys extends Component {
}
goBack = () => {
- history.back();
+ window.history.back();
};
onClickPair = item => {
diff --git a/src/pages/Store/index.jsx b/src/pages/Store/index.jsx
index 642699f4..97951cbf 100644
--- a/src/pages/Store/index.jsx
+++ b/src/pages/Store/index.jsx
@@ -106,9 +106,7 @@ export default class Store extends Component {
};
render() {
- const {
- appStore, categoryStore, match, t
- } = this.props;
+ const { appStore, categoryStore, match } = this.props;
const { storeApps, isLoading, isProgressive } = appStore;
const categories = categoryStore.categories;