Skip to content

Commit

Permalink
fix: Package.json script compat with npm, remove yarn cmd (#537)
Browse files Browse the repository at this point in the history
Fix src/App LazyLoad typo
Refactor dashboard apps change viewType
  • Loading branch information
sunnywx authored Nov 8, 2018
1 parent 2c1d2f1 commit 744eb34
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"scripts": {
"dev:client": "NODE_ENV=development webpack --config webpack.dev.js --progress",
"dev:serve": "DEBUG_DEPTH=5 DEBUG=app BABEL_ENV=server NODE_ENV=development nodemon -w lib -w server server/server.js",
"dev": "npm-run-all -p dev:serve 'dev:client --watch'",
"dev": "npm-run-all -p dev:serve 'dev:client -- --watch'",
"clean:dev": "rimraf build",
"clean:prod": "rimraf dist",
"prod:build": "npm run clean:prod && NODE_ENV=production webpack -p --config webpack.prod.js",
Expand All @@ -57,7 +57,7 @@
"build:prod-server": "node build.js --prod-server",
"lint-fix": "eslint . --fix",
"test": "NODE_ENV=testing jest --config jest.config.json -u",
"precommit": "yarn test && lint-staged",
"precommit": "npm test && lint-staged",
"viz": "webpack --config webpack.dev.js --profile --progress --json > reports/stats.json && webpack-bundle-analyzer reports/stats.json",
"report-cov": "cat ./coverage/lcov.info | codecov",
"dbg": "BABEL_ENV=server NODE_ENV=development node --inspect-brk server/server.js",
Expand Down
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class App extends React.Component {
/>
))}
</Switch>
</LazyLoad>>
</LazyLoad>
</div>
</BrowserRouter>
</Provider>
Expand Down
1 change: 1 addition & 0 deletions src/components/Deploy/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
.editorWrap {
width: 90%;
max-width: 95% !important;
padding-right: 10px;
}

.isYamlLabel {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Loading/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
.loadOuter{
position: absolute;
top: 40%;
left: 40%;
left: 50%;
margin: -3em 0 0 -3em;

.loader {
Expand Down
41 changes: 25 additions & 16 deletions src/pages/Dashboard/Apps/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Toolbar from 'components/Toolbar';
import TdName, { ProviderName } from 'components/TdName';
import Statistics from 'components/Statistics';
import TimeShow from 'components/TimeShow';
import Loading from 'components/Loading';
import { getObjName, mappingStatus } from 'utils';

import styles from './index.scss';
Expand Down Expand Up @@ -55,8 +56,14 @@ export default class Apps extends Component {

changeView = type => {
const { appStore } = this.props;

if (appStore.viewType !== type) {
appStore.isLoading = true;
appStore.viewType = type;
// mimic loading
setTimeout(() => {
appStore.isLoading = false;
}, 200);
}
};

Expand Down Expand Up @@ -171,24 +178,26 @@ export default class Apps extends Component {
}

renderCardApps() {
const { apps } = this.props.appStore;
const { apps, isLoading } = this.props.appStore;

return (
<div className={styles.appCardContent}>
{apps.map(app => (
<Link key={app.app_id} to={`/dashboard/app/${app.app_id}`}>
<div className={styles.appCard}>
<span className={styles.icon}>
<Image src={app.icon} iconSize={48} />
</span>
<p className={styles.name}>{app.name}</p>
<p className={styles.description} title={app.description}>
{app.description}
</p>
</div>
</Link>
))}
</div>
<Loading isLoading={isLoading}>
<div className={styles.appCardContent}>
{apps.map(app => (
<Link key={app.app_id} to={`/dashboard/app/${app.app_id}`}>
<div className={styles.appCard}>
<span className={styles.icon}>
<Image src={app.icon} iconSize={48} />
</span>
<p className={styles.name}>{app.name}</p>
<p className={styles.description} title={app.description}>
{app.description}
</p>
</div>
</Link>
))}
</div>
</Loading>
);
}

Expand Down

0 comments on commit 744eb34

Please sign in to comment.