diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..bebf6c3d2 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,99 @@ +# docker镜像 +image: git.mesalab.cn:7443/nezha/nz-build-env:1.3 +# 定义全局变量 +variables: + MINIO_HOST: 'http://192.168.44.36:2020/' + MINIO_USER: 'admin' + MINIO_PWD: "Nezha@02!" +# 依赖的docker服务 +# services: +# - mariadb +# - redis +# 开始执行脚本前所需执行脚本 +before_script: + - echo "begin ci" +# 脚本执行完后的钩子,执行所需脚本 +after_script: + - echo "end ci" +# 该ci pipeline适合的场景 +stages: + - build + - test +# maven setting /usr/share/maven/conf/settings.xml +cache: + paths: + - /builds/nezha/nezha-fronted/nezha-fronted/node_modules/ + + +# dev 分支 +dev_build: + # 所需执行的脚本 + script: + - env | sort + - pwd + - cd nezha-fronted + + # 安装 npm 依赖文件 + - echo "npm install ..." + - npm install --registry=http://registry.npmmirror.com + - echo "npm run build" + - npm run build + + - cd /builds/nezha/nezha-fronted/nezha-fronted/dist + - rm -rf nz-gui*.zip + - export FILE_NAME=nz-gui-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA.zip + # 生成 git log 日志文件 + - sed -i 's++更新记录\n+g' ./index.html; + - echo "
" > ./static/git-log.html
+    - "git log -100 --pretty=format:'%ad : %s' >> ./static/git-log.html"
+    - echo "
" >> ./static/git-log.html + - zip -q -r $FILE_NAME ./* + + # 将 dist zip 上传到 minio + - mc alias set nz $MINIO_HOST $MINIO_USER $MINIO_PWD + - mc cp $FILE_NAME nz/ci-cd/nz-gui/$FILE_NAME + - mc cp $FILE_NAME nz/ci-cd/nz-gui/nz-gui-$CI_COMMIT_REF_NAME-latest.zip + artifacts: + name: "nz-gui-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA" + when: on_success + paths: + - /builds/nezha/nezha-fronted/nezha-fronted/dist/nz-gui*.zip + expire_in: 1 day + # 在哪个分支上可用 + only: + - /^dev-.*$/i + # 指定哪个ci runner跑该工作 + tags: + - nezha + + +# release build +rel_build: + stage: build + # 所需执行的脚本 + script: + - env | sort + - pwd + - echo "npm install ..." + - cd nezha-fronted + - npm install --registry=http://registry.npmmirror.com + - echo "npm run build" + - npm run build + - cd /builds/nezha/nezha-fronted/nezha-fronted/dist + - mv nz-gui*.zip nz-gui-$CI_COMMIT_SHORT_SHA.zip + - md5sum nz-gui-$CI_COMMIT_SHORT_SHA.zip > nz-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt + - mc alias set nz $MINIO_HOST $MINIO_USER $MINIO_PWD + - mc cp nz-gui-$CI_COMMIT_SHORT_SHA.zip nz/release/nz-gui/nz-gui-$CI_COMMIT_SHORT_SHA.zip + - mc cp nz-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt nz/release/nz-gui/nz-gui-$CI_COMMIT_SHORT_SHA.zip.md5sum.txt + artifacts: + name: "nz-gui-$CI_COMMIT_REF_NAME-$CI_COMMIT_SHORT_SHA" + when: on_success + paths: + - /builds/nezha/nezha-fronted/nezha-fronted/dist/nz-gui-$CI_COMMIT_SHORT_SHA.zip + expire_in: 1 week + # 在哪个分支上可用 + only: + - /^rel-.*$/i + # 指定哪个ci runner跑该工作 + tags: + - nezha diff --git a/nezha-fronted/.babelrc b/nezha-fronted/.babelrc index 01be98850..9c0246d3a 100644 --- a/nezha-fronted/.babelrc +++ b/nezha-fronted/.babelrc @@ -33,7 +33,8 @@ ] }, "test": { - "plugins": ["istanbul"] + "presets": ["env"], + "plugins": ["transform-es2015-modules-commonjs"] } } } diff --git a/nezha-fronted/README.md b/nezha-fronted/README.md index bd59e561b..9faddcd74 100644 --- a/nezha-fronted/README.md +++ b/nezha-fronted/README.md @@ -20,6 +20,17 @@ npm run build --report For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader). -使用 +#启动项目 需要配置 config.json 为 {"baseUrl":"http://192.168.40.42:8080/", "version": "21.04"} + +#自动化测试 +npm run unit +根目录下 /test/jest.conf.js collectCoverageFrom 变量配置需要测试报告的文件 (因为暂时不测所有 只能一个个引入) +specs 配置对应的测试用例 (https://docs.geedge.net/pages/viewpage.action?pageId=58310079 参考匹配器) + +#思维导图 +https://docs.geedge.net/pages/viewpage.action?pageId=67209306 + + + diff --git a/nezha-fronted/build/build.js b/nezha-fronted/build/build.js index a18b6744d..d09dcb77c 100644 --- a/nezha-fronted/build/build.js +++ b/nezha-fronted/build/build.js @@ -4,8 +4,8 @@ require('./check-versions')() let arg = process.argv.splice(2)[0]; process.env.NODE_ENV = arg == 'dev' ? 'development' : 'production' process.env.BUILD_MODE = arg - const ora = require('ora') + const rm = require('rimraf') const path = require('path') const chalk = require('chalk') diff --git a/nezha-fronted/build/script/buildEnd.sh b/nezha-fronted/build/script/buildEnd.sh deleted file mode 100644 index e68986e9e..000000000 --- a/nezha-fronted/build/script/buildEnd.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -BUILD_MODE=$1 - -CUR_PATH=`pwd` -echo 'cur path is '${CUR_PATH} -DIST_PATH=$CUR_PATH/dist - -echo 'dist dir path is '${DIST_PATH} - -cp -f src/assets/img/explore-tab-logo.png $DIST_PATH/static - -cd $DIST_PATH - -if [[ 'all' == "${BUILD_MODE}" ]];then - echo 'build all to zip file ,now moving map picture to static dir...' - \cp -rf ../static/Tiles/ $DIST_PATH/static/ -fi -echo 'start create zip...' - -#find ./ * -exec touch -t $(date +%Y%m%d0000.00) {} \; - -#find ./ * -exec touch -t 202104301200.00 {} \; - -zip -rX nz-gui.zip ./* >/dev/null - -MD5=$(md5sum nz-gui.zip |awk '{print $1}'|cut -c 1-8) -mv nz-gui.zip nz-gui-${MD5}.zip - -echo 'package zip file is complate ,please check in '${DIST_PATH} diff --git a/nezha-fronted/build/script/buildStart.sh b/nezha-fronted/build/script/buildStart.sh deleted file mode 100644 index c4e93025f..000000000 --- a/nezha-fronted/build/script/buildStart.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo 'clean dist dir ...' -rm -rf dist diff --git a/nezha-fronted/build/webpack.dev.conf.js b/nezha-fronted/build/webpack.dev.conf.js index 63b88ed18..8d2b242ae 100644 --- a/nezha-fronted/build/webpack.dev.conf.js +++ b/nezha-fronted/build/webpack.dev.conf.js @@ -29,6 +29,7 @@ const devWebpackConfig = merge(baseWebpackConfig, { ] }, hot: true, + inline:true, contentBase: false, // since we use CopyWebpackPlugin. compress: true, host: HOST || config.dev.host, @@ -54,6 +55,7 @@ const devWebpackConfig = merge(baseWebpackConfig, { new webpack.NoEmitOnErrorsPlugin(), // https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ + favicon: path.resolve(__dirname, '../src/assets/img/favicon.ico'), filename: 'index.html', template: 'index.html', inject: true diff --git a/nezha-fronted/build/webpack.prod.conf.js b/nezha-fronted/build/webpack.prod.conf.js index fa2a2a370..719ea6036 100644 --- a/nezha-fronted/build/webpack.prod.conf.js +++ b/nezha-fronted/build/webpack.prod.conf.js @@ -1,5 +1,6 @@ 'use strict' const path = require('path') + const utils = require('./utils') const webpack = require('webpack') const config = require('../config') @@ -9,7 +10,7 @@ const CopyWebpackPlugin = require('copy-webpack-plugin') const HtmlWebpackPlugin = require('html-webpack-plugin') const ExtractTextPlugin = require('extract-text-webpack-plugin') const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') -const UglifyJsPlugin = require('uglifyjs-webpack-plugin') +const ParallelUglifyPlugin = require('webpack-parallel-uglify-plugin') const fileManagerPlugin = require('filemanager-webpack-plugin') const WebpackZipPlugin = require('webpack-zip-plugin') // const GitRevisionPlugin = require('git-revision-webpack-plugin') @@ -57,15 +58,18 @@ const webpackConfig = merge(baseWebpackConfig, { new webpack.DefinePlugin({ 'process.env': env }), - new UglifyJsPlugin({ - uglifyOptions: { + new ParallelUglifyPlugin({ + cacheDir: '.cache/', + uglifyJS: { + output: { + comments: false + }, + warnings: false, compress: { - warnings: false + drop_debugger: true, + drop_console: true } - }, - exclude: /manifest.+js/, - sourceMap: config.build.productionSourceMap, - parallel: true + } }), // extract css into its own file new ExtractTextPlugin({ @@ -87,6 +91,7 @@ const webpackConfig = merge(baseWebpackConfig, { // you can customize output by editing /index.html // see https://github.com/ampedandwired/html-webpack-plugin new HtmlWebpackPlugin({ + favicon: path.resolve(__dirname, '../src/assets/img/favicon.ico'), filename: config.build.index, template: 'index.html', hash: false, @@ -190,26 +195,57 @@ if (process.env.NODE_ENV == 'development') { } ] }) - ) } else { webpackConfig.plugins.push( + new fileManagerPlugin({ + onStart: [ + { + delete: [path.join(__dirname, '../dist/')] + } + ], + onEnd: [ + { + move: [ + { source: path.join(__dirname, '../dist', '/static/config.json'), destination: path.join(__dirname, '../dist/config.json') } + + ], + 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'), + path.join(__dirname, '../.cache/') + ] + }, + { + archive: [ + { source: path.join(__dirname, '../dist'), destination: path.join(__dirname, '../dist', '/nz-gui.zip') } + ] + } + ] + }), // new WebpackZipPlugin({ // initialFile: './dist', // endPath: './dist', - // zipName: 'nz-gui.zip', - // 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] - }) + // zipName: 'nz-gui.zip' + // // 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] + // }) // new fileManagerPlugin({ - // onStart:[ + // onStart: [ // { - // delete:[path.join(__dirname,'../dist/') ] + // delete: [path.join(__dirname, '../dist/')] // } - // ], + // ] // }) ) } diff --git a/nezha-fronted/config/index.js b/nezha-fronted/config/index.js index 97c7b0130..b270f7a71 100644 --- a/nezha-fronted/config/index.js +++ b/nezha-fronted/config/index.js @@ -20,7 +20,7 @@ module.exports = { }, // Various Dev Server settings // host: '0.0.0.0', // can be overwritten by process.env.HOST - host: '127.0.0.1', // can be overwritten by process.env.HOST + host: 'localhost', // can be overwritten by process.env.HOST port: 80, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined autoOpenBrowser: false, errorOverlay: true, diff --git a/nezha-fronted/index.html b/nezha-fronted/index.html index 4c7d00a6f..835362dc2 100644 --- a/nezha-fronted/index.html +++ b/nezha-fronted/index.html @@ -5,9 +5,9 @@ - + - Nezha + Network Zodiac ")}catch(a){console&&console.log(a)}}function m(){o||(o=!0,l())}function p(){try{z.documentElement.doScroll("left")}catch(a){return void setTimeout(p,50)}m()}c=function(){var a,c=document.createElement("div");c.innerHTML=i,i=null,(c=c.getElementsByTagName("svg")[0])&&(c.setAttribute("aria-hidden","true"),c.style.position="absolute",c.style.width=0,c.style.height=0,c.style.overflow="hidden",c=c,(a=document.body).firstChild?t(c,a.firstChild):a.appendChild(c))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(c,0):(h=function(){document.removeEventListener("DOMContentLoaded",h,!1),c()},document.addEventListener("DOMContentLoaded",h,!1)):document.attachEvent&&(l=c,z=a.document,o=!1,p(),z.onreadystatechange=function(){"complete"==z.readyState&&(z.onreadystatechange=null,m())})}(window); \ No newline at end of file +!(function (a) { let h; let c; let l; let z; let o; let i = ''; var v = (v = document.getElementsByTagName('script'))[v.length - 1].getAttribute('data-injectcss'); const t = function (a, h) { h.parentNode.insertBefore(a, h) }; if (v && !a.__iconfont__svg__cssinject__) { a.__iconfont__svg__cssinject__ = !0; try { document.write('') } catch (a) { console && console.log(a) } } function m () { o || (o = !0, l()) } function p () { try { z.documentElement.doScroll('left') } catch (a) { return void setTimeout(p, 50) }m() }h = function () { let a; let h = document.createElement('div'); h.innerHTML = i, i = null, (h = h.getElementsByTagName('svg')[0]) && (h.setAttribute('aria-hidden', 'true'), h.style.position = 'absolute', h.style.width = 0, h.style.height = 0, h.style.overflow = 'hidden', h = h, (a = document.body).firstChild ? t(h, a.firstChild) : a.appendChild(h)) }, document.addEventListener ? ~['complete', 'loaded', 'interactive'].indexOf(document.readyState) ? setTimeout(h, 0) : (c = function () { document.removeEventListener('DOMContentLoaded', c, !1), h() }, document.addEventListener('DOMContentLoaded', c, !1)) : document.attachEvent && (l = h, z = a.document, o = !1, p(), z.onreadystatechange = function () { z.readyState == 'complete' && (z.onreadystatechange = null, m()) }) }(window)) diff --git a/nezha-fronted/src/assets/css/font/iconfont.json b/nezha-fronted/src/assets/css/font/iconfont.json new file mode 100644 index 000000000..8636252c1 --- /dev/null +++ b/nezha-fronted/src/assets/css/font/iconfont.json @@ -0,0 +1,1612 @@ +{ + "id": "2030432", + "name": "Nezha_v1.2", + "font_family": "nz-icon", + "css_prefix_text": "nz-icon-", + "description": "", + "glyphs": [ + { + "icon_id": "28893756", + "name": "Tool", + "font_class": "tool", + "unicode": "e76f", + "unicode_decimal": 59247 + }, + { + "icon_id": "28893757", + "name": "导出pdf", + "font_class": "export-pdf", + "unicode": "e770", + "unicode_decimal": 59248 + }, + { + "icon_id": "28687088", + "name": "Router", + "font_class": "Router", + "unicode": "e766", + "unicode_decimal": 59238 + }, + { + "icon_id": "28687089", + "name": "Computer", + "font_class": "Computer", + "unicode": "e767", + "unicode_decimal": 59239 + }, + { + "icon_id": "28687090", + "name": "Network devices", + "font_class": "a-Networkdevices", + "unicode": "e768", + "unicode_decimal": 59240 + }, + { + "icon_id": "28687091", + "name": "Other", + "font_class": "Other", + "unicode": "e769", + "unicode_decimal": 59241 + }, + { + "icon_id": "28687092", + "name": "Virtual machine", + "font_class": "a-Virtualmachine", + "unicode": "e76a", + "unicode_decimal": 59242 + }, + { + "icon_id": "28687093", + "name": "Switch", + "font_class": "Switch", + "unicode": "e76b", + "unicode_decimal": 59243 + }, + { + "icon_id": "28687094", + "name": "Server", + "font_class": "Server", + "unicode": "e76c", + "unicode_decimal": 59244 + }, + { + "icon_id": "28687095", + "name": "ADC", + "font_class": "ADC", + "unicode": "e76d", + "unicode_decimal": 59245 + }, + { + "icon_id": "28687096", + "name": "Firewall", + "font_class": "Firewall", + "unicode": "e76e", + "unicode_decimal": 59246 + }, + { + "icon_id": "28259318", + "name": "Topology", + "font_class": "Topology", + "unicode": "e763", + "unicode_decimal": 59235 + }, + { + "icon_id": "28259319", + "name": "Silence alert", + "font_class": "a-Silencealert", + "unicode": "e764", + "unicode_decimal": 59236 + }, + { + "icon_id": "27340139", + "name": "role", + "font_class": "role1", + "unicode": "e760", + "unicode_decimal": 59232 + }, + { + "icon_id": "27269594", + "name": "Cabinet", + "font_class": "Cabinet1", + "unicode": "e75f", + "unicode_decimal": 59231 + }, + { + "icon_id": "27269592", + "name": "user", + "font_class": "user1", + "unicode": "e75d", + "unicode_decimal": 59229 + }, + { + "icon_id": "27269593", + "name": "Datacenter2", + "font_class": "Datacenter2", + "unicode": "e75e", + "unicode_decimal": 59230 + }, + { + "icon_id": "26441511", + "name": "Upload", + "font_class": "Upload1", + "unicode": "e75c", + "unicode_decimal": 59228 + }, + { + "icon_id": "26402285", + "name": "加载", + "font_class": "jiazai", + "unicode": "e758", + "unicode_decimal": 59224 + }, + { + "icon_id": "26402254", + "name": "回车", + "font_class": "huiche", + "unicode": "e756", + "unicode_decimal": 59222 + }, + { + "icon_id": "26402256", + "name": "向上", + "font_class": "xiangshang", + "unicode": "e759", + "unicode_decimal": 59225 + }, + { + "icon_id": "26402257", + "name": "向下", + "font_class": "xiangxia", + "unicode": "e75a", + "unicode_decimal": 59226 + }, + { + "icon_id": "26402258", + "name": "esc", + "font_class": "esc", + "unicode": "e75b", + "unicode_decimal": 59227 + }, + { + "icon_id": "14342026", + "name": "stack", + "font_class": "stack", + "unicode": "e7c6", + "unicode_decimal": 59334 + }, + { + "icon_id": "25329699", + "name": "上传失败", + "font_class": "import-failed", + "unicode": "e757", + "unicode_decimal": 59223 + }, + { + "icon_id": "25329639", + "name": "上传成功", + "font_class": "import-success", + "unicode": "e755", + "unicode_decimal": 59221 + }, + { + "icon_id": "25327471", + "name": "导入成功", + "font_class": "import-success1", + "unicode": "e753", + "unicode_decimal": 59219 + }, + { + "icon_id": "25327472", + "name": "导入失败", + "font_class": "import-failed1", + "unicode": "e754", + "unicode_decimal": 59220 + }, + { + "icon_id": "25119001", + "name": "阻止", + "font_class": "stop", + "unicode": "e74a", + "unicode_decimal": 59210 + }, + { + "icon_id": "25107541", + "name": "Panel空", + "font_class": "no-data-panel", + "unicode": "e748", + "unicode_decimal": 59208 + }, + { + "icon_id": "25107546", + "name": "Project空", + "font_class": "no-data-project", + "unicode": "e74f", + "unicode_decimal": 59215 + }, + { + "icon_id": "25107556", + "name": "Asset空", + "font_class": "no-data-list", + "unicode": "e750", + "unicode_decimal": 59216 + }, + { + "icon_id": "25103274", + "name": "Kill", + "font_class": "ZD", + "unicode": "e74e", + "unicode_decimal": 59214 + }, + { + "icon_id": "25103083", + "name": "发送失败", + "font_class": "failed", + "unicode": "e749", + "unicode_decimal": 59209 + }, + { + "icon_id": "25103085", + "name": "未知错误", + "font_class": "unknown-error", + "unicode": "e74c", + "unicode_decimal": 59212 + }, + { + "icon_id": "25080761", + "name": "已结束", + "font_class": "over", + "unicode": "e74b", + "unicode_decimal": 59211 + }, + { + "icon_id": "25080763", + "name": "连接中", + "font_class": "connecting", + "unicode": "e74d", + "unicode_decimal": 59213 + }, + { + "icon_id": "24976061", + "name": "Tab", + "font_class": "label", + "unicode": "e747", + "unicode_decimal": 59207 + }, + { + "icon_id": "24921434", + "name": "语言", + "font_class": "language-change", + "unicode": "e746", + "unicode_decimal": 59206 + }, + { + "icon_id": "24914890", + "name": "guide", + "font_class": "guide", + "unicode": "e744", + "unicode_decimal": 59204 + }, + { + "icon_id": "24914894", + "name": "外链", + "font_class": "more-app", + "unicode": "e745", + "unicode_decimal": 59205 + }, + { + "icon_id": "24867305", + "name": "列表", + "font_class": "list-view", + "unicode": "e742", + "unicode_decimal": 59202 + }, + { + "icon_id": "24867306", + "name": "详细视图", + "font_class": "detail-view", + "unicode": "e743", + "unicode_decimal": 59203 + }, + { + "icon_id": "24243818", + "name": "定时时间", + "font_class": "dingshishijian", + "unicode": "e73f", + "unicode_decimal": 59199 + }, + { + "icon_id": "24243819", + "name": "日历(周)", + "font_class": "a-rilizhou", + "unicode": "e740", + "unicode_decimal": 59200 + }, + { + "icon_id": "24243820", + "name": "故障数据", + "font_class": "guzhangshuju", + "unicode": "e741", + "unicode_decimal": 59201 + }, + { + "icon_id": "23787899", + "name": "Metrics", + "font_class": "Metrics", + "unicode": "e73d", + "unicode_decimal": 59197 + }, + { + "icon_id": "23787900", + "name": "logs", + "font_class": "logs", + "unicode": "e73e", + "unicode_decimal": 59198 + }, + { + "icon_id": "23738797", + "name": "位置", + "font_class": "weizhi", + "unicode": "e737", + "unicode_decimal": 59191 + }, + { + "icon_id": "23629503", + "name": "mobile", + "font_class": "mobile", + "unicode": "e738", + "unicode_decimal": 59192 + }, + { + "icon_id": "23629504", + "name": "email", + "font_class": "email", + "unicode": "e739", + "unicode_decimal": 59193 + }, + { + "icon_id": "23629505", + "name": "来源", + "font_class": "laiyuan", + "unicode": "e73a", + "unicode_decimal": 59194 + }, + { + "icon_id": "23629506", + "name": "重置2FA", + "font_class": "zhongzhi2FA1", + "unicode": "e73b", + "unicode_decimal": 59195 + }, + { + "icon_id": "23629507", + "name": "role", + "font_class": "role", + "unicode": "e73c", + "unicode_decimal": 59196 + }, + { + "icon_id": "13990891", + "name": "reset", + "font_class": "reset", + "unicode": "e618", + "unicode_decimal": 58904 + }, + { + "icon_id": "23490001", + "name": "验证码", + "font_class": "yanzhengma", + "unicode": "e736", + "unicode_decimal": 59190 + }, + { + "icon_id": "23383693", + "name": "提示1", + "font_class": "about-full", + "unicode": "e735", + "unicode_decimal": 59189 + }, + { + "icon_id": "23366526", + "name": "批量新增", + "font_class": "batchadd", + "unicode": "e734", + "unicode_decimal": 59188 + }, + { + "icon_id": "22742509", + "name": "形状2", + "font_class": "rectangle1", + "unicode": "e730", + "unicode_decimal": 59184 + }, + { + "icon_id": "22742510", + "name": "形状1", + "font_class": "EMAC1", + "unicode": "e731", + "unicode_decimal": 59185 + }, + { + "icon_id": "22742511", + "name": "形状4", + "font_class": "EMAC", + "unicode": "e732", + "unicode_decimal": 59186 + }, + { + "icon_id": "22742512", + "name": "形状3", + "font_class": "rectangle2", + "unicode": "e733", + "unicode_decimal": 59187 + }, + { + "icon_id": "16055308", + "name": "倒角矩形", + "font_class": "rectangle", + "unicode": "e64d", + "unicode_decimal": 58957 + }, + { + "icon_id": "20163202", + "name": "转交", + "font_class": "zhuanjiao", + "unicode": "e63f", + "unicode_decimal": 58943 + }, + { + "icon_id": "21959203", + "name": "Silence", + "font_class": "Silence", + "unicode": "e72e", + "unicode_decimal": 59182 + }, + { + "icon_id": "11799005", + "name": "告警管理", + "font_class": "fast-silence", + "unicode": "e64e", + "unicode_decimal": 58958 + }, + { + "icon_id": "15065587", + "name": "mute", + "font_class": "mute", + "unicode": "e63e", + "unicode_decimal": 58942 + }, + { + "icon_id": "21907756", + "name": "更多操作1", + "font_class": "more3", + "unicode": "e725", + "unicode_decimal": 59173 + }, + { + "icon_id": "21826867", + "name": "更多操作", + "font_class": "more4", + "unicode": "e72d", + "unicode_decimal": 59181 + }, + { + "icon_id": "21826869", + "name": "使用向导", + "font_class": "guide2", + "unicode": "e72f", + "unicode_decimal": 59183 + }, + { + "icon_id": "21726503", + "name": "收起", + "font_class": "shouqi", + "unicode": "e726", + "unicode_decimal": 59174 + }, + { + "icon_id": "1028153", + "name": "圆", + "font_class": "circle", + "unicode": "e62f", + "unicode_decimal": 58927 + }, + { + "icon_id": "21358395", + "name": "Alert message", + "font_class": "overview-alert", + "unicode": "e727", + "unicode_decimal": 59175 + }, + { + "icon_id": "21358396", + "name": "Endpoint", + "font_class": "overview-endpoint", + "unicode": "e728", + "unicode_decimal": 59176 + }, + { + "icon_id": "21358397", + "name": "Alert rule", + "font_class": "Alertrule", + "unicode": "e729", + "unicode_decimal": 59177 + }, + { + "icon_id": "21358398", + "name": "Assets", + "font_class": "overview-project", + "unicode": "e72a", + "unicode_decimal": 59178 + }, + { + "icon_id": "21358786", + "name": "Project", + "font_class": "project", + "unicode": "e72b", + "unicode_decimal": 59179 + }, + { + "icon_id": "21358789", + "name": "Module", + "font_class": "overview-module", + "unicode": "e72c", + "unicode_decimal": 59180 + }, + { + "icon_id": "21356548", + "name": "Single Value", + "font_class": "single-value", + "unicode": "e721", + "unicode_decimal": 59169 + }, + { + "icon_id": "21282633", + "name": "模板导入", + "font_class": "mobandaoru", + "unicode": "e724", + "unicode_decimal": 59172 + }, + { + "icon_id": "21119423", + "name": "更 多", + "font_class": "more1", + "unicode": "e677", + "unicode_decimal": 58999 + }, + { + "icon_id": "21262643", + "name": "bar chart", + "font_class": "bar-chart", + "unicode": "e71a", + "unicode_decimal": 59162 + }, + { + "icon_id": "21262644", + "name": "alert list", + "font_class": "alert-list", + "unicode": "e71b", + "unicode_decimal": 59163 + }, + { + "icon_id": "21262645", + "name": "Text1", + "font_class": "text1", + "unicode": "e71c", + "unicode_decimal": 59164 + }, + { + "icon_id": "21262646", + "name": "Pie chart", + "font_class": "pie-chart", + "unicode": "e71d", + "unicode_decimal": 59165 + }, + { + "icon_id": "21262647", + "name": "Stack Area", + "font_class": "stack-area", + "unicode": "e71e", + "unicode_decimal": 59166 + }, + { + "icon_id": "21262648", + "name": "Link Chart", + "font_class": "link-chart", + "unicode": "e71f", + "unicode_decimal": 59167 + }, + { + "icon_id": "21262649", + "name": "Group", + "font_class": "group", + "unicode": "e720", + "unicode_decimal": 59168 + }, + { + "icon_id": "21262651", + "name": "URL", + "font_class": "url", + "unicode": "e722", + "unicode_decimal": 59170 + }, + { + "icon_id": "21262652", + "name": "Table", + "font_class": "table1", + "unicode": "e723", + "unicode_decimal": 59171 + }, + { + "icon_id": "21209541", + "name": "Add", + "font_class": "add", + "unicode": "e719", + "unicode_decimal": 59161 + }, + { + "icon_id": "21586070", + "name": "Add", + "font_class": "create-square", + "unicode": "ebff", + "unicode_decimal": 60415 + }, + { + "icon_id": "21160940", + "name": "Cabinet", + "font_class": "cabinet", + "unicode": "e718", + "unicode_decimal": 59160 + }, + { + "icon_id": "21100249", + "name": "about", + "font_class": "about", + "unicode": "e716", + "unicode_decimal": 59158 + }, + { + "icon_id": "21100250", + "name": "License", + "font_class": "license", + "unicode": "e717", + "unicode_decimal": 59159 + }, + { + "icon_id": "10462588", + "name": "链接", + "font_class": "link", + "unicode": "e675", + "unicode_decimal": 58997 + }, + { + "icon_id": "21078128", + "name": "radio", + "font_class": "radio", + "unicode": "e70f", + "unicode_decimal": 59151 + }, + { + "icon_id": "21078129", + "name": "multitext", + "font_class": "multitext", + "unicode": "e710", + "unicode_decimal": 59152 + }, + { + "icon_id": "21078130", + "name": "INTEGER", + "font_class": "integer", + "unicode": "e711", + "unicode_decimal": 59153 + }, + { + "icon_id": "21078131", + "name": "Text", + "font_class": "text", + "unicode": "e712", + "unicode_decimal": 59154 + }, + { + "icon_id": "21078132", + "name": "checkbox", + "font_class": "checkbox", + "unicode": "e713", + "unicode_decimal": 59155 + }, + { + "icon_id": "21078133", + "name": "textarea", + "font_class": "textarea", + "unicode": "e714", + "unicode_decimal": 59156 + }, + { + "icon_id": "21078134", + "name": "DOUBLE", + "font_class": "double", + "unicode": "e715", + "unicode_decimal": 59157 + }, + { + "icon_id": "21048738", + "name": "Visualization", + "font_class": "visualization", + "unicode": "e70c", + "unicode_decimal": 59148 + }, + { + "icon_id": "21048739", + "name": "Agent", + "font_class": "agent", + "unicode": "e70d", + "unicode_decimal": 59149 + }, + { + "icon_id": "21048740", + "name": "Datacenter1", + "font_class": "datacenter1", + "unicode": "e70e", + "unicode_decimal": 59150 + }, + { + "icon_id": "20743471", + "name": "Assets", + "font_class": "menu-assets", + "unicode": "e706", + "unicode_decimal": 59142 + }, + { + "icon_id": "20742841", + "name": "Alert", + "font_class": "menu-alert", + "unicode": "e707", + "unicode_decimal": 59143 + }, + { + "icon_id": "20742842", + "name": "Setting", + "font_class": "menu-setting", + "unicode": "e708", + "unicode_decimal": 59144 + }, + { + "icon_id": "20742843", + "name": "Administation", + "font_class": "personal-circle", + "unicode": "e709", + "unicode_decimal": 59145 + }, + { + "icon_id": "20742844", + "name": "Project", + "font_class": "menu-project", + "unicode": "e70a", + "unicode_decimal": 59146 + }, + { + "icon_id": "20742845", + "name": "Dashboard", + "font_class": "menu-dashboard", + "unicode": "e70b", + "unicode_decimal": 59147 + }, + { + "icon_id": "20712319", + "name": "个人中心", + "font_class": "personal", + "unicode": "e6ff", + "unicode_decimal": 59135 + }, + { + "icon_id": "20712320", + "name": "更多", + "font_class": "more2", + "unicode": "e700", + "unicode_decimal": 59136 + }, + { + "icon_id": "20712321", + "name": "退出", + "font_class": "exit", + "unicode": "e701", + "unicode_decimal": 59137 + }, + { + "icon_id": "20712322", + "name": "view", + "font_class": "view1", + "unicode": "e702", + "unicode_decimal": 59138 + }, + { + "icon_id": "20712323", + "name": "语言切换", + "font_class": "language-change1", + "unicode": "e703", + "unicode_decimal": 59139 + }, + { + "icon_id": "20712325", + "name": "终端", + "font_class": "terminal", + "unicode": "e705", + "unicode_decimal": 59141 + }, + { + "icon_id": "20706486", + "name": "同比", + "font_class": "compare", + "unicode": "e6fe", + "unicode_decimal": 59134 + }, + { + "icon_id": "17521468", + "name": "模板", + "font_class": "template2", + "unicode": "e604", + "unicode_decimal": 58884 + }, + { + "icon_id": "20306184", + "name": "超时", + "font_class": "timeout", + "unicode": "e6fd", + "unicode_decimal": 59133 + }, + { + "icon_id": "20158768", + "name": "arrow-left1", + "font_class": "arrow-left1", + "unicode": "e6fb", + "unicode_decimal": 59131 + }, + { + "icon_id": "20158769", + "name": "arrow-right1", + "font_class": "arrow-right1", + "unicode": "e6fc", + "unicode_decimal": 59132 + }, + { + "icon_id": "19942580", + "name": "Fast forward", + "font_class": "fast-forward", + "unicode": "e6fa", + "unicode_decimal": 59130 + }, + { + "icon_id": "19941177", + "name": "Replay", + "font_class": "replay", + "unicode": "e6f1", + "unicode_decimal": 59121 + }, + { + "icon_id": "19941178", + "name": "play", + "font_class": "play", + "unicode": "e6f3", + "unicode_decimal": 59123 + }, + { + "icon_id": "19941179", + "name": "suspend", + "font_class": "suspend", + "unicode": "e6f8", + "unicode_decimal": 59128 + }, + { + "icon_id": "19941032", + "name": "drop-down", + "font_class": "drop-down", + "unicode": "e6f0", + "unicode_decimal": 59120 + }, + { + "icon_id": "19941034", + "name": "HF", + "font_class": "replay2", + "unicode": "e6f2", + "unicode_decimal": 59122 + }, + { + "icon_id": "19941036", + "name": "JC", + "font_class": "JC", + "unicode": "e6f4", + "unicode_decimal": 59124 + }, + { + "icon_id": "19941037", + "name": "A-", + "font_class": "A-", + "unicode": "e6f5", + "unicode_decimal": 59125 + }, + { + "icon_id": "19941038", + "name": "A+", + "font_class": "A", + "unicode": "e6f6", + "unicode_decimal": 59126 + }, + { + "icon_id": "19941039", + "name": "RZ", + "font_class": "terminal-log", + "unicode": "e6f7", + "unicode_decimal": 59127 + }, + { + "icon_id": "19768292", + "name": "取消撤销", + "font_class": "revoke1", + "unicode": "e6ee", + "unicode_decimal": 59118 + }, + { + "icon_id": "19768293", + "name": "撤销", + "font_class": "revoke", + "unicode": "e6ef", + "unicode_decimal": 59119 + }, + { + "icon_id": "18831707", + "name": "unlock", + "font_class": "unlock", + "unicode": "e6e9", + "unicode_decimal": 59113 + }, + { + "icon_id": "18831344", + "name": "lock", + "font_class": "lock", + "unicode": "e6e8", + "unicode_decimal": 59112 + }, + { + "icon_id": "7898500", + "name": "宝贝管理-批量修改", + "font_class": "batch-edit", + "unicode": "e600", + "unicode_decimal": 58880 + }, + { + "icon_id": "17696428", + "name": "三角形", + "font_class": "triangle", + "unicode": "e6cf", + "unicode_decimal": 59087 + }, + { + "icon_id": "11635640", + "name": "push-pin-2-line", + "font_class": "push-pin-line", + "unicode": "e751", + "unicode_decimal": 59217 + }, + { + "icon_id": "11635641", + "name": "push-pin-2-fill", + "font_class": "push-pin-fill", + "unicode": "e752", + "unicode_decimal": 59218 + }, + { + "icon_id": "17334086", + "name": "上", + "font_class": "jiantou-top", + "unicode": "e6c8", + "unicode_decimal": 59080 + }, + { + "icon_id": "17334088", + "name": "下", + "font_class": "jiantou-down", + "unicode": "e6c9", + "unicode_decimal": 59081 + }, + { + "icon_id": "17334246", + "name": "左", + "font_class": "jiantou-left", + "unicode": "e6ca", + "unicode_decimal": 59082 + }, + { + "icon_id": "17334255", + "name": "右", + "font_class": "jiantou-right", + "unicode": "e6cb", + "unicode_decimal": 59083 + }, + { + "icon_id": "17334264", + "name": "up", + "font_class": "arrow-up2", + "unicode": "e6cc", + "unicode_decimal": 59084 + }, + { + "icon_id": "17334265", + "name": "down", + "font_class": "arrow-down1", + "unicode": "e6cd", + "unicode_decimal": 59085 + }, + { + "icon_id": "12932066", + "name": "l-goToTop", + "font_class": "top", + "unicode": "e791", + "unicode_decimal": 59281 + }, + { + "icon_id": "1368623", + "name": "warning", + "font_class": "warning", + "unicode": "e630", + "unicode_decimal": 58928 + }, + { + "icon_id": "17120864", + "name": "12", + "font_class": "asset", + "unicode": "e6bd", + "unicode_decimal": 59069 + }, + { + "icon_id": "17120870", + "name": "Endpoint11", + "font_class": "endpoint", + "unicode": "e6be", + "unicode_decimal": 59070 + }, + { + "icon_id": "10236672", + "name": "yingwenyuyan", + "font_class": "lang-en", + "unicode": "e66d", + "unicode_decimal": 58989 + }, + { + "icon_id": "10236675", + "name": "zhongwenyuyan", + "font_class": "lang-zh", + "unicode": "e66f", + "unicode_decimal": 58991 + }, + { + "icon_id": "10276252", + "name": "俄语Py", + "font_class": "lang-py", + "unicode": "e682", + "unicode_decimal": 59010 + }, + { + "icon_id": "1226661", + "name": "nav_more", + "font_class": "navmore", + "unicode": "e69f", + "unicode_decimal": 59039 + }, + { + "icon_id": "1308591", + "name": "728编辑器_字体大小", + "font_class": "728bianjiqi_zitidaxiao", + "unicode": "e660", + "unicode_decimal": 58976 + }, + { + "icon_id": "555665", + "name": "刷新", + "font_class": "refresh", + "unicode": "e650", + "unicode_decimal": 58960 + }, + { + "icon_id": "7949522", + "name": "警告", + "font_class": "jinggao", + "unicode": "e687", + "unicode_decimal": 59015 + }, + { + "icon_id": "14541278", + "name": "六边形", + "font_class": "hexagonBorder", + "unicode": "e603", + "unicode_decimal": 58883 + }, + { + "icon_id": "16952308", + "name": "关 闭", + "font_class": "circle-close", + "unicode": "e6b9", + "unicode_decimal": 59065 + }, + { + "icon_id": "16952194", + "name": "定位2", + "font_class": "shuidi", + "unicode": "e6bb", + "unicode_decimal": 59067 + }, + { + "icon_id": "16952195", + "name": "多边形2", + "font_class": "liubianxing", + "unicode": "e6bc", + "unicode_decimal": 59068 + }, + { + "icon_id": "16943517", + "name": "最大化", + "font_class": "maxview", + "unicode": "e6b7", + "unicode_decimal": 59063 + }, + { + "icon_id": "16943518", + "name": "最小化", + "font_class": "exit-maxview", + "unicode": "e6b8", + "unicode_decimal": 59064 + }, + { + "icon_id": "7925655", + "name": "切换", + "font_class": "sort1", + "unicode": "e8b1", + "unicode_decimal": 59569 + }, + { + "icon_id": "17162194", + "name": "caret-down", + "font_class": "caret-bottom", + "unicode": "ebfe", + "unicode_decimal": 60414 + }, + { + "icon_id": "16920615", + "name": "caret-down", + "font_class": "caret-down", + "unicode": "e6b1", + "unicode_decimal": 59057 + }, + { + "icon_id": "16920616", + "name": "caret-right", + "font_class": "caret-right", + "unicode": "e6b2", + "unicode_decimal": 59058 + }, + { + "icon_id": "16920617", + "name": "caret-up", + "font_class": "caret-up", + "unicode": "e6b3", + "unicode_decimal": 59059 + }, + { + "icon_id": "16920620", + "name": "caret-left", + "font_class": "caret-left", + "unicode": "e6b4", + "unicode_decimal": 59060 + }, + { + "icon_id": "16920147", + "name": "d-arrow-left", + "font_class": "d-arrow-left", + "unicode": "e6b5", + "unicode_decimal": 59061 + }, + { + "icon_id": "16920148", + "name": "d-arrow-right", + "font_class": "d-arrow-right", + "unicode": "e6b6", + "unicode_decimal": 59062 + }, + { + "icon_id": "16915855", + "name": "上", + "font_class": "arrow-up", + "unicode": "e6af", + "unicode_decimal": 59055 + }, + { + "icon_id": "16915856", + "name": "下", + "font_class": "arrow-down", + "unicode": "e6b0", + "unicode_decimal": 59056 + }, + { + "icon_id": "16915721", + "name": "右", + "font_class": "arrow-right", + "unicode": "e6ad", + "unicode_decimal": 59053 + }, + { + "icon_id": "16915722", + "name": "左", + "font_class": "arrow-left", + "unicode": "e6ae", + "unicode_decimal": 59054 + }, + { + "icon_id": "16915157", + "name": "import", + "font_class": "upload", + "unicode": "e6ac", + "unicode_decimal": 59052 + }, + { + "icon_id": "16915152", + "name": "export", + "font_class": "download1", + "unicode": "e6ab", + "unicode_decimal": 59051 + }, + { + "icon_id": "16913852", + "name": "arrow-up", + "font_class": "arrow-up1", + "unicode": "e6a0", + "unicode_decimal": 59040 + }, + { + "icon_id": "16913853", + "name": "arrow-down", + "font_class": "arrow-down2", + "unicode": "e6aa", + "unicode_decimal": 59050 + }, + { + "icon_id": "16909954", + "name": "search", + "font_class": "search", + "unicode": "e6a9", + "unicode_decimal": 59049 + }, + { + "icon_id": "16908261", + "name": "icon", + "font_class": "plus", + "unicode": "e6a7", + "unicode_decimal": 59047 + }, + { + "icon_id": "16908262", + "name": "icon1", + "font_class": "minus", + "unicode": "e6a8", + "unicode_decimal": 59048 + }, + { + "icon_id": "16902351", + "name": "形状", + "font_class": "reading", + "unicode": "e6a5", + "unicode_decimal": 59045 + }, + { + "icon_id": "16902291", + "name": "wenjian", + "font_class": "folder-opened", + "unicode": "e6a3", + "unicode_decimal": 59043 + }, + { + "icon_id": "16902292", + "name": "table", + "font_class": "table", + "unicode": "e6a4", + "unicode_decimal": 59044 + }, + { + "icon_id": "16902294", + "name": "编组 15", + "font_class": "table-edit", + "unicode": "e6a6", + "unicode_decimal": 59046 + }, + { + "icon_id": "13097688", + "name": "password", + "font_class": "password", + "unicode": "e62a", + "unicode_decimal": 58922 + }, + { + "icon_id": "13097697", + "name": "user", + "font_class": "user", + "unicode": "e62c", + "unicode_decimal": 58924 + }, + { + "icon_id": "5485635", + "name": "链接", + "font_class": "link1", + "unicode": "e60c", + "unicode_decimal": 58892 + }, + { + "icon_id": "16901527", + "name": "筛 选", + "font_class": "funnel", + "unicode": "e6a2", + "unicode_decimal": 59042 + }, + { + "icon_id": "16893874", + "name": "leaf", + "font_class": "leaf", + "unicode": "e6a1", + "unicode_decimal": 59041 + }, + { + "icon_id": "16827726", + "name": "更多", + "font_class": "more", + "unicode": "e699", + "unicode_decimal": 59033 + }, + { + "icon_id": "16827718", + "name": "对勾", + "font_class": "check", + "unicode": "e689", + "unicode_decimal": 59017 + }, + { + "icon_id": "16827609", + "name": "最小化", + "font_class": "exit-full-screen", + "unicode": "e698", + "unicode_decimal": 59032 + }, + { + "icon_id": "16827138", + "name": "查看", + "font_class": "view", + "unicode": "e683", + "unicode_decimal": 59011 + }, + { + "icon_id": "16827139", + "name": "关闭", + "font_class": "close", + "unicode": "e684", + "unicode_decimal": 59012 + }, + { + "icon_id": "16827141", + "name": "覆盖", + "font_class": "override", + "unicode": "e68a", + "unicode_decimal": 59018 + }, + { + "icon_id": "16827143", + "name": "编辑", + "font_class": "edit", + "unicode": "e68c", + "unicode_decimal": 59020 + }, + { + "icon_id": "16827144", + "name": "历史", + "font_class": "time", + "unicode": "e68d", + "unicode_decimal": 59021 + }, + { + "icon_id": "16827146", + "name": "删除", + "font_class": "delete", + "unicode": "e68f", + "unicode_decimal": 59023 + }, + { + "icon_id": "16827149", + "name": "删除1", + "font_class": "shanchu1", + "unicode": "e692", + "unicode_decimal": 59026 + }, + { + "icon_id": "16827150", + "name": "下载", + "font_class": "download", + "unicode": "e693", + "unicode_decimal": 59027 + }, + { + "icon_id": "16827151", + "name": "设置", + "font_class": "gear", + "unicode": "e694", + "unicode_decimal": 59028 + }, + { + "icon_id": "16827153", + "name": "排序", + "font_class": "sort4", + "unicode": "e696", + "unicode_decimal": 59030 + }, + { + "icon_id": "16827154", + "name": "Asset", + "font_class": "template", + "unicode": "e697", + "unicode_decimal": 59031 + }, + { + "icon_id": "16827157", + "name": "日历", + "font_class": "date", + "unicode": "e69a", + "unicode_decimal": 59034 + }, + { + "icon_id": "16827158", + "name": "数据分析", + "font_class": "chart", + "unicode": "e69b", + "unicode_decimal": 59035 + }, + { + "icon_id": "16827160", + "name": "云", + "font_class": "sync", + "unicode": "e69c", + "unicode_decimal": 59036 + }, + { + "icon_id": "16827161", + "name": "最大化", + "font_class": "full-screen", + "unicode": "e69d", + "unicode_decimal": 59037 + }, + { + "icon_id": "16827162", + "name": "终端", + "font_class": "cli", + "unicode": "e69e", + "unicode_decimal": 59038 + }, + { + "icon_id": "16815935", + "name": "注释", + "font_class": "info-normal", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "16814408", + "name": "添加", + "font_class": "create-square-copy", + "unicode": "e685", + "unicode_decimal": 59013 + }, + { + "icon_id": "16814411", + "name": "下拉选择", + "font_class": "xialaxuanze", + "unicode": "e688", + "unicode_decimal": 59016 + }, + { + "icon_id": "16813091", + "name": "module6", + "font_class": "module6", + "unicode": "e680", + "unicode_decimal": 59008 + }, + { + "icon_id": "16812979", + "name": "module2", + "font_class": "module2", + "unicode": "e67b", + "unicode_decimal": 59003 + }, + { + "icon_id": "16812980", + "name": "module4", + "font_class": "module4", + "unicode": "e67c", + "unicode_decimal": 59004 + }, + { + "icon_id": "16812981", + "name": "module1", + "font_class": "module1", + "unicode": "e67d", + "unicode_decimal": 59005 + }, + { + "icon_id": "16812982", + "name": "module3", + "font_class": "module3", + "unicode": "e67e", + "unicode_decimal": 59006 + }, + { + "icon_id": "16812983", + "name": "module5", + "font_class": "module5", + "unicode": "e67f", + "unicode_decimal": 59007 + }, + { + "icon_id": "16809568", + "name": "缩小", + "font_class": "narrow", + "unicode": "e679", + "unicode_decimal": 59001 + }, + { + "icon_id": "16809569", + "name": "放大", + "font_class": "enlarge", + "unicode": "e67a", + "unicode_decimal": 59002 + }, + { + "icon_id": "16806972", + "name": "Fill 1", + "font_class": "model", + "unicode": "e672", + "unicode_decimal": 58994 + }, + { + "icon_id": "16806973", + "name": "info", + "font_class": "info", + "unicode": "e674", + "unicode_decimal": 58996 + }, + { + "icon_id": "16806975", + "name": "alert", + "font_class": "gaojing", + "unicode": "e676", + "unicode_decimal": 58998 + }, + { + "icon_id": "16807002", + "name": "shuju", + "font_class": "shuju", + "unicode": "e678", + "unicode_decimal": 59000 + }, + { + "icon_id": "16742548", + "name": "Alert", + "font_class": "overview-alert1", + "unicode": "e66e", + "unicode_decimal": 58990 + }, + { + "icon_id": "16742549", + "name": "Asset", + "font_class": "overview-asset1", + "unicode": "e670", + "unicode_decimal": 58992 + }, + { + "icon_id": "16742550", + "name": "endpoint", + "font_class": "overview-endpoint1", + "unicode": "e671", + "unicode_decimal": 58993 + } + ] +} diff --git a/nezha-fronted/src/assets/css/font/iconfont.ttf b/nezha-fronted/src/assets/css/font/iconfont.ttf index 5ff9eda40..d480853bb 100644 Binary files a/nezha-fronted/src/assets/css/font/iconfont.ttf and b/nezha-fronted/src/assets/css/font/iconfont.ttf differ diff --git a/nezha-fronted/src/assets/css/font/iconfont.woff b/nezha-fronted/src/assets/css/font/iconfont.woff index 52588227b..d616e3a27 100644 Binary files a/nezha-fronted/src/assets/css/font/iconfont.woff and b/nezha-fronted/src/assets/css/font/iconfont.woff differ diff --git a/nezha-fronted/src/assets/css/font/iconfont.woff2 b/nezha-fronted/src/assets/css/font/iconfont.woff2 index 65ef480be..62c37e43b 100644 Binary files a/nezha-fronted/src/assets/css/font/iconfont.woff2 and b/nezha-fronted/src/assets/css/font/iconfont.woff2 differ diff --git a/nezha-fronted/src/assets/css/nzIcon.css b/nezha-fronted/src/assets/css/nzIcon.css index b5ddc32e7..1b7c609d1 100644 --- a/nezha-fronted/src/assets/css/nzIcon.css +++ b/nezha-fronted/src/assets/css/nzIcon.css @@ -1,8 +1,8 @@ @font-face { font-family: "nz-icon"; /* Project id 2030432 */ - src: url('./font/iconfont.woff2?t=1647598587378') format('woff2'), - url('./font/iconfont.woff?t=1647598587378') format('woff'), - url('./font/iconfont.ttf?t=1647598587378') format('truetype'); + src: url('./font/iconfont.woff2?t=1649732646689') format('woff2'), + url('./font/iconfont.woff?t=1649732646689') format('woff'), + url('./font/iconfont.ttf?t=1649732646689') format('truetype'); } .nz-icon { @@ -13,6 +13,50 @@ -moz-osx-font-smoothing: grayscale; } +.nz-icon-tool:before { + content: "\e76f"; +} + +.nz-icon-export-pdf:before { + content: "\e770"; +} + +.nz-icon-Router:before { + content: "\e766"; +} + +.nz-icon-Computer:before { + content: "\e767"; +} + +.nz-icon-a-Networkdevices:before { + content: "\e768"; +} + +.nz-icon-Other:before { + content: "\e769"; +} + +.nz-icon-a-Virtualmachine:before { + content: "\e76a"; +} + +.nz-icon-Switch:before { + content: "\e76b"; +} + +.nz-icon-Server:before { + content: "\e76c"; +} + +.nz-icon-ADC:before { + content: "\e76d"; +} + +.nz-icon-Firewall:before { + content: "\e76e"; +} + .nz-icon-Topology:before { content: "\e763"; } diff --git a/nezha-fronted/src/assets/css/themes/theme-light.scss b/nezha-fronted/src/assets/css/themes/theme-light.scss index 9807384e4..7fe14a84c 100644 --- a/nezha-fronted/src/assets/css/themes/theme-light.scss +++ b/nezha-fronted/src/assets/css/themes/theme-light.scss @@ -32,9 +32,9 @@ $--left-menu-background-color-hover: $--left-menu-background-color-active; /* 3.字色 */ // 标题字色(覆盖element-ui内置变量) -$--color-text-primary: #333332; +$--color-text-primary: #333333; // 普通字色(覆盖element-ui内置变量) -$--color-text-regular: #666665; +$--color-text-regular: #666666; // 次要字色(覆盖element-ui内置变量) $--color-text-secondary: #999998; // 链接字色 @@ -221,7 +221,7 @@ $--switch-background-color: #dcdfe6; $--project-input-background-color: $--color-text-disabled; /* alert rule */ -$--alert-rule-background-color: #f4f4f5; +$--alert-rule-background-color: #f5f5f5; $--alert-rule-color: $--overview-icon-color; /* webSSH */ diff --git a/nezha-fronted/src/assets/img/explore-tab-logo.png b/nezha-fronted/src/assets/img/explore-tab-logo.png index 9ab70f657..0b402b5ce 100644 Binary files a/nezha-fronted/src/assets/img/explore-tab-logo.png and b/nezha-fronted/src/assets/img/explore-tab-logo.png differ diff --git a/nezha-fronted/src/assets/img/favicon.ico b/nezha-fronted/src/assets/img/favicon.ico new file mode 100644 index 000000000..0b402b5ce Binary files /dev/null and b/nezha-fronted/src/assets/img/favicon.ico differ diff --git a/nezha-fronted/src/assets/img/logo-big.png b/nezha-fronted/src/assets/img/logo-big.png index 8c6676124..b7114519d 100644 Binary files a/nezha-fronted/src/assets/img/logo-big.png and b/nezha-fronted/src/assets/img/logo-big.png differ diff --git a/nezha-fronted/src/assets/img/logo1-2.png b/nezha-fronted/src/assets/img/logo1-2.png index aeddd5f17..0b402b5ce 100644 Binary files a/nezha-fronted/src/assets/img/logo1-2.png and b/nezha-fronted/src/assets/img/logo1-2.png differ diff --git a/nezha-fronted/src/components/chart/ChartScreenHeader.vue b/nezha-fronted/src/components/chart/ChartScreenHeader.vue index 8d4ee025d..394f9e1a2 100644 --- a/nezha-fronted/src/components/chart/ChartScreenHeader.vue +++ b/nezha-fronted/src/components/chart/ChartScreenHeader.vue @@ -45,6 +45,7 @@ ref="pickTime" style="height: 28px;" id="line-chart" + :sign="chartInfo.id" @unitChange="unitChange" > diff --git a/nezha-fronted/src/components/chart/chart.vue b/nezha-fronted/src/components/chart/chart.vue index c9148793d..c1c80f0cd 100644 --- a/nezha-fronted/src/components/chart/chart.vue +++ b/nezha-fronted/src/components/chart/chart.vue @@ -1,4 +1,5 @@ - diff --git a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue index f8a4684d6..490e34358 100644 --- a/nezha-fronted/src/components/common/bottomBox/bottomBox.vue +++ b/nezha-fronted/src/components/common/bottomBox/bottomBox.vue @@ -38,9 +38,9 @@ - + - + @@ -48,9 +48,9 @@ - - - + + + @@ -118,7 +118,8 @@ export default { obj: Object, // 关联的实体对象 from: String, // 来自哪个页面 tabList: Array, // 动态页签列表 - targetTab: String // 展示哪个页签 + targetTab: String, // 展示哪个页签 + sign:[Number,String], //pickTime历史记录的唯一标识 }, watch: { obj: { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue index 78cffc1f8..4de64861c 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/alertMessageTabNew.vue @@ -18,7 +18,7 @@ - + @@ -54,12 +54,15 @@ export default { nzBottomDataList, logTab }, + props: { + sign:[Number,String] + }, data () { return { logData: null, filterTime: [ - bus.timeFormate(bus.getOffsetTimezoneData(-1), this.timeFormatMain), - bus.timeFormate(bus.getOffsetTimezoneData(), this.timeFormatMain) + bus.timeFormate(bus.getOffsetTimezoneData(-1)), + bus.timeFormate(bus.getOffsetTimezoneData()) ], expressions: [''], matchSymbol: '|=', @@ -72,8 +75,8 @@ export default { exportLog ({ limit, descending }) { const params = { logql: this.expressions, - start: this.$stringTimeParseToUnix(this.filterTime[0]), - end: this.$stringTimeParseToUnix(this.filterTime[1]), + start: this.$stringTimeParseToUnix(bus.formateTimeToTime(this.filterTime[0])), + end: this.$stringTimeParseToUnix(bus.formateTimeToTime(this.filterTime[1])), direction: descending ? 'backward' : 'forward', limit } @@ -115,7 +118,9 @@ export default { if (item != '') { let expr = item this.matchContent && (expr = `${item} ${this.matchSymbol} "${this.matchContent}"`) - requestArr.push(this.$get('/logs/loki/api/v1/query_range?format=1&query=' + encodeURIComponent(expr) + '&start=' + this.$stringTimeParseToUnix(this.filterTime[0]) + '&end=' + this.$stringTimeParseToUnix(this.filterTime[1]) + '&limit=' + limit)) + const statTime = bus.formateTimeToTime(this.filterTime[0]) + const endTime = bus.formateTimeToTime(this.filterTime[1]) + requestArr.push(this.$get('/logs/loki/api/v1/query_range?format=1&query=' + encodeURIComponent(expr) + '&start=' + this.$stringTimeParseToUnix(statTime) + '&end=' + this.$stringTimeParseToUnix(endTime) + '&limit=' + limit)) } }) axios.all(requestArr).then(res => { diff --git a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue index 4399a1cc6..d5ce05025 100644 --- a/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue +++ b/nezha-fronted/src/components/common/bottomBox/tabs/panelTabNew.vue @@ -13,7 +13,7 @@
- + @@ -72,6 +75,9 @@
{{ $t('overall.syncChart') }}
+ +
{{ $t('overall.downloadToPdf') }}
+
@@ -146,9 +152,10 @@ import chartTempBox from '@/components/common/rightBox/chartTempBox' import topToolMoreOptions from '@/components/common/popBox/topToolMoreOptions' import detailViewRightMixin from '@/components/common/mixin/detailViewRightMixin' import { randomcolor } from '@/components/common/js/radomcolor/randomcolor' +import htmlToPdfMixin from '@/components/common/mixin/htmlToPdfMixin' export default { name: 'panelTabNew', - mixins: [subDataListMixin, detailViewRightMixin], + mixins: [subDataListMixin, detailViewRightMixin, htmlToPdfMixin], props: { from: String, obj: Object, @@ -156,7 +163,8 @@ export default { paramsType: { type: String, default: 'dashboard' - } + }, + sign:[Number,String] }, computed: { chartRightBoxShow () { @@ -172,6 +180,8 @@ export default { data () { return { fromRoute, + pdfId: 'pdfDom', + htmlTitle: 'panel', panelTabLoading: false, showTopBtn: false, // top按钮 visible: false, @@ -279,8 +289,8 @@ export default { this.getData(this.filter) }, refreshTime (st, et) { - const startTime = bus.timeFormate(st, 'yyyy-MM-dd hh:mm') - const endTime = bus.timeFormate(et, 'yyyy-MM-dd hh:mm') + const startTime = bus.timeFormate(st) + const endTime = bus.timeFormate(et) this.searchTime = [startTime, endTime] }, panelReloadForDel () { @@ -485,8 +495,8 @@ export default { const nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType this.nowTimeType = this.$refs.pickTime.$refs.timePicker.nowTimeType this.setSearchTime(nowTimeType.type, nowTimeType.value) - this.filter.start_time = bus.timeFormate(this.searchTime[0], 'YYYY-MM-DD HH:mm:ss') - this.filter.end_time = bus.timeFormate(this.searchTime[1], 'YYYY-MM-DD HH:mm:ss') + this.filter.start_time = bus.timeFormate(this.searchTime[0]) + this.filter.end_time = bus.timeFormate(this.searchTime[1]) this.filter.panelId = this.showPanel.id this.getData(this.filter) this.$store.dispatch('dispatchPanelTime', { @@ -498,20 +508,20 @@ export default { /* 时间条件查询--end */ setSearchTime (type, val) { // 设置searchTime if (type === 'minute') { - const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val), 'YYYY-MM-DD HH:mm:ss') - const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss') + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setMinutes(new Date(bus.computeTimezone(new Date().getTime())).getMinutes() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 2, val + 'm') } else if (type === 'hour') { - const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val), 'YYYY-MM-DD HH:mm:ss') - const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss') + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setHours(new Date(bus.computeTimezone(new Date().getTime())).getHours() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 2, val + 'h') } else if (type === 'date') { - const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val), 'YYYY-MM-DD HH:mm:ss') - const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())), 'YYYY-MM-DD HH:mm:ss') + const startTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime())).setDate(new Date(bus.computeTimezone(new Date().getTime())).getDate() - val)) + const endTime = bus.timeFormate(new Date(bus.computeTimezone(new Date().getTime()))) this.$set(this.searchTime, 0, startTime) this.$set(this.searchTime, 1, endTime) this.$set(this.searchTime, 2, val + 'd') @@ -724,6 +734,42 @@ export default { if (type === 'duplicate') { this.editChart(chartInfo, true) } + }, + htmlToPdf () { + const dom = document.getElementsByClassName(this.pdfId)[0] + this.htmlTitle = this.obj.name || 'pdf' + if (dom) { + // dom = dom.getElementsByClassName('vue-grid-layout')[0] + this.scrollbarWrap.scrollTop = this.scrollbarWrap.scrollHeight + this.$refs.chartList.onScroll(this.scrollbarWrap.scrollTop) + let flag = true + this.showScreenLoading(true) + let timer = setInterval(() => { + flag = true + this.$refs.chartList.copyDataList.forEach(chart => { + if (chart.type !== 'group') { + flag = flag && chart.loaded + } else if (chart.collapse) { + chart.children.forEach(groupChart => { + flag = flag && groupChart.loaded + }) + } + }) + if (flag) { + clearInterval(timer) + timer = null + setTimeout(() => { + document.body.style.height = 'auto' + // document.getElementsByTagName('html')[0].style.overflow = 'visible' + const position = dom.getBoundingClientRect() + this.getPdf(dom, -1 * position.left, -1 * position.top,this.searchTime) + // this.getPdf(dom, 0, 0) + }, 2000) + } + }, 200) + } else { + this.showScreenLoading(false) + } } }, mounted () { diff --git a/nezha-fronted/src/components/common/chartUnit.vue b/nezha-fronted/src/components/common/chartUnit.vue index 78195293a..a6887964b 100644 --- a/nezha-fronted/src/components/common/chartUnit.vue +++ b/nezha-fronted/src/components/common/chartUnit.vue @@ -22,7 +22,7 @@ @@ -179,7 +186,7 @@ export default { margin-left: 5px; } .time-picker { - padding-left: 8px; + /* padding-left: 8px; */ display: flex; } diff --git a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue index a227f5220..92c896490 100644 --- a/nezha-fronted/src/components/common/project/L5/CanvasProps.vue +++ b/nezha-fronted/src/components/common/project/L5/CanvasProps.vue @@ -1093,7 +1093,7 @@ diff --git a/nezha-fronted/src/components/common/rightBox/administration/backupsBox.vue b/nezha-fronted/src/components/common/rightBox/administration/backupsBox.vue index d4b9fb6ac..0ba5fe4fa 100644 --- a/nezha-fronted/src/components/common/rightBox/administration/backupsBox.vue +++ b/nezha-fronted/src/components/common/rightBox/administration/backupsBox.vue @@ -169,88 +169,88 @@ diff --git a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue index e1e4c344c..e803c0c28 100644 --- a/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue +++ b/nezha-fronted/src/components/common/rightBox/alertRuleBox.vue @@ -342,12 +342,13 @@ diff --git a/nezha-fronted/src/components/common/table/asset/assetTable.vue b/nezha-fronted/src/components/common/table/asset/assetTable.vue index 661a4f730..f9190855f 100644 --- a/nezha-fronted/src/components/common/table/asset/assetTable.vue +++ b/nezha-fronted/src/components/common/table/asset/assetTable.vue @@ -300,7 +300,7 @@ export default { hideTableTooltip, tableDataSort (item) { let orderBy = '' - let str = item.prop + const str = item.prop if (str === 'dc') { orderBy = str } diff --git a/nezha-fronted/src/components/common/table/nzDataList.vue b/nezha-fronted/src/components/common/table/nzDataList.vue index dd5da160f..57e06b2c6 100644 --- a/nezha-fronted/src/components/common/table/nzDataList.vue +++ b/nezha-fronted/src/components/common/table/nzDataList.vue @@ -67,6 +67,7 @@ @getTableData = 'getTableData' ref="bottomBox" :from="from" + :sign ="sign" :is-full-screen="bottomBox.isFullScreen" :obj="bottomBox.object" :sub-resize-show="bottomBox.subResizeShow" @@ -153,6 +154,7 @@ export default { }, data () { return { + sign:'', fromRoute: fromRoute, /* 二级页面相关 */ bottomBox: { @@ -193,6 +195,7 @@ export default { bottomBoxWindow.listResize(vm, e) }, showBottomBox (targetTab, row) { + this.sign = row.id this.bottomBox.targetTab = targetTab this.bottomBox.object = JSON.parse(JSON.stringify(row)) this.bottomBox.showSubList = true diff --git a/nezha-fronted/src/components/common/table/settings/backupsTable.vue b/nezha-fronted/src/components/common/table/settings/backupsTable.vue index 5e94f2c83..e70940518 100644 --- a/nezha-fronted/src/components/common/table/settings/backupsTable.vue +++ b/nezha-fronted/src/components/common/table/settings/backupsTable.vue @@ -14,8 +14,8 @@
-
diff --git a/nezha-fronted/src/components/page/config/backups.vue b/nezha-fronted/src/components/page/config/backups.vue index cc1a81178..ba01bb6b2 100644 --- a/nezha-fronted/src/components/page/config/backups.vue +++ b/nezha-fronted/src/components/page/config/backups.vue @@ -1,7 +1,7 @@ +
+ {{ appendMsg }} +
+
+ + + -
-
+
+
+ +
+
+
-
- + center + > + Expression - + - Variable - + Variable + - + - + - + - + - -
diff --git a/nezha-fronted/src/components/page/dashboard/overview/chart.vue b/nezha-fronted/src/components/page/dashboard/overview/chart.vue index 0639d3261..0ff73f068 100644 --- a/nezha-fronted/src/components/page/dashboard/overview/chart.vue +++ b/nezha-fronted/src/components/page/dashboard/overview/chart.vue @@ -18,7 +18,7 @@ + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/components/common/js/index.html b/nezha-fronted/test/unit/coverage/lcov-report/components/common/js/index.html new file mode 100644 index 000000000..dfef36fb7 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/components/common/js/index.html @@ -0,0 +1,110 @@ + + + + + + Code coverage report for components/common/js + + + + + + + + +
+
+

All files components/common/js

+
+ +
+ 100% + Statements + 13/13 +
+ + +
+ 100% + Branches + 8/8 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 13/13 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
example.js +
+
100%13/13100%8/8100%2/2100%13/13
+
+
+
+ +
+ + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/components/common/mixin/index.html b/nezha-fronted/test/unit/coverage/lcov-report/components/common/mixin/index.html new file mode 100644 index 000000000..a6a90f185 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/components/common/mixin/index.html @@ -0,0 +1,110 @@ + + + + + + Code coverage report for components/common/mixin + + + + + + + + +
+
+

All files components/common/mixin

+
+ +
+ 82.22% + Statements + 37/45 +
+ + +
+ 70% + Branches + 21/30 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 82.22% + Lines + 37/45 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
mainMixinFun.js +
+
82.22%37/4570%21/30100%4/482.22%37/45
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/components/common/mixin/mainMixinFun.js.html b/nezha-fronted/test/unit/coverage/lcov-report/components/common/mixin/mainMixinFun.js.html new file mode 100644 index 000000000..8548a4b38 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/components/common/mixin/mainMixinFun.js.html @@ -0,0 +1,340 @@ + + + + + + Code coverage report for components/common/mixin/mainMixinFun.js + + + + + + + + +
+
+

All files / components/common/mixin mainMixinFun.js

+
+ +
+ 82.22% + Statements + 37/45 +
+ + +
+ 70% + Branches + 21/30 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 82.22% + Lines + 37/45 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88  +  +  +  +  +  +2x +2x +  +  +  +3x +2x +  +3x +3x +  +  +  +  +  +5x +5x +  +  +  +3x +2x +  +3x +3x +  +  +  +1x +  +  +2x +  +  +4x +4x +2x +2x +2x +  +2x +  +  +  +  +  +2x +  +  +  +  +  +  +  +2x +  +  +2x +  +  +3x +  +  +2x +1x +1x +1x +1x +1x +1x +1x +  +1x +1x +1x +1x +1x +  +  +  +  + 
import bus from '@/libs/bus'
+import { hasButton } from '@/permission'
+import i18n from '@/components/common/i18n'
+export default {
+  methods: {
+    utcTimeToTimezone: function (time) { // 将utc时间 转为系统设者的时间  返回时间戳
+      Eif (time) {
+        return bus.UTCTimeToConfigTimezone(time)
+      }
+    },
+    utcTimeToTimezoneStr: function (time, fmt) { // 将utc时间 转为系统设者的时间  返回String
+      if (!fmt) {
+        fmt = localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss'
+      }
+      Eif (time) {
+        return bus.timeFormate(bus.UTCTimeToConfigTimezone(time), fmt)
+      } else {
+        return '-'
+      }
+    },
+    timezoneToUtcTime: function (time) { // 将系统设者的时间 转为utc时间 返回时间戳
+      Eif (time) {
+        return bus.configTimezoneToUTCTime(time)
+      }
+    },
+    timezoneToUtcTimeStr: function (time, fmt) { // 将系统设者的时间 转为utc时间 返回String
+      if (!fmt) {
+        fmt = localStorage.getItem('nz-default-dateFormat') || 'YYYY-MM-DD HH:mm:ss'
+      }
+      Eif (time) {
+        return bus.timeFormate(this.timezoneToUtcTime(time), fmt)
+      }
+    },
+    timeFormate (time) {
+      return bus.timeFormate(time)
+    },
+    hasButton (code) {
+      return hasButton(this.$store.getters.buttonList, code)
+    },
+    numberWithEConvent (num) {
+      Eif (num) {
+        if ((('' + num).indexOf('E') !== -1) || (('' + num).indexOf('e') !== -1)) {
+          const regExp = /'^((\\d+.?\\d+)[Ee]{1}(\\d+))$', 'ig'/
+          let result = regExp.exec(num)
+          let resultValue = ''
+          let power
+          Iif (result != null) {
+            resultValue = result[2]
+            power = result[3]
+            result = regExp.exec(num)
+          }
+ 
+          Iif (resultValue) {
+            if (power) {
+              const powVer = Math.pow(10, power)
+              resultValue = resultValue * powVer
+              return resultValue
+            }
+          }
+        } else {
+          return num
+        }
+      }
+      return 0
+    },
+    translation (key) {
+      return i18n.t(key)
+    },
+    timeFormatStrToDatePickFormat (str, flag) {
+      if (flag) {
+        const reg = /Y/g
+        str = str.replace(reg, 'y')
+        const reg1 = /D/g
+        str = str.replace(reg1, 'd')
+        const reg2 = /[H,m,s,:]/g
+        str = str.replace(reg2, '')
+        return str
+      } else {
+        const reg = /Y/g
+        str = str.replace(reg, 'y')
+        const reg1 = /D/g
+        str = str.replace(reg1, 'd')
+        return str
+      }
+    },
+  }
+}
+ 
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/index.html b/nezha-fronted/test/unit/coverage/lcov-report/index.html new file mode 100644 index 000000000..c63545d8f --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/index.html @@ -0,0 +1,140 @@ + + + + + + Code coverage report for All files + + + + + + + + +
+
+

All files

+
+ +
+ 46.78% + Statements + 109/233 +
+ + +
+ 36.91% + Branches + 55/149 +
+ + +
+ 42.86% + Functions + 9/21 +
+ + +
+ 46.98% + Lines + 109/232 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
components/common/js +
+
100%13/13100%8/8100%2/2100%13/13
components/common/mixin +
+
82.22%37/4570%21/30100%4/482.22%37/45
libs +
+
33.71%59/17523.42%26/11120%3/1533.91%59/174
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/libs/bus.js.html b/nezha-fronted/test/unit/coverage/lcov-report/libs/bus.js.html new file mode 100644 index 000000000..432a6dc88 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/libs/bus.js.html @@ -0,0 +1,979 @@ + + + + + + Code coverage report for libs/bus.js + + + + + + + + +
+
+

All files / libs bus.js

+
+ +
+ 33.71% + Statements + 59/175 +
+ + +
+ 23.42% + Branches + 26/111 +
+ + +
+ 20% + Functions + 3/15 +
+ + +
+ 33.91% + Lines + 59/174 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239 +240 +241 +242 +243 +244 +245 +246 +247 +248 +249 +250 +251 +252 +253 +254 +255 +256 +257 +258 +259 +260 +261 +262 +263 +264 +265 +266 +267 +268 +269 +270 +271 +272 +273 +274 +275 +276 +277 +278 +279 +280 +281 +282 +283 +284 +285 +286 +287 +288 +289 +290 +291 +292 +293 +294 +295 +296 +297 +298 +299 +300 +301  +  +2x +2x +2x +2x +  +2x +2x +2x +2x +  +  +  +  +2x +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +2x +2x +2x +2x +  +  +2x +2x +2x +  +  +  +  +  +  +  +  +4x +4x +4x +  +  +  +  +  +  +  +  +  +  +  +  +  +12x +12x +10x +  +2x +  +12x +12x +  +  +  +  +  +  +  +  +  +  +4x +4x +4x +4x +4x +4x +4x +4x +1x +3x +1x +2x +1x +  +1x +  +4x +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +5x +5x +5x +5x +5x +3x +  +5x +5x +5x +  +  +  +  +  +5x +5x +5x +5x +5x +3x +  +5x +5x +5x +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +2x +  +  +  +  +  +  +  +  +  + 
import Vue from 'vue'
+import moment from 'moment-timezone'
+Date.prototype.setStart = function () {
+  this.setHours(0)
+  this.setMinutes(0)
+  this.setSeconds(0)
+}
+Date.prototype.setEnd = function () {
+  this.setHours(23)
+  this.setMinutes(59)
+  this.setSeconds(59)
+}
+ 
+export default new Vue({
+  data () {
+    return {
+      selectDate: [], // 选中的时间段
+      emailReg: /^[a-zA-Z0-9]{1,10}@[a-zA-Z0-9]{1,5}\.[a-zA-Z0-9]{1,5}$/,
+      // 创建策略信息
+      buildRuleInfo: {
+        triggers: [],
+        actions: []
+      },
+      backtoRulelist: '', // 返回策略列表页信息
+      // role: md5(1),
+      role: 1,
+      // 创建图表信息
+      chartAddInfo: {
+        metricTarget: []
+      }
+    }
+  },
+  methods: {
+    // 获取初始化时间,默认最近一周
+    getDefaultDate () {
+      let start = this.getDays(-7)
+      let end = this.getDays(0)
+      start.setStart()
+      end.setEnd()
+      // let start = this.getHoursTime(-1);
+      // let end = this.getHoursTime(0);
+      start = this.timeFormate(start, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
+      end = this.timeFormate(end, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
+      this.selectDate = [start, end]
+    },
+    getHoursTime (hours) {
+      const today = new Date().getTime()
+      const date = new Date(today + (hours * 60 * 60 * 1000))
+      return date
+    },
+    // 初始化日期
+    getDays (days) {
+      const today = new Date().getTime()
+      const date = new Date(today + (days * 24 * 60 * 60 * 1000))
+      return date
+    },
+    formatDate (date, type) {
+      const yy = date.getFullYear()
+      const dateM = date.getMonth() + 1
+      const mm = dateM > 9 ? dateM : `0${dateM}`
+      const dateD = date.getDate()
+      const dd = dateD > 9 ? dateD : `0${dateD}`
+      if (type) {
+        return `${yy}${type}${mm}${type}${dd}`
+      }
+      return `${yy}${mm}${dd}`
+    },
+    timeFormate (date, fmt = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss') {
+      let time = ''
+      if (!isNaN(date)) {
+        time = new Date(date)
+      } else {
+        time = moment(date, fmt)
+      }
+      const fm = fmt
+      return moment(time).format(fm)
+    },
+    formateTimeToTime (date, fmt = localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss') {
+      if (isNaN(date)) {
+        const newDate = moment(date, fmt)
+        return newDate
+      } else {
+        return date
+      }
+    },
+    getStep (startTime, endTime) {
+      const start = new Date(startTime)
+      const end = new Date(endTime)
+      let step = '15s'
+      const numInterval = end.getTime() - start.getTime()
+      const oneDay = 86400000
+      const sevenDay = 604800000
+      const thirtyDay = 2592000000
+      if (numInterval < oneDay) { // 小于1天,step为15s
+        step = '15s'
+      } else if (numInterval < sevenDay) { // 小于7天,step为15s
+        step = '5m'
+      } else if (numInterval < thirtyDay) { // 小于30天,step为15s
+        step = '10m'
+      } else {
+        step = '30m'
+      }
+      return step
+    },
+    isEmptyObject (obj) {
+      if (obj) {
+        let name = ''
+        // eslint-disable-next-line
+        for (name in obj) { return false; }
+        return true
+      }
+      return true
+    },
+    validateEmail (rule, value, callback) {
+      if (value === '') {
+        callback(new Error('请输入邮箱'))
+      } else if (!this.emailReg.test(value)) {
+        callback(new Error('邮箱格式不正确'))
+      } else {
+        callback()
+      }
+    },
+    getNumStr (num) {
+      if (num >= 1000) {
+        const kbNum = num / 1000
+        if (kbNum >= 1000) {
+          const mbNum = kbNum / 1000
+          if (mbNum > 1000) {
+            const gbNum = mbNum / 1000
+            if (gbNum > 1000) {
+              const tbNum = gbNum / 1000
+              if (tbNum > 1000) {
+                const pbNum = tbNum / 1000
+                return `${pbNum.toFixed(2)}PB`
+              }
+              return `${tbNum.toFixed(2)}TB`
+            }
+            return `${gbNum.toFixed(2)}GB`
+          }
+          return `${mbNum.toFixed(2)}MB`
+        }
+        return `${kbNum.toFixed(2)}KB`
+      }
+      return num.toFixed(2)
+    },
+    getSingleStatRlt (statistics, result) {
+      let dataArray = []
+      if (result) {
+        result.forEach((item) => {
+          dataArray.push(item[1])
+        })
+      }
+      let statisticsRlt = ''
+      if (dataArray.length > 0) {
+        if (statistics === 'min') { // min:最小值
+          statisticsRlt = dataArray.reduce(function (a, b) {
+            return b < a ? b : a
+          })
+        } else if (statistics === 'max') { // max:最大值
+          statisticsRlt = dataArray.reduce(function (a, b) {
+            return b > a ? b : a
+          })
+        } else if (statistics === 'avg') { // avg:平均值
+          let sum = 0
+          dataArray.forEach((item) => {
+            sum = Number(sum) + Number(item)
+          })
+          statisticsRlt = sum / dataArray.length
+        } else if (statistics === 'total') { // total:总计
+          dataArray.forEach((item) => {
+            statisticsRlt = Number(statisticsRlt) + Number(item)
+          })
+        } else if (statistics === 'first') { // first:第一个值
+          statisticsRlt = dataArray[0]
+        } else if (statistics === 'last') { // last:最后一个值
+          statisticsRlt = dataArray[dataArray.length - 1]
+        } else if (statistics === 'range') { // range : max - min
+          const min = dataArray.reduce(function (a, b) {
+            return b < a ? b : a
+          })
+          const max = dataArray.reduce(function (a, b) {
+            return b > a ? b : a
+          })
+          statisticsRlt = max - min
+        } else if (statistics === 'different') { // different : last - first
+          statisticsRlt = dataArray[dataArray.length - 1] - dataArray[0]
+        }
+      }
+      dataArray = null
+      return statisticsRlt
+    },
+    // 将本地时区转为系统配置的时区
+    computeTimezone: function (sourceTime) {
+      let offset = localStorage.getItem('nz-sys-timezone')
+      offset = moment.tz(offset).format('Z')
+      if (offset && offset !== 'undefined') {
+        offset = Number.parseInt(offset)
+        const date = new Date(sourceTime)
+        const localOffset = date.getTimezoneOffset() * 60 * 1000 // 默认 一分钟显示时区偏移的结果
+        const utcTime = sourceTime + localOffset
+        return utcTime + (offset * 60 * 60 * 1000)
+      } else {
+        return sourceTime
+      }
+    },
+    // 将本地时区转为系统配置的时区
+    computeTimezoneTime: function (sourceTime) {
+      let offset = localStorage.getItem('nz-sys-timezone')
+      offset = moment.tz(offset).format('Z')
+      if (offset && offset !== 'undefined') {
+        offset = Number.parseInt(offset)
+        const date = new Date(sourceTime)
+        const localOffset = date.getTimezoneOffset() * 60 * 1000 // 默认 一分钟显示时区偏移的结果
+        const utcTime = date.getTime() + localOffset
+        return utcTime + (offset * 60 * 60 * 1000)
+      } else {
+        return sourceTime
+      }
+    },
+    getTimezontDateRange: function (offset = -1) {
+      return [
+        new Date(new Date(this.computeTimezone(new Date().getTime())).setHours(new Date(this.computeTimezone(new Date().getTime())).getHours() + offset)),
+        new Date(this.computeTimezone(new Date().getTime()))
+      ]
+    },
+    getNewTime (time, num) {
+      const date = new Date(time)
+      const newDate = new Date(parseInt(date.getTime(), 10) + num)
+      return this.timeFormate(newDate, localStorage.getItem('nz-default-dateFormat') ? localStorage.getItem('nz-default-dateFormat') : 'YYYY-MM-DD HH:mm:ss')
+    },
+    getOffsetTimezoneData (offset = 0) {
+      return new Date(this.computeTimezone(new Date().getTime())).setHours(new Date(this.computeTimezone(new Date().getTime())).getHours() + offset)
+    },
+    debounce (fn, delay) {
+      // 记录上一次的延时器
+      let timer = null
+      delay = delay || 200
+      return function () {
+        const args = arguments
+        const that = this
+        // 清除上一次延时器
+        clearTimeout(timer)
+        timer = setTimeout(function () {
+          fn.apply(that, args)
+        }, delay)
+      }
+    },
+    UTCTimeToConfigTimezone (utcTime) {
+      let offset = localStorage.getItem('nz-sys-timezone')
+      offset = moment.tz(offset).format('Z')
+      Eif (offset && offset !== 'undefined') {
+        let time = utcTime
+        if (typeof time === 'string' && /(\d+?-){2}\d+?\s(\d+?:)*\d+/.test(time)) {
+          time = new Date(time).getTime()
+        }
+        offset = Number.parseInt(offset)
+        time += offset * 60 * 60 * 1000
+        return time
+      } else {
+        return utcTime
+      }
+    },
+    configTimezoneToUTCTime: function (configTime) {
+      let offset = localStorage.getItem('nz-sys-timezone')
+      offset = moment.tz(offset).format('Z')
+      Eif (offset && offset !== 'undefined') {
+        let time = configTime
+        if (typeof time === 'string' && /(\d+?-){2}\d+?\s(\d+?:)*\d+/.test(time)) {
+          time = new Date(time).getTime()
+        }
+        offset = Number.parseInt(offset)
+        time -= offset * 60 * 60 * 1000
+        return time
+      } else {
+        return configTime
+      }
+    },
+    countDecimals (value) {
+      if ((value || value === 0) && Math.floor(value) !== value) {
+        const arr = value.toString().split('.')
+        if (Math.abs(arr[0] > 0) || arr.length < 2) {
+          return 2
+        }
+        const dot = arr[1].split('0').length + 1
+        return dot || 2
+      }
+      return 2
+    }
+  },
+  created () {
+    this.getDefaultDate()
+  },
+  computed: {
+    /*
+    isAdmin() {
+      return this.role === Cookies.get('owl_role');
+    },
+    */
+  }
+})
+ 
+ +
+
+ + + + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/libs/index.html b/nezha-fronted/test/unit/coverage/lcov-report/libs/index.html new file mode 100644 index 000000000..1f2f3ab74 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/libs/index.html @@ -0,0 +1,110 @@ + + + + + + Code coverage report for libs + + + + + + + + +
+
+

All files libs

+
+ +
+ 33.71% + Statements + 59/175 +
+ + +
+ 23.42% + Branches + 26/111 +
+ + +
+ 20% + Functions + 3/15 +
+ + +
+ 33.91% + Lines + 59/174 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
bus.js +
+
33.71%59/17523.42%26/11120%3/1533.91%59/174
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/nezha-fronted/test/unit/coverage/lcov-report/prettify.css b/nezha-fronted/test/unit/coverage/lcov-report/prettify.css new file mode 100644 index 000000000..b317a7cda --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/nezha-fronted/test/unit/coverage/lcov-report/prettify.js b/nezha-fronted/test/unit/coverage/lcov-report/prettify.js new file mode 100644 index 000000000..b3225238f --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/prettify.js @@ -0,0 +1,2 @@ +/* eslint-disable */ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/nezha-fronted/test/unit/coverage/lcov-report/sort-arrow-sprite.png b/nezha-fronted/test/unit/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 000000000..03f704a60 Binary files /dev/null and b/nezha-fronted/test/unit/coverage/lcov-report/sort-arrow-sprite.png differ diff --git a/nezha-fronted/test/unit/coverage/lcov-report/sorter.js b/nezha-fronted/test/unit/coverage/lcov-report/sorter.js new file mode 100644 index 000000000..16de10c43 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov-report/sorter.js @@ -0,0 +1,170 @@ +/* eslint-disable */ +var addSorting = (function() { + 'use strict'; + var cols, + currentSort = { + index: 0, + desc: false + }; + + // returns the summary table element + function getTable() { + return document.querySelector('.coverage-summary'); + } + // returns the thead element of the summary table + function getTableHeader() { + return getTable().querySelector('thead tr'); + } + // returns the tbody element of the summary table + function getTableBody() { + return getTable().querySelector('tbody'); + } + // returns the th element for nth column + function getNthColumn(n) { + return getTableHeader().querySelectorAll('th')[n]; + } + + // loads all columns + function loadColumns() { + var colNodes = getTableHeader().querySelectorAll('th'), + colNode, + cols = [], + col, + i; + + for (i = 0; i < colNodes.length; i += 1) { + colNode = colNodes[i]; + col = { + key: colNode.getAttribute('data-col'), + sortable: !colNode.getAttribute('data-nosort'), + type: colNode.getAttribute('data-type') || 'string' + }; + cols.push(col); + if (col.sortable) { + col.defaultDescSort = col.type === 'number'; + colNode.innerHTML = + colNode.innerHTML + ''; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function(a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function(a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc + ? ' sorted-desc' + : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function() { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i = 0; i < cols.length; i += 1) { + if (cols[i].sortable) { + // add the click event handler on the th so users + // dont have to click on those tiny arrows + el = getNthColumn(i).querySelector('.sorter').parentElement; + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function() { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/nezha-fronted/test/unit/coverage/lcov.info b/nezha-fronted/test/unit/coverage/lcov.info new file mode 100644 index 000000000..3669d2ea5 --- /dev/null +++ b/nezha-fronted/test/unit/coverage/lcov.info @@ -0,0 +1,450 @@ +TN: +SF:C:\Users\蟹Bro\Desktop\pro\nezha-fronted\nezha-fronted\src\components\common\js\example.js +FN:2,dealLegendAlias +FN:4,(anonymous_1) +FNF:2 +FNH:2 +FNDA:5,dealLegendAlias +FNDA:4,(anonymous_1) +DA:3,5 +DA:4,3 +DA:5,4 +DA:9,4 +DA:10,4 +DA:11,4 +DA:12,3 +DA:13,3 +DA:15,4 +DA:17,3 +DA:19,2 +DA:20,1 +DA:24,1 +LF:13 +LH:13 +BRDA:3,0,0,3 +BRDA:3,0,1,2 +BRDA:11,1,0,3 +BRDA:11,1,1,1 +BRDA:15,2,0,4 +BRDA:15,2,1,1 +BRDA:19,3,0,1 +BRDA:19,3,1,1 +BRF:8 +BRH:8 +end_of_record +TN: +SF:C:\Users\蟹Bro\Desktop\pro\nezha-fronted\nezha-fronted\src\components\common\mixin\mainMixinFun.js +FN:6,(anonymous_0) +FN:11,(anonymous_1) +FN:21,(anonymous_2) +FN:26,(anonymous_3) +FNF:4 +FNH:4 +FNDA:2,(anonymous_0) +FNDA:3,(anonymous_1) +FNDA:5,(anonymous_2) +FNDA:3,(anonymous_3) +DA:7,2 +DA:8,2 +DA:12,3 +DA:13,2 +DA:15,3 +DA:16,3 +DA:18,0 +DA:22,5 +DA:23,5 +DA:27,3 +DA:28,2 +DA:30,3 +DA:31,3 +DA:35,1 +DA:38,2 +DA:41,4 +DA:42,4 +DA:43,2 +DA:44,2 +DA:45,2 +DA:47,2 +DA:48,0 +DA:49,0 +DA:50,0 +DA:53,2 +DA:54,0 +DA:55,0 +DA:56,0 +DA:57,0 +DA:61,2 +DA:64,2 +DA:67,3 +DA:70,2 +DA:71,1 +DA:72,1 +DA:73,1 +DA:74,1 +DA:75,1 +DA:76,1 +DA:77,1 +DA:79,1 +DA:80,1 +DA:81,1 +DA:82,1 +DA:83,1 +LF:45 +LH:37 +BRDA:7,0,0,2 +BRDA:7,0,1,0 +BRDA:12,1,0,2 +BRDA:12,1,1,1 +BRDA:13,2,0,2 +BRDA:13,2,1,2 +BRDA:15,3,0,3 +BRDA:15,3,1,0 +BRDA:22,4,0,5 +BRDA:22,4,1,0 +BRDA:27,5,0,2 +BRDA:27,5,1,1 +BRDA:28,6,0,2 +BRDA:28,6,1,2 +BRDA:30,7,0,3 +BRDA:30,7,1,0 +BRDA:41,8,0,4 +BRDA:41,8,1,0 +BRDA:42,9,0,2 +BRDA:42,9,1,2 +BRDA:42,10,0,4 +BRDA:42,10,1,4 +BRDA:47,11,0,0 +BRDA:47,11,1,2 +BRDA:53,12,0,0 +BRDA:53,12,1,2 +BRDA:54,13,0,0 +BRDA:54,13,1,0 +BRDA:70,14,0,1 +BRDA:70,14,1,1 +BRF:30 +BRH:21 +end_of_record +TN: +SF:C:\Users\蟹Bro\Desktop\pro\nezha-fronted\nezha-fronted\src\libs\bus.js +FN:3,(anonymous_0) +FN:8,(anonymous_1) +FN:149,(anonymous_2) +FN:156,(anonymous_3) +FN:160,(anonymous_4) +FN:165,(anonymous_5) +FN:170,(anonymous_6) +FN:178,(anonymous_7) +FN:181,(anonymous_8) +FN:193,(anonymous_9) +FN:207,(anonymous_10) +FN:220,(anonymous_11) +FN:238,(anonymous_12) +FN:243,(anonymous_13) +FN:263,(anonymous_14) +FNF:15 +FNH:3 +FNDA:2,(anonymous_0) +FNDA:2,(anonymous_1) +FNDA:0,(anonymous_2) +FNDA:0,(anonymous_3) +FNDA:0,(anonymous_4) +FNDA:0,(anonymous_5) +FNDA:0,(anonymous_6) +FNDA:0,(anonymous_7) +FNDA:0,(anonymous_8) +FNDA:0,(anonymous_9) +FNDA:0,(anonymous_10) +FNDA:0,(anonymous_11) +FNDA:0,(anonymous_12) +FNDA:0,(anonymous_13) +FNDA:5,(anonymous_14) +DA:3,2 +DA:4,2 +DA:5,2 +DA:6,2 +DA:8,2 +DA:9,2 +DA:10,2 +DA:11,2 +DA:16,2 +DA:36,2 +DA:37,2 +DA:38,2 +DA:39,2 +DA:42,2 +DA:43,2 +DA:44,2 +DA:47,0 +DA:48,0 +DA:49,0 +DA:53,4 +DA:54,4 +DA:55,4 +DA:58,0 +DA:59,0 +DA:60,0 +DA:61,0 +DA:62,0 +DA:63,0 +DA:64,0 +DA:66,0 +DA:69,12 +DA:70,12 +DA:71,10 +DA:73,2 +DA:75,12 +DA:76,12 +DA:79,0 +DA:80,0 +DA:81,0 +DA:83,0 +DA:87,4 +DA:88,4 +DA:89,4 +DA:90,4 +DA:91,4 +DA:92,4 +DA:93,4 +DA:94,4 +DA:95,1 +DA:96,3 +DA:97,1 +DA:98,2 +DA:99,1 +DA:101,1 +DA:103,4 +DA:106,0 +DA:107,0 +DA:109,0 +DA:110,0 +DA:112,0 +DA:115,0 +DA:116,0 +DA:117,0 +DA:118,0 +DA:120,0 +DA:124,0 +DA:125,0 +DA:126,0 +DA:127,0 +DA:128,0 +DA:129,0 +DA:130,0 +DA:131,0 +DA:132,0 +DA:133,0 +DA:134,0 +DA:136,0 +DA:138,0 +DA:140,0 +DA:142,0 +DA:144,0 +DA:147,0 +DA:148,0 +DA:149,0 +DA:150,0 +DA:153,0 +DA:154,0 +DA:155,0 +DA:156,0 +DA:157,0 +DA:159,0 +DA:160,0 +DA:161,0 +DA:163,0 +DA:164,0 +DA:165,0 +DA:166,0 +DA:168,0 +DA:169,0 +DA:170,0 +DA:171,0 +DA:173,0 +DA:174,0 +DA:175,0 +DA:176,0 +DA:177,0 +DA:178,0 +DA:179,0 +DA:181,0 +DA:182,0 +DA:184,0 +DA:185,0 +DA:186,0 +DA:189,0 +DA:190,0 +DA:194,0 +DA:195,0 +DA:196,0 +DA:197,0 +DA:198,0 +DA:199,0 +DA:200,0 +DA:201,0 +DA:203,0 +DA:208,0 +DA:209,0 +DA:210,0 +DA:211,0 +DA:212,0 +DA:213,0 +DA:214,0 +DA:215,0 +DA:217,0 +DA:221,0 +DA:227,0 +DA:228,0 +DA:229,0 +DA:232,0 +DA:236,0 +DA:237,0 +DA:238,0 +DA:239,0 +DA:240,0 +DA:242,0 +DA:243,0 +DA:244,0 +DA:249,5 +DA:250,5 +DA:251,5 +DA:252,5 +DA:253,5 +DA:254,3 +DA:256,5 +DA:257,5 +DA:258,5 +DA:260,0 +DA:264,5 +DA:265,5 +DA:266,5 +DA:267,5 +DA:268,5 +DA:269,3 +DA:271,5 +DA:272,5 +DA:273,5 +DA:275,0 +DA:279,0 +DA:280,0 +DA:281,0 +DA:282,0 +DA:284,0 +DA:285,0 +DA:287,0 +DA:291,2 +LF:174 +LH:59 +BRDA:42,0,0,0 +BRDA:42,0,1,2 +BRDA:43,1,0,0 +BRDA:43,1,1,2 +BRDA:60,2,0,0 +BRDA:60,2,1,0 +BRDA:62,3,0,0 +BRDA:62,3,1,0 +BRDA:63,4,0,0 +BRDA:63,4,1,0 +BRDA:68,5,0,2 +BRDA:68,6,0,0 +BRDA:68,6,1,2 +BRDA:70,7,0,10 +BRDA:70,7,1,2 +BRDA:78,8,0,0 +BRDA:78,9,0,0 +BRDA:78,9,1,0 +BRDA:79,10,0,0 +BRDA:79,10,1,0 +BRDA:94,11,0,1 +BRDA:94,11,1,3 +BRDA:96,12,0,1 +BRDA:96,12,1,2 +BRDA:98,13,0,1 +BRDA:98,13,1,1 +BRDA:106,14,0,0 +BRDA:106,14,1,0 +BRDA:115,15,0,0 +BRDA:115,15,1,0 +BRDA:117,16,0,0 +BRDA:117,16,1,0 +BRDA:124,17,0,0 +BRDA:124,17,1,0 +BRDA:126,18,0,0 +BRDA:126,18,1,0 +BRDA:128,19,0,0 +BRDA:128,19,1,0 +BRDA:130,20,0,0 +BRDA:130,20,1,0 +BRDA:132,21,0,0 +BRDA:132,21,1,0 +BRDA:148,22,0,0 +BRDA:148,22,1,0 +BRDA:154,23,0,0 +BRDA:154,23,1,0 +BRDA:155,24,0,0 +BRDA:155,24,1,0 +BRDA:157,25,0,0 +BRDA:157,25,1,0 +BRDA:159,26,0,0 +BRDA:159,26,1,0 +BRDA:161,27,0,0 +BRDA:161,27,1,0 +BRDA:163,28,0,0 +BRDA:163,28,1,0 +BRDA:169,29,0,0 +BRDA:169,29,1,0 +BRDA:173,30,0,0 +BRDA:173,30,1,0 +BRDA:175,31,0,0 +BRDA:175,31,1,0 +BRDA:177,32,0,0 +BRDA:177,32,1,0 +BRDA:179,33,0,0 +BRDA:179,33,1,0 +BRDA:182,34,0,0 +BRDA:182,34,1,0 +BRDA:185,35,0,0 +BRDA:185,35,1,0 +BRDA:196,36,0,0 +BRDA:196,36,1,0 +BRDA:196,37,0,0 +BRDA:196,37,1,0 +BRDA:210,38,0,0 +BRDA:210,38,1,0 +BRDA:210,39,0,0 +BRDA:210,39,1,0 +BRDA:220,40,0,0 +BRDA:229,41,0,0 +BRDA:229,41,1,0 +BRDA:231,42,0,0 +BRDA:237,43,0,0 +BRDA:237,43,1,0 +BRDA:251,44,0,5 +BRDA:251,44,1,0 +BRDA:251,45,0,5 +BRDA:251,45,1,5 +BRDA:253,46,0,3 +BRDA:253,46,1,2 +BRDA:253,47,0,5 +BRDA:253,47,1,3 +BRDA:266,48,0,5 +BRDA:266,48,1,0 +BRDA:266,49,0,5 +BRDA:266,49,1,5 +BRDA:268,50,0,3 +BRDA:268,50,1,2 +BRDA:268,51,0,5 +BRDA:268,51,1,3 +BRDA:279,52,0,0 +BRDA:279,52,1,0 +BRDA:279,53,0,0 +BRDA:279,53,1,0 +BRDA:279,53,2,0 +BRDA:281,54,0,0 +BRDA:281,54,1,0 +BRDA:281,55,0,0 +BRDA:281,55,1,0 +BRDA:285,56,0,0 +BRDA:285,56,1,0 +BRF:111 +BRH:26 +end_of_record diff --git a/nezha-fronted/test/unit/jest.conf.js b/nezha-fronted/test/unit/jest.conf.js new file mode 100644 index 000000000..3c3d0c999 --- /dev/null +++ b/nezha-fronted/test/unit/jest.conf.js @@ -0,0 +1,66 @@ +const path = require('path') + +module.exports = { + verbose: true, + // testURL: 'http://localhost/', + rootDir: path.resolve(__dirname, '../../'), + transform: { + '^.+\\.js$': '/node_modules/babel-jest', + '.*\\.(vue)$': '/node_modules/vue-jest' + }, + moduleFileExtensions: [ + 'js', + 'json', + 'vue' + ], + transformIgnorePatterns: ['/node_modules/(?!vue-awesome)', 'element-ui'], + moduleNameMapper: { // 处理引入报错的文件 将其改为引入空文件 或者自定义的 function + 'element-ui/*': '/test/unit/__mocks__/fileMock.js', + 'css/font/*': '/test/unit/__mocks__/fileMock.js', + 'store/*': '/test/unit/__mocks__/fileMock.js', + 'elSelect/MyElSelect': '/test/unit/__mocks__/fileMock.js', + '/chartList': '/test/unit/__mocks__/fileMock.js', + '/myDatePicker': '/test/unit/__mocks__/fileMock.js', + '/promqlInput': '/test/unit/__mocks__/fileMock.js', + 'v-selectpage/': '/test/unit/__mocks__/fileMock.js', + '@topology/': '/test/unit/__mocks__/fileMock.js', + '/diagram': '/test/unit/__mocks__/fileMock.js', + '/topology': '/test/unit/__mocks__/fileMock.js', + '@svgdotjs': '/test/unit/__mocks__/fileMock.js', + '@interactjs': '/test/unit/__mocks__/fileMock.js', + 'pl-table': '/test/unit/__mocks__/fileMock.js', + '/htmlToPdf': '/test/unit/__mocks__/fileMock.js', + '\/*\/http': '/test/unit/__mocks__/axios.js', + // '\/*\/permission': '/test/unit/__mocks__/fileMock.js', + '/i18n': '/test/unit/__mocks__/i18nMock.js', + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/test/unit/__mocks__/fileMock.js', // 模拟加载静态文件 + '\\.(css|less|scss|sass)$': '/test/unit/__mocks__/styleMock.js', // 模拟加载样式文件 + '\\.(css|less|scss|sass|style)$': 'jest-css-modules', + '^@\/(.*?\.?(js|vue)?|)$': '/src/$1' // @路径转换,例如:@/components/Main.vue -> rootDir/src/components/Main.vue + }, + testMatch: [ // 匹配测试用例的文件 + '/test/unit/specs/*.spec.js', + '/test/unit/specs/lib/*.spec.js', + '/test/unit/specs/components/*.spec.js' + ], + moduleDirectories: [ + 'node_modules' + ], + // testPathIgnorePatterns: [ + // '/test/e2e' + // ], + setupFiles: ['/test/unit/jest.setup'], + // snapshotSerializers: ['/node_modules/jest-serializer-vue'], + coverageDirectory: '/test/unit/coverage', // 覆盖率报告的目录 + collectCoverageFrom: [ // 测试报告想要覆盖那些文件,目录,前面加!是避开这些文件 + // 'test/unit/specs/*.(js)', + 'src/components/common/js/example.js', + 'src/libs/bus.js', + 'src/components/common/mixin/*.js', + // 'src/components/common/js/tools.js', + // '!src/*.(js)', + '!src/http.js', + '!src/router/index.js', + '!**/node_modules/**' + ] +} diff --git a/nezha-fronted/test/unit/jest.setup.js b/nezha-fronted/test/unit/jest.setup.js new file mode 100644 index 000000000..a0d53840a --- /dev/null +++ b/nezha-fronted/test/unit/jest.setup.js @@ -0,0 +1,7 @@ +jest.mock('request', () => { + return { + addEventListener: jest.fn(), + requestPermissions: jest.fn(() => Promise.resolve()), + getInitialNotification: jest.fn(() => Promise.resolve()), + }; +}); diff --git a/nezha-fronted/test/unit/specs/example.spec.js b/nezha-fronted/test/unit/specs/example.spec.js new file mode 100644 index 000000000..6f22565da --- /dev/null +++ b/nezha-fronted/test/unit/specs/example.spec.js @@ -0,0 +1,23 @@ +import { dealLegendAlias } from '@/components/common/js/example' + +describe('别名替换函数', () => { + // 测试代码可读性最好 + // 分组 + const str = 'node_load1{module="node-exporter",endpoint_id="69",project="Common",datacenter="xin_xi_gang_DC",asset_id="11",endpoint="node-exporter-192.168.44.18",module_id="165",nz_agent_id="75",project_id="17",olap="node_exporter_nacos",asset="Bifang-CM-Server2",datacenter_id="4"} ' + it('正常替换一个', () => { + expect(dealLegendAlias(str, '{{module}}')).toBe('node-exporter') + }) + it('正常替换多个个', () => { + expect(dealLegendAlias(str, '{{module}}{{endpoint_id}}')).toBe('node-exporter69') + }) + it('匹配不到', () => { + expect(dealLegendAlias(str, '{{c}}')).toBe('') + }) + it('没有legend', () => { + expect(dealLegendAlias(str, '')).toBe(str) + }) + it('legend没有变量', () => { + expect(dealLegendAlias(str, 'c')).toBe('c') + }) +}) + diff --git a/nezha-fronted/test/unit/specs/lib/bus.spec.js b/nezha-fronted/test/unit/specs/lib/bus.spec.js new file mode 100644 index 000000000..4de511edb --- /dev/null +++ b/nezha-fronted/test/unit/specs/lib/bus.spec.js @@ -0,0 +1,38 @@ +// import { mount, createLocalVue } from '@vue/test-utils' +// import Vue from 'vue' +// import ElementUI from 'element-ui' + +import bus from '@/libs/bus' +import moment from 'moment-timezone' +// const localVue = createLocalVue() +// localVue.use(ElementUI) + +describe('bus时间函数', () => { + localStorage.setItem('nz-sys-timezone', 'America/Danmarkshavn') + // 测试代码可读性最好 + // 分组 + it('文字替换', function () { + // console.log(bus) + expect(bus.timeFormate('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00') + }) +}) +describe('bus getStep', () => { + // 测试代码可读性最好 + // 分组 + it('15s', function () { + // console.log(bus) + expect(bus.getStep('2022-04-15 15:16:00', '2022-04-15 16:16:00')).toBe('15s') + }) + it('5m', function () { + // console.log(bus) + expect(bus.getStep('2022-04-15 15:16:00', '2022-04-16 16:16:00')).toBe('5m') + }) + it('10m', function () { + // console.log(bus) + expect(bus.getStep('2022-04-15 15:16:00', '2022-04-23 16:16:00')).toBe('10m') + }) + it('30m', function () { + // console.log(bus) + expect(bus.getStep('2022-04-15 15:16:00', '2022-05-23 16:16:00')).toBe('30m') + }) +}) diff --git a/nezha-fronted/test/unit/specs/main.spec.js b/nezha-fronted/test/unit/specs/main.spec.js new file mode 100644 index 000000000..9ac86b305 --- /dev/null +++ b/nezha-fronted/test/unit/specs/main.spec.js @@ -0,0 +1,91 @@ +import mainMixin from '@/components/common/mixin/mainMixinFun' +import i18n from '@/components/common/i18n' +import moment from 'moment-timezone' +describe('时间函数', () => { + localStorage.setItem('nz-sys-timezone', 'America/Danmarkshavn') + it('utc时间转系统时间 返回时间戳', () => { + expect(mainMixin.methods.utcTimeToTimezone(1650006960000)).toBe(1650006960000) + }) + it('utc时间转系统时间 返回时间戳', () => { + expect(mainMixin.methods.utcTimeToTimezone('2022-04-15 15:16:00')).toBe(1650006960000) + }) + it('utc时间转系统时间 返回时间字符串', () => { + expect(mainMixin.methods.utcTimeToTimezoneStr(1650006960000)).toBe('2022-04-15 15:16:00') + }) + it('utc时间转系统时间 返回时间字符串', () => { + expect(mainMixin.methods.utcTimeToTimezoneStr('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00') + }) + it('utc时间转系统时间 返回时间字符串 指定时间格式', () => { + expect(mainMixin.methods.utcTimeToTimezoneStr('2022-04-15 15:16:00', 'DD/MM/YYYY')).toBe('15/04/2022') + }) + + it('系统时间转utc时间转 返回时间戳', () => { + expect(mainMixin.methods.timezoneToUtcTime(1650006960000)).toBe(1650006960000) + }) + it('系统时间转utc时间转 返回时间戳', () => { + expect(mainMixin.methods.timezoneToUtcTime('2022-04-15 15:16:00')).toBe(1650006960000) + }) + it('系统时间转utc时间转 返回时间字符串', () => { + expect(mainMixin.methods.timezoneToUtcTimeStr(1650006960000)).toBe('2022-04-15 15:16:00') + }) + it('系统时间转utc时间转 返回时间字符串', () => { + expect(mainMixin.methods.timezoneToUtcTimeStr('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00') + }) + it('系统时间转utc时间转 返回时间字符串 指定时间格式', () => { + expect(mainMixin.methods.timezoneToUtcTimeStr('2022-04-15 15:16:00', 'DD/MM/YYYY')).toBe('15/04/2022') + }) + it('使用bus提供的 时间函数', () => { + expect(mainMixin.methods.timeFormate('2022-04-15 15:16:00')).toBe('2022-04-15 15:16:00') + }) +}) +describe('是否含有指数', () => { + it('测试正常数字是否是指数显示', () => { + expect(mainMixin.methods.numberWithEConvent(10)).toBe(10) + }) + it('测试小数是否是指数显示', () => { + expect(mainMixin.methods.numberWithEConvent(0.1)).toBe(0.1) + }) + it('测试较小数字是否是指数显示', () => { + expect(mainMixin.methods.numberWithEConvent(1.0000000000000004e-8)).toBe(0) + }) + it('测试较大的数字是否是指数显示', () => { + expect(mainMixin.methods.numberWithEConvent(1e+23)).toBe(0) + }) +}) + +describe('是否含有Button的权限', () => { + const obj = { + $store: { + getters: { + buttonList: ['main_add'] + } + } + } + it('有', () => { + expect(mainMixin.methods.hasButton.bind(obj)('main_add')).toBeTruthy() + }) + it('无', () => { + expect(mainMixin.methods.hasButton.bind(obj)('main_qwe')).toBeFalsy() + }) +}) +describe('i18n的使用', () => { + it('正常使用 匹配英文', () => { + expect(mainMixin.methods.translation('overall.all')).toBe('All') + }) + it('正常使用 匹配中文', () => { + i18n.local = 'zh' + expect(mainMixin.methods.translation('overall.all')).toBe('全部') + }) + it('未匹配到', () => { + expect(mainMixin.methods.translation('overall.asd')).toBe('overall.asd') + }) +}) +describe('替换 moment 跟 elementui的时间格式', () => { + // timeFormatStrToDatePickFormat + it('正常替换', () => { + expect(mainMixin.methods.timeFormatStrToDatePickFormat('YYYY-DD-MM HH:mm:ss')).toBe('yyyy-dd-MM HH:mm:ss') + }) + it('不包含时分秒', () => { + expect(mainMixin.methods.timeFormatStrToDatePickFormat('YYYY-DD-MM HH:mm:ss', true)).toBe('yyyy-dd-MM ') + }) +})