Skip to content

Commit

Permalink
luci-mod-system: add modal overlay dialog to reboot
Browse files Browse the repository at this point in the history
Signed-off-by: sbwml <admin@cooluc.com>
  • Loading branch information
sbwml committed Sep 13, 2024
1 parent a803b9e commit 49dddd8
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,11 @@ bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_scri
### 一、Fork 本仓库到自己 GitHub 存储库

### 二、构建固件
- 在存储库名称下,单击(<img src="https://camo.githubusercontent.com/392391d290482f9c4881912eec0700ec2acef8e0d5d2e24b3f8b23d9354fa73e/68747470733a2f2f66696c652e636f6f6c75632e636f6d2f323232322e737667" alt="Actions"> Actions)。

- 在存储库名称下,单击(<img src="https://github.com/user-attachments/assets/f1db14da-2dd9-4f10-8e37-d92ef9651912" alt="Actions"> Actions)。

- 在左侧边栏中,单击要运行的工作流的名称:**Build releases**

- 在工作流运行的列表上方,单击“**Run workflow**”按钮,选择要构建的设备固件并运行工作流。

![image](https://github.com/sbwml/r4s_build_script/assets/16485166/136abcd1-ecf3-4e6d-aa1a-5393a75a25cc)
![image](https://github.com/user-attachments/assets/0c2eb064-a130-47b3-a5a3-1e9a9bb6f50d)
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From 0c1f0e62e72e4c89b0db25aa6f6baa19c7e91e75 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Fri, 13 Sep 2024 19:36:44 +0800
Subject: [PATCH 1/5] luci-mod-system: add modal overlay dialog to reboot

Signed-off-by: sbwml <admin@cooluc.com>
---
.../resources/view/system/reboot.js | 21 ++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js
index 92e1dd4..c106f78 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/reboot.js
@@ -30,7 +30,26 @@ return view.extend({
body.appendChild(E('hr'));
body.appendChild(E('button', {
'class': 'cbi-button cbi-button-action important',
- 'click': ui.createHandlerFn(this, 'handleReboot')
+ 'click': function () {
+ ui.showModal(_('Confirm Reboot'), [
+ E('p', {}, _('Are you sure you want to reboot the system?')),
+ E('button', {
+ 'class': 'cbi-button cbi-button-action important',
+ 'style': 'margin-left: 0px; background: red!important; border-color: red!important',
+ 'click': function () {
+ ui.hideModal();
+ this.handleReboot();
+ }.bind(this)
+ }, _('Confirm')),
+ E('button', {
+ 'class': 'btn cbi-button cbi-button-apply',
+ 'style': 'margin-left: 20px',
+ 'click': function () {
+ ui.hideModal();
+ }
+ }, _('Cancel'))
+ ]);
+ }.bind(this)
}, _('Perform reboot')));

return body;
--
2.42.0

Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
From fb9d1a301136922a624e1eb2927ad60260ee11f8 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Fri, 13 Sep 2024 19:43:19 +0800
Subject: [PATCH 2/5] luci-mod-status: displays actual process memory usage

Signed-off-by: sbwml <admin@cooluc.com>
---
.../luci-static/resources/view/status/include/20_memory.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
index 0a885c0..d3302ff 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/20_memory.js
Expand All @@ -13,3 +23,6 @@ index 0a885c0..d3302ff 100644
];

if (mem.buffered)
--
2.42.0

Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
From 8a052b2e2ffd2e6a46fe361a946b1acd42998402 Mon Sep 17 00:00:00 2001
From 2543713322fa4f7b404a673429ce36f4319c4749 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Sun, 24 Mar 2024 00:12:45 +0800
Subject: [PATCH] luci-mod-status: storage index applicable only to valid
Subject: [PATCH 3/5] luci-mod-status: storage index applicable only to valid
devices

Signed-off-by: sbwml <admin@cooluc.com>
---
.../luci-static/resources/view/status/include/25_storage.js | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js
index 60661f6..aac6711 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/25_storage.js
@@ -13,12 +13,14 @@ var callMountPoints = rpc.declare({
Expand Down Expand Up @@ -36,4 +38,6 @@ Signed-off-by: sbwml <admin@cooluc.com>
continue;

var name = entry.device + ' (' + entry.mount +')',
--
2.42.0

Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
From 44cb42a004b8334d784814c5f616c8d8ceda6b22 Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Fri, 13 Sep 2024 19:44:52 +0800
Subject: [PATCH 4/5] luci-mod-status: firewall: disable legacy firewall rule
warning

Signed-off-by: sbwml <admin@cooluc.com>
---
.../resources/view/status/nftables.js | 14 --------------
.../share/luci/menu.d/luci-mod-status.json | 19 ++++++++++++++++---
2 files changed, 16 insertions(+), 17 deletions(-)

diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
index d891526..04fd5af 100644
index be62d91..1718494 100644
--- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
+++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/nftables.js
@@ -672,26 +672,12 @@ return view.extend({
Expand Down Expand Up @@ -70,3 +82,6 @@ index 190eef0..e9cf485 100644
"action": {
"type": "view",
"path": "status/iptables"
--
2.42.0

Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
From 8596f6d48c24c063fd75f007b8e24cd011ac93fb Mon Sep 17 00:00:00 2001
From: sbwml <admin@cooluc.com>
Date: Fri, 13 Sep 2024 19:47:13 +0800
Subject: [PATCH 5/5] luci-mod-system: add refresh interval setting

Signed-off-by: sbwml <admin@cooluc.com>
---
.../htdocs/luci-static/resources/view/system/system.js | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js
index 767bc8c..c8969ac 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/system.js
Expand All @@ -17,3 +27,6 @@ index 767bc8c..c8969ac 100644
/*
* NTP
*/
--
2.42.0

11 changes: 6 additions & 5 deletions openwrt/scripts/00-prepare_base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -391,12 +391,13 @@ sed -i 's/cheaper = 1/cheaper = 2/g' feeds/packages/net/uwsgi/files-luci-support
sed -i 's/option timeout 30/option timeout 60/g' package/system/rpcd/files/rpcd.config
sed -i 's#20) \* 1000#60) \* 1000#g' feeds/luci/modules/luci-base/htdocs/luci-static/resources/rpc.js

# luci - 20_memory & 25_storage & refresh interval
# luci-mod extra
pushd feeds/luci
curl -s https://$mirror/openwrt/patch/luci/20_memory.js.patch | patch -p1
curl -s https://$mirror/openwrt/patch/luci/luci-refresh-interval.patch | patch -p1
# luci-mod-status: storage index applicable only to valid
curl -s https://$mirror/openwrt/patch/luci/luci-mod-status-storage-index-applicable-only-to-val.patch | patch -p1
curl -s https://$mirror/openwrt/patch/luci/0001-luci-mod-system-add-modal-overlay-dialog-to-reboot.patch | patch -p1
curl -s https://$mirror/openwrt/patch/luci/0002-luci-mod-status-displays-actual-process-memory-usage.patch | patch -p1
curl -s https://$mirror/openwrt/patch/luci/0003-luci-mod-status-storage-index-applicable-only-to-val.patch | patch -p1
curl -s https://$mirror/openwrt/patch/luci/0004-luci-mod-status-firewall-disable-legacy-firewall-rul.patch | patch -p1
curl -s https://$mirror/openwrt/patch/luci/0005-luci-mod-system-add-refresh-interval-setting.patch | patch -p1
popd

# Luci diagnostics.js
Expand Down

0 comments on commit 49dddd8

Please sign in to comment.