Skip to content

Commit

Permalink
Merge 064379f into 8bccb32
Browse files Browse the repository at this point in the history
  • Loading branch information
qianmoQ authored Sep 23, 2021
2 parents 8bccb32 + 064379f commit 21a4965
Show file tree
Hide file tree
Showing 50 changed files with 900 additions and 209 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/upload-to-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
with:
tag_name: 1.5.0
release_name: 1.5.0
tag_name: 1.6.0
release_name: 1.6.0
draft: false
prerelease: false

Expand Down
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@ Gitee:
- Support query history (pagination, clear all, etc.)
- Support selected sql clauses query
- Support terminating query
- Support table management (metadata, delete, preview)
- Support table management
- Delete table operation
- Get ddl operation
- Get table preview data operation
- Rename table operation
- Support column management
- Add column operation
- Delete column operation
- Get column info operation
- Modify column operation
- Rename column operation
- Support database management (delete, create)
- Support custom query
- Support multiple data sources management(connection test, monitoring)
Expand Down
29 changes: 29 additions & 0 deletions docs/_posts/2021-09-23-1.6.0-Release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
layout: post
title: "1.6.0"
date: 2021-09-23
author: qianmoQ
---

DBM Version for 1.6.0 is released!

#### Bugs
---

- Fix information word
- Fix the migration data password null problem

#### UI
---

- Increase query history limit reminder
- Disallow clicking on the mask layer to close the dialog popover

#### Enhancement
---

- Support add column to table
- Support delete column
- Support modify column
- Support rename column
- Support preview data for column
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "dbm",
"version": "1.5.0",
"version": "1.6.0",
"author": "qianmoQ <shicheng@ttxit.com>",
"description": "ClickHouse DataBase Manager Tools",
"credits": "EdurtIO",
"github": "https://github.com/EdurtIO/incubator-dbm.git",
"github": "https://github.com/EdurtIO/dbm.git",
"license": "Apache",
"main": "./dist/electron/main.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/api/query.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { post, get } from '@/utils/Query'
const HttpUtils = require('../utils/HttpUtils')

export function runExecute(host, sql) {
return post(host, sql + '\n FORMAT JSON')
return HttpUtils.post(host, sql + '\n FORMAT JSON')
}

export function checkHealth(host) {
return get(host)
return HttpUtils.get(host)
}
8 changes: 6 additions & 2 deletions src/renderer/i18n/en_US.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
mutations: 'Mutations',
id: 'ID',
createTime: 'Create Time',
infomation: 'Infomation',
information: 'Information',
edit: 'Edit',
tools: 'Tools',
track: 'Track',
Expand Down Expand Up @@ -160,7 +160,11 @@ export default {
refersh_config: 'After the configuration is modified, it needs to be reloaded manually!'
},
tooltip: {
is_empty: 'Is not empty'
is_empty: 'Is not empty',
history_max: 'The query history will not be saved if it exceeds the upper limit'
},
formatter: {
column: 'The table engine {0} does not support the ALTER operation'
},
table: {
engine: {
Expand Down
8 changes: 6 additions & 2 deletions src/renderer/i18n/zh_CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default {
mutations: 'Mutations',
id: 'ID',
createTime: '创建时间',
infomation: '信息',
information: '信息',
edit: '修改',
tools: '工具',
track: 'Track',
Expand Down Expand Up @@ -160,7 +160,11 @@ export default {
refersh_config: '配置修改后需要手动重新载入!'
},
tooltip: {
is_empty: '是否非空'
is_empty: '是否非空',
history_max: '查询历史超过系统最大限制将不再保存'
},
formatter: {
column: '表引擎{0}不支持ALTER操作'
},
table: {
engine: {
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Vue.prototype.stringFormat = StringUtils.format
Vue.prototype.isEmpty = StringUtils.isEmpty
Vue.prototype.isNotEmpty = StringUtils.isNotEmpty

import { getFaIcon, getTrackColor } from './utils/utils'
import { getFaIcon, getTrackColor } from './utils/Utils'
Vue.prototype.getFaIcon = getFaIcon
Vue.prototype.getTrackColor = getTrackColor

Expand Down Expand Up @@ -105,6 +105,8 @@ Vue.config.productionTip = false

Vue.prototype.commonLabelWidth120 = '120px'

ElementUI.Dialog.props.closeOnClickModal.default = false

new Vue({
components: { App },
router,
Expand Down
22 changes: 11 additions & 11 deletions src/renderer/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,57 +50,57 @@ export const constantRouterMap = [
{
path: '/data',
component: Layout,
redirect: '/data/source',
redirect: '/Data/Source',
name: 'DataSource',
meta: { title: i18n.t('router.data.source'), icon: 'adjust' },
children: [
{
path: 'source',
name: 'DataSource',
component: () => import('@/views/data/source/index'),
component: () => import('@/views/Data/Source/index'),
meta: { title: i18n.t('router.data.source'), icon: 'table' }
},
{
path: 'metadata/:name',
name: 'Metadata',
component: () => import('@/views/data/metadata/index'),
component: () => import('@/views/Data/Metadata/index'),
meta: { title: i18n.t('router.data.metadata'), icon: 'archive' }
},
{
path: 'detail/:server/:database/:table',
name: 'Detail',
hidden: true,
component: () => import('@/views/data/detail/index'),
component: () => import('@/views/Data/Detail/index'),
meta: { title: i18n.t('router.data.table.detail'), icon: 'password' }
}
]
},
{
path: '/monitor',
component: Layout,
redirect: '/monitor/processor',
redirect: '/Monitor/Processor',
name: 'Monitor',
new: false,
meta: { title: i18n.t('common.monitor'), icon: 'desktop' },
children: [
{
path: 'processor',
name: 'Processor',
component: () => import('@/views/monitor/processor'),
component: () => import('@/views/Monitor/Processor'),
meta: { title: i18n.t('common.processor'), icon: 'bullseye' }
},
{
path: 'connection',
name: 'Connection',
new: false,
component: () => import('@/views/monitor/connection'),
component: () => import('@/views/Monitor/Connection'),
meta: { title: i18n.t('common.connection'), icon: 'compress' }
},
{
path: 'mutations',
name: 'Mutations',
new: false,
component: () => import('@/views/monitor/mutations'),
component: () => import('@/views/Monitor/Mutations'),
meta: { title: i18n.t('common.mutations'), icon: 'anchor' }
}
]
Expand All @@ -109,19 +109,19 @@ export const constantRouterMap = [
path: '/tools',
component: Layout,
name: i18n.t('common.tools'),
redirect: '/tools/track',
redirect: '/Tools/Track',
meta: { title: i18n.t('common.tools'), icon: 'tools' },
children: [
{
path: 'track',
name: 'Track',
component: () => import('@/views/tools/track'),
component: () => import('@/views/Tools/Track'),
meta: { title: i18n.t('common.track'), icon: 'wrench' }
},
{
path: 'migrate',
name: 'Migrate',
component: () => import('@/views/tools/migrate'),
component: () => import('@/views/Tools/Migrate'),
meta: { title: i18n.t('common.migrate'), icon: 'exchange-alt' }
}
]
Expand Down
34 changes: 34 additions & 0 deletions src/renderer/services/ColumnService.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { getQuery } from './Metadata'

const StringUtils = require('../utils/StringUtils')
const ColumnUtils = require('../utils/ColumnUtils')

export async function addColumns(configure, columns) {
const sql = StringUtils.format('ALTER TABLE {0}.{1} {2}',
[configure.database, configure.table, ColumnUtils.builderAddColumnDDL(columns)])
return getQuery(configure.server, sql)
}

export function deleteColumn(configure) {
const sql = StringUtils.format('ALTER TABLE {0}.{1} DROP COLUMN {2}',
[configure.database, configure.table, configure.column])
return getQuery(configure.server, sql)
}

export function modifyColumn(configure, column) {
const sql = StringUtils.format('ALTER TABLE {0}.{1} MODIFY COLUMN {2}',
[configure.database, configure.table, ColumnUtils.builderColumnToString(column)])
return getQuery(configure.server, sql)
}

export function renameColumn(configure, value) {
const sql = StringUtils.format('ALTER TABLE {0}.{1} RENAME COLUMN {2} TO {3}',
[configure.database, configure.table, configure.column, value])
return getQuery(configure.server, sql)
}

export function previewColumn(configure) {
const sql = StringUtils.format('SELECT {0} FROM {1}.{2} LIMIT 100',
[configure.column, configure.database, configure.table])
return getQuery(configure.server, sql)
}
27 changes: 24 additions & 3 deletions src/renderer/services/ContextMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function getContextMenu(type) {
case Support.SERVER:
add.type = Support.SERVER
menus.push(add, {
name: i18n.t('common.infomation'),
name: i18n.t('common.information'),
command: Support.INFO,
icon: Support.INFO_ICON,
type: Support.SERVER
Expand All @@ -35,6 +35,11 @@ export function getContextMenu(type) {
case Support.TABLE:
deleted.type = Support.TABLE
menus.push(deleted, {
name: StringUtils.format('{0}{1}', [i18n.t('common.add'), i18n.t('common.column')]),
command: Support.ADD,
icon: Support.ADD_ICON,
type: Support.TABLE
}, {
name: i18n.t('common.ddl'),
command: Support.DDL,
icon: Support.DDL_ICON,
Expand All @@ -52,11 +57,27 @@ export function getContextMenu(type) {
})
break
case Support.COLUMN:
menus.push({
name: StringUtils.format('{0}{1}', [i18n.t('common.column'), i18n.t('common.infomation')]),
deleted.type = Support.COLUMN
menus.push(deleted, {
name: i18n.t('common.edit'),
command: Support.EDIT,
icon: Support.EDIT_ICON,
type: Support.COLUMN
}, {
name: i18n.t('common.rename'),
command: Support.RENAME,
icon: Support.EDIT_ICON,
type: Support.COLUMN
}, {
name: i18n.t('common.preview'),
command: Support.PREVIEW,
icon: Support.PREVIEW_ICON,
type: Support.COLUMN
}, {
name: i18n.t('common.information'),
command: Support.INFO,
icon: Support.INFO_ICON,
type: Support.COLUMN
})
break
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/Migrate.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export async function migrate(source, target) {
// step 4: create table on target server
let tableCreate = false
if (!tableExists) {
const gqr = await getQuery(source.server, tableDdl)
const gqr = await getQuery(target.server, tableDdl)
if (gqr && gqr.status) {
tableCreate = true
}
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/services/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function saveQuery(queryHistory) {
if (histroy.length > 0) {
index = histroy.length + 1
}
if (index < 100) {
if (index <= 100) {
queryHistory.id = index
histroy.unshift(queryHistory)
localStorage.setItem('QueryHistory', JSON.stringify(histroy))
Expand Down
6 changes: 4 additions & 2 deletions src/renderer/services/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,13 @@ export function getTableColumnInfo(server, database, table, column) {
SELECT
"database",
"table",
type,
replace(replace(type, 'Nullable(', ''), ')', '') AS type,
name,
is_in_primary_key AS isPrimaryKey,
is_in_partition_key AS isPartitionKey,
is_in_sorting_key AS isSortingKey
is_in_sorting_key AS isSortingKey,
"comment" AS "comment",
if (position(type, 'Nullable') > 0, 'true', 'false') AS empty
FROM
"system".columns
WHERE
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/DataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default class DataSource {
host = 'localhost';
port = 8123;
username = 'default';
password = null;
password = '';
status = false;
message = 'Please check whether the version of Clickhouse supports it!';
delivery = false;
Expand Down
28 changes: 28 additions & 0 deletions src/renderer/utils/ColumnUtils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const StringUtils = require('./StringUtils')

export function builderAddColumnsDDL(columns) {
const columnsDDL = []
if (StringUtils.getLengthGtZone(columns)) {
columns.forEach(column => {
columnsDDL.push(builderAddColumnDDL(column))
})
}
return columnsDDL
}

export function builderAddColumnDDL(column) {
return StringUtils.format('ADD COLUMN {0}', [builderColumnToString(column)])
}

export function builderColumnToString(column) {
let columnString
if (StringUtils.isNotEmpty(column)) {
columnString = column.name
const columnType = column.empty ? StringUtils.format('Nullable({0})', [column.type]) : column.type
columnString = StringUtils.format('{0} {1}', [columnString, columnType])
if (StringUtils.isNotEmpty(column.comment)) {
columnString = StringUtils.format(`{0} COMMENT '{1}'`, [columnString, column.comment])
}
}
return columnString
}
File renamed without changes.
Loading

0 comments on commit 21a4965

Please sign in to comment.