-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
databases/redis: add reset db button (#1348)
- Loading branch information
Showing
5 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
PLUGIN_NAME= redis | ||
PLUGIN_VERSION= 1.0 | ||
PLUGIN_VERSION= 1.1 | ||
PLUGIN_COMMENT= Redis DB | ||
PLUGIN_DEPENDS= redis | ||
PLUGIN_MAINTAINER= [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
/* | ||
* Copyright (C) 2017 Fabian Franz | ||
* Copyright (C) 2019 Michael Muenz <[email protected]> | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
|
@@ -29,11 +30,23 @@ | |
namespace OPNsense\Redis\Api; | ||
|
||
use OPNsense\Base\ApiMutableServiceControllerBase; | ||
use OPNsense\Core\Backend; | ||
|
||
class ServiceController extends ApiMutableServiceControllerBase | ||
{ | ||
protected static $internalServiceClass = '\OPNsense\Redis\Redis'; | ||
protected static $internalServiceTemplate = 'OPNsense/Redis'; | ||
protected static $internalServiceEnabled = 'general.enabled'; | ||
protected static $internalServiceName = 'redis'; | ||
|
||
/** | ||
* remove database folder | ||
* @return array | ||
*/ | ||
public function resetdbAction() | ||
{ | ||
$backend = new Backend(); | ||
$response = $backend->configdRun("redis resetdb"); | ||
return array("response" => $response); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
{# | ||
# Copyright (C) 2017 Fabian Franz | ||
# Copyright (C) 2014-2015 Deciso B.V. | ||
# Copyright (C) 2019 Michael Muenz <[email protected]> | ||
# All rights reserved. | ||
# | ||
# Redistribution and use in source and binary forms, with or without | ||
|
@@ -78,6 +79,20 @@ $( document ).ready(function() { | |
}); | ||
}); | ||
}); | ||
$("#resetdbAct").click(function () { | ||
stdDialogConfirm( | ||
'{{ lang._('Confirm database reset') }}', | ||
'{{ lang._('Do you want to reset the database?') }}', | ||
'{{ lang._('Yes') }}', '{{ lang._('Cancel') }}', function () { | ||
$("#resetdbAct_progress").addClass("fa fa-spinner fa-pulse"); | ||
ajaxCall(url="/api/redis/service/resetdb", sendData={}, callback=function(data,status) { | ||
ajaxCall(url="/api/redis/service/reconfigure", sendData={}, callback=function(data,status) { | ||
updateServiceControlUI('redis'); | ||
$("#resetdbAct_progress").removeClass("fa fa-spinner fa-pulse"); | ||
}); | ||
}); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
|
||
|
@@ -87,4 +102,5 @@ $( document ).ready(function() { | |
|
||
<div class="content-box tab-content"> | ||
{{ partial("layout_partials/base_tabs_content",['formData':settings]) }} | ||
<button class="btn btn-default" id="resetdbAct" type="button"><b>{{ lang._('Reset') }}</b> <i id="resetdbAct_progress" class=""></i></button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters