Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to create a custom widget under DSM #5768

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions spk/simpleextjswidget/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SPK_NAME = simpleextjswidget
SPK_VERS = 0.1
SPK_REV = 1
SPK_ICON = src/simpleextjswidget.png
WIZARDS_DIR = WIZARD_UIFILES
DSM_UI_DIR = app

DEPENDS =
WHEELS = flask

override ARCH=

MAINTAINER = DigitalBox98

DESCRIPTION = SimpleExtJS Widget demo to illustrate the usage of Syno ExtJS framework for DSM. This package is for experienced users.
STARTABLE = no
DISPLAY_NAME = SimpleExtJSWidget

HOMEPAGE = https://github.com/DigitalBox98/SimpleExtJSApp

POST_STRIP_TARGET = simpleextjswidget_install

include ../../mk/spksrc.spk.mk

.PHONY: simpleextjswidget_install
simpleextjswidget_install:
install -m 755 -d $(STAGING_DIR)/var/
install -m 755 -d $(STAGING_DIR)/app/
install -m 644 src/app/config $(STAGING_DIR)/app/config
install -m 644 src/app/simpleextjswidget.js $(STAGING_DIR)/app/simpleextjswidget.js
install -m 755 -d $(STAGING_DIR)/app/texts
for language in enu fre; do \
install -m 755 -d $(STAGING_DIR)/app/texts/$${language}; \
install -m 644 src/app/texts/$${language}/strings $(STAGING_DIR)/app/texts/$${language}/strings; \
done
1 change: 1 addition & 0 deletions spk/simpleextjswidget/PLIST
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rsc:README
10 changes: 10 additions & 0 deletions spk/simpleextjswidget/WIZARD_UIFILES/install_uifile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{
"step_title": "Information",
"items": [
{
"desc": "SimpleExtJSWidget is a demo DSM widget aimed to document Synology's GUI framework based on ExtJS.<br><br>For more information, you can visit the <a target=\"_blank\" href=\"https://github.com/DigitalBox98/SimpleExtJSApp\">SimpleExtJSApp Github page</a>."
}
]
}
]
13 changes: 13 additions & 0 deletions spk/simpleextjswidget/src/app/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"simpleextjswidget.js": {
"SYNOCOMMUNITY.SimpleExtJSApp.WidgetCustom": {
"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 spk/simpleextjswidget/src/app/simpleextjswidget.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// Namespace definition
Ext.ns("SYNOCOMMUNITY.SimpleExtJSApp");

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

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

Ext.define("SYNOCOMMUNITY.SimpleExtJSApp.WidgetCustom", {
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("app", "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.SimpleExtJSApp.WidgetCustom.superclass.destroy.call(this)
}
});
5 changes: 5 additions & 0 deletions spk/simpleextjswidget/src/app/texts/enu/strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[app]
app_name = "SimpleExtJSWidget"
description = "ExtJS Demo Widget"
index_title = "Help documentation"
message = "Simple widget !"
5 changes: 5 additions & 0 deletions spk/simpleextjswidget/src/app/texts/fre/strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[app]
app_name = "SimpleExtJSWidget"
description = "Widget ExtJS de démonstration"
index_title = "Aide"
message = "Widget simple !"
2 changes: 2 additions & 0 deletions spk/simpleextjswidget/src/conf/resource
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
Binary file added spk/simpleextjswidget/src/simpleextjswidget.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.