diff --git a/web/src/js/component/table/index.js b/web/src/js/component/table/index.js index 350c6b1a73..5def7449c0 100644 --- a/web/src/js/component/table/index.js +++ b/web/src/js/component/table/index.js @@ -15,7 +15,7 @@ * */ -import WeTable from './table.vue'; +import WeTable from './resultTable/table.vue'; import historyTable from './historyTable/historyTable.vue'; export default { WeTable, diff --git a/web/src/js/component/table/resultTable/body.vue b/web/src/js/component/table/resultTable/body.vue new file mode 100644 index 0000000000..502a4aa3f2 --- /dev/null +++ b/web/src/js/component/table/resultTable/body.vue @@ -0,0 +1,285 @@ + + + diff --git a/web/src/js/component/table/resultTable/header.vue b/web/src/js/component/table/resultTable/header.vue new file mode 100644 index 0000000000..f8bfc2fec5 --- /dev/null +++ b/web/src/js/component/table/resultTable/header.vue @@ -0,0 +1,128 @@ + + diff --git a/web/src/js/component/table/resultTable/list.vue b/web/src/js/component/table/resultTable/list.vue new file mode 100644 index 0000000000..aab7cf4e1e --- /dev/null +++ b/web/src/js/component/table/resultTable/list.vue @@ -0,0 +1,102 @@ + + diff --git a/web/src/js/component/table/resultTable/table.vue b/web/src/js/component/table/resultTable/table.vue new file mode 100644 index 0000000000..faa5693b04 --- /dev/null +++ b/web/src/js/component/table/resultTable/table.vue @@ -0,0 +1,188 @@ + + + + diff --git a/web/src/js/module/hiveSidebar/hiveSidebar.vue b/web/src/js/module/hiveSidebar/hiveSidebar.vue index 4479c4d27b..2edfe52691 100644 --- a/web/src/js/module/hiveSidebar/hiveSidebar.vue +++ b/web/src/js/module/hiveSidebar/hiveSidebar.vue @@ -307,8 +307,8 @@ export default { this.dispatch('Workbench:pasteInEditor', value, this.node); }, queryTable() { - const tabName = `${this.currentAcitved.dbName}.${this.currentAcitved.name}`; - const code = `select * from ${tabName} limit 100`; + const tabName = `${this.currentAcitved.dbName}_${this.currentAcitved.name}`; + const code = `select * from ${this.currentAcitved.dbName}.${this.currentAcitved.name} limit 100`; const filename = `${tabName}_select.hql`; const md5Path = util.md5(filename); this.dispatch('Workbench:add', { diff --git a/web/src/js/module/process/module.vue b/web/src/js/module/process/module.vue index 5b734c3bbd..06846caa42 100644 --- a/web/src/js/module/process/module.vue +++ b/web/src/js/module/process/module.vue @@ -797,7 +797,7 @@ export default { 'msgName': '', 'queryFrequency': 10, 'maxReceiveHours': 12, - 'msgSavekey': '', + 'msgSavekey': 'msg.body', 'onlyReceiveToday': 'true', }, }); @@ -1635,7 +1635,7 @@ export default { const fileName = `${time.getTime()}${match.ext}`; const params = { fileName, - scriptContent: rst.fileContent, + scriptContent: rst.fileContent[0][0], metadata: rst.params, }; api.fetch('/filesystem/saveScriptToBML', params, 'post') diff --git a/web/src/js/module/workbench/container.vue b/web/src/js/module/workbench/container.vue index 64c7dd8e2f..68773e0067 100644 --- a/web/src/js/module/workbench/container.vue +++ b/web/src/js/module/workbench/container.vue @@ -441,13 +441,13 @@ export default { api.fetch('/filesystem/openFile', { path: option.path, }, 'get').then((rst) => { - const ismodifyByOldTab = option.code && !rst.fileContent; + const ismodifyByOldTab = option.code && !rst.fileContent[0][0]; const params = ismodifyByOldTab ? option.params : this.convertSettingParams(rst.params); this[methodName]({ id: md5Path, filename: option.filename, filepath: option.path, - code: rst.fileContent || option.code, + code: rst.fileContent[0][0] || option.code, params, type: option.type, saveAs: option.saveAs || false, diff --git a/web/src/js/module/workbench/script/result.vue b/web/src/js/module/workbench/script/result.vue index 30c0458a87..b0b6842d10 100644 --- a/web/src/js/module/workbench/script/result.vue +++ b/web/src/js/module/workbench/script/result.vue @@ -36,6 +36,7 @@ :height="tableData.height" :columns="data.headRows" :data="data.bodyRows" + @on-sort-change="sortChange" @on-current-change="onRowClick" class="result-normal-table"> @@ -58,7 +59,8 @@ @on-scroll="saveOffset" @dbl-click="copyLabel" @on-click="onWeTableRowClick" - @change-status="changeStatus"/> + @change-status="changeStatus" + @handleSortClick="handleSortClick"/> + v-html="result.bodyRows[0][0]"/> {{ $t('message.workBench.body.script.result.emptyText') }} @@ -111,6 +113,7 @@ import WeWaterMask from '@js/component/watermark'; import WeToolbar from './toolbar.vue'; import elementResizeEvent from '@js/helper/elementResizeEvent'; import resultSetList from './resultSetList.vue'; +import pinyin from 'pinyin'; export default { components: { WeTable: Table.WeTable, @@ -243,6 +246,146 @@ export default { 'Workbench:setParseAction'(id) { this.resize(); }, + handleSortClick(args) { + let { reverse,col, colIndex, cb } = args; + let order = 'normal'; + if (args.reverse === -1) { + order = 'desc' + } else if (args.reverse === 1) { + order = 'asc' + } + // 先通过表头的内容找到对应全数据数据的index + let sortIndex + this.data.headRows.map((head, index) => { + if (head.content === col.content) { + sortIndex = index + } + }) + // 大于50列排序现将要排序的列和原始index保持 + let sortColumnAll = this.originRows.map((row, index) => { + return { + originIndex: index, + value: row[sortIndex] + } + }) + // 将找出的列排序 + sortColumnAll = this.arraySortByName(sortColumnAll, col.columnType, 'value');// 从小到大 + let newRow = []; + if (order === 'asc') {// 升序 + sortColumnAll.map((item, index) => { + newRow[index] = this.originRows[item.originIndex]; + }) + this.originRows = newRow; + } else if (order === 'desc') {// 降序 + sortColumnAll.reverse(); + sortColumnAll.map((item, index) => { + newRow[index] = this.originRows[item.originIndex]; + }) + this.originRows = newRow; + } else if (order === 'normal') {// 恢复原来数据 + this.originRows = this.result.bodyRows || []; + this.data.originRows = this.originRows; + } + this.pageingData(); + }, + addCellClassName() { + // 需要将每一行中的NULL挑选出来 + if (this.tableData.type === 'normal') { + this.originRows = this.originRows.map((row) => { + row.cellClassName = {}; + Object.keys(row).forEach((key)=> { + if (row[key] === 'NULL') { + row.cellClassName[key] = 'is-null'; + } + }) + return row; + }) + } + }, + sortChange({column, key, order}) { + this.originRows = this.arraySortByName(this.originRows, column.columnType, key);// 从小到大 + if (order === 'asc') {// 升序 + this.addCellClassName(); + } else if (order === 'desc') {// 降序 + this.originRows.reverse(); + this.addCellClassName(); + } else if (order === 'normal') {// 恢复原来数据 + if (this.tableData.type === 'normal') { + this.originRows = this.result.bodyRows.map((row) => { + let newItem = {}; + const NullList = []; + row.forEach((item, index) => { + Object.assign(newItem, { + [this.result.headRows[index]]: item, + }); + if (item === 'NULL') { + NullList.push(this.result.headRows[index]); + } + }); + // 对于NULL值加上高亮样式 + if (NullList.length) { + newItem.cellClassName = {}; + NullList.forEach((item) => { + newItem.cellClassName[item] = 'is-null'; + }); + } + return newItem; + }); + } else { + this.originRows = this.result.bodyRows || []; + } + this.data.originRows = this.originRows; + } + this.pageingData(); + }, + arraySortByName(list, valueType, key) { + if (list === undefined || list === null) return []; + list.sort((a, b) => { + let strA = a[key]; + let strB = b[key]; + // 谁为非法值谁在前面 + if (strA === undefined || strA === null || strA === '' || strA === ' ' || strA === ' ' || strA === 'NULL') { + return -1; + } + if (strB === undefined || strB === null || strB === '' || strB === ' ' || strB === ' ' || strB === 'NULL') { + return 1; + } + // 如果为整数型大小 + if (['int', 'float', 'double', 'long', 'short', 'bigInt', 'decimal'].includes(valueType.toLowerCase())) { + + return strA - strB; + } + const charAry = strA.split(''); + for (const i in charAry) { + if ((this.charCompare(strA[i], strB[i]) !== 0)) { + return this.charCompare(strA[i], strB[i]); + } + } + // 如果通过上面的循环对比还比不出来,就无解了,直接返回-1 + return -1; + }); + return list; + }, + charCompare(charA, charB) { + // 谁为非法值谁在前面 + if (charA === undefined || charA === null || charA === '' || charA === ' ' || charA === ' ') { + return -1; + } + if (charB === undefined || charB === null || charB === '' || charB === ' ' || charB === ' ') { + return 1; + } + if (!this.notChinese(charA)) { + charA = pinyin(charA)[0][0]; + } + if (!this.notChinese(charB)) { + charB = pinyin(charB)[0][0]; + } + return charA.localeCompare(charB); + }, + notChinese(char) { + const charCode = char.charCodeAt(0); + return charCode >= 0 && charCode <= 128; + }, initOffset() { let cache = this.script.result.cache; let x = 0; @@ -279,6 +422,7 @@ export default { let headRows = this.result.headRows || []; this.data.headRows = []; this.data.bodyRows = []; + this.originRows = this.result.bodyRows || []; this.tableData.total = this.result.total; if (this.tableData.type === 'normal') { @@ -289,10 +433,7 @@ export default { this.data.headRows.push({ title, key: item, - sortable: 'true', - sortMethod: function(a, b, type) { - return util.sort(a, b, type); - }, + sortable: 'custom', columnType, renderHeader: (h, params) => { return h('span', { @@ -362,7 +503,7 @@ export default { this.data.bodyRows = newArr; } }, - change(page) { + change(page = 1) { this.hightLightRow = null; this.page.current = page; this.pageingData(); diff --git a/web/src/js/view/newhome/images/111.png b/web/src/js/view/newhome/images/111.png new file mode 100644 index 0000000000..0d0dc410e3 Binary files /dev/null and b/web/src/js/view/newhome/images/111.png differ diff --git a/web/src/js/view/newhome/images/333.png b/web/src/js/view/newhome/images/333.png new file mode 100644 index 0000000000..5f696746e0 Binary files /dev/null and b/web/src/js/view/newhome/images/333.png differ diff --git a/web/src/js/view/newhome/images/QR.jpg b/web/src/js/view/newhome/images/QR.jpg new file mode 100644 index 0000000000..f85da5edab Binary files /dev/null and b/web/src/js/view/newhome/images/QR.jpg differ diff --git a/web/src/js/view/newhome/images/desktop.ini b/web/src/js/view/newhome/images/desktop.ini new file mode 100644 index 0000000000..564c65794a --- /dev/null +++ b/web/src/js/view/newhome/images/desktop.ini @@ -0,0 +1,11 @@ +[LocalizedFileNames] +u620.png=@u620.png,0 +u501.png=@u501.png,0 +u504.png=@u504.png,0 +u509.png=@u509.png,0 +u513.png=@u513.png,0 +u517.png=@u517.png,0 +u82.svg=@u82.svg,0 +u476.png=@u476.png,0 +u619.png=@u619.png,0 +u621.png=@u621.png,0 diff --git a/web/src/js/view/newhome/images/edit1.png b/web/src/js/view/newhome/images/edit1.png new file mode 100644 index 0000000000..09c8c78ce6 Binary files /dev/null and b/web/src/js/view/newhome/images/edit1.png differ diff --git a/web/src/js/view/newhome/images/u1191.png b/web/src/js/view/newhome/images/u1191.png new file mode 100644 index 0000000000..e65a0f3425 Binary files /dev/null and b/web/src/js/view/newhome/images/u1191.png differ diff --git a/web/src/js/view/newhome/images/u1225.png b/web/src/js/view/newhome/images/u1225.png new file mode 100644 index 0000000000..47a86ba9df Binary files /dev/null and b/web/src/js/view/newhome/images/u1225.png differ diff --git a/web/src/js/view/newhome/images/u1226.png b/web/src/js/view/newhome/images/u1226.png new file mode 100644 index 0000000000..cd61e21058 Binary files /dev/null and b/web/src/js/view/newhome/images/u1226.png differ diff --git a/web/src/js/view/newhome/images/u1229.png b/web/src/js/view/newhome/images/u1229.png new file mode 100644 index 0000000000..11052cd14c Binary files /dev/null and b/web/src/js/view/newhome/images/u1229.png differ diff --git a/web/src/js/view/newhome/images/u476.png b/web/src/js/view/newhome/images/u476.png new file mode 100644 index 0000000000..106414b56f Binary files /dev/null and b/web/src/js/view/newhome/images/u476.png differ diff --git a/web/src/js/view/newhome/images/u501.png b/web/src/js/view/newhome/images/u501.png new file mode 100644 index 0000000000..9f0e0f2cc0 Binary files /dev/null and b/web/src/js/view/newhome/images/u501.png differ diff --git a/web/src/js/view/newhome/images/u504.png b/web/src/js/view/newhome/images/u504.png new file mode 100644 index 0000000000..59fd43ac27 Binary files /dev/null and b/web/src/js/view/newhome/images/u504.png differ diff --git a/web/src/js/view/newhome/images/u509.png b/web/src/js/view/newhome/images/u509.png new file mode 100644 index 0000000000..986e397194 Binary files /dev/null and b/web/src/js/view/newhome/images/u509.png differ diff --git a/web/src/js/view/newhome/images/u513.png b/web/src/js/view/newhome/images/u513.png new file mode 100644 index 0000000000..97905ddd3b Binary files /dev/null and b/web/src/js/view/newhome/images/u513.png differ diff --git a/web/src/js/view/newhome/images/u517.png b/web/src/js/view/newhome/images/u517.png new file mode 100644 index 0000000000..b39cd2120a Binary files /dev/null and b/web/src/js/view/newhome/images/u517.png differ diff --git a/web/src/js/view/newhome/images/u619.png b/web/src/js/view/newhome/images/u619.png new file mode 100644 index 0000000000..72022a302b Binary files /dev/null and b/web/src/js/view/newhome/images/u619.png differ diff --git a/web/src/js/view/newhome/images/u620.png b/web/src/js/view/newhome/images/u620.png new file mode 100644 index 0000000000..05c87dec57 Binary files /dev/null and b/web/src/js/view/newhome/images/u620.png differ diff --git a/web/src/js/view/newhome/images/u621.png b/web/src/js/view/newhome/images/u621.png new file mode 100644 index 0000000000..23932f13f6 Binary files /dev/null and b/web/src/js/view/newhome/images/u621.png differ diff --git a/web/src/js/view/newhome/images/u82.svg b/web/src/js/view/newhome/images/u82.svg new file mode 100644 index 0000000000..e67551d388 --- /dev/null +++ b/web/src/js/view/newhome/images/u82.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/web/src/js/view/newhome/index.vue b/web/src/js/view/newhome/index.vue new file mode 100644 index 0000000000..09d9d0d42e --- /dev/null +++ b/web/src/js/view/newhome/index.vue @@ -0,0 +1,3 @@ + diff --git a/web/src/js/view/newhome/module/caseAndIntroduction/index.js b/web/src/js/view/newhome/module/caseAndIntroduction/index.js new file mode 100644 index 0000000000..9ea52ad7e8 --- /dev/null +++ b/web/src/js/view/newhome/module/caseAndIntroduction/index.js @@ -0,0 +1,10 @@ +export default { + name: 'CaseAndIntroduction', + events: [], + dispatchs: { + }, + data: { + API_PATH: process.env.VUE_APP_MN_CONFIG_PREFIX || `http://${window.location.host}/api/rest_j/v1/`, + }, + component: () => import('./index.vue'), +}; \ No newline at end of file diff --git a/web/src/js/view/newhome/module/caseAndIntroduction/index.vue b/web/src/js/view/newhome/module/caseAndIntroduction/index.vue new file mode 100644 index 0000000000..6a84b08139 --- /dev/null +++ b/web/src/js/view/newhome/module/caseAndIntroduction/index.vue @@ -0,0 +1,227 @@ + + + + diff --git a/web/src/js/view/newhome/module/workspace/index.js b/web/src/js/view/newhome/module/workspace/index.js new file mode 100644 index 0000000000..01be3f4532 --- /dev/null +++ b/web/src/js/view/newhome/module/workspace/index.js @@ -0,0 +1,10 @@ +export default { + name: 'Workspace', + events: [], + dispatchs: { + }, + data: { + API_PATH: process.env.VUE_APP_MN_CONFIG_PREFIX || `http://${window.location.host}/api/rest_j/v1/`, + }, + component: () => import('./index.vue'), +}; \ No newline at end of file diff --git a/web/src/js/view/newhome/module/workspace/index.scss b/web/src/js/view/newhome/module/workspace/index.scss new file mode 100644 index 0000000000..9987fbef04 --- /dev/null +++ b/web/src/js/view/newhome/module/workspace/index.scss @@ -0,0 +1,147 @@ +@import '../../../assets/styles/variables.scss'; + +.page-bgc { + background-color: #f7f7f7; + background: #fff; + + .page-bgc-header { + padding: 10px 25px 0; + } + + .header-info { + padding: 10px 0 10px 20px; + + p { + line-height: 24px; + } + } + + .workspace-main { + padding: 10px 25px; + display: flex; + justify-content: flex-start; + align-items: flex-start; + + .left { + flex: 1; + box-shadow: 0 1px 6px rgba(0, 0, 0, .2); + border-color: #eee; + min-height: 500px; + + .workspace-type-header { + padding: 10px 20px 0; + line-height: 30px; + display: flex; + justify-content: flex-start; + align-items: center; + + .workspace-type-header-label { + font-size: 14px; + display: inline-block; + margin: 0 5px; + font-weight: 900; + } + } + + .workspace-create-search { + padding: 0 35px; + display: flex; + justify-content: flex-start; + align-items: center; + margin: 10px 0 50px 0; + + .workspace-create { + flex-basis: 200px; + display: flex; + justify-content: flex-start; + align-items: center; + padding: 15px 10px; + &:hover { + box-shadow: 0 2px 12px 0 rgba(0,0,0,.2); + border-radius: 4px; + } + .workspace-create-text { + margin-left: 10px; + cursor: pointer; + } + } + + .header-search { + flex: 50%; + } + } + + .item-header { + font-size: 14px; + margin: 20px 25px 10px 25px; + font-weight: bold; + padding-left: 5px; + border-left: 3px solid $primary-color; + } + + .workspace-content { + .content-item { + .workspace-item { + cursor: pointer; + height: 180px; + margin: 15px; + box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2); + background: #fff; + padding: 10px; + position: relative; + background: url("../../../assets/images/workspace.png") center center no-repeat; + background-size: cover; + min-width: 222px; + .name { + display: block; + font-size: 16px; + font-weight: 600; + color: white; + } + + .desc { + width: 100%; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + text-overflow: ellipsis; + word-break: break-all; + color: white; + } + + .lable-list { + position: absolute; + left: 10px; + bottom: 30px; + display: flex; + justify-content: flex-start; + align-items: flex-start; + width: 100%; + .item { + display: inline-block; + font-size: 10px; + padding: .3em .9em; + margin: 0 .5em .5em 0; + white-space: nowrap; + background-color: #f1f8ff; + border-radius: 3px; + color: #0366d6; + overflow: hidden; + text-overflow: ellipsis; + max-width: 31%; + } + } + + .editor { + position: absolute; + right: 10px; + bottom: 10px; + } + } + } + } + } + } + +} diff --git a/web/src/js/view/newhome/module/workspace/index.vue b/web/src/js/view/newhome/module/workspace/index.vue new file mode 100644 index 0000000000..953c1f68a4 --- /dev/null +++ b/web/src/js/view/newhome/module/workspace/index.vue @@ -0,0 +1,157 @@ + + + diff --git a/web/src/js/view/newhome/module/workspace/module/workspaceForm.vue b/web/src/js/view/newhome/module/workspace/module/workspaceForm.vue new file mode 100644 index 0000000000..e297a552ad --- /dev/null +++ b/web/src/js/view/newhome/module/workspace/module/workspaceForm.vue @@ -0,0 +1,168 @@ + + diff --git a/web/src/js/view/newhome/tips.md b/web/src/js/view/newhome/tips.md new file mode 100644 index 0000000000..99a8d98213 --- /dev/null +++ b/web/src/js/view/newhome/tips.md @@ -0,0 +1,12 @@ +#### 开发注意 + +1. 自定义首页就在idnex.vue文件下开发,需要的工作空间和案例、快速入门在./module下,需要自行调试哦!!! + +2. 新增其他页面在view下面新建文件夹,页面对应的路由在:src\js\service\router.js下自行配置 + +3. 开发过程中可以使用:src\js\component下的公共组件,尽量不要修改,造成不通用,也可以新增组件 + +4. 目前开源的还没工作空间概念,所以对应的接口服务还没有,需要后台上传对应服务代码 + +5. 开发过程有问题随时联系 ![扫码加入](images/QR.png) +