Skip to content

Commit 86b240a

Browse files
mhmdkrmabddigiserg
andauthored
Tickets #390, #558, #664, #771, #813, #867, #957, updates & improvements (#1031)
Co-authored-by: Sergio Rua <58211930+digiserg@users.noreply.github.com>
1 parent 77dd114 commit 86b240a

File tree

29 files changed

+297
-78
lines changed

29 files changed

+297
-78
lines changed

custom_modules/main/pty.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,22 @@ class Pty {
188188
throw 0
189189

190190
// Add the received data to the variable
191-
instance.allOutput += minifyText(data)
191+
instance.allOutput += minifyText(data, false)
192192

193193
// If any of the keywords have been found
194-
if ((['KEYWORD:OUTPUT:COMPLETED:ALL', 'KEYWORD:CQLSH:STARTED', 'cqlsh>']).some((keyword) => instance.allOutput.indexOf(minifyText(keyword)) != -1)) {
194+
if ((['KEYWORD:OUTPUT:COMPLETED:ALL', 'KEYWORD:CQLSH:STARTED', 'cqlsh>']).some((keyword) => instance.allOutput.indexOf(minifyText(keyword, false)) != -1)) {
195+
let loggedInUsername = ''
196+
197+
try {
198+
loggedInUsername = instance.allOutput.match(/KEYWORD\:USERNAME\:\[(.*?)\]/i)[1]
199+
} catch (e) {}
200+
195201
// Add the ignore keyword
196202
instance.allOutput = 'ignore-text'
197203

198204
// Send the `started` keyword to the renderer thread
199205
return instance[instance.windowBackground != null ? 'windowBackground' : 'window'].webContents.send(`pty:data:${instance.id}`, {
200-
output: 'KEYWORD:CQLSH:STARTED'
206+
output: (`${loggedInUsername}`.length != 0 ? (OS.EOL + `KEYWORD:USERNAME:[${loggedInUsername}] `) : '') + 'KEYWORD:CQLSH:STARTED'
201207
})
202208
}
203209
} catch (e) {
@@ -1282,7 +1288,7 @@ let cleanCommand = (command) => {
12821288
*
12831289
* @Return: {string} the manipulated text
12841290
*/
1285-
let minifyText = (text) => {
1291+
let minifyText = (text, toLowerCase = true) => {
12861292
// Define the regex expression to be created
12871293
let regexs = ['\\n', '\\r']
12881294

@@ -1296,7 +1302,10 @@ let minifyText = (text) => {
12961302
})
12971303

12981304
// Call the text manipulation function
1299-
text = `${text}`.replace(/\s+/gm, '').toLowerCase()
1305+
text = `${text}`.replace(/\s+/gm, '')
1306+
1307+
if (toLowerCase)
1308+
text = `${text}`.toLowerCase()
13001309

13011310
// Return final result
13021311
return text

custom_modules/renderer/connections.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,21 @@ let getPrePostScripts = async (workspaceID, connectionID = null) => {
18381838
}
18391839
}
18401840

1841+
let ignoredConnections = [],
1842+
watchConnectionPath = (connectionID, connectionPath, callback) => {
1843+
if (Modules.Connections.ignoredConnections.includes(connectionID)) {
1844+
Modules.Connections.ignoredConnections = Modules.Connections.ignoredConnections.filter((id) => id != connectionID)
1845+
return
1846+
}
1847+
1848+
setTimeout(() => {
1849+
if (!pathIsAccessible(connectionPath, false))
1850+
return callback()
1851+
1852+
watchConnectionPath(connectionID, connectionPath, callback)
1853+
}, getRandom.numberInterval(1000, 10000))
1854+
}
1855+
18411856
module.exports = {
18421857
// Main connection's operations
18431858
getConnections,
@@ -1859,5 +1874,7 @@ module.exports = {
18591874
getSnapshots,
18601875
getNewestSnapshot,
18611876
executeScript,
1862-
getPrePostScripts
1877+
getPrePostScripts,
1878+
ignoredConnections,
1879+
watchConnectionPath
18631880
}

custom_modules/renderer/workspaces.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,27 @@ let deleteWorkspace = async (workspace, workspaces, keepFiles = false) => {
382382
}
383383
}
384384

385+
let ignoredWorkspaces = [],
386+
watchWorkspacePath = (workspaceID, workspacePath, callback) => {
387+
if (Modules.Workspaces.ignoredWorkspaces.includes(workspaceID)) {
388+
Modules.Workspaces.ignoredWorkspaces = Modules.Workspaces.ignoredWorkspaces.filter((id) => id != workspaceID)
389+
return
390+
}
391+
392+
setTimeout(() => {
393+
if (!pathIsAccessible(workspacePath, false))
394+
return callback()
395+
396+
watchWorkspacePath(workspaceID, workspacePath, callback)
397+
}, getRandom.numberInterval(1000, 10000))
398+
}
399+
385400
module.exports = {
386401
getWorkspaces,
387402
getWorkspacesNoAsync,
388403
saveWorkspace,
389404
updateWorkspace,
390-
deleteWorkspace
405+
deleteWorkspace,
406+
ignoredWorkspaces,
407+
watchWorkspacePath
391408
}

data/credits.db

0 Bytes
Binary file not shown.
-231 KB
Binary file not shown.
-226 KB
Binary file not shown.
-223 KB
Binary file not shown.
-226 KB
Binary file not shown.
-221 KB
Binary file not shown.
-229 KB
Binary file not shown.

0 commit comments

Comments
 (0)