Skip to content

Commit c04faac

Browse files
[WIP] fix define extjs ns
1 parent 71ee956 commit c04faac

File tree

4 files changed

+108
-104
lines changed

4 files changed

+108
-104
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SPK_NAME = rr-manager
22
SPK_VERS = 2.0
3-
SPK_REV = 33
3+
SPK_REV = 34
44
SPK_ICON = src/rr-manager.png
55

66
DSM_UI_DIR = app

src/src/appWindow.js

+70-68
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,75 @@
11
import helper from './utils/updateWizardHelper';
22
import SynoApiProvider from './utils/synoApiProvider';
3+
// Namespace definition
4+
Ext.ns('SYNOCOMMUNITY.RRManager');
35
export default
4-
// Window definition
5-
Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', {
6-
helper: SYNOCOMMUNITY.RRManager.Helper,
7-
apiProvider: SYNOCOMMUNITY.RRManager.SynoApiProvider,
8-
formatString: function (str, ...args) {
9-
return str.replace(/{(\d+)}/g, function (match, number) {
10-
return typeof args[number] !== 'undefined' ? args[number] : match;
11-
});
12-
},
13-
extend: "SYNO.SDS.PageListAppWindow",
14-
activePage: "SYNOCOMMUNITY.RRManager.Overview.Main",
15-
defaultWinSize: { width: 1160, height: 620 },
16-
constructor: function (config) {
17-
const t = this;
18-
t.callParent([t.fillConfig(config)]);
19-
this.apiProvider.init(this.sendWebAPI.bind(this));
20-
},
21-
fillConfig: function (e) {
22-
let t;
23-
t = this.getListItems();
24-
const i = {
25-
cls: "syno-app-iscsi",
26-
width: this.defaultWinSize.width,
27-
height: this.defaultWinSize.height,
28-
minWidth: this.defaultWinSize.width,
29-
minHeight: this.defaultWinSize.height,
30-
activePage: "SYNOCOMMUNITY.RRManager.Overview.Main",
31-
listItems: t,
32-
};
33-
return Ext.apply(i, e), i;
6+
// Window definition
7+
Ext.define('SYNOCOMMUNITY.RRManager.AppWindow', {
8+
helper: SYNOCOMMUNITY.RRManager.Helper,
9+
apiProvider: SYNOCOMMUNITY.RRManager.SynoApiProvider,
10+
formatString: function (str, ...args) {
11+
return str.replace(/{(\d+)}/g, function (match, number) {
12+
return typeof args[number] !== 'undefined' ? args[number] : match;
13+
});
14+
},
15+
extend: "SYNO.SDS.PageListAppWindow",
16+
activePage: "SYNOCOMMUNITY.RRManager.Overview.Main",
17+
defaultWinSize: { width: 1160, height: 620 },
18+
constructor: function (config) {
19+
const t = this;
20+
t.callParent([t.fillConfig(config)]);
21+
this.apiProvider.init(this.sendWebAPI.bind(this));
22+
},
23+
fillConfig: function (e) {
24+
let t;
25+
t = this.getListItems();
26+
const i = {
27+
cls: "syno-app-iscsi",
28+
width: this.defaultWinSize.width,
29+
height: this.defaultWinSize.height,
30+
minWidth: this.defaultWinSize.width,
31+
minHeight: this.defaultWinSize.height,
32+
activePage: "SYNOCOMMUNITY.RRManager.Overview.Main",
33+
listItems: t,
34+
};
35+
return Ext.apply(i, e), i;
3436

35-
},
36-
getListItems: function () {
37-
return [
38-
{
39-
text: this.helper.V('ui', 'tab_general'),
40-
iconCls: "icon-overview",
41-
fn: "SYNOCOMMUNITY.RRManager.Overview.Main",
42-
// help: "overview.html",
43-
},
44-
{
45-
text: this.helper.V('ui', 'tab_addons'),
46-
iconCls: "icon-log",
47-
fn: "SYNOCOMMUNITY.RRManager.Addons.Main",
48-
// help: "overview.html",
49-
},
50-
{
51-
text: this.helper.V('ui', 'tab_configuration'),
52-
iconCls: "icon-settings",
53-
fn: "SYNOCOMMUNITY.RRManager.Setting.Main",
54-
// help: "setting.html",
55-
},
56-
{
57-
text: this.helper.V('ui', 'tab_debug'),
58-
iconCls: "icon-debug",
59-
fn: "SYNOCOMMUNITY.RRManager.Debug.Main",
60-
// help: "setting.html",
61-
},
62-
];
63-
},
37+
},
38+
getListItems: function () {
39+
return [
40+
{
41+
text: this.helper.V('ui', 'tab_general'),
42+
iconCls: "icon-overview",
43+
fn: "SYNOCOMMUNITY.RRManager.Overview.Main",
44+
// help: "overview.html",
45+
},
46+
{
47+
text: this.helper.V('ui', 'tab_addons'),
48+
iconCls: "icon-log",
49+
fn: "SYNOCOMMUNITY.RRManager.Addons.Main",
50+
// help: "overview.html",
51+
},
52+
{
53+
text: this.helper.V('ui', 'tab_configuration'),
54+
iconCls: "icon-settings",
55+
fn: "SYNOCOMMUNITY.RRManager.Setting.Main",
56+
// help: "setting.html",
57+
},
58+
{
59+
text: this.helper.V('ui', 'tab_debug'),
60+
iconCls: "icon-debug",
61+
fn: "SYNOCOMMUNITY.RRManager.Debug.Main",
62+
// help: "setting.html",
63+
},
64+
];
65+
},
6466

65-
onOpen: function (a) {
66-
this.apiProvider.runScheduledTask('MountLoaderDisk');
67-
SYNOCOMMUNITY.RRManager.AppWindow.superclass.onOpen.call(this, a);
68-
},
69-
onDestroy: function (e) {
70-
this.apiProvider.runScheduledTask('UnMountLoaderDisk');
71-
SYNOCOMMUNITY.RRManager.AppWindow.superclass.onDestroy.call(this);
72-
}
73-
});
67+
onOpen: function (a) {
68+
this.apiProvider.runScheduledTask('MountLoaderDisk');
69+
SYNOCOMMUNITY.RRManager.AppWindow.superclass.onOpen.call(this, a);
70+
},
71+
onDestroy: function (e) {
72+
this.apiProvider.runScheduledTask('UnMountLoaderDisk');
73+
SYNOCOMMUNITY.RRManager.AppWindow.superclass.onDestroy.call(this);
74+
}
75+
});

src/src/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// Namespace definition
2-
Ext.ns('SYNOCOMMUNITY.RRManager');
31
import AppWindow from './appWindow';
42

53
//tab main
@@ -21,6 +19,8 @@ import RrManagerConfigTab from './panels/settings/rrManagerConfigTab';
2119
import Debug from './tabs/debug';
2220
import DebugGeneralTab from './panels/debug/generalTab';
2321

22+
// Namespace definition
23+
Ext.ns('SYNOCOMMUNITY.RRManager');
2424
// Application definition
2525
Ext.define('SYNOCOMMUNITY.RRManager.AppInstance', {
2626
extend: 'SYNO.SDS.AppInstance',

src/src/utils/updateWizardHelper.js

+35-33
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,36 @@
1+
// Namespace definition
2+
Ext.ns('SYNOCOMMUNITY.RRManager');
13
export default
2-
SYNOCOMMUNITY.RRManager.Helper = {
3-
T: function (a, b) {
4-
return _T(a, b);
5-
},
6-
V: function (category, element) {
7-
return _TT("SYNOCOMMUNITY.RRManager.AppInstance", category, element)
8-
},
9-
formatString: function (str, ...args) {
10-
return str.replace(/{(\d+)}/g, function (match, number) {
11-
return typeof args[number] !== 'undefined' ? args[number] : match;
12-
});
13-
},
14-
maskLoading: function (a) {
15-
a.getEl().mask(this.T("common", "loading"), "x-mask-loading");
16-
},
17-
unmask: function (a) {
18-
a?.getEl()?.unmask();
19-
},
20-
mask: function (b, a) {
21-
b?.getEl()?.mask(a, "x-mask-loading");
22-
},
23-
diskSizeRenderer: function (a) {
24-
return Ext.util.Format.fileSize(a);
25-
},
26-
tryUnmaskAndReload: function (a, b, c) {
27-
this.unmask(a);
28-
// b.reload();
29-
// c();
30-
},
31-
getError: function (a) {
32-
return _T("error", a);
33-
},
34-
};
4+
SYNOCOMMUNITY.RRManager.Helper = {
5+
T: function (a, b) {
6+
return _T(a, b);
7+
},
8+
V: function (category, element) {
9+
return _TT("SYNOCOMMUNITY.RRManager.AppInstance", category, element)
10+
},
11+
formatString: function (str, ...args) {
12+
return str.replace(/{(\d+)}/g, function (match, number) {
13+
return typeof args[number] !== 'undefined' ? args[number] : match;
14+
});
15+
},
16+
maskLoading: function (a) {
17+
a.getEl().mask(this.T("common", "loading"), "x-mask-loading");
18+
},
19+
unmask: function (a) {
20+
a?.getEl()?.unmask();
21+
},
22+
mask: function (b, a) {
23+
b?.getEl()?.mask(a, "x-mask-loading");
24+
},
25+
diskSizeRenderer: function (a) {
26+
return Ext.util.Format.fileSize(a);
27+
},
28+
tryUnmaskAndReload: function (a, b, c) {
29+
this.unmask(a);
30+
// b.reload();
31+
// c();
32+
},
33+
getError: function (a) {
34+
return _T("error", a);
35+
},
36+
};

0 commit comments

Comments
 (0)