diff --git a/babel.config.js b/babel.config.js index ba179669a..11a65b9fb 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,5 +1,8 @@ module.exports = { presets: [ '@vue/app' + ], + plugins: [ + '@babel/plugin-proposal-optional-chaining', ] } diff --git a/nginx.conf b/nginx.conf index 7e98037ce..f5164215f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,6 +1,16 @@ server { listen 80; + gzip on; + gzip_min_length 1k; + gzip_buffers 4 16k; + #gzip_http_version 1.0; + gzip_comp_level 8; + gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png; + gzip_vary off; + gzip_static on; + gzip_disable "MSIE [1-6]."; + location /ui/ { try_files $uri / /ui/index.html; alias /opt/lina/; diff --git a/package.json b/package.json index bd9f4695f..9d9b808c6 100644 --- a/package.json +++ b/package.json @@ -18,13 +18,15 @@ "vue-i18n-report": "vue-i18n-extract report -v './src/**/*.?(js|vue)' -l './src/i18n/langs/**/*.json'" }, "dependencies": { + "@babel/plugin-proposal-optional-chaining": "^7.13.12", "@ztree/ztree_v3": "3.5.44", - "axios": "0.18.1", + "axios": "0.21.1", "axios-retry": "^3.1.9", "deepmerge": "^4.2.2", "echarts": "^4.7.0", "element-ui": "2.13.2", "eslint-plugin-html": "^6.0.0", + "install": "^0.13.0", "jquery": "^3.5.0", "js-cookie": "2.2.0", "less": "^3.10.3", @@ -43,6 +45,7 @@ "lodash.values": "^4.3.0", "moment-parseformat": "^3.0.0", "normalize.css": "7.0.0", + "npm": "^7.8.0", "nprogress": "0.2.0", "path-to-regexp": "2.4.0", "vue": "2.6.10", @@ -73,6 +76,7 @@ "babel-eslint": "10.0.1", "babel-jest": "23.6.0", "chalk": "2.4.2", + "compression-webpack-plugin": "^6.1.1", "connect": "3.6.6", "element-theme-chalk": "^2.13.1", "eslint": "^5.15.3", diff --git a/src/components/DataForm/rules/index.js b/src/components/DataForm/rules/index.js index 83b98e649..57fc7a3fe 100644 --- a/src/components/DataForm/rules/index.js +++ b/src/components/DataForm/rules/index.js @@ -8,7 +8,14 @@ export const RequiredChange = { required: true, message: i18n.t('common.fieldRequiredError'), trigger: 'change' } +export const EmailCheck = { + type: 'email', + message: i18n.t('common.InputEmailAddress'), + trigger: ['blur', 'change'] +} + export default { Required, - RequiredChange + RequiredChange, + EmailCheck } diff --git a/src/components/DataTable/compenents/el-data-table/el-data-table.vue b/src/components/DataTable/compenents/el-data-table/el-data-table.vue index 0cbe9dbe3..5baa08a0e 100644 --- a/src/components/DataTable/compenents/el-data-table/el-data-table.vue +++ b/src/components/DataTable/compenents/el-data-table/el-data-table.vue @@ -723,6 +723,10 @@ export default { default(row, index) { return true } + }, + totalData: { + type: Array, + default: null } }, data() { @@ -828,6 +832,12 @@ export default { * @property {array} rows - 已选中的行数据的数组 */ this.$emit('selection-change', val) + }, + totalData(val) { + if (val) { + this.total = val.length + this.getList() + } } }, mounted() { @@ -877,12 +887,34 @@ export default { } return query }, + getList({ loading = true } = {}) { + const { url } = this + if (url) { + return this.getListFromRemote({ loading: loading }) + } + if (this.totalData) { + this.getListFromStaticData() + } + }, + getListFromStaticData() { + if (!this.hasPagination) { + this.data = this.totalData + return + } + // page + const pageOffset = this.firstPage - defaultFirstPage + const page = this.page === 0 ? 1 : this.page + const start = (page + pageOffset - 1) * this.size + const end = (page + pageOffset) * this.size + console.log(`page: ${page}, size: ${this.size}, start: ${start}, end: ${end}`) + this.data = this.totalData.slice(start, end) + }, /** * 手动刷新列表数据,选项的默认值为: { loading: true } * @public * @param {object} options 方法选项 */ - getList({ loading = true } = {}) { + getListFromRemote({ loading = true } = {}) { const { url } = this if (!url) { return diff --git a/src/components/DataTable/index.vue b/src/components/DataTable/index.vue index 82f570d43..a1c1de300 100644 --- a/src/components/DataTable/index.vue +++ b/src/components/DataTable/index.vue @@ -100,6 +100,9 @@ export default { iListeners() { return Object.assign({}, this.$listeners, this.tableConfig.listeners) }, + dataTable() { + return this.$refs.table + }, ...mapGetters({ 'globalTableConfig': 'tableConfig' }) diff --git a/src/components/Dialog/index.vue b/src/components/Dialog/index.vue index 73a967c27..1c569f19c 100644 --- a/src/components/Dialog/index.vue +++ b/src/components/Dialog/index.vue @@ -55,7 +55,6 @@ export default { }, data() { return { - } }, methods: { @@ -74,4 +73,8 @@ export default { /*padding-top: 10px;*/ } + .dialog-footer { + padding-right: 50px; + } + diff --git a/src/components/ListTable/TableAction/ImportDialog.vue b/src/components/ListTable/TableAction/ImportDialog.vue index 40dc5215a..e1d1f206b 100644 --- a/src/components/ListTable/TableAction/ImportDialog.vue +++ b/src/components/ListTable/TableAction/ImportDialog.vue @@ -1,64 +1,74 @@ + + diff --git a/src/components/ListTable/formatters/EditableInputFormatter.vue b/src/components/ListTable/formatters/EditableInputFormatter.vue new file mode 100644 index 000000000..26670874c --- /dev/null +++ b/src/components/ListTable/formatters/EditableInputFormatter.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/components/ListTable/formatters/StatusFormatter.vue b/src/components/ListTable/formatters/StatusFormatter.vue new file mode 100644 index 000000000..9e7d96bed --- /dev/null +++ b/src/components/ListTable/formatters/StatusFormatter.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/components/ListTable/formatters/index.js b/src/components/ListTable/formatters/index.js index b6ca12fa8..44193de8b 100644 --- a/src/components/ListTable/formatters/index.js +++ b/src/components/ListTable/formatters/index.js @@ -10,6 +10,8 @@ import SystemUserFormatter from './GrantedSystemUsersShowFormatter' import ShowKeyFormatter from '@/components/ListTable/formatters/ShowKeyFormatter' import DialogDetailFormatter from './DialogDetailFormatter' import LoadingActionsFormatter from './LoadingActionsFormatter' +import EditableInputFormatter from './EditableInputFormatter' +import StatusFormatter from './StatusFormatter' export default { DetailFormatter, @@ -23,7 +25,9 @@ export default { ShowKeyFormatter, DialogDetailFormatter, LoadingActionsFormatter, - ArrayFormatter + ArrayFormatter, + EditableInputFormatter, + StatusFormatter } export { @@ -38,5 +42,7 @@ export { ShowKeyFormatter, DialogDetailFormatter, LoadingActionsFormatter, - ArrayFormatter + ArrayFormatter, + EditableInputFormatter, + StatusFormatter } diff --git a/src/components/ListTable/index.vue b/src/components/ListTable/index.vue index bfca6573d..de025d6d5 100644 --- a/src/components/ListTable/index.vue +++ b/src/components/ListTable/index.vue @@ -45,17 +45,6 @@ export default { dataTable() { return this.$refs.dataTable.$refs.dataTable }, - // hasCreateAction() { - // const hasLeftAction = this.headerActions.hasLeftActions - // if (hasLeftAction === false) { - // return false - // } - // const hasCreate = this.headerActions.hasCreate - // if (hasCreate === false) { - // return false - // } - // return true - // }, iTableConfig() { const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery }) this.$log.debug('Header actions', this.headerActions) diff --git a/src/i18n/langs/cn.json b/src/i18n/langs/cn.json index d4b4dc8ce..136894bf0 100644 --- a/src/i18n/langs/cn.json +++ b/src/i18n/langs/cn.json @@ -179,7 +179,7 @@ "TestAssetsConnective": "测试资产可连接性", "TestConnection": "测试连接", "Type": "类型", - "UnselectedAssets": "未选择资产", + "UnselectedAssets": "未选择资产或所选择的资产不支持SSH协议连接", "UnselectedNodes": "未选择节点", "UpdateAssetUserToken": "更新资产用户认证信息", "Username": "用户名", @@ -258,6 +258,10 @@ "EnterForSearch": "按回车进行搜索", "Export": "导出", "Import": "导入", + "ContinueImport": "继续导入", + "Continue": "继续", + "Stop": "停止", + "Finished": "完成", "Refresh": "刷新", "Info": "提示", "MFAConfirm": "MFA 认证", @@ -320,16 +324,25 @@ "fieldRequiredError": "这个字段是必填项", "getErrorMsg": "获取失败", "MFAErrorMsg": "MFA错误,请检查", + "Total": "总共", + "Success": "成功", + "Failed": "失败", + "Pending": "等待", + "Status": "状态", + "InputEmailAddress": "请输入正确的邮箱地址", "imExport": { "ExportAll": "导出所有", "ExportOnlyFiltered": "仅导出搜索结果", "ExportOnlySelectedItems": "仅导出选择项", "ExportRange": "导出范围", "createSuccessMsg": "导入创建成功,总共:{count}", - "downloadImportTemplateMsg": "下载导入模板", + "downloadImportTemplateMsg": "下载创建模板", "downloadUpdateTemplateMsg": "下载更新模板", "onlyCSVFilesTips": "仅支持csv文件导入", - "updateSuccessMsg": "导入更新成功,总共:{count}" + "updateSuccessMsg": "导入更新成功,总共:{count}", + "uploadCsvLth10MHelpText": "只能上传 csv/xlsx, 且不超过 10m", + "dragUploadFileInfo": "将文件拖到此处,或点击上传", + "hasImportErrorItemMsg": "存在导入失败项,点击表格编辑后,可以继续导入失败项" }, "fileType": "文件类型", "isValid": "有效", diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 7a2d51f96..dc1b66371 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -178,7 +178,7 @@ "TestAssetsConnective": "Test assets connective", "TestConnection": "Test connection", "Type": "Type", - "UnselectedAssets": "Unselected assets", + "UnselectedAssets": "No asset selected or the selected asset does not support SSH protocol connection", "UnselectedNodes": "Unselected nodes", "UpdateAssetUserToken": "Update asset user auth", "Username": "Username", @@ -257,6 +257,10 @@ "EnterForSearch": "Press enter to search", "Export": "Export", "Import": "Import", + "ContinueImport": "ContinueImport", + "Continue": "Continue", + "Stop": "Stop", + "Finished": "Finished", "Refresh": "Refresh", "Info": "Info", "MFAConfirm": "MFA Confirm", @@ -277,6 +281,7 @@ "Reset": "Reset", "Search": "Search", "MFAErrorMsg": "MFA Error,please check", + "InputEmailAddress": "Please enter your email address", "Select": "Select", "SelectFile": "Select file", "Show": "Show", @@ -318,6 +323,11 @@ "fieldRequiredError": "This field is required", "getErrorMsg": "Get failed", "fileType": "File type", + "Status": "Status", + "Total": "Total", + "Success": "Success", + "Failed": "Failed", + "Pending": "Pending", "imExport": { "ExportAll": "Export all", "ExportOnlyFiltered": "Export only filtered", @@ -327,7 +337,10 @@ "downloadImportTemplateMsg": "Download import template", "downloadUpdateTemplateMsg": "Download update template", "onlyCSVFilesTips": "Only csv supported", - "updateSuccessMsg": "Update success, total: {count}" + "updateSuccessMsg": "Update success, total: {count}", + "dragUploadFileInfo": "Drag file here or click to upload", + "uploadCsvLth10MHelpText": "csv/xlsx files with a size less than 10m", + "hasImportErrorItemMsg": "Has import failed item, click to edit it and continue upload" }, "isValid": "Is valid", "nav": { diff --git a/src/layout/components/Page/index.vue b/src/layout/components/Page/index.vue index 120229ae2..fdd08b332 100644 --- a/src/layout/components/Page/index.vue +++ b/src/layout/components/Page/index.vue @@ -1,6 +1,6 @@