Skip to content

Commit

Permalink
Mainly for ticket #539, bunch of changes, updates and improvements
Browse files Browse the repository at this point in the history
- Ticket #539: Table data INSERTION process
	- The workbench now supports the insertion process for all standard tables via the UI through right-click actions.
	- A tree view structure has been implemented for listing table structures. This structure accommodates all table complexities, including various depths and nesting levels, ensuring accurate representation.
	- Real-time validation is provided for all supported Cassandra data types, such as integer, date, UUID, etc.
	- For each data type, appropriate functions and tools are available for seamless insertion. For example, date types include user-friendly date/time pickers, while UUID types are automatically populated with relevant functions like `uuid()`.
	- For `blob` type, a file with maxium set size in the workbench's config file can be uploaded, the workbench will convert it to hexadecimal string, blob content can also be previewed easily - if it's safe to do that -, for now, images and documents are fully supported.
		- This feature can be disabled via the option `previewBlob` under the `features` section, the maximum allowed size for a file to be uploaded and converted to proper blob content can be changed via the option `insertBlobSize` under the `limit` section.
	- NULL values can be easily set for fields, alongside the ability to ignore non-mandatory fields during insertion.
	- Data requiring conversion via built-in Cassandra functions is automatically handled. For instance, when inserting a timestamp into a date type, the workbench will automatically include the toDate() function in the generated insertion statement.
	- Support has been added for setting the TTL (Time to Live), data creation timestamp, and write consistency level during data insertion.
	- JSON data format insertion is now supported, including the ability to set default values for omitted columns in JSON format.

- Minor changes and update
	- New phrases have been added to the languages files.
	- New packages have been added, and other have been removed.
	- Renamed a few labels in the UI.
	- Minor other changes and updates.
  • Loading branch information
mhmdkrmabd committed Feb 17, 2025
1 parent 779f74d commit 5974cc6
Show file tree
Hide file tree
Showing 34 changed files with 17,758 additions and 3,961 deletions.
2 changes: 2 additions & 0 deletions config/app-config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ language=en
[limit]
sandbox=1
cqlsh=10
insertBlobSize=1GB

[sshtunnel]
readyTimeout=60000
Expand All @@ -18,6 +19,7 @@ forwardTimeout=60000
sandboxProjects=true
containersManagementTool=none
basicCQLSH=true
previewBlob=true

[updates]
checkForUpdates=true
Expand Down
2 changes: 1 addition & 1 deletion custom_node_modules/main/reports.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion localization/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "نظام التسجيل",
"logging": "تسجيل",
"logout": "تسجيل خروج",
"mandatory field": "حقل إجباري",
"mandatory": "إجباري",
"maximum number": "الرقم الأقصى",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "تم نسخ البيانات الوصفية للعنقود المُتصَل به من خلال [b]$data[/b]، حجم البيانات هو $data",
"missing variables": "المتغيرات المفقودة",
Expand Down
2 changes: 1 addition & 1 deletion localization/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "logging system",
"logging": "logging",
"logout": "logout",
"mandatory field": "mandatory field",
"mandatory": "mandatory",
"maximum number": "maximum number",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data",
"missing variables": "missing variables",
Expand Down
2 changes: 1 addition & 1 deletion localization/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "Sistema de registro",
"logging": "Registro",
"logout": "Cerrar sesión",
"mandatory field": "Campo obligatorio",
"mandatory": "obligatorio",
"maximum number": "Número máximo",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "Los metadatos del clúster conectado por [b]$data[/b] se han copiado en el portapapeles, el tamaño es $data",
"missing variables": "Variables faltantes",
Expand Down
2 changes: 1 addition & 1 deletion localization/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "système d’enregistrement",
"logging": "exploitation forestière",
"logout": "déconnexion",
"mandatory field": "Champ obligatoire",
"mandatory": "obligatoire",
"maximum number": "nombre maximum",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "Les métadonnées du cluster connecté par [b]$data[/b] ont été copiées dans le presse-papiers, leur taille est de $data",
"missing variables": "Variables manquantes",
Expand Down
2 changes: 1 addition & 1 deletion localization/gl.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "Sistema de rexistro",
"logging": "Rexistro",
"logout": "Logout",
"mandatory field": "Campo obrigatorio",
"mandatory": "obrigatorio",
"maximum number": "Número máximo",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "Os metadatos para o cluster conectado a [b]$data[/b] foron copiados no portapapeis, o tamaño é $data",
"missing variables": "Faltan variables",
Expand Down
2 changes: 1 addition & 1 deletion localization/iw.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "מערכת רישום",
"logging": "רישום",
"logout": "התנתקות",
"mandatory field": "שדה חובה",
"mandatory": "הֶכְרֵחִי",
"maximum number": "מספר מרבי",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "מטה-נתונים עבור האשכול המחובר באמצעות [b]$data[/b] הועתקו ללוח, הגודל הוא $data",
"missing variables": "משתנים חסרים",
Expand Down
2 changes: 1 addition & 1 deletion localization/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"logging system": "测井系统",
"logging": "伐木",
"logout": "注销",
"mandatory field": "必填字段",
"mandatory": "强制的",
"maximum number": "最大数量",
"metadata for the cluster connected to by [b]$data[/b] has been copied to the clipboard, the size is $data": "通过 [b]$data[/b] 连接的集群的元数据已复制到剪贴板,大小为 $data",
"missing variables": "缺少变量",
Expand Down
31 changes: 30 additions & 1 deletion main/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ const Electron = require('electron'),
* https://www.electronjs.org/docs/latest/api/menu-item
*
*/
MenuItem = Electron.MenuItem
MenuItem = Electron.MenuItem,
NativeImage = Electron.nativeImage

/**
* Import modules globally
Expand Down Expand Up @@ -776,6 +777,28 @@ App.on('second-instance', () => {
})
})
}

{
IPCMain.on('blob:read-convert', (_, data) => {
// Send the request to the background processes' renderer thread
views.backgroundProcesses.webContents.send('blob:read-convert', data)

IPCMain.on(`blob:read-convert:result:${data.requestID}`, (_, data) => {
// Send the response to the renderer thread
views.main.webContents.send(`blob:read-convert:result:${data.requestID}`, data)
})
})

IPCMain.on('blob:convert-write', (_, data) => {
// Send the request to the background processes' renderer thread
views.backgroundProcesses.webContents.send('blob:convert-write', data)

IPCMain.on(`blob:convert-write:result:${data.requestID}`, (_, data) => {
// Send the response to the renderer thread
views.main.webContents.send(`blob:convert-write:result:${data.requestID}`, data)
})
})
}
}

/**
Expand Down Expand Up @@ -924,6 +947,12 @@ App.on('second-instance', () => {
try {
item.click = eval(item.click)
} catch (e) {}

try {
item.icon = NativeImage.createFromPath(item.icon)
} catch (e) {
item.icon = ''
}
} catch (e) {}
}
}
Expand Down
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@
"main/bin",
"config"
],
"publish": [
{
"provider": "github"
}
],
"publish": [{
"provider": "github"
}],
"artifactName": "AxonOps.Workbench-${version}-${os}-${arch}.${ext}",
"win": {
"icon": "./renderer/assets/images/axonops-icon-256x256.ico",
Expand Down Expand Up @@ -347,11 +345,14 @@
"autosize": "^6.0.1",
"axios": "^1.7.9",
"better-sqlite3": "^11.8.1",
"byte-size": "^8.1.1",
"bytes": "^3.1.2",
"chart.js": "^4.4.7",
"cheerio": "^1.0.0",
"co": "^4.6.0",
"configparser": "^0.3.10",
"convert-hex": "^0.1.0",
"debug": "^4.4.0",
"detect-file-type": "^0.2.8",
"diff": "^5.2.0",
"dotenv": "^16.4.7",
"electron-context-menu": "^3.6.1",
Expand All @@ -363,6 +364,7 @@
"highlight.js": "^11.11.1",
"i18next": "^22.4.9",
"id-16": "^1.0.5",
"is-timestamp": "^1.0.0",
"jquery": "^3.6.3",
"jquery-sortablejs": "^1.6.1",
"jquery.json-viewer": "^1.5.0",
Expand Down Expand Up @@ -398,7 +400,9 @@
"tinykeys": "^2.1.0",
"tree-kill": "^1.2.2",
"url-join": "^5.0.0",
"uuid": "^11.0.5",
"v8-compile-cache": "^2.3.0",
"validate-date": "^2.1.0",
"value-size": "^1.0.1",
"xterm-theme": "^1.1.0",
"xterm-webfont": "^2.0.0",
Expand Down
14 changes: 14 additions & 0 deletions renderer/assets/images/icons/calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions renderer/assets/images/icons/function.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions renderer/assets/images/icons/time-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 54 additions & 1 deletion renderer/js/background_processes.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ const FS = require('fs-extra'),
* Working with file and directory paths, and providing useful utilities
*/
Path = require('path'),
/**
* Node.js OS module
* Used for operating system-related utilities and properties
*/
OS = require('os'),
// JQuery library
$ = require('jquery'),
jQuery = $,
Expand All @@ -53,7 +58,11 @@ const FS = require('fs-extra'),
*/
SSH2Utils = require('ssh2').utils,
// JS module for text differencing implementation
Diff = require('diff')
Diff = require('diff'),
// Convert to/from HEX strings and byte arrays
ConvertHEX = require('convert-hex'),
// Sanitize a string to be safe for use as a file name; by removing directory paths and invalid characters
Sanitize = require('sanitize-filename')

/**
* Get the set extra resources path
Expand Down Expand Up @@ -472,5 +481,49 @@ $(document).ready(() => IPCRenderer.on('extra-resources-path', (_, path) => {
})
})
}

// Handle `blob` content bi-directional conversion
{
IPCRenderer.on('blob:read-convert', (_, data) => {
let itemHEXString = ''

try {
let itemBuffer = FS.readFileSync(data.itemPath)

itemHEXString = ConvertHEX.bytesToHex(Array.from(itemBuffer))

itemHEXString = `0x${itemHEXString}`
} catch (e) {}

IPCRenderer.send(`blob:read-convert:result:${data.requestID}`, {
itemHEXString,
requestID: data.requestID
})
})

IPCRenderer.on('blob:convert-write', (_, data) => {
let itemTempFile = ``,
error = false

try {
let blobBytes = ConvertHEX.hexToBytes(data.blobHEXString),
itemBuffer = Buffer.from(blobBytes)

itemTempFile = Path.join(OS.tmpdir(), Sanitize(`preview_item_${data.randomID}`))

itemTempFile = `${itemTempFile}.${data.itemType}`

FS.writeFileSync(itemTempFile, itemBuffer)
} catch (e) {
error = true
} finally {
IPCRenderer.send(`blob:convert-write:result:${data.requestID}`, {
itemTempFile,
error,
requestID: data.requestID
})
}
})
}
}
}))
Loading

0 comments on commit 5974cc6

Please sign in to comment.