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

luci-app-ddns: Toggle Button Won't Work. #7423

Open
1 task done
Try2079 opened this issue Nov 25, 2024 · 2 comments · May be fixed by #7426
Open
1 task done

luci-app-ddns: Toggle Button Won't Work. #7423

Try2079 opened this issue Nov 25, 2024 · 2 comments · May be fixed by #7426

Comments

@Try2079
Copy link

Try2079 commented Nov 25, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Actual behaviour

Hit "Stop DDNS" button, nothing happened.

CLI: logread
nothing new

Expected behaviour

Toggle DDNS service status.

Steps to reproduce

Hit "Stop DDNS" button.


And source code snippet below:
/luci-app-ddns/htdocs/luci-static/resources/view/ddns/overview.js
line 169~175

1. handleToggleDDns: function(m, ev) {
2. 	return this.callInitAction('ddns', 'enabled')
3. 		.then(L.bind(function (action) { return this.callInitAction('ddns', action ? 'disable' : 'enable')}, this))
4. 		.then(L.bind(function (action) { return this.callInitAction('ddns', action ? 'stop' : 'start')}, this))
5. 		.then(L.bind(m.render, m))
6. 		.catch(function(e) { ui.addNotification(null, E('p', e.message)) });
7. },

line 2 (line 170): When I run ubus call luci setInitAction "{'name':'ddns', 'action':'enabled'}",
it return an error:
{ "error": "Invalid action" }
==Seems like no such an action as 'enabled'.==

@systemcrash
Copy link
Contributor

enabled is not an action, it's a state. enable, however, is an action.

setInitAction: {
args: { name: 'name', action: 'action' },
call: function(request) {
switch (request.args.action) {
case 'enable':
case 'disable':
case 'start':
case 'stop':
case 'restart':
case 'reload':
const rc = init_action(request.args.name, request.args.action);
if (rc === false)
return { error: 'No such init script' };
return { result: rc == 0 };
default:
return { error: 'Invalid action' };
}
}
},

@Try2079
Copy link
Author

Try2079 commented Nov 26, 2024

Submitted a pull request #7426. I'm not very good at using github, but I really want to make my contribution. Please forgive me if there are any mistakes.

@Try2079 Try2079 linked a pull request Nov 26, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants