You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2020/01/04 10:43:36 UTC
[incubator-shardingsphere-benchmark] branch master updated:
refactor:[shadingsphere-benchmark-ui]: project size optimization #41
This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-shardingsphere-benchmark.git
The following commit(s) were added to refs/heads/master by this push:
new e4904e7 refactor:[shadingsphere-benchmark-ui]: project size optimization #41
new cb6c02b Merge pull request #42 from wqzwh/master
e4904e7 is described below
commit e4904e7ee73cfe689c50900d15d6c60e5e7908d5
Author: wqzwh <wa...@163.com>
AuthorDate: Sat Jan 4 16:47:56 2020 +0800
refactor:[shadingsphere-benchmark-ui]: project size optimization #41
---
shadingsphere-benchmark-ui/.babelrc | 5 ++++-
shadingsphere-benchmark-ui/build/webpack.base.conf.js | 16 ++++++++--------
shadingsphere-benchmark-ui/build/webpack.prod.conf.js | 6 ++----
shadingsphere-benchmark-ui/config/index.js | 4 ++--
shadingsphere-benchmark-ui/package.json | 2 ++
.../src/components/Container/index.vue | 11 ++++++++++-
shadingsphere-benchmark-ui/src/main.js | 4 ----
shadingsphere-benchmark-ui/src/utils/mixin.js | 2 +-
shadingsphere-benchmark-ui/src/views/overview/index.vue | 6 ++++++
.../src/views/overview_detail/index.vue | 9 +++++++++
10 files changed, 44 insertions(+), 21 deletions(-)
diff --git a/shadingsphere-benchmark-ui/.babelrc b/shadingsphere-benchmark-ui/.babelrc
index f261300..a14318d 100644
--- a/shadingsphere-benchmark-ui/.babelrc
+++ b/shadingsphere-benchmark-ui/.babelrc
@@ -18,7 +18,10 @@
"presets": [
"@babel/preset-env"
],
- "plugins": ["transform-vue-jsx", "@babel/plugin-transform-runtime", "@babel/plugin-syntax-dynamic-import"],
+ "plugins": ["transform-vue-jsx", "@babel/plugin-transform-runtime", "@babel/plugin-syntax-dynamic-import", ["import", {
+ "libraryName": "iview",
+ "libraryDirectory": "src/components"
+ }]],
"env": {
"test": {
"plugins": ["istanbul"]
diff --git a/shadingsphere-benchmark-ui/build/webpack.base.conf.js b/shadingsphere-benchmark-ui/build/webpack.base.conf.js
index 76b5575..5576570 100644
--- a/shadingsphere-benchmark-ui/build/webpack.base.conf.js
+++ b/shadingsphere-benchmark-ui/build/webpack.base.conf.js
@@ -69,14 +69,14 @@ module.exports = {
loader: 'babel-loader',
include: [resolve('src'), resolve('test')]
},
- {
- test: /\.svg$/,
- loader: 'svg-sprite-loader',
- include: [resolve('src/icons')],
- options: {
- symbolId: 'icon-[name]'
- }
- },
+ // {
+ // test: /\.svg$/,
+ // loader: 'svg-sprite-loader',
+ // include: [resolve('src/icons')],
+ // options: {
+ // symbolId: 'icon-[name]'
+ // }
+ // },
{
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader',
diff --git a/shadingsphere-benchmark-ui/build/webpack.prod.conf.js b/shadingsphere-benchmark-ui/build/webpack.prod.conf.js
index f23e6a5..83aa329 100644
--- a/shadingsphere-benchmark-ui/build/webpack.prod.conf.js
+++ b/shadingsphere-benchmark-ui/build/webpack.prod.conf.js
@@ -132,11 +132,9 @@ if (config.build.productionGzip) {
webpackConfig.plugins.push(
new CompressionWebpackPlugin({
- asset: '[path].gz[query]',
+ filename: '[path].gz[query]',
algorithm: 'gzip',
- test: new RegExp(
- '\\.(' + config.build.productionGzipExtensions.join('|') + ')$'
- ),
+ test: new RegExp('\\.(' + config.build.productionGzipExtensions.join('|') + ')$'),
threshold: 10240,
minRatio: 0.8
})
diff --git a/shadingsphere-benchmark-ui/config/index.js b/shadingsphere-benchmark-ui/config/index.js
index 2aa1ca3..24acd01 100644
--- a/shadingsphere-benchmark-ui/config/index.js
+++ b/shadingsphere-benchmark-ui/config/index.js
@@ -80,7 +80,7 @@ module.exports = {
* Source Maps
*/
- productionSourceMap: true,
+ productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
@@ -88,7 +88,7 @@ module.exports = {
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
- productionGzip: false,
+ productionGzip: true,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
diff --git a/shadingsphere-benchmark-ui/package.json b/shadingsphere-benchmark-ui/package.json
index d675ea2..a434e43 100644
--- a/shadingsphere-benchmark-ui/package.json
+++ b/shadingsphere-benchmark-ui/package.json
@@ -33,11 +33,13 @@
"babel-helper-vue-jsx-merge-props": "^2.0.3",
"babel-loader": "^7.1.1",
"babel-plugin-dynamic-import-webpack": "^1.1.0",
+ "babel-plugin-import": "^1.13.0",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-plugin-transform-vue-jsx": "^3.7.0",
"chalk": "^2.0.1",
+ "compression-webpack-plugin": "^3.0.1",
"copy-webpack-plugin": "^5.0.3",
"cross-env": "^5.2.1",
"css-loader": "^2.1.1",
diff --git a/shadingsphere-benchmark-ui/src/components/Container/index.vue b/shadingsphere-benchmark-ui/src/components/Container/index.vue
index ccc3657..b5c95ed 100644
--- a/shadingsphere-benchmark-ui/src/components/Container/index.vue
+++ b/shadingsphere-benchmark-ui/src/components/Container/index.vue
@@ -41,10 +41,19 @@
</div>
</template>
<script>
+import Vue from 'vue'
import { mapActions } from 'vuex'
import apis from '../../utils/page-apis'
-
import Footer from '../Footer/index.vue'
+
+import { Layout, Header, Content, Breadcrumb, BreadcrumbItem, Icon } from 'iview'
+Vue.component('Layout', Layout)
+Vue.component('Header', Header)
+Vue.component('Content', Content)
+Vue.component('Breadcrumb', Breadcrumb)
+Vue.component('BreadcrumbItem', BreadcrumbItem)
+Vue.component('Icon', Icon)
+
export default {
name: 'Container',
components: {
diff --git a/shadingsphere-benchmark-ui/src/main.js b/shadingsphere-benchmark-ui/src/main.js
index 55c59cf..3816abb 100644
--- a/shadingsphere-benchmark-ui/src/main.js
+++ b/shadingsphere-benchmark-ui/src/main.js
@@ -20,14 +20,10 @@ import App from './App'
import store from './store'
import router from './router'
import './assets/css/css.css'
-
-import iView from 'iview'
import 'iview/dist/styles/iview.css'
Vue.config.productionTip = false
-Vue.use(iView)
-
new Vue({
router,
store,
diff --git a/shadingsphere-benchmark-ui/src/utils/mixin.js b/shadingsphere-benchmark-ui/src/utils/mixin.js
index 4b2e4d7..2d6990f 100644
--- a/shadingsphere-benchmark-ui/src/utils/mixin.js
+++ b/shadingsphere-benchmark-ui/src/utils/mixin.js
@@ -194,7 +194,7 @@ const mountedMixin = {
data.push({
...mm.data[mmm],
value: mm.data[mmm].Throughout,
- Date: moment(mm.data[mmm].Date).format('YYYY-MM-DD HH:mm:ss')
+ Date: moment(new Date(mm.data[mmm].Date)).format('YYYY-MM-DD HH:mm:ss')
})
}
diff --git a/shadingsphere-benchmark-ui/src/views/overview/index.vue b/shadingsphere-benchmark-ui/src/views/overview/index.vue
index 9153354..946d69a 100644
--- a/shadingsphere-benchmark-ui/src/views/overview/index.vue
+++ b/shadingsphere-benchmark-ui/src/views/overview/index.vue
@@ -41,6 +41,12 @@
</Card>
</template>
<script>
+import Vue from 'vue'
+import { Card, Row, Col, Icon } from 'iview'
+Vue.component('Card', Card)
+Vue.component('Row', Row)
+Vue.component('Col', Col)
+Vue.component('Icon', Icon)
export default {
name: 'Overview'
}
diff --git a/shadingsphere-benchmark-ui/src/views/overview_detail/index.vue b/shadingsphere-benchmark-ui/src/views/overview_detail/index.vue
index d1d2e2d..fdda955 100644
--- a/shadingsphere-benchmark-ui/src/views/overview_detail/index.vue
+++ b/shadingsphere-benchmark-ui/src/views/overview_detail/index.vue
@@ -62,6 +62,15 @@ import apis from '../../utils/page-apis'
import { mountedMixin } from '../../utils/mixin'
import { getLineOptions } from '../../utils/line'
+import Vue from 'vue'
+import { Modal, Spin, Col, Icon, Card, Row } from 'iview'
+Vue.component('Modal', Modal)
+Vue.component('Spin', Spin)
+Vue.component('Col', Col)
+Vue.component('Icon', Icon)
+Vue.component('Card', Card)
+Vue.component('Row', Row)
+
export default {
name: 'OverviewDetailTest',
components: {