diff --git a/nezha-fronted/build/webpack.dev.conf.js b/nezha-fronted/build/webpack.dev.conf.js index d715197fa..63b88ed18 100644 --- a/nezha-fronted/build/webpack.dev.conf.js +++ b/nezha-fronted/build/webpack.dev.conf.js @@ -25,8 +25,8 @@ const devWebpackConfig = merge(baseWebpackConfig, { clientLogLevel: 'warning', historyApiFallback: { rewrites: [ - { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, - ], + { from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') } + ] }, hot: true, contentBase: false, // since we use CopyWebpackPlugin. @@ -37,12 +37,12 @@ const devWebpackConfig = merge(baseWebpackConfig, { overlay: config.dev.errorOverlay ? { warnings: false, errors: true } : false, - publicPath: "/", - /*publicPath: config.dev.assetsPublicPath,*/ + publicPath: '/', + /* publicPath: config.dev.assetsPublicPath, */ proxy: config.dev.proxyTable, quiet: true, // necessary for FriendlyErrorsPlugin watchOptions: { - poll: config.dev.poll, + poll: config.dev.poll } }, plugins: [ @@ -64,6 +64,11 @@ const devWebpackConfig = merge(baseWebpackConfig, { from: path.resolve(__dirname, '../static'), to: config.dev.assetsSubDirectory, ignore: ['.*'] + }, + { + from: path.resolve(__dirname, '../src/components/chart'), + to: 'components/chart', + ignore: ['.*'] } ]) ] @@ -83,11 +88,11 @@ module.exports = new Promise((resolve, reject) => { // Add FriendlyErrorsPlugin devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ compilationSuccessInfo: { - messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], + messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`] }, onErrors: config.dev.notifyOnErrors - ? utils.createNotifierCallback() - : undefined + ? utils.createNotifierCallback() + : undefined })) resolve(devWebpackConfig) diff --git a/nezha-fronted/build/webpack.prod.conf.js b/nezha-fronted/build/webpack.prod.conf.js index 2558dfc6c..fa2a2a370 100644 --- a/nezha-fronted/build/webpack.prod.conf.js +++ b/nezha-fronted/build/webpack.prod.conf.js @@ -13,24 +13,24 @@ const UglifyJsPlugin = require('uglifyjs-webpack-plugin') const fileManagerPlugin = require('filemanager-webpack-plugin') const WebpackZipPlugin = require('webpack-zip-plugin') // const GitRevisionPlugin = require('git-revision-webpack-plugin') -const GenerateAssetPlugin = require('generate-asset-webpack-plugin'); -const WebpackShellPlugin = require('webpack-shell-plugin'); +const GenerateAssetPlugin = require('generate-asset-webpack-plugin') +const WebpackShellPlugin = require('webpack-shell-plugin') -const serverConfig = require('../static/config.json')//引入根目录下的配置文件 +const serverConfig = require('../static/config.json')// 引入根目录下的配置文件 // const gitRevisionPlugin = new GitRevisionPlugin(); -const createJson = function() { +const createJson = function () { // serverConfig.version=config.build.version +"-"+gitRevisionPlugin.commithash(); - serverConfig.version=config.build.version; - return JSON.stringify(serverConfig); -}; + serverConfig.version = config.build.version + return JSON.stringify(serverConfig) +} const env = require('../config/prod.env') -/*const GenerateAssetPlugin = require('generate-asset-webpack-plugin'); +/* const GenerateAssetPlugin = require('generate-asset-webpack-plugin'); const createConfig = function(compilation){ let cfgJson={baseUrl:"http://192.168.40.247:8080/nz-admin"}; return JSON.stringify(cfgJson); -}*/ +} */ const webpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ @@ -46,13 +46,13 @@ const webpackConfig = merge(baseWebpackConfig, { chunkFilename: utils.assetsPath('js/[name].[chunkhash].js') }, plugins: [ - /*new GenerateAssetPlugin({ + /* new GenerateAssetPlugin({ filename: 'config.json', fn: (compilation, cb) => { cb(null, createConfig(compilation)); }, extraFiles: [] - }),*/ + }), */ // http://vuejs.github.io/vue-loader/en/workflow/production.html new webpack.DefinePlugin({ 'process.env': env @@ -74,7 +74,7 @@ const webpackConfig = merge(baseWebpackConfig, { // Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack. // It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`, // increasing file size: https://github.com/vuejs-templates/webpack/issues/1110 - allChunks: true, + allChunks: true }), // Compress extracted CSS. We are using this plugin so that possible // duplicated CSS from different components can be deduped. @@ -89,7 +89,7 @@ const webpackConfig = merge(baseWebpackConfig, { new HtmlWebpackPlugin({ filename: config.build.index, template: 'index.html', - hash:false, + hash: false, inject: true, minify: { removeComments: true, @@ -104,8 +104,8 @@ const webpackConfig = merge(baseWebpackConfig, { new GenerateAssetPlugin({ filename: 'static/config.json', fn: (compilation, cb) => { - cb(null, createJson()); - }, + cb(null, createJson()) + } }), // keep module.id stable when vendor modules does not change new webpack.HashedModuleIdsPlugin(), @@ -147,47 +147,52 @@ const webpackConfig = merge(baseWebpackConfig, { from: path.resolve(__dirname, '../static'), to: config.build.assetsSubDirectory, ignore: ['*'] + }, + { + from: path.resolve(__dirname, '../src/components/chart'), + to: 'components', + ignore: ['.*'] } - ]), + ]) ] }) -if(process.env.NODE_ENV == 'development'){ +if (process.env.NODE_ENV == 'development') { webpackConfig.plugins.push( new fileManagerPlugin({ - onStart:[ + onStart: [ { - delete:[path.join(__dirname,'../dist/') ] + delete: [path.join(__dirname, '../dist/')] } ], onEnd: [ { - move:[ - { source: path.join(__dirname,'../dist','/static/config.json'), destination: path.join(__dirname,'../dist/config.json') }, + move: [ + { source: path.join(__dirname, '../dist', '/static/config.json'), destination: path.join(__dirname, '../dist/config.json') } ], - mkdir:[ - path.join(__dirname,'../dist','/static') + mkdir: [ + path.join(__dirname, '../dist', '/static') ], - copy:[ - { source: path.join(__dirname,'../dist','/config.json'), destination: path.join(__dirname,'../dist','/static/config.json') } - ], - }, - { - delete:[ - path.join(__dirname,'../dist','/config.json') + copy: [ + { source: path.join(__dirname, '../dist', '/config.json'), destination: path.join(__dirname, '../dist', '/static/config.json') } ] }, { - archive:[ - { source: path.join(__dirname,'../dist'), destination: path.join(__dirname,'../dist','/nz-gui.zip') } + delete: [ + path.join(__dirname, '../dist', '/config.json') + ] + }, + { + archive: [ + { source: path.join(__dirname, '../dist'), destination: path.join(__dirname, '../dist', '/nz-gui.zip') } ] } ] - }), + }) ) -}else{ +} else { webpackConfig.plugins.push( // new WebpackZipPlugin({ // initialFile: './dist', @@ -196,9 +201,9 @@ if(process.env.NODE_ENV == 'development'){ // behindShell: 'cd '+path.join(__dirname,'../dist/')+";md5=`md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8`;mv nz-gui.zip nz-gui-${md5}.zip;"+(process.env.BUILD_MODE=='all'?'mkdir -p ./dist/static;echo "start add map picture to zip file,it will take a few moment,please wait...";cp -r ../static/Tiles dist/static/;zip -gr nz-gui-${md5}.zip dist/static/Tiles>/dev/null;rm -rf dist;':'') // }), new WebpackShellPlugin({ - onBuildStart: ['/bin/bash '+path.join(__dirname,'script')+'/buildStart.sh'], - onBuildEnd: ['/bin/bash '+path.join(__dirname,'script')+'/buildEnd.sh '+process.env.BUILD_MODE] - }), + onBuildStart: ['/bin/bash ' + path.join(__dirname, 'script') + '/buildStart.sh'], + onBuildEnd: ['/bin/bash ' + path.join(__dirname, 'script') + '/buildEnd.sh ' + process.env.BUILD_MODE] + }) // new fileManagerPlugin({ // onStart:[ // { diff --git a/nezha-fronted/package-lock.json b/nezha-fronted/package-lock.json index 0bb5f3ef3..f030ca970 100644 --- a/nezha-fronted/package-lock.json +++ b/nezha-fronted/package-lock.json @@ -7138,6 +7138,11 @@ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", "dev": true }, + "immediate": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", + "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=" + }, "import-cwd": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/import-cwd/-/import-cwd-2.1.0.tgz", @@ -7802,6 +7807,17 @@ "verror": "1.10.0" } }, + "jszip": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.9.1.tgz", + "integrity": "sha512-H9A60xPqJ1CuC4Ka6qxzXZeU8aNmgOeP5IFqwJbQQwtu2EUYxota3LdsiZWplF7Wgd9tkAd0mdu36nceSaPuYw==", + "requires": { + "lie": "~3.3.0", + "pako": "~1.0.2", + "readable-stream": "~2.3.6", + "set-immediate-shim": "~1.0.1" + } + }, "keyv": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.0.0.tgz", @@ -7884,6 +7900,14 @@ "type-check": "~0.4.0" } }, + "lie": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz", + "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==", + "requires": { + "immediate": "~3.0.5" + } + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -9292,8 +9316,7 @@ "pako": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.10.tgz", - "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==", - "dev": true + "integrity": "sha512-0DTvPVU3ed8+HNXOu5Bs+o//Mbdj9VNQMUOe9oKCwh8l0GNwpTDMKCWbRjgtD291AWnkAgkqA/LOnQS8AmS1tw==" }, "parallel-transform": { "version": "1.2.0", @@ -13012,6 +13035,11 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=" + }, "set-value": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", diff --git a/nezha-fronted/package.json b/nezha-fronted/package.json index 6006c073f..c1c9138c5 100644 --- a/nezha-fronted/package.json +++ b/nezha-fronted/package.json @@ -32,6 +32,7 @@ "file-saver": "^2.0.2", "html2canvas": "^1.4.1", "jspdf": "^2.5.1", + "jszip": "^3.9.1", "leaflet": "^1.7.1", "moment-timezone": "^0.5.33", "mqtt": "4.2.6", diff --git a/nezha-fronted/src/components/chart/chart/chartStat.vue b/nezha-fronted/src/components/chart/chart/chartStat.vue index 2e8c3d3b7..bd476b63e 100644 --- a/nezha-fronted/src/components/chart/chart/chartStat.vue +++ b/nezha-fronted/src/components/chart/chart/chartStat.vue @@ -69,7 +69,7 @@ export default { x: 0, y: 0, title: 0, - value: 0, + value: 0, show: false }, fontSize: 12, diff --git a/nezha-fronted/src/components/chart/chart/options/graph.js b/nezha-fronted/src/components/chart/chart/options/graph.js deleted file mode 100644 index 47f3af027..000000000 --- a/nezha-fronted/src/components/chart/chart/options/graph.js +++ /dev/null @@ -1,1190 +0,0 @@ -//$Id$ - -/* This file contains source for d3 map */ - -var view = (function() { - var initializeView = function (baseCIName) { - if(attributes.assetDetailsTab || attributes.iframe) { - jQuery(".svgbdy").css("padding-top", 0); //no i18n - } - if(attributes.iframe) { - jQuery('#zoom-slider').css("height", "80px"); //no i18n - } - if(attributes.assetDetailsTab) { - jQuery("body").removeClass("svgbdy") - } - if(attributes.adminDetailsTab){ - jQuery("body").css("overflow", "auto"); //NO I18N - } - if(attributes.editable != undefined && attributes.editable == false) { - jQuery("#save").remove(); - } - if(!attributes.viewId) { - jQuery("#saved-view-header").hide(); - if(!attributes.newView) { - jQuery("#ciNameLabel").text(baseCIName); - jQuery("#savethisviewLabel").remove(); - jQuery("#saveviewbtn").text(getMessageForKey("ae.cmdb.businessview.save.title")); //no i18n - } - } - else { - jQuery("#ciNameLabel").remove(); // set ci name in ui - jQuery("#new-view-header").remove(); - jQuery("#saved-view-header").show(); - } - } - - var showProgressIndicator = function() { - invokeProgressIndicator(null, 'sdp.common.loading', 'progress', null, false, 200, 200); // no i18n - } - - var removeProgressIndicator = function () { - jQuery('[id^=_DIALOG_LAYER]').remove(); - } - - return { - initializeView: initializeView, - showProgressIndicator: showProgressIndicator, - removeProgressIndicator: removeProgressIndicator - }; -})(); - -var header = (function() { - var buildViewDropdown = function (data, currentViewId) { - var dropdown = jQuery("#viewsDropDown"); - dropdown.empty(); - if(data.length != 0) { - jQuery.each(data, function() { - var viewNameDecoded = this.name; - viewNameDecoded = viewNameDecoded.replace(/\+/g, '%20'); - viewNameDecoded = decodeURIComponent(viewNameDecoded); - if(viewNameDecoded.length > 25) { - dropdown.append(jQuery("