Skip to content

Commit

Permalink
Add initial support for RRm widget
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriiNazarenkoTine committed Apr 7, 2024
1 parent 90dd192 commit 5632759
Show file tree
Hide file tree
Showing 4 changed files with 149 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SPK_NAME = rr-manager
SPK_VERS = 2.0
SPK_REV = 19
SPK_REV = 20
SPK_ICON = src/rr-manager.png

DSM_UI_DIR = app
Expand Down Expand Up @@ -76,6 +76,7 @@ rr-manager_extra_install:
install -m 755 src/app/checkUpdateStatus.cgi $(STAGING_DIR)/app/checkUpdateStatus.cgi
install -m 644 src/app/config $(STAGING_DIR)/app/config
install -m 644 src/app/rr-manager.js $(STAGING_DIR)/app/rr-manager.js
install -m 644 src/app/rr-manager.widget.js $(STAGING_DIR)/app/rr-manager.widget.js
install -m 644 src/app/helptoc.conf $(STAGING_DIR)/app/helptoc.conf
install -m 755 src/app/createsqlitedata.sql $(STAGING_DIR)/app/createsqlitedata.sql
install -m 755 src/app/createsqlitedata.cgi $(STAGING_DIR)/app/createsqlitedata.cgi
Expand Down
11 changes: 11 additions & 0 deletions src/app/config
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,16 @@
"icon": "images/rr-manager-{0}.png",
"texts": "texts"
}
},
"rr-manager.widget.js": {
"SYNOCOMMUNITY.RRManager.Widget": {
"type": "widget",
"title": "Customized",
"icon": "images\/{1}\/wdgt_icn_title_system_info.png",
"appInstance": "SYNO.SDS.AdminCenter.Application",
"launchParam": "{\"fn\":\"SYNO.SDS.AdminCenter.InfoCenter.Main\"}",
"depend": ["SYNO.SDS._Widget.GridPanel"],
"texts": "texts"
}
}
}
133 changes: 133 additions & 0 deletions src/app/rr-manager.widget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// Namespace definition
Ext.ns('SYNOCOMMUNITY.RRManager');

// Translator
_V = function (category, element) {
return _TT("SYNOCOMMUNITY.RRManager.Widget", category, element)
}

Ext.ns("SYNO.SDS.SystemInfoApp");

Ext.define("SYNOCOMMUNITY.RRManager.Widget", {
extend: "Ext.Panel",
minimizable: true,
taskButton: undefined,
constructor: function constructor(a) {
this.initializeSouthTable();
var b = Ext.apply(this.getConfig(), a);
SYNOCOMMUNITY.SimpleExtJSApp.WidgetCustom.superclass.constructor.call(this, b);
this.westIcon = this.getIconComponent();
this.centerContent = this.getContentComponent();
this.isActive = false;
this.timestamp = null;
this.uptime = null;
this.appSetting = SYNO.SDS.SystemInfoApp.SystemHealthDefaultApp
},
getConfig: function getConfig() {
return {
layout: "fit",
border: false,
defaults: {
border: false
},
items: [this.getViewConfig()]
}
},
getViewConfig: function getViewConfig() {
return {
itemId: "layoutPanel",
layout: "vbox",
height: "100%",
border: false,
padding: "4px 12px 5px 12px",
cls: "syno-sysinfo-system-health",
defaults: {
border: false
},
items: [{
xtype: "container",
itemId: "northPanel",
height: 20,
width: 296,
cls: "syno-sysinfo-system-health-status",
items: [{
xtype: "box",
itemId: "westIcon"
}, {
xtype: "box",
itemId: "centerContent",
region: "center"
}]
}, {
region: "south",
height: 84,
width: 296,
items: this.southTable
}]
}
},
doCollapse: function doCollapse() {
this.getEl().setHeight(84);
this.doLayout()
},
doExpand: function doExpand() {
this.getEl().setHeight(172);
this.doLayout()
},
setApp: function setApp(a) {
this.appSetting = a
},

getIconComponent: function getIconComponent() {
return this.getComponent("layoutPanel").getComponent("northPanel").getComponent("westIcon")
},
getContentComponent: function getContentComponent() {
return this.getComponent("layoutPanel").getComponent("northPanel").getComponent("centerContent")
},
onClickTitle: function onClickTitle() {
SYNO.SDS.AppLaunch(this.appSetting.appInstance, this.appSetting.launchParam)
},
onActivate: function onActivate() {
this.isActive = true;
},
onDeactivate: function onDeactivate() {
this.isActive = false;
this.unmask()
},
mask: Ext.emptyFn,
unmask: Ext.emptyFn,
initializeSouthTable: function initializeSouthTable() {
var b = Ext.util.Format.htmlEncode(_V("widget", "message"));
var c = Ext.util.Format.htmlEncode(_S("hostname"));
this.southTable = new Ext.Panel({
layout: "table",
itemId: "southTable",
cls: "sys-info-south-table",
margins: 0,
height: 84,
layoutConfig: {
columns: 2,
cellCls: "sys-info-row"
},
items: [{
xtype: "box",
html: String.format('<p ext:qtip="{1}" class="syno-sysinfo-system-health-south-title">{0}</p>', b, Ext.util.Format.htmlEncode(b))
}, {
xtype: "box",
html: String.format('<p ext:qtip="{1}" class="syno-sysinfo-system-health-south-data">{0}</p>', c, Ext.util.Format.htmlEncode(c))
}]
})
},

destroy: function destroy() {
var a = this;
a.onDeactivate();
if (a.taskButton) {
Ext.destroy(a.taskButton)
}
if (a.southGrid && a.southGrid.getStore()) {
a.southGrid.getStore().destroy()
}
SYNOCOMMUNITY.RRManager.Widget.superclass.destroy.call(this)
}
});
3 changes: 3 additions & 0 deletions src/app/texts/enu/strings
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,6 @@ col_version="Verison"
col_name="Name"
col_description="Description"


[widget]
message="Hello world!"

0 comments on commit 5632759

Please sign in to comment.