From 13fc7d163d0b21c400f096ce3a63420580b76f6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E7=9B=8A?= <326170945@qq.com>
Date: Thu, 12 May 2022 13:40:38 +0800
Subject: [PATCH 01/25] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=8F=9C=E5=8D=95?=
=?UTF-8?q?=E6=A0=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
main.js | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/main.js b/main.js
index f885e58..7c34841 100644
--- a/main.js
+++ b/main.js
@@ -2,17 +2,21 @@ const { app, BrowserWindow } = require('electron')
function createWindow () {
const win = new BrowserWindow({
+ autoHideMenuBar: true,
width: 1200,
- height: 880,
+ height: 900,
+ // show: false, //关闭窗口显示
webPreferences: {
nodeIntegration: true
}
})
win.loadFile('./renderer/index.html')
+ // win.maximize() //设置最大化
+ // win.show() //手动显示窗口
+
+ //打开调试窗口
+ // win.webContents.openDevTools()
}
app.whenReady().then(createWindow)
-
-
-
From b1456ac3a4b0df38b9b0a54d663ab4bd7d65a836 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E7=9B=8A?= <326170945@qq.com>
Date: Thu, 12 May 2022 13:40:50 +0800
Subject: [PATCH 02/25] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBoolean=E5=80=BC?=
=?UTF-8?q?=E6=97=A0=E6=B3=95=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
renderer/index.css | 88 +-
renderer/index.html | 957 +++++++++++-----------
renderer/index.js | 1860 ++++++++++++++++++++++---------------------
3 files changed, 1474 insertions(+), 1431 deletions(-)
diff --git a/renderer/index.css b/renderer/index.css
index 9d74d0b..92e6f9e 100644
--- a/renderer/index.css
+++ b/renderer/index.css
@@ -4,7 +4,7 @@ html, body, div {
padding: 0;
}
-.app{
+.app {
height: 100%;
}
@@ -13,11 +13,11 @@ html, body, div {
width: 600px;
}
-.linkBtn{
+.linkBtn {
width: 90%;
}
-.el-menu{
+.el-menu {
border: none;
margin-top: 20px;
width: 90%;
@@ -26,23 +26,26 @@ html, body, div {
.el-dialog {
z-index: 1000;
}
-.main{
+
+.main {
height: 100%;
}
-.mainContent{
+
+.mainContent {
height: 100%;
}
-.tablePage{
- height: 90%;
+.tablePage {
+ height: 95%;
}
-.mainTab{
+.mainTab {
width: 100%;
border: none;
box-shadow: none;
}
-.tableWrapper{
+
+.tableWrapper {
height: 100%;
}
@@ -63,18 +66,18 @@ html, body, div {
height: 35px !important;
}
-.linkformstyle{
+.linkformstyle {
margin: 0 10px;
}
-.icon{
+.icon {
height: 12px;
width: 12px;
position: relative;
top: 1px;
}
-.icon1{
+.icon1 {
height: 16px;
width: 16px;
position: relative;
@@ -83,14 +86,15 @@ html, body, div {
z-index: 111;
}
-.icon11{
+.icon11 {
height: 16px;
width: 16px;
position: relative;
bottom: 1px;
right: 8px;
}
-.icon111{
+
+.icon111 {
height: 16px;
width: 16px;
position: absolute;
@@ -98,72 +102,73 @@ html, body, div {
right: 8px;
}
-.switchBtn{
+.switchBtn {
position: relative;
bottom: 1px;
}
-.footTextWrapper{
+.footTextWrapper {
margin-left: 10px;
-
+
}
-.footText{
+.footText {
margin-left: 10px;
font-size: 13px;
color: #444;
}
-.iconWrapper{
+.iconWrapper {
display: inline;
margin-left: 50px;
}
-.iconWrapper2{
+.iconWrapper2 {
display: inline;
- position:absolute;
+ position: absolute;
right: 14px;
height: 100%;
}
-.iconWrapper3{
+
+.iconWrapper3 {
display: inline;
- position:absolute;
+ position: absolute;
right: 54px;
}
-.surperTables{
+.surperTables {
margin-left: 10px;
cursor: pointer;
}
-.paginationWrapper{
+.paginationWrapper {
margin-top: 20px;
display: flex;
justify-content: center;
}
-.menu{
+.menu {
overflow-y: auto;
height: 650px;
}
-.greyText{
+.greyText {
color: #606266;
}
-.checkboxGroup{
+.checkboxGroup {
margin: 10px 0 0 10px;
}
-.btnGroup{
+.btnGroup {
margin: 6px 0 0 10px;
}
-.checkboxGroup2{
+.checkboxGroup2 {
margin: 12px 0 0 10px;
}
-.surperTSearchRow{
+.surperTSearchRow {
margin: 20px 0 20px 0;
}
@@ -175,22 +180,22 @@ html, body, div {
background-color: #fff;
}
-.freshDataBtn{
+.freshDataBtn {
padding-left: 20px;
}
-.dataPackerLabel{
+.dataPackerLabel {
line-height: 34px;
font-size: 14px;
color: #606266;
}
-.consoleWrapper{
+.consoleWrapper {
height: 90%;
- width:100%;
+ width: 100%;
}
-.resultPlace{
+.resultPlace {
height: 92%;
width: 100%;
border: 1px solid #DCDFE6;
@@ -198,27 +203,26 @@ html, body, div {
margin-top: 15px;
}
-.resultPlaceTitle{
- color: #DCDFE6;
+.resultPlaceTitle {
margin-top: 7px;
margin-left: 10px;
}
-.iconWrapper_{
+.iconWrapper_ {
display: inline;
}
-.switchStyle{
+.switchStyle {
margin-left: 12px;
position: relative;
bottom: 3px;
}
-.el-switch__label{
+.el-switch__label {
height: auto !important;
}
-.addDBswitchStyle{
+.addDBswitchStyle {
position: relative;
top: 6px;
}
diff --git a/renderer/index.html b/renderer/index.html
index a445f8a..94c11c1 100644
--- a/renderer/index.html
+++ b/renderer/index.html
@@ -1,505 +1,530 @@
-
+
TDengineGUI
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
- 新建连接
-
-
-
-
-
-
+
+ 新建连接
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
- 超级表名
-
-
-
-
- {{ scope.row.name }}
-
-
-

-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/renderer/index.js b/renderer/index.js
index 43a9f3a..4fb4310 100644
--- a/renderer/index.js
+++ b/renderer/index.js
@@ -1,961 +1,975 @@
const TaosRestful = require('./taosrestful_.js')
const storage = require('./localDataStore.js')
-const { TouchBarScrubber } = require('electron')
+const {TouchBarScrubber} = require('electron')
new Vue({
el: '#app',
mounted: function () {
- let links = storage.getLinks()
- for(let i = 0,len=links.length; i < len; i++) {
- let payload = {
- ip:links[i].host,
- port:links[i].port,
- user:links[i].user,
- password:links[i].password
+ let links = storage.getLinks()
+ for (let i = 0, len = links.length; i < len; i++) {
+ let payload = {
+ ip: links[i].host,
+ port: links[i].port,
+ user: links[i].user,
+ password: links[i].password
+ }
+ TaosRestful.getVersion(payload).then(data => {
+ links[i].version = data
+ this.$data.links = links
+ })
}
- TaosRestful.getVersion(payload).then(data => {
- links[i].version = data
- this.$data.links =links
- })
- }
-
+
},
- data: function() {
- return {
- dbInfo:'',
- consoleResult:'',
- loadingLinks: false,
- drawer: true,
- addLinkDialog: false,
- linkForm: {
- name:"",
- host:"",
- port:"",
- user:"",
- password:"",
- },
- activeTab:"1",
-
- surperTableFilterCopy:{},
-
- surperTableFilter:{
- fields:[],
- surperDateRange:[],
- surperTSearchText: "",
- surperTSearchColumn: "",
- },
-
- tableFilterCopy:{},
- tableFilter:{
- fields:[],
- dateRange:[],
- tableSearchText:"",
- tableSearchColumn:"",
- },
- surperWhere:"",
- tableWhere:"",
-
- tableFilterDialog:false,
- surperTableFilterDialog:false,
-
- surperTables: [], //超级表list
- surperTableData: [],
- surperTableName: "",
- totalSurperTable: 0,
- surperTableLabelItems: [],
- surperTableLabel: [],
- loadingSurperList: false,
- loadingSurperTable: false,
-
- tables: [], //表list
- tableData: [],
- tableName: "",
- totalTable: 0,
- tableLabelItems: [],
- tableLabel: [],
- loadingTableList: false,
- loadingTable: false,
-
- eachPageSurperTable:10,
- currentPageSurperTable:1,
- eachPageTable:10,
- currentPageTable:1,
-
- addDBDialogLinkKey:0,
- addDBDialog:false,
- addDBname:"",
- addDBcomp:"",
- addDBreplica:"",
- addDBkeep:"",
- addDBupdate:false,
- addDBquorum:"",
- addDBblocks:"",
-
- searchIcon: true,
- freshIcon: true,
- links:[],
- theLink:{}, //当前连接
- theDB: "", //当前数据库
-
- SuperTdialog: false,
- SuperTdialogText: "",
- Tdialog: false,
- TdialogText: "",
-
- surperTorder:"ASC",
- Torder:"ASC",
- consoleInput: "",
- marks: {
- 0: '0',
- 365: '365',
- 36500: '36500'
+ data: function () {
+ return {
+ dbInfo: '',
+ consoleResult: '',
+ loadingLinks: false,
+ drawer: true,
+ addLinkDialog: false,
+ linkForm: {
+ name: "",
+ host: "",
+ port: "",
+ user: "",
+ password: "",
+ },
+ activeTab: "1",
+
+ surperTableFilterCopy: {},
+
+ surperTableFilter: {
+ fields: [],
+ surperDateRange: [],
+ surperTSearchText: "",
+ surperTSearchColumn: "",
+ },
+
+ tableFilterCopy: {},
+ tableFilter: {
+ fields: [],
+ dateRange: [],
+ tableSearchText: "",
+ tableSearchColumn: "",
+ },
+ surperWhere: "",
+ tableWhere: "",
+
+ tableFilterDialog: false,
+ surperTableFilterDialog: false,
+
+ surperTables: [], //超级表list
+ surperTableData: [],
+ surperTableName: "",
+ totalSurperTable: 0,
+ surperTableLabelItems: [],
+ surperTableLabel: [],
+ loadingSurperList: false,
+ loadingSurperTable: false,
+
+ tables: [], //表list
+ tableData: [],
+ tableName: "",
+ totalTable: 0,
+ tableLabelItems: [],
+ tableLabel: [],
+ loadingTableList: false,
+ loadingTable: false,
+
+ eachPageSurperTable: 15,
+ currentPageSurperTable: 1,
+ eachPageTable: 15,
+ currentPageTable: 1,
+
+ addDBDialogLinkKey: 0,
+ addDBDialog: false,
+ addDBname: "",
+ addDBcomp: "",
+ addDBreplica: "",
+ addDBkeep: "",
+ addDBupdate: false,
+ addDBquorum: "",
+ addDBblocks: "",
+
+ searchIcon: true,
+ freshIcon: true,
+ links: [],
+ theLink: {}, //当前连接
+ theDB: "", //当前数据库
+
+ SuperTdialog: false,
+ SuperTdialogText: "",
+ Tdialog: false,
+ TdialogText: "",
+
+ surperTorder: "ASC",
+ Torder: "ASC",
+ consoleInput: "",
+ marks: {
+ 0: '0',
+ 365: '365',
+ 36500: '36500'
+ }
}
- }
},
methods: {
- beforeClosedrawer(){
- if(this.theDB){
- this.drawer = false
- } else {
- this.$message({
- message: '请选择数据库',
- type: 'warning',
- duration:1000
- });
- }
- },
- cancelAddLink() {
- this.addLinkDialog = false
- //清空表单
- this.linkForm={
- name:"",
- host:"",
- port:"",
- user:"",
- password:""
- }
- },
- confirmAddLink(event) {
- //新建连接,先连接,如果成功,将payload+name记入本地
- //var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
- let payload = {
- ip:this.linkForm.host,
- port:this.linkForm.port,
- user:this.linkForm.user,
- password:this.linkForm.password
- }
- TaosRestful.showDatabases(payload).then(data =>{
- //处理返回的数据库数据
- if(data.res){
-
- TaosRestful.getVersion(payload).then(_data => {
- //连接成功,保存到本地
- storage.AddALink({
- name: this.linkForm.name,
- host: this.linkForm.host,
- port: this.linkForm.port,
- user: this.linkForm.user,
- password: this.linkForm.password,
- version: _data
- })
- //关闭新建连接的弹窗
- this.addLinkDialog = false
- //清空表单
- this.linkForm={
- name:"",
- host:"",
- port:"",
- user:"",
- password:"",
- }
-
- //更新连接列表
- this.links = storage.getLinks()
- })
-
+ beforeClosedrawer() {
+ if (this.theDB) {
+ this.drawer = false
} else {
- //连接失败
- this.$message({
- message: '连接失败',
- type: 'error',
- duration:1000
- });
+ this.$message({
+ message: '请选择数据库',
+ type: 'warning',
+ duration: 1000
+ });
}
-
- }
- )
-
- },
- deleteLink(key, linkName){
- this.$confirm('确认删除连接' + linkName + "吗?")
- .then(_ => {
- storage.deleteALink(key)
- this.links = storage.getLinks()
- this.$message({
- message: '删除成功',
- type: 'success',
- duration:500
- });
- })
- .catch(_ => {
- this.$message({
- message: '操作已取消',
- type: 'warning',
- duration:500
- });
- });
- },
- freshDB(key){
- let theLink = this.links[key]
- let payload = {
- ip:theLink.host,
- port:theLink.port,
- user:theLink.user,
- password:theLink.password
- }
- this.loadingLinks = true
- TaosRestful.showDatabases(payload).then(data =>{
- this.loadingLinks = false
- if(data.res){
- this.$message({
- message: '刷新成功',
- type: 'success',
- duration:1000
- });
- this.links[key].dbs = data.data
- //TODO展开菜单
-
- } else {
- //连接失败,1.提示 2.删除当前连接 3.重新连接
- //1
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
- //2
- storage.deleteALink(key)
- this.links = storage.getLinks()
- //3
- this.$message({
- message: '尝试重新连接',
- type: 'warning',
- duration:1000
- });
+ },
+ cancelAddLink() {
+ this.addLinkDialog = false
+ //清空表单
this.linkForm = {
- name: theLink.name,
- host: theLink.host,
- port: theLink.port,
- user: theLink.user,
- password: theLink.password,
+ name: "",
+ host: "",
+ port: "",
+ user: "",
+ password: ""
}
- this.addLinkDialog = true
- }
- })
- },
- addDB(key){
- this.addDBDialogLinkKey = key
- this.addDBDialog = true
-
- this.addDBname = ""
- this.addDBcomp = ""
- this.addDBreplica = ""
- this.addDBkeep = ""
- this.addDBupdate = false
- this.addDBquorum = ""
- this.addDBblocks = ""
- },
- postaddDB(){
- let key = this.addDBDialogLinkKey
- let theLink = this.links[key]
- let payload = {
- ip:theLink.host,
- port:theLink.port,
- user:theLink.user,
- password:theLink.password
- }
- if(this.addDBname){
- if(this.addDBreplica && this.addDBquorum){
- if(this.addDBreplica < this.addDBquorum){
- this.$message({
- message: 'replica应大于等于quorum',
- type: 'error',
- duration:1000
- });
- return
+ },
+ formatBoolean(data) {
+ data.forEach(item => {
+ for (let i in item) {
+ if (item[i] === true) {
+ item[i] = 'true'
+ } else if (item[i] === false) {
+ item[i] = 'false'
+ }
+ }
+ })
+ },
+ confirmAddLink(event) {
+ //新建连接,先连接,如果成功,将payload+name记入本地
+ //var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
+ let payload = {
+ ip: this.linkForm.host,
+ port: this.linkForm.port,
+ user: this.linkForm.user,
+ password: this.linkForm.password
}
- }
- TaosRestful.createDatabase(this.addDBname, payload,safe=true,keep= this.addDBkeep,update=this.addDBupdate,comp=this.addDBcomp, replica=this.addDBreplica,quorum=this.addDBquorum,blocks=this.addDBblocks).then(data => {
- if(data.res){
- //新增成功
- this.$message({
- message: '添加成功',
- type: 'success',
- duration:1000
- });
- this.freshDB(key)
- this.addDBDialog = false
- }else{
- //添加失败
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
+ TaosRestful.showDatabases(payload).then(data => {
+ //处理返回的数据库数据
+ if (data.res) {
+
+ TaosRestful.getVersion(payload).then(_data => {
+ //连接成功,保存到本地
+ storage.AddALink({
+ name: this.linkForm.name,
+ host: this.linkForm.host,
+ port: this.linkForm.port,
+ user: this.linkForm.user,
+ password: this.linkForm.password,
+ version: _data
+ })
+ //关闭新建连接的弹窗
+ this.addLinkDialog = false
+ //清空表单
+ this.linkForm = {
+ name: "",
+ host: "",
+ port: "",
+ user: "",
+ password: "",
+ }
+
+ //更新连接列表
+ this.links = storage.getLinks()
+ })
+
+ } else {
+ //连接失败
+ this.$message({
+ message: '连接失败',
+ type: 'error',
+ duration: 1000
+ });
+ }
+
+ }
+ )
+
+ },
+ deleteLink(key, linkName) {
+ this.$confirm('确认删除连接' + linkName + "吗?")
+ .then(_ => {
+ storage.deleteALink(key)
+ this.links = storage.getLinks()
+ this.$message({
+ message: '删除成功',
+ type: 'success',
+ duration: 500
+ });
+ })
+ .catch(_ => {
+ this.$message({
+ message: '操作已取消',
+ type: 'warning',
+ duration: 500
+ });
+ });
+ },
+ freshDB(key) {
+ let theLink = this.links[key]
+ let payload = {
+ ip: theLink.host,
+ port: theLink.port,
+ user: theLink.user,
+ password: theLink.password
}
- })
- } else{
- this.$message({
- message: '请填写内容',
- type: 'warning',
- duration:1000
- });
- }
- },
- deleteDB(link, dbName, key){
- this.$confirm('确认删除数据库' + dbName + "吗?")
- .then(_ => {
- let payload = {
- ip:link.host,
- port:link.port,
- user:link.user,
- password:link.password
- }
- this.loadingLinks = true
-
- TaosRestful.dropDatabase(dbName, payload).then(data => {
-
- if(data.res){
- //成功
- this.$message({
- message: '删除成功',
- type: 'success',
- duration:1000
- });
+ this.loadingLinks = true
+ TaosRestful.showDatabases(payload).then(data => {
+ this.loadingLinks = false
+ if (data.res) {
+ this.$message({
+ message: '刷新成功',
+ type: 'success',
+ duration: 1000
+ });
+ this.links[key].dbs = data.data
+ //TODO展开菜单
+
+ } else {
+ //连接失败,1.提示 2.删除当前连接 3.重新连接
+ //1
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ //2
+ storage.deleteALink(key)
+ this.links = storage.getLinks()
+ //3
+ this.$message({
+ message: '尝试重新连接',
+ type: 'warning',
+ duration: 1000
+ });
+ this.linkForm = {
+ name: theLink.name,
+ host: theLink.host,
+ port: theLink.port,
+ user: theLink.user,
+ password: theLink.password,
+ }
+ this.addLinkDialog = true
+ }
+ })
+ },
+ addDB(key) {
+ this.addDBDialogLinkKey = key
+ this.addDBDialog = true
+
+ this.addDBname = ""
+ this.addDBcomp = ""
+ this.addDBreplica = ""
+ this.addDBkeep = ""
+ this.addDBupdate = false
+ this.addDBquorum = ""
+ this.addDBblocks = ""
+ },
+ postaddDB() {
+ let key = this.addDBDialogLinkKey
+ let theLink = this.links[key]
+ let payload = {
+ ip: theLink.host,
+ port: theLink.port,
+ user: theLink.user,
+ password: theLink.password
+ }
+ if (this.addDBname) {
+ if (this.addDBreplica && this.addDBquorum) {
+ if (this.addDBreplica < this.addDBquorum) {
+ this.$message({
+ message: 'replica应大于等于quorum',
+ type: 'error',
+ duration: 1000
+ });
+ return
+ }
+ }
+ TaosRestful.createDatabase(this.addDBname, payload, safe = true, keep = this.addDBkeep, update = this.addDBupdate, comp = this.addDBcomp, replica = this.addDBreplica, quorum = this.addDBquorum, blocks = this.addDBblocks).then(data => {
+ if (data.res) {
+ //新增成功
+ this.$message({
+ message: '添加成功',
+ type: 'success',
+ duration: 1000
+ });
+ this.freshDB(key)
+ this.addDBDialog = false
+ } else {
+ //添加失败
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ }
+ })
} else {
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
+ this.$message({
+ message: '请填写内容',
+ type: 'warning',
+ duration: 1000
+ });
}
- this.loadingLinks = false
- this.freshDB(key)
- })
- })
- .catch(_ => {
- this.$message({
- message: '操作已取消',
- type: 'warning',
- duration:1000
- });
- });
- },
- makeDbInfo(dbs,dbName){
- console.log(dbs)
- let info = '无法获取数据库信息'
- dbs.forEach(item => {
- if(item['name'] == dbName){
- info = `数据库名: ${dbName}
`
- info += `创建时间: ${item['created_time']}
`
- info += `可更新: ${item['update'] == 0?'否':'是'}
`
- info += `cache(MB): ${item['cache(MB)']}
`
- info += `cachelast: ${item['cachelast']}
`
- info += `comp: ${item['comp']}
`
- info += `days: ${item['days']}
`
- info += `fsync: ${item['fsync']}
`
- info += `keep0,keep1,keep(D): ${item['keep0,keep1,keep(D)']}
`
- info += `maxrows: ${item['maxrows']}
`
- info += `minrows: ${item['minrows']}
`
- info += `ntables: ${item['ntables']}
`
- info += `quorum: ${item['quorum']}
`
- info += `replica: ${item['replica']}
`
- info += `status: ${item['status']}
`
- info += `vgroups: ${item['vgroups']}
`
- info += `wallevel: ${item['wallevel']}
`
- info += `precision: ${item['precision']}
`
- }
- })
- return info
- },
- alartDB(link,dbName){
- //切换数据库前先清空表
- this.dbInfo=this.makeDbInfo(link.dbs,dbName)
- this.surperTables = []
- this.clearSurperTable()
- this.tables = []
- this.clearTable()
-
- //记录进入的数据库
- this.theLink = link
- this.theDB = dbName
-
- //更新超级表页
- this.drawer = false
- this.activeTab = "1"
- this.freshSurperTables()
- },
- searchSurperTList(){
- this.SuperTdialog = false
- this.surperTables = []
- this.clearSurperTable()
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingSurperList = true
- TaosRestful.showSuperTables(this.theDB, payload, like=this.SuperTdialogText).then(data =>{
- if(data.res){
- //拉取超级表成功
- this.$message({
- message: '查找成功',
- type: 'success',
- duration:1000
- });
- this.surperTables = data.data
- } else {
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
+ },
+ deleteDB(link, dbName, key) {
+ this.$confirm('确认删除数据库' + dbName + "吗?")
+ .then(_ => {
+ let payload = {
+ ip: link.host,
+ port: link.port,
+ user: link.user,
+ password: link.password
+ }
+ this.loadingLinks = true
+
+ TaosRestful.dropDatabase(dbName, payload).then(data => {
+
+ if (data.res) {
+ //成功
+ this.$message({
+ message: '删除成功',
+ type: 'success',
+ duration: 1000
+ });
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ }
+ this.loadingLinks = false
+ this.freshDB(key)
+ })
+ })
+ .catch(_ => {
+ this.$message({
+ message: '操作已取消',
+ type: 'warning',
+ duration: 1000
+ });
+ });
+ },
+ makeDbInfo(dbs, dbName) {
+ console.log(dbs)
+ let info = '无法获取数据库信息'
+ dbs.forEach(item => {
+ if (item['name'] == dbName) {
+ info = `数据库名: ${dbName}
`
+ info += `创建时间: ${item['created_time']}
`
+ info += `可更新: ${item['update'] == 0 ? '否' : '是'}
`
+ info += `cache(MB): ${item['cache(MB)']}
`
+ info += `cachelast: ${item['cachelast']}
`
+ info += `comp: ${item['comp']}
`
+ info += `days: ${item['days']}
`
+ info += `fsync: ${item['fsync']}
`
+ info += `keep0,keep1,keep(D): ${item['keep0,keep1,keep(D)']}
`
+ info += `maxrows: ${item['maxrows']}
`
+ info += `minrows: ${item['minrows']}
`
+ info += `ntables: ${item['ntables']}
`
+ info += `quorum: ${item['quorum']}
`
+ info += `replica: ${item['replica']}
`
+ info += `status: ${item['status']}
`
+ info += `vgroups: ${item['vgroups']}
`
+ info += `wallevel: ${item['wallevel']}
`
+ info += `precision: ${item['precision']}
`
+ }
+ })
+ return info
+ },
+ alartDB(link, dbName) {
+ //切换数据库前先清空表
+ this.dbInfo = this.makeDbInfo(link.dbs, dbName)
+ this.surperTables = []
+ this.clearSurperTable()
+ this.tables = []
+ this.clearTable()
+
+ //记录进入的数据库
+ this.theLink = link
+ this.theDB = dbName
+
+ //更新超级表页
+ this.drawer = false
+ this.activeTab = "1"
this.freshSurperTables()
- }
- this.SuperTdialogText = ""
- this.loadingSurperList = false
- })
-
- },
- freshSurperTList(){
- this.surperTables = []
- this.clearSurperTable()
- this.freshSurperTables()
- },
- searchTList(){
- this.Tdialog = false
- this.tables = []
- this.clearTable()
-
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingTableList = true
- TaosRestful.showTables(this.theDB, payload, like=this.TdialogText).then(data =>{
- if(data.res){
- //拉取表成功
- this.$message({
- message: '查找成功',
- type: 'success',
- duration:1000
- });
- this.tables = data.data
- }else{
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
- this.freshTables()
+ },
+ searchSurperTList() {
+ this.SuperTdialog = false
+ this.surperTables = []
+ this.clearSurperTable()
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingSurperList = true
+ TaosRestful.showSuperTables(this.theDB, payload, like = this.SuperTdialogText).then(data => {
+ if (data.res) {
+ //拉取超级表成功
+ this.$message({
+ message: '查找成功',
+ type: 'success',
+ duration: 1000
+ });
+ this.surperTables = data.data
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ this.freshSurperTables()
+ }
+ this.SuperTdialogText = ""
+ this.loadingSurperList = false
+ })
- }
- this.TdialogText = ""
- this.loadingTableList = false
- })
- },
- freshTList(){
- this.tables = []
- this.clearTable()
- this.freshTables()
- },
- clearSurperTable(){
- this.surperTableName = ""
- this.totalSurperTable = 0
- this.surperTableData = []
- this.surperTableLabel = []
- this.surperTableFilter={
- fields:[],
- surperDateRange:[],
- surperTSearchText: "",
- surperTSearchColumn: "",
- }
- },
- clearTable(){
- this.tableName = ""
- this.totalTable = 0
- this.tableData = []
- this.tableLabel = []
- this.tableFilter={
- fields:[],
- dateRange:[],
- tableSearchText:"",
- tableSearchColumn:"",
- }
- },
- freshSurperTables(){
- //清理超级表列表
- this.surperTables = []
- //清理选中的超级表和具体数据
- this.clearSurperTable()
-
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingSurperList = true
- TaosRestful.showSuperTables(this.theDB, payload).then(data =>{
- if(data.res){
- //拉取超级表成功
- this.$message({
- message: '刷新成功',
- type: 'success',
- duration:1000
- });
- this.surperTables = data.data
- } else {
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
- }
- this.loadingSurperList = false
- })
- },
- freshTables(){
- //清理表列表
- this.tables = []
- //清理选中的表和具体数据
- this.clearTable()
-
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingTableList = true
- TaosRestful.showTables(this.theDB, payload).then(data =>{
- if(data.res){
- //拉取表成功
+ },
+ freshSurperTList() {
+ this.surperTables = []
+ this.clearSurperTable()
+ this.freshSurperTables()
+ },
+ searchTList() {
+ this.Tdialog = false
+ this.tables = []
+ this.clearTable()
+
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingTableList = true
+ TaosRestful.showTables(this.theDB, payload, like = this.TdialogText).then(data => {
+ if (data.res) {
+ //拉取表成功
+ this.$message({
+ message: '查找成功',
+ type: 'success',
+ duration: 1000
+ });
+ this.tables = data.data
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ this.freshTables()
+
+ }
+ this.TdialogText = ""
+ this.loadingTableList = false
+ })
+ },
+ freshTList() {
+ this.tables = []
+ this.clearTable()
+ this.freshTables()
+ },
+ clearSurperTable() {
+ this.surperTableName = ""
+ this.totalSurperTable = 0
+ this.surperTableData = []
+ this.surperTableLabel = []
+ this.surperTableFilter = {
+ fields: [],
+ surperDateRange: [],
+ surperTSearchText: "",
+ surperTSearchColumn: "",
+ }
+ },
+ clearTable() {
+ this.tableName = ""
+ this.totalTable = 0
+ this.tableData = []
+ this.tableLabel = []
+ this.tableFilter = {
+ fields: [],
+ dateRange: [],
+ tableSearchText: "",
+ tableSearchColumn: "",
+ }
+ },
+ freshSurperTables() {
+ //清理超级表列表
+ this.surperTables = []
+ //清理选中的超级表和具体数据
+ this.clearSurperTable()
+
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingSurperList = true
+ TaosRestful.showSuperTables(this.theDB, payload).then(data => {
+ if (data.res) {
+ //拉取超级表成功
+ this.$message({
+ message: '刷新成功',
+ type: 'success',
+ duration: 1000
+ });
+ this.surperTables = data.data
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ }
+ this.loadingSurperList = false
+ })
+ },
+ freshTables() {
+ //清理表列表
+ this.tables = []
+ //清理选中的表和具体数据
+ this.clearTable()
+
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingTableList = true
+ TaosRestful.showTables(this.theDB, payload).then(data => {
+ if (data.res) {
+ //拉取表成功
+ this.$message({
+ message: '刷新成功',
+ type: 'success',
+ duration: 1000
+ });
+ this.tables = data.data
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ }
+ this.loadingTableList = false
+ })
+ },
+ handleSwichTab(tab) {
+ switch (tab.name) {
+ case "1":
+ //超级表
+ this.freshSurperTables()
+ break;
+ case "2":
+ //表
+ this.freshTables()
+ break;
+ case "3":
+ //控制台
+ break;
+ case "4":
+ //数据库属性
+ break;
+ }
+ },
+ openSurperTableFilterD() {
+ this.surperTableFilterDialog = true
+ this.surperTableFilterCopy = JSON.parse(JSON.stringify(this.surperTableFilter))
+ },
+ concelSurperTableFilter() {
this.$message({
- message: '刷新成功',
- type: 'success',
- duration:1000
+ message: '取消操作',
+ type: 'warning',
+ duration: 1000
});
- this.tables = data.data
- }else{
+ this.surperTableFilterDialog = false
+ this.surperTableFilter = this.surperTableFilterCopy
+ },
+ postSurperTableFilter() {
+ this.surperTableFilterDialog = false
+ this.selectSurperData(false)
+ },
+ openTableFilterD() {
+ this.tableFilterDialog = true
+ this.tableFilterCopy = JSON.parse(JSON.stringify(this.tableFilter))
+ },
+ concelTableFilter() {
this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
+ message: '取消操作',
+ type: 'warning',
+ duration: 1000
});
- }
- this.loadingTableList = false
- })
- },
- handleSwichTab(tab) {
- switch(tab.name) {
- case "1":
- //超级表
- this.freshSurperTables()
- break;
- case "2":
- //表
- this.freshTables()
- break;
- case "3":
- //控制台
- break;
- case "4":
- //数据库属性
- break;
- }
- },
- openSurperTableFilterD(){
- this.surperTableFilterDialog = true
- this.surperTableFilterCopy = JSON.parse(JSON.stringify(this.surperTableFilter))
- },
- concelSurperTableFilter(){
- this.$message({
- message: '取消操作',
- type: 'warning',
- duration:1000
- });
- this.surperTableFilterDialog = false
- this.surperTableFilter = this.surperTableFilterCopy
- },
- postSurperTableFilter(){
- this.surperTableFilterDialog = false
- this.selectSurperData(false)
- },
- openTableFilterD(){
- this.tableFilterDialog = true
- this.tableFilterCopy = JSON.parse(JSON.stringify(this.tableFilter))
- },
- concelTableFilter(){
- this.$message({
- message: '取消操作',
- type: 'warning',
- duration:1000
- });
- this.tableFilterDialog = false
- this.tableFilter = this.tableFilterCopy
- },
- postTableFilter(){
- this.tableFilterDialog = false
- this.selectTData(false)
- },
- searchSurperText(){
- if(this.surperTableFilter.surperTSearchColumn && this.surperTableFilter.surperTSearchText.trim()){
- // this.surperWhere = this.surperTSearchColumn + " > " + this.surperTSearchText.trim()+"%"
- // this.clearSurperTable()
- let surperTSearchText = this.surperTableFilter.surperTSearchText.trim()
- if(!isNaN(surperTSearchText)){
- this.surperWhere =this.surperTableFilter.surperTSearchColumn + " = " + surperTSearchText
- } else {
- this.surperWhere =this.surperTableFilter.surperTSearchColumn + " = '" + surperTSearchText +"'"
- }
-
- this.selectSurperData(false)
- } else {
- this.surperWhere = ""
- this.$message({
- message: '请填写正确',
- type: 'warning',
- duration:1000
- });
- this.selectSurperData(false)
- }
- },
- searchTableText(){
- if(this.tableFilter.tableSearchColumn && this.tableFilter.tableSearchText.trim()){
-
- let tableSearchText = this.tableFilter.tableSearchText.trim()
- if(!isNaN(tableSearchText)){
- this.tableWhere =this.tableFilter.tableSearchColumn + " = " + tableSearchText
- } else {
- this.tableWhere =this.tableFilter.tableSearchColumn + " = '" + tableSearchText +"'"
- }
-
- this.selectTData(false)
- } else {
- this.tableWhere = ""
- this.$message({
- message: '请填写正确',
- type: 'warning',
- duration:1000
- });
- this.selectTData(false)
- }
- },
- selectSurperData(isFirst, isResetPage){
-
- //处理时间范围
- let startTime = null
- let endTime = null
- if(this.surperTableFilter.surperDateRange){
- startTime = this.surperTableFilter.surperDateRange[0];
- endTime = this.surperTableFilter.surperDateRange[1];
- }
+ this.tableFilterDialog = false
+ this.tableFilter = this.tableFilterCopy
+ },
+ postTableFilter() {
+ this.tableFilterDialog = false
+ this.selectTData(false)
+ },
+ searchSurperText() {
+ if (this.surperTableFilter.surperTSearchColumn && this.surperTableFilter.surperTSearchText.trim()) {
+ // this.surperWhere = this.surperTSearchColumn + " > " + this.surperTSearchText.trim()+"%"
+ // this.clearSurperTable()
+ let surperTSearchText = this.surperTableFilter.surperTSearchText.trim()
+ if (!isNaN(surperTSearchText)) {
+ this.surperWhere = this.surperTableFilter.surperTSearchColumn + " = " + surperTSearchText
+ } else {
+ this.surperWhere = this.surperTableFilter.surperTSearchColumn + " = '" + surperTSearchText + "'"
+ }
- //是否需要重置分页
- if(isResetPage){
- this.currentPageSurperTable = 1
- }
+ this.selectSurperData(false)
+ } else {
+ this.surperWhere = ""
+ this.$message({
+ message: '请填写正确',
+ type: 'warning',
+ duration: 1000
+ });
+ this.selectSurperData(false)
+ }
+ },
+ searchTableText() {
+ if (this.tableFilter.tableSearchColumn && this.tableFilter.tableSearchText.trim()) {
+
+ let tableSearchText = this.tableFilter.tableSearchText.trim()
+ if (!isNaN(tableSearchText)) {
+ this.tableWhere = this.tableFilter.tableSearchColumn + " = " + tableSearchText
+ } else {
+ this.tableWhere = this.tableFilter.tableSearchColumn + " = '" + tableSearchText + "'"
+ }
- let offsetVal = (this.currentPageSurperTable-1)*this.eachPageSurperTable
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingSurperTable = true
-
- //处理查询数据
- // if(!this.surperTableFilter.surperTSearchText.trim()){
- // this.surperWhere = ""
- // }
-
- //tableName,dbName,payload,fields=null,where=null,limit =null,offset = null,desc =null,startTime=null,endTime=null
- TaosRestful.selectData(this.surperTableName, this.theDB, payload, fields=this.surperTableFilter.fields, where=this.surperWhere
- , limit=this.eachPageSurperTable, offset=offsetVal, desc=this.surperTorder, startTime=startTime, endTime=endTime)
- .then(data =>{
- if(data.res){
- //成功
- if(data.data.length != 0){
- //有数据
- this.$message({
- message: '获取成功',
- type: 'success',
- duration:1000
- });
- if(isFirst){
- this.surperTableLabelItems = Object.keys(data.data[0])
- }
- this.surperTableLabel = Object.keys(data.data[0])
- this.surperTableFilter.fields = Object.keys(data.data[0])
- this.surperTableData = data.data
- this.totalSurperTable = data.count
+ this.selectTData(false)
} else {
- this.surperTableLabel = []
- this.surperTableData = data.data
- this.totalSurperTable = data.count
- this.$message({
- message: '无数据',
- type: 'warning',
- duration:1000
- });
+ this.tableWhere = ""
+ this.$message({
+ message: '请填写正确',
+ type: 'warning',
+ duration: 1000
+ });
+ this.selectTData(false)
+ }
+ },
+ selectSurperData(isFirst, isResetPage) {
+
+ //处理时间范围
+ let startTime = null
+ let endTime = null
+ if (this.surperTableFilter.surperDateRange) {
+ startTime = this.surperTableFilter.surperDateRange[0];
+ endTime = this.surperTableFilter.surperDateRange[1];
}
- }else{
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
- }
- this.loadingSurperTable = false
-
- })
- },
- selectTData(isFirst, isResetPage=false){
-
- //处理时间范围
- let startTime = null
- let endTime = null
- if(this.tableFilter.dateRange){
- startTime = this.tableFilter.dateRange[0];
- endTime = this.tableFilter.dateRange[1];
- }
- if(isResetPage){
- this.currentPageTable = 1
- }
+ //是否需要重置分页
+ if (isResetPage) {
+ this.currentPageSurperTable = 1
+ }
- let offsetVal = (this.currentPageTable-1)*this.eachPageTable
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingTable = true
-
- // if(!this.tableFilter.tableSearchText.trim()){
- // this.tableWhere = ""
- // }
-
- //tableName,dbName,payload,fields=null,where=null,limit =null,offset = null,desc =null,startTime=null,endTime=null
- TaosRestful.selectData(this.tableName, this.theDB, payload, fields=this.tableFilter.fields, where=this.tableWhere
- , limit=this.eachPageTable, offset=offsetVal, desc=this.Torder, startTime=startTime, endTime=endTime)
- .then(data =>{
- if(data.res){
- //成功
- if(data.data.length != 0){
- //有数据
- this.$message({
- message: '获取成功',
- type: 'success',
- duration:1000
- });
- if(isFirst){
- this.tableLabelItems = Object.keys(data.data[0])
- }
- this.tableLabel = Object.keys(data.data[0])
- this.tableFilter.fields = Object.keys(data.data[0])
- this.tableData = data.data
- this.totalTable = data.count
- } else {
- this.tableLabel = []
- this.tableData = data.data
- this.totalTable = data.count
- this.$message({
- message: '无数据',
- type: 'warning',
- duration:1000
- });
+ let offsetVal = (this.currentPageSurperTable - 1) * this.eachPageSurperTable
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
}
- }
- this.loadingTable = false
- })
- },
- surTableFilter(){
- this.selectSurperData(0)
- },
- handleClickSurperT(val) {
- if(val){
- this.clearSurperTable()
- this.surperTableName = val.name
- this.selectSurperData(true)
- }
- },
- handleClickT(val) {
- if(val){
- this.clearTable()
- this.tableName = val.table_name
- this.selectTData(true)
- }
- },
- paginationSurperChange(){
- this.selectSurperData(false)
- },
- paginationChange(){
- this.selectTData(false)
- },
- editSurperT(val) {
- console.log(val)
- },
- deleteSurperT(val) {
- this.$confirm('确认删除超级表' + val + "吗?")
- .then(_ => {
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingSurperList = true
-
- //TODO没测试过
- TaosRestful.dropTable(val, this.theDB, payload).then(data => {
-
- if(data.res){
- //成功
- this.$message({
- message: '删除成功',
- type: 'success',
- duration:500
- });
- } else {
- this.$message({
- message: data.msg,
- type: 'error',
- duration:500
- });
+ this.loadingSurperTable = true
+
+ //处理查询数据
+ // if(!this.surperTableFilter.surperTSearchText.trim()){
+ // this.surperWhere = ""
+ // }
+
+ //tableName,dbName,payload,fields=null,where=null,limit =null,offset = null,desc =null,startTime=null,endTime=null
+ TaosRestful.selectData(this.surperTableName, this.theDB, payload, fields = this.surperTableFilter.fields, where = this.surperWhere
+ , limit = this.eachPageSurperTable, offset = offsetVal, desc = this.surperTorder, startTime = startTime, endTime = endTime)
+ .then(data => {
+ if (data.res) {
+ //成功
+ if (data.data.length != 0) {
+ //有数据
+ this.$message({
+ message: '获取成功',
+ type: 'success',
+ duration: 1000
+ });
+ if (isFirst) {
+ this.surperTableLabelItems = Object.keys(data.data[0])
+ }
+ this.surperTableLabel = Object.keys(data.data[0])
+ this.surperTableFilter.fields = Object.keys(data.data[0])
+ this.formatBoolean(data.data)
+ this.surperTableData = data.data
+ this.totalSurperTable = data.count
+ } else {
+ this.surperTableLabel = []
+ this.formatBoolean(data.data)
+ this.surperTableData = data.data
+ this.totalSurperTable = data.count
+ this.$message({
+ message: '无数据',
+ type: 'warning',
+ duration: 1000
+ });
+ }
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ }
+ this.loadingSurperTable = false
+
+ })
+ },
+ selectTData(isFirst, isResetPage = false) {
+
+ //处理时间范围
+ let startTime = null
+ let endTime = null
+ if (this.tableFilter.dateRange) {
+ startTime = this.tableFilter.dateRange[0];
+ endTime = this.tableFilter.dateRange[1];
}
- this.loadingSurperList = false
- this.freshSurperTables()
- })
-
- })
- .catch(_ => {
- this.$message({
- message: '操作已取消',
- type: 'warning',
- duration:500
- });
- });
- },
- editT(val) {
- console.log(val)
- },
- deleteT(val) {
- this.$confirm('确认删除表' + val + "吗?")
- .then(_ => {
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
- }
- this.loadingTableList = true
-
- //TODO没测试过
- TaosRestful.dropTable(val, this.theDB, payload).then(data => {
-
- if(data.res){
- //成功
- this.$message({
- message: '删除成功',
- type: 'success',
- duration:500
- });
- } else {
- this.$message({
- message: data.msg,
- type: 'error',
- duration:500
- });
+
+ if (isResetPage) {
+ this.currentPageTable = 1
}
- this.loadingTableList = false
- this.freshTables()
- })
-
- })
- .catch(_ => {
- this.$message({
- message: '操作已取消',
- type: 'warning',
- duration:500
- });
- });
- },
- sendSQL(){
- let payload = {
- ip:this.theLink.host,
- port:this.theLink.port,
- user:this.theLink.user,
- password:this.theLink.password
+
+ let offsetVal = (this.currentPageTable - 1) * this.eachPageTable
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingTable = true
+
+ // if(!this.tableFilter.tableSearchText.trim()){
+ // this.tableWhere = ""
+ // }
+
+ //tableName,dbName,payload,fields=null,where=null,limit =null,offset = null,desc =null,startTime=null,endTime=null
+ TaosRestful.selectData(this.tableName, this.theDB, payload, fields = this.tableFilter.fields, where = this.tableWhere
+ , limit = this.eachPageTable, offset = offsetVal, desc = this.Torder, startTime = startTime, endTime = endTime)
+ .then(data => {
+ if (data.res) {
+ //成功
+ if (data.data.length != 0) {
+ //有数据
+ this.$message({
+ message: '获取成功',
+ type: 'success',
+ duration: 1000
+ });
+ if (isFirst) {
+ this.tableLabelItems = Object.keys(data.data[0])
+ }
+ this.tableLabel = Object.keys(data.data[0])
+ this.tableFilter.fields = Object.keys(data.data[0])
+ this.formatBoolean(data.data)
+ this.tableData = data.data
+ this.totalTable = data.count
+ } else {
+ this.tableLabel = []
+ this.formatBoolean(data.data)
+ this.tableData = data.data
+ this.totalTable = data.count
+ this.$message({
+ message: '无数据',
+ type: 'warning',
+ duration: 1000
+ });
+ }
+ }
+ this.loadingTable = false
+ })
+ },
+ surTableFilter() {
+ this.selectSurperData(0)
+ },
+ handleClickSurperT(val) {
+ if (val) {
+ this.clearSurperTable()
+ this.surperTableName = val.name
+ this.selectSurperData(true)
+ }
+ },
+ handleClickT(val) {
+ if (val) {
+ this.clearTable()
+ this.tableName = val.table_name
+ this.selectTData(true)
+ }
+ },
+ paginationSurperChange() {
+ this.selectSurperData(false)
+ },
+ paginationChange() {
+ this.selectTData(false)
+ },
+ editSurperT(val) {
+ console.log(val)
+ },
+ deleteSurperT(val) {
+ this.$confirm('确认删除超级表' + val + "吗?")
+ .then(_ => {
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingSurperList = true
+
+ //TODO没测试过
+ TaosRestful.dropTable(val, this.theDB, payload).then(data => {
+
+ if (data.res) {
+ //成功
+ this.$message({
+ message: '删除成功',
+ type: 'success',
+ duration: 500
+ });
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 500
+ });
+ }
+ this.loadingSurperList = false
+ this.freshSurperTables()
+ })
+
+ })
+ .catch(_ => {
+ this.$message({
+ message: '操作已取消',
+ type: 'warning',
+ duration: 500
+ });
+ });
+ },
+ editT(val) {
+ console.log(val)
+ },
+ deleteT(val) {
+ this.$confirm('确认删除表' + val + "吗?")
+ .then(_ => {
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ this.loadingTableList = true
+
+ //TODO没测试过
+ TaosRestful.dropTable(val, this.theDB, payload).then(data => {
+
+ if (data.res) {
+ //成功
+ this.$message({
+ message: '删除成功',
+ type: 'success',
+ duration: 500
+ });
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 500
+ });
+ }
+ this.loadingTableList = false
+ this.freshTables()
+ })
+
+ })
+ .catch(_ => {
+ this.$message({
+ message: '操作已取消',
+ type: 'warning',
+ duration: 500
+ });
+ });
+ },
+ sendSQL() {
+ let payload = {
+ ip: this.theLink.host,
+ port: this.theLink.port,
+ user: this.theLink.user,
+ password: this.theLink.password
+ }
+ // console.log(this.theDB)
+ TaosRestful.rawSqlWithDB(this.consoleInput, this.theDB, payload).then(data => {
+ if (data.res) {
+ // let info = ''
+ // info += `数据数量: ${data.count}
`
+ // info += `数据列: ${data.head}
`
+ // info += `数据: ${data.data}
`
+ this.$message({
+ message: '执行成功',
+ type: 'success',
+ duration: 500
+ });
+ this.consoleResult = data
+ } else {
+ this.$message({
+ message: data.msg,
+ type: 'error',
+ duration: 1000
+ });
+ }
+
+ })
+ },
+ closeSuperTdialog() {
+ this.SuperTdialogText = ""
+ this.SuperTdialog = false
+ },
+ closeTdialog() {
+ this.TdialogText = ""
+ this.Tdialog = false
+ },
+ STChooseAll() {
+ this.surperTableFilter.fields = this.surperTableLabelItems
+ },
+ STChooseReverse() {
+ let newFields = this.surperTableLabelItems.filter((item) => {
+ return this.surperTableFilter ? this.surperTableFilter.fields.indexOf(item) == -1 : false;
+ })
+ this.surperTableFilter.fields = newFields
+ },
+ TChooseAll() {
+ this.tableFilter.fields = this.tableLabelItems
+ },
+ TChooseReverse() {
+ let newFields = this.tableLabelItems.filter((item) => {
+ return this.tableLabelItems.fields ? this.tableLabelItems.fields.indexOf(item) == -1 : false;
+ })
+ this.tableFilter.fields = newFields
}
- // console.log(this.theDB)
- TaosRestful.rawSqlWithDB(this.consoleInput,this.theDB,payload).then(data => {
- if(data.res){
- // let info = ''
- // info += `数据数量: ${data.count}
`
- // info += `数据列: ${data.head}
`
- // info += `数据: ${data.data}
`
- this.$message({
- message: '执行成功',
- type: 'success',
- duration:500
- });
- this.consoleResult = data
- } else {
- this.$message({
- message: data.msg,
- type: 'error',
- duration:1000
- });
- }
-
- })
- },
- closeSuperTdialog(){
- this.SuperTdialogText = ""
- this.SuperTdialog = false
- },
- closeTdialog(){
- this.TdialogText = ""
- this.Tdialog = false
- },
- STChooseAll(){
- this.surperTableFilter.fields = this.surperTableLabelItems
- },
- STChooseReverse(){
- let newFields = this.surperTableLabelItems.filter((item) => {
- return this.surperTableFilter ? this.surperTableFilter.fields.indexOf(item) == -1 : false;
- })
- this.surperTableFilter.fields = newFields
- },
- TChooseAll(){
- this.tableFilter.fields = this.tableLabelItems
- },
- TChooseReverse(){
- let newFields = this.tableLabelItems.filter((item) => {
- return this.tableLabelItems.fields? this.tableLabelItems.fields.indexOf(item) == -1: false;
- })
- this.tableFilter.fields = newFields
- }
-
+
}
- })
+})
-
\ No newline at end of file
From 3a62d6de9838a4de02cc6a9c72c46eb788ef3014 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E7=9B=8A?= <326170945@qq.com>
Date: Thu, 12 May 2022 13:43:52 +0800
Subject: [PATCH 03/25] =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/package.json b/package.json
index afb64e9..7ae1d8f 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "TDengineGUI",
- "version": "1.0.0",
+ "version": "1.0.1",
"description": "A simple TDengine DeskTop Manager",
"main": "main.js",
"scripts": {
From 8604713516bf84860ab816375d7490021a92010f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=83=A1=E7=9B=8A?= <326170945@qq.com>
Date: Fri, 13 May 2022 13:52:51 +0800
Subject: [PATCH 04/25] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E6=9F=A5?=
=?UTF-8?q?=E8=AF=A2=E7=BB=93=E6=9E=9C=E5=8F=AF=E5=A4=8D=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
datatest/test_alterdb.js | 2 +-
datatest/test_createdb.js | 2 +-
datatest/test_distable.js | 2 +-
datatest/test_droptable.js | 2 +-
datatest/test_getversion.js | 2 +-
datatest/test_insertdata.js | 4 ++--
datatest/test_rawsql.js | 2 +-
datatest/test_selectdata.js | 4 ++--
datatest/test_showdb.js | 2 +-
datatest/test_showtable.js | 4 ++--
renderer/{ => css}/index.css | 2 +-
renderer/index.html | 14 +++++++++-----
renderer/{ => js}/index.js | 8 ++++++++
renderer/{ => js}/localDataStore.js | 0
renderer/{ => js}/taosrestful.js | 0
renderer/{ => js}/taosrestful_.js | 0
renderer/js/vue-clipboard2/vue-clipboard.min.js | 1 +
17 files changed, 32 insertions(+), 19 deletions(-)
rename renderer/{ => css}/index.css (99%)
rename renderer/{ => js}/index.js (99%)
rename renderer/{ => js}/localDataStore.js (100%)
rename renderer/{ => js}/taosrestful.js (100%)
rename renderer/{ => js}/taosrestful_.js (100%)
create mode 100644 renderer/js/vue-clipboard2/vue-clipboard.min.js
diff --git a/datatest/test_alterdb.js b/datatest/test_alterdb.js
index 12364fd..35db928 100644
--- a/datatest/test_alterdb.js
+++ b/datatest/test_alterdb.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
diff --git a/datatest/test_createdb.js b/datatest/test_createdb.js
index 51a4389..67c7a25 100644
--- a/datatest/test_createdb.js
+++ b/datatest/test_createdb.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
diff --git a/datatest/test_distable.js b/datatest/test_distable.js
index 9545f12..b6c1d9e 100644
--- a/datatest/test_distable.js
+++ b/datatest/test_distable.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
diff --git a/datatest/test_droptable.js b/datatest/test_droptable.js
index f29242c..70b4618 100644
--- a/datatest/test_droptable.js
+++ b/datatest/test_droptable.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
diff --git a/datatest/test_getversion.js b/datatest/test_getversion.js
index 6feedaa..433f5ba 100644
--- a/datatest/test_getversion.js
+++ b/datatest/test_getversion.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
diff --git a/datatest/test_insertdata.js b/datatest/test_insertdata.js
index c4ec9b6..e2679bc 100644
--- a/datatest/test_insertdata.js
+++ b/datatest/test_insertdata.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
@@ -12,4 +12,4 @@ tr.insertData('person100',{'td':Date.now(),'name5':1.2},'test3').then(a =>
tr.useDatabase('test3')
tr.insertData('person100',{'td':Date.now(),'name5':1.2}).then(a =>
console.log(a)
-)
\ No newline at end of file
+)
diff --git a/datatest/test_rawsql.js b/datatest/test_rawsql.js
index 7399fcf..1cd8a12 100644
--- a/datatest/test_rawsql.js
+++ b/datatest/test_rawsql.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
diff --git a/datatest/test_selectdata.js b/datatest/test_selectdata.js
index 41d3d69..3b63d6e 100644
--- a/datatest/test_selectdata.js
+++ b/datatest/test_selectdata.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
@@ -22,4 +22,4 @@ tr.selectData('node_7',['ts','pjxdy1'],null,100,1000,null,'dianli1','2021-01-12
tr.countData('node_7',null,'dianli1','2021-01-12 20:42:30.275','2021-03-12 20:42:30.275').then(a =>
console.log(a)
-)
\ No newline at end of file
+)
diff --git a/datatest/test_showdb.js b/datatest/test_showdb.js
index 80e4510..7603a02 100644
--- a/datatest/test_showdb.js
+++ b/datatest/test_showdb.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918",1)
diff --git a/datatest/test_showtable.js b/datatest/test_showtable.js
index 864c334..92b7e26 100644
--- a/datatest/test_showtable.js
+++ b/datatest/test_showtable.js
@@ -1,7 +1,7 @@
'use strict'
-var TaosRestful = require('../renderer/taosrestful.js')
+var TaosRestful = require('../renderer/js/taosrestful.js')
var tr = new TaosRestful("121.36.56.117","6041","root","msl110918")
@@ -23,4 +23,4 @@ tr.showTables('dianli1','1').then(a =>
// tr.useDatabase('test3')
// tr.showTables().then(a =>
// console.log(a)
-// )
\ No newline at end of file
+// )
diff --git a/renderer/index.css b/renderer/css/index.css
similarity index 99%
rename from renderer/index.css
rename to renderer/css/index.css
index 92e6f9e..f2d3c6e 100644
--- a/renderer/index.css
+++ b/renderer/css/index.css
@@ -32,7 +32,7 @@ html, body, div {
}
.mainContent {
- height: 100%;
+ height: 95%;
}
.tablePage {
diff --git a/renderer/index.html b/renderer/index.html
index 94c11c1..9b1d5ef 100644
--- a/renderer/index.html
+++ b/renderer/index.html
@@ -3,11 +3,12 @@
TDengineGUI
-
+
+
SQL:
-
+ 执行
-
+
+
复制
{{ JSON.stringify(consoleResult, null, 4) }}
-
+
@@ -524,7 +528,7 @@