forked from DigitalBox98/SimpleExtJSApp
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Add initial support of the SSH client. Improved UI
- Loading branch information
1 parent
925ec3e
commit 7eaf807
Showing
12 changed files
with
576 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
SPK_NAME = rr-manager | ||
SPK_VERS = 2.0 | ||
SPK_REV = 57 | ||
SPK_REV = 58 | ||
SPK_ICON = src/rr-manager.png | ||
|
||
DSM_UI_DIR = ui | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Ext.define("SYNOCOMMUNITY.RRManager.IframePanel", { | ||
extend: "SYNO.ux.Panel", | ||
constructor: function (config) { | ||
this.callParent([this.fillConfig(config)]); | ||
}, | ||
|
||
fillConfig: function (config) { | ||
const me = this; | ||
const cfg = { | ||
items: [ | ||
{ | ||
itemId: "iframeBox", | ||
xtype: "box", | ||
cls: "iframe-panel", | ||
html: '<iframe src="' + (config.iframeSrc || '') + '" style="width:100%; height:100%; border:none;"></iframe>', | ||
} | ||
], | ||
listeners: { | ||
scope: me, | ||
afterrender: me.onAfterRender, | ||
update: me.updateIframe, | ||
src_change: me.onSrcChange | ||
} | ||
}; | ||
return Ext.apply(cfg, config); | ||
}, | ||
|
||
onAfterRender: function () { | ||
// Example: Add a click event listener if needed | ||
this.mon(this.body, "click", this.onMouseClick, this); | ||
}, | ||
|
||
updateIframe: function () { | ||
const iframeBox = this.getComponent("iframeBox"); | ||
iframeBox.update('<iframe src="' + this.iframeSrc + '" style="width:100%; height:100%; border:none;"></iframe>'); | ||
}, | ||
|
||
setSrc: function (src) { | ||
this.iframeSrc = src; | ||
this.fireEvent('src_change'); | ||
}, | ||
|
||
onSrcChange: function () { | ||
this.updateIframe(); | ||
}, | ||
|
||
onMouseClick: function () { | ||
// Example: Fire an event when the iframe panel is clicked | ||
this.fireEvent("iframeclick", this); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Terminal } from '@xterm/xterm'; | ||
import { WebLinksAddon } from '@xterm/addon-web-links'; | ||
|
||
export default | ||
Ext.define('SYNOCOMMUNITY.RRManager.TerminalPanel', { | ||
extend: "SYNO.ux.Panel", | ||
|
||
constructor: function (config) { | ||
this.callParent([this.fillConfig(config)]); | ||
}, | ||
|
||
fillConfig: function (config) { | ||
const me = this; | ||
const cfg = { | ||
itemId: "iframeBox", | ||
cls: "iframe-panel", | ||
html: '<div class="terminal-container" style="width:100%; height:100%;"></div>', | ||
listeners: { | ||
scope: me, | ||
afterrender: me.onAfterRender, | ||
resize: me.onResize | ||
} | ||
}; | ||
return Ext.apply(cfg, config); | ||
}, | ||
|
||
onAfterRender: function () { | ||
const me = this; | ||
// Defer the initialization to ensure the DOM is ready | ||
Ext.defer(function () { | ||
const containerEl = me.getEl().dom | ||
// Initialize the xterm Terminal | ||
me.terminal = new Terminal({ | ||
cols: 80, | ||
rows: 24 | ||
}); | ||
|
||
me.terminal.open(containerEl); | ||
|
||
// Optional: You can add some initial content to the terminal | ||
me.terminal.write('Welcome to the xterm.js terminal!\r\n'); | ||
|
||
// Adjust terminal size to fit the container | ||
me.resizeTerminal(); | ||
}, 50); | ||
}, | ||
|
||
onResize: function () { | ||
this.resizeTerminal(); | ||
}, | ||
|
||
resizeTerminal: function () { | ||
const me = this; | ||
if (me.terminal) { | ||
const containerEl = me.getEl().dom; | ||
const width = containerEl.clientWidth; | ||
const height = containerEl.clientHeight; | ||
|
||
// Calculate new cols and rows based on the container size | ||
const cols = Math.floor(width / me.terminal._core._renderService.dimensions.actualCellWidth); | ||
const rows = Math.floor(height / me.terminal._core._renderService.dimensions.actualCellHeight); | ||
if (cols && rows){ | ||
me.terminal.resize(cols, rows); | ||
} | ||
} | ||
}, | ||
|
||
// Optional: Method to send data to the terminal | ||
write: function (data) { | ||
if (this.terminal) { | ||
this.terminal.write(data); | ||
} | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.