Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
f132a541
Commit
f132a541
authored
Jan 03, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(firmware) glue reinstall action into UI
parent
6fb2f255
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
FirmwareController.php
.../app/controllers/OPNsense/Core/Api/FirmwareController.php
+28
-0
firmware.volt
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
+25
-1
No files found.
src/opnsense/mvc/app/controllers/OPNsense/Core/Api/FirmwareController.php
View file @
f132a541
...
...
@@ -116,6 +116,34 @@ class FirmwareController extends ApiControllerBase
return
$response
;
}
/**
* reinstall package
* @param string $pkg_name package name to reinstall
* @return array status
* @throws \Exception
*/
public
function
reinstallAction
(
$pkg_name
)
{
$backend
=
new
Backend
();
$response
=
array
();
if
(
$this
->
request
->
isPost
())
{
$response
[
'status'
]
=
'ok'
;
// sanitize package name
$filter
=
new
\Phalcon\Filter
();
$filter
->
add
(
'pkgname'
,
function
(
$value
)
{
return
preg_replace
(
'/[^0-9a-zA-Z-_]/'
,
''
,
$value
);
});
$pkg_name
=
$filter
->
sanitize
(
$pkg_name
,
"pkgname"
);
// execute action
$response
[
'msg_uuid'
]
=
trim
(
$backend
->
configdpRun
(
"firmware reinstall"
,
array
(
$pkg_name
),
true
));
}
else
{
$response
[
'status'
]
=
'failure'
;
}
return
$response
;
}
/**
* retrieve upgrade status (and log file of current process)
*/
...
...
src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt
View file @
f132a541
...
...
@@ -91,6 +91,20 @@ POSSIBILITY OF SUCH DAMAGE.
});
}
/**
* perform package reinstall, install poller to update status
*/
function reinstall(pkg_name)
{
$('#progresstab > a').tab('show');
$('#updatestatus').html("{{ lang._('Reinstalling... (do not leave this page while reinstall is in progress)') }}");
ajaxCall('/api/core/firmware/reinstall/'+pkg_name,{},function() {
$('#updatelist').empty();
setTimeout(trackStatus, 500);
});
}
/**
* check if a reboot is required, warn user or just upgrade
*/
...
...
@@ -190,7 +204,10 @@ POSSIBILITY OF SUCH DAMAGE.
'<td>' + row['version'] + '</td>' +
'<td>' + row['flatsize'] + '</td>' +
'<td>' + row['comment'] + '</td>' +
'<td>reinstall, ' + (row['locked'] === '1' ? 'unlock' : 'lock') +'</td>' +
'<td>' +
'<button class="btn btn-default btn-xs act_reinstall" data-package="' + row['name'] + '">reinstall</button>'+
', ' + (row['locked'] === '1' ? 'unlock' : 'lock') +
'</td>' +
'</tr>'
);
if (!row['name'].match(/^os-/g)) {
...
...
@@ -198,6 +215,13 @@ POSSIBILITY OF SUCH DAMAGE.
}
installed[row['name']] = row;
});
// link reinstall buttons to action
$(".act_reinstall").click(function(event){
event.preventDefault();
reinstall($(this).data('package'));
});
$.each(data['remote'], function(index, row) {
if (!row['name'].match(/^os-/g)) {
return 1;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment