mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-15 17:56:12 +01:00
set up manage application page for elasticsearch
This commit is contained in:
@@ -901,6 +901,8 @@
|
||||
<div class="sidebar-submenu">
|
||||
|
||||
<ul>
|
||||
<li><a href="{% url 'manageApplications' %}"
|
||||
title="{% trans 'Manage Applications' %}"><span>{% trans "Applications" %}</span></a></li>
|
||||
<li><a href="{% url 'managePowerDNS' %}"
|
||||
title="{% trans 'Manage PowerDNS' %}"><span>{% trans "Manage PowerDNS" %}</span></a>
|
||||
</li>
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
* Created by usman on 6/22/18.
|
||||
*/
|
||||
|
||||
|
||||
/* Java script code */
|
||||
|
||||
app.controller('powerDNS', function ($scope, $http, $timeout, $window) {
|
||||
@@ -163,11 +162,8 @@ app.controller('powerDNS', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
});
|
||||
|
||||
|
||||
/* Java script code */
|
||||
|
||||
|
||||
|
||||
/* Java script code */
|
||||
|
||||
app.controller('postfix', function ($scope, $http, $timeout, $window) {
|
||||
@@ -298,7 +294,6 @@ app.controller('postfix', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
/* Java script code */
|
||||
|
||||
|
||||
/* Java script code */
|
||||
|
||||
app.controller('pureFTPD', function ($scope, $http, $timeout, $window) {
|
||||
@@ -427,4 +422,67 @@ app.controller('pureFTPD', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
});
|
||||
|
||||
/* Java script code */
|
||||
|
||||
/* Java script code */
|
||||
|
||||
app.controller('manageApplications', function ($scope, $http, $timeout, $window) {
|
||||
|
||||
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
$scope.saveStatus = function (service) {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
|
||||
url = "/manageservices/saveStatus";
|
||||
|
||||
var data = {
|
||||
status: serviceStatus,
|
||||
service: service
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
|
||||
if (response.data.status === 1) {
|
||||
|
||||
$scope.failedToFetch = true;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.changesApplied = false;
|
||||
|
||||
}
|
||||
else {
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
$scope.failedToFetch = false;
|
||||
$scope.couldNotConnect = true;
|
||||
$scope.changesApplied = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.serviceLoading = true;
|
||||
$scope.failedToFetch = true;
|
||||
$scope.couldNotConnect = false;
|
||||
$scope.changesApplied = true;
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
/* Java script code */
|
||||
144
manageServices/templates/manageServices/applications.html
Executable file
144
manageServices/templates/manageServices/applications.html
Executable file
@@ -0,0 +1,144 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Manage Applications - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Manage Applications" %}</h2>
|
||||
<p>{% trans "Install/Remove Applications from your server." %}</p>
|
||||
</div>
|
||||
<div ng-controller="manageApplications" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Applications" %} <img ng-hide="cyberpanelLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<!------ List of records --------------->
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="col-sm-12">
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Username" %}</th>
|
||||
<th>{% trans "Websites Limit" %}</th>
|
||||
<th>{% trans "Disk Usage" %}</th>
|
||||
<th>{% trans "ACL" %}</th>
|
||||
<th>{% trans "Owner" %}</th>
|
||||
<th>{% trans "State" %}</th>
|
||||
<th>{% trans "Actions" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in records track by $index">
|
||||
<td ng-bind="record.name"></td>
|
||||
<td ng-bind="record.websites"></td>
|
||||
<td ng-bind="record.diskUsage"></td>
|
||||
<td ng-bind="record.acl"></td>
|
||||
<td ng-bind="record.owner"></td>
|
||||
<td ng-bind="record.state"></td>
|
||||
<td>
|
||||
<a ng-show="record.state=='ACTIVE'"
|
||||
class="btn btn-border btn-alt border-red btn-link font-red" href="#"
|
||||
ng-click="controlUserState(record.name, 'SUSPEND')" title=""><span>{% trans 'Suspend' %}</span></a>
|
||||
<a ng-show="record.state=='SUSPENDED'"
|
||||
class="btn btn-border btn-alt border-green btn-link font-green" href="#"
|
||||
ng-click="controlUserState(record.name, 'ACTIVATE')" title=""><span>{% trans 'Activate' %}</span></a>
|
||||
<a data-toggle="modal" data-target="#settings"
|
||||
ng-click="editInitial(record.name)"
|
||||
class="btn btn-border btn-alt border-purple btn-link font-purple" href="#"
|
||||
title=""><span>{% trans 'Edit' %}</span></a>
|
||||
<a ng-click="deleteUserFinal(record.name)"
|
||||
class="btn btn-border btn-alt border-red btn-link font-red" href="#"
|
||||
title=""><span>{% trans 'Delete' %}</span></a>
|
||||
|
||||
<!--- Modal --->
|
||||
<div id="settings" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×
|
||||
</button>
|
||||
<h4 class="modal-title">Edit User
|
||||
<img ng-hide="cyberpanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<form name="containerSettingsForm" action="/"
|
||||
class="form-horizontal">
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="name" type="text" class="form-control"
|
||||
ng-model="name" readonly>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "New Owner" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="saveResellerChanges()"
|
||||
ng-model="$parent.newOwner"
|
||||
class="form-control">
|
||||
{% for items in resellerPrivUsers %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select ACL" %} </label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-change="changeACLFunc()"
|
||||
ng-model="$parent.selectedACL"
|
||||
class="form-control">
|
||||
{% for items in aclNames %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--- Modal End--->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------ List of records --------------->
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -9,4 +9,6 @@ urlpatterns = [
|
||||
|
||||
url(r'^fetchStatus$', views.fetchStatus, name='fetchStatus'),
|
||||
url(r'^saveStatus$', views.saveStatus, name='saveStatus'),
|
||||
|
||||
url(r'^manageApplications$', views.manageApplications, name='manageApplications'),
|
||||
]
|
||||
@@ -298,4 +298,22 @@ def saveStatus(request):
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def manageApplications(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
try:
|
||||
return render(request, 'manageServices/applications.html', {})
|
||||
except BaseException as msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return HttpResponse("See CyberCP main log file.")
|
||||
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
Reference in New Issue
Block a user