mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-06 21:35:55 +01:00
Docker site recreate pull
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
|
||||
from plogical.DockerSites import Docker_Sites
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
@@ -1077,3 +1080,119 @@ class ContainerManager(multi.Thread):
|
||||
data_ret = {'getTagsStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def getDockersiteList(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.acl.adminStatus != 1:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
name = data['name']
|
||||
|
||||
passdata = {}
|
||||
passdata["JobID"] = None
|
||||
passdata['name'] = name
|
||||
da = Docker_Sites(None, passdata)
|
||||
retdata = da.ListContainers()
|
||||
|
||||
|
||||
data_ret = {'status': 1, 'error_message': 'None', 'data':retdata}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
data_ret = {'removeImageStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
# Internal function for recreating containers
|
||||
|
||||
def getContainerAppinfo(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.acl.adminStatus != 1:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
name = data['name']
|
||||
containerID = data['id']
|
||||
|
||||
passdata = {}
|
||||
passdata["JobID"] = None
|
||||
passdata['name'] = name
|
||||
passdata['containerID'] = containerID
|
||||
da = Docker_Sites(None, passdata)
|
||||
retdata = da.ContainerInfo()
|
||||
|
||||
|
||||
data_ret = {'status': 1, 'error_message': 'None', 'data':retdata}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
data_ret = {'removeImageStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def getContainerApplog(self, userID=None, data=None):
|
||||
try:
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.acl.adminStatus != 1:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
name = data['name']
|
||||
containerID = data['id']
|
||||
|
||||
passdata = {}
|
||||
passdata["JobID"] = None
|
||||
passdata['name'] = name
|
||||
passdata['containerID'] = containerID
|
||||
passdata['numberOfLines'] = 50
|
||||
da = Docker_Sites(None, passdata)
|
||||
retdata = da.ContainerLogs()
|
||||
|
||||
|
||||
data_ret = {'status': 1, 'error_message': 'None', 'data':retdata}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
data_ret = {'removeImageStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def recreateappcontainer(self, userID=None, data=None):
|
||||
try:
|
||||
from websiteFunctions.models import DockerSites
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.acl.adminStatus != 1:
|
||||
return ACLManager.loadError()
|
||||
|
||||
|
||||
name = data['name']
|
||||
|
||||
dockersite = DockerSites.objects.get(SiteName=name)
|
||||
#-------------------------delete or create docker site wala function call krna hai dekh kr kya kya data pass ho ga
|
||||
# passdata = {}
|
||||
# passdata["JobID"] = None
|
||||
# passdata['name'] = name
|
||||
# passdata['numberOfLines'] = 50
|
||||
# da = Docker_Sites(None, passdata)
|
||||
# retdata = da.ContainerLogs()
|
||||
|
||||
|
||||
data_ret = {'status': 1, 'error_message': 'None', 'data':"retdata"}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException as msg:
|
||||
data_ret = {'removeImageStatus': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
@@ -31,4 +31,8 @@ urlpatterns = [
|
||||
url(r'^view/(?P<name>(.*))$', views.viewContainer, name='viewContainer'),
|
||||
|
||||
path('manage/<int:dockerapp>/app', Dockersitehome, name='Dockersitehome'),
|
||||
path('getDockersiteList', views.getDockersiteList, name='getDockersiteList'),
|
||||
path('getContainerAppinfo', views.getContainerAppinfo, name='getContainerAppinfo'),
|
||||
path('getContainerApplog', views.getContainerApplog, name='getContainerApplog'),
|
||||
path('recreateappcontainer', views.recreateappcontainer, name='recreateappcontainer'),
|
||||
]
|
||||
@@ -4,6 +4,7 @@
|
||||
from django.shortcuts import redirect, HttpResponse
|
||||
from loginSystem.models import Administrator
|
||||
from loginSystem.views import loadLoginPage
|
||||
from plogical.DockerSites import Docker_Sites
|
||||
from plogical.httpProc import httpProc
|
||||
from .container import ContainerManager
|
||||
from .decorators import preDockerRun
|
||||
@@ -417,6 +418,82 @@ def removeImage(request):
|
||||
cm = ContainerManager()
|
||||
coreResult = cm.removeImage(userID, json.loads(request.body))
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
@preDockerRun
|
||||
def getDockersiteList(request):
|
||||
import json
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
cm = ContainerManager()
|
||||
coreResult = cm.getDockersiteList(userID, json.loads(request.body))
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
@preDockerRun
|
||||
def getContainerAppinfo(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
cm = ContainerManager()
|
||||
coreResult = cm.getContainerAppinfo(userID, json.loads(request.body))
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
@preDockerRun
|
||||
def getContainerApplog(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
cm = ContainerManager()
|
||||
coreResult = cm.getContainerApplog(userID, json.loads(request.body))
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
@preDockerRun
|
||||
def recreateappcontainer(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson()
|
||||
|
||||
cm = ContainerManager()
|
||||
coreResult = cm.recreateappcontainer(userID, json.loads(request.body))
|
||||
|
||||
return coreResult
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
@@ -10234,7 +10234,7 @@ app.controller('AssignPackage', function ($scope, $http,) {
|
||||
}
|
||||
|
||||
})
|
||||
app.controller('createDockerSite', function ($scope, $http,$timeout) {
|
||||
app.controller('createDockerSite', function ($scope, $http, $timeout) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.installationDetailsForm = false;
|
||||
$scope.installationProgress = true;
|
||||
@@ -10258,15 +10258,11 @@ app.controller('createDockerSite', function ($scope, $http,$timeout) {
|
||||
$scope.currentStatus = "Starting creation..";
|
||||
|
||||
|
||||
|
||||
|
||||
url = "/websites/submitDockerSiteCreation";
|
||||
|
||||
var package = $scope.packageForWebsite;
|
||||
|
||||
|
||||
|
||||
|
||||
var data = {
|
||||
sitename: $scope.siteName,
|
||||
Owner: $scope.userSelection,
|
||||
@@ -10523,10 +10519,10 @@ app.controller('listDockersite', function ($scope, $http) {
|
||||
};
|
||||
|
||||
var deletedockersiteurl;
|
||||
$scope.DeleteDockersite = function (url, id){
|
||||
$scope.DeleteDockersite = function (url, id) {
|
||||
// console.log(url)
|
||||
// console.log(id)
|
||||
deletedockersiteurl= url+id;
|
||||
deletedockersiteurl = url + id;
|
||||
}
|
||||
|
||||
$scope.ConfirmDelete = function () {
|
||||
@@ -10535,3 +10531,196 @@ app.controller('listDockersite', function ($scope, $http) {
|
||||
|
||||
|
||||
});
|
||||
|
||||
app.controller('ListDockersitecontainer', function ($scope, $http) {
|
||||
$scope.conatinerview = true
|
||||
$scope.getcontainer = function () {
|
||||
url = "/docker/getDockersiteList";
|
||||
|
||||
var data = {'name': $('#sitename').html()};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
|
||||
if (response.data.status === 1) {
|
||||
|
||||
var finalData = JSON.parse(response.data.data[1]);
|
||||
|
||||
$scope.ContainerList = finalData;
|
||||
$("#listFail").hide();
|
||||
} else {
|
||||
$("#listFail").fadeIn();
|
||||
$scope.errorMessage = response.data.error_message;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'Connect disrupted, refresh the page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$scope.getcontainer()
|
||||
|
||||
$scope.Lunchcontainer = function (containerid){
|
||||
// $scope.listcontainerview = true
|
||||
var url = "/docker/getContainerAppinfo";
|
||||
|
||||
var data = {
|
||||
'name': $('#sitename').html(),
|
||||
'id': containerid
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.conatinerview = false
|
||||
// console.log(response);
|
||||
|
||||
if (response.data.status === 1) {
|
||||
console.log(response.data.data);
|
||||
$scope.cid = response.data.data[1].id
|
||||
$scope.appcpuUsage = 5
|
||||
$scope.appmemoryUsage = 9
|
||||
$scope.name = response.data.data[1].name
|
||||
$scope.port = response.data.data[1].name
|
||||
$scope.getcontainerlog(containerid)
|
||||
} else {
|
||||
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'Connect disrupted, refresh the page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.getcontainerlog = function (containerid){
|
||||
// $scope.listcontainerview = true
|
||||
|
||||
var url = "/docker/getContainerApplog";
|
||||
|
||||
var data = {
|
||||
'name': $('#sitename').html(),
|
||||
'id': containerid
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.conatinerview = false
|
||||
$scope.logs = response.data.data[1];
|
||||
|
||||
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Container info fetched.',
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'Connect disrupted, refresh the page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$scope.recreateappcontainer = function (){
|
||||
var url = "/docker/recreateappcontainer";
|
||||
|
||||
var data = {
|
||||
'name': $('#sitename').html(),
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
$http.post(url, data, config).then(ListInitialData, cantLoadInitialData);
|
||||
|
||||
|
||||
function ListInitialData(response) {
|
||||
$scope.conatinerview = false
|
||||
$scope.logs = response.data.data[1];
|
||||
|
||||
|
||||
if (response.data.status === 1) {
|
||||
new PNotify({
|
||||
title: 'Success!',
|
||||
text: 'Container info fetched.',
|
||||
type: 'success'
|
||||
});
|
||||
} else {
|
||||
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: response.data.error_message,
|
||||
type: 'error'
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function cantLoadInitialData(response) {
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
text: 'Connect disrupted, refresh the page.',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -13,7 +13,575 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<h2> Docker Site Home</h2>
|
||||
<p>{{ dockerSite.SiteName }}</p>
|
||||
|
||||
<div class="container" ng-controller="ListDockersitecontainer">
|
||||
|
||||
<div id="page-title">
|
||||
<h2 id="domainNamePage">{% trans "Containers" %}
|
||||
<a class="pull-right btn btn-primary" href="{% url "CreateDockersite" %}">Create</a>
|
||||
</h2>
|
||||
<p>{% trans "Manage containers on server" %}</p>
|
||||
</div>
|
||||
|
||||
<div class="panel" ng-hide="listcontainerview">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Containers" %} {{ dockerSite.SiteName }}<img id="imageLoading"
|
||||
src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</h3>
|
||||
<span style="display: none" id="sitename">{{ dockerSite.SiteName }}</span>
|
||||
<div class="example-box-wrapper ">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="datatable-example"
|
||||
style="padding:0px;">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Launch</th>
|
||||
{# <th>Owner</th>#}
|
||||
{# <th>Image</th>#}
|
||||
{# <th>Tag</th>#}
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr ng-repeat="web in ContainerList track by $index">
|
||||
<td ng-bind="web.name"></td>
|
||||
<td ng-click="Lunchcontainer(web.id)"><img width="30px" height="30" class=""
|
||||
src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}">
|
||||
</td>
|
||||
{# <td ng-bind="web.admin"></td>#}
|
||||
{# <td ng-bind="web.image"></td>#}
|
||||
{# <td ng-bind="web.tag"></td>#}
|
||||
<td>
|
||||
<button class="btn btn-primary" ng-click="delContainer(web.name)"><i
|
||||
class="fa fa-trash btn-icon"></i></button>
|
||||
{# <button class="btn btn-primary" ng-click="showLog(web.name)"><i#}
|
||||
{# class="fa fa-file btn-icon"></i></button>#}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<div id="listFail" class="alert alert-danger">
|
||||
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
|
||||
</div>
|
||||
|
||||
<div class="row text-center">
|
||||
|
||||
<div class="col-sm-4 col-sm-offset-8">
|
||||
|
||||
<nav aria-label="Page navigation">
|
||||
<ul class="pagination">
|
||||
|
||||
|
||||
{% for items in pagination %}
|
||||
|
||||
<li ng-click="getFurtherContainersFromDB({{ forloop.counter }})" id="webPages">
|
||||
<a href="">{{ forloop.counter }}</a></li>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{% if showUnlistedContainer %}
|
||||
<h3 class="title-hero">
|
||||
{% trans "Unlisted Containers" %} <i class="fa fa-question-circle"
|
||||
title="{% trans "Containers listed below were either not created through panel or were not saved to database properly" %}"></i>
|
||||
</h3>
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered"
|
||||
id="datatable-example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Status</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
{% for container in unlistedContainers %}
|
||||
<tr>
|
||||
<td>{{ container.name }}</td>
|
||||
<td>{{ container.status }}</td>
|
||||
<td>
|
||||
<button class="btn btn-primary"
|
||||
ng-click="delContainer('{{ container.name }}', true)"><i
|
||||
class="fa fa-trash"></i></button>
|
||||
<button class="btn btn-primary" ng-click="showLog('{{ container.name }}')"><i
|
||||
class="fa fa-file"></i></button>
|
||||
<button class="btn btn-primary"
|
||||
ng-click="assignContainer('{{ container.name }}')"><i
|
||||
class="fa fa-user"></i></button>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div id="logs" 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">Container logs</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<textarea name="logs" class="form-control" id="" cols="30"
|
||||
rows="10">{$ logs $}</textarea>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" ng-click="showLog('', true)">Refresh
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="assign" 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">Assign Container to user</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="/" class="form-horizontal">
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Owner" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select ng-model="dockerOwner" class="form-control">
|
||||
{% for user in adminNames %}
|
||||
<option>{{ user }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary" ng-click="submitAssignContainer()">
|
||||
Submit
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div ng-hide="conatinerview">
|
||||
<div >
|
||||
<div class="container">
|
||||
|
||||
<div id="page-title" ng-init="cName='{{ name }}'">
|
||||
{# <h2 id="domainNamePage">{% trans "Manage Container" %}</h2>#}
|
||||
<p>{% trans "Currently managing: " %} {$ name $}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div class="panel panel-body">
|
||||
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Container Information" %}
|
||||
<img id="infoLoading" src="/static/images/loading.gif" style="display: none;">
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Memory Usage" %}
|
||||
</h3>
|
||||
<div class="progressbar" data-value="{$ appmemoryUsage $}">
|
||||
<div class="progressbar-value bg-primary">
|
||||
<div class="progress-overlay"></div>
|
||||
<div class="progress-label" title="{$ appmemoryUsage $}%">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<h3 class="title-hero">
|
||||
{% trans "CPU Usage" %}
|
||||
</h3>
|
||||
<div class="progressbar" data-value="{$ appcpuUsage $}">
|
||||
<div class="progressbar-value bg-primary">
|
||||
<div class="progress-overlay"></div>
|
||||
<div class="progress-label" title="{$ appcpuUsage $}"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
{% trans "Container ID" %}: {$ cid $}
|
||||
<br>
|
||||
{% trans "Image" %}: {{ image }}
|
||||
<span ng-show="'{{ image }}' == 'unknown:unknown'"
|
||||
title="Actions involving container recreation cannot be executed">
|
||||
<i class="fa fa-warning btn-icon"></i>
|
||||
</span>
|
||||
<br>
|
||||
{% if ports %}
|
||||
{% trans "Ports" %}: <br>
|
||||
{% for iport, eport in ports.items %}
|
||||
{{ iport }} {% trans "to" %} {{ eport }}<br>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
|
||||
{# <button class="btn btn-warning" data-toggle="modal"#}
|
||||
{# data-target="#settings"><i#}
|
||||
{# class="fa fa-gear btn-icon"></i> Settings#}
|
||||
{# </button>#}
|
||||
<button class="btn btn-warning" ng-click="recreateappcontainer()"><i
|
||||
class="fa fa-refresh btn-icon"></i> Recreate
|
||||
</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div class="panel panel-body">
|
||||
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Actions" %}
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="title-hero" ng-init="status='{{ status }}'">Main Actions
|
||||
<img id="actionLoading" src="/static/images/loading.gif"
|
||||
style="display: none;width: 20px;">
|
||||
</h3>
|
||||
<b>Status:</b> <span ng-bind="status"></span>
|
||||
<span ng-click='refreshStatus()' style="cursor:pointer;"
|
||||
class="pull-right"
|
||||
title="Refresh status"><i class="fa fa-refresh btn-icon"></i></span>
|
||||
<hr>
|
||||
<button ng-disabled="status=='running'" class="btn btn-primary"
|
||||
ng-click="cAction('start')"><i
|
||||
class="fa fa-play btn-icon"></i> Start
|
||||
</button>
|
||||
<button ng-disabled="status!='running'" class="btn btn-primary"
|
||||
ng-click="cAction('restart')"><i
|
||||
class="fa fa-refresh btn-icon"></i>
|
||||
Restart
|
||||
</button>
|
||||
<button ng-disabled="status!='running'" class="btn btn-primary"
|
||||
ng-click="cAction('stop')"><i
|
||||
class="fa fa-stop btn-icon"></i> Stop
|
||||
</button>
|
||||
<button class="btn btn-primary" ng-click="cRemove()">Remove
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="title-hero" ng-init="rPolicy='{{ restartPolicy }}'">Other
|
||||
Actions</h3>
|
||||
<b>Restart on system reboot:</b> <span ng-bind="rPolicy"></span>
|
||||
<hr>
|
||||
<a href="/docker/exportContainer/?name={{ name }}"
|
||||
class="btn btn-primary">Export
|
||||
file</a>
|
||||
<button class="btn btn-primary" ng-disabled="loadingTop"
|
||||
ng-click="showTop()">
|
||||
View Process
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div class="content-box panel-body">
|
||||
|
||||
<h3 class="content-box-header" ng-init="loadLogs('{{ name }}')">
|
||||
{% trans "Logs" %}
|
||||
<span style="cursor:pointer;" class="pull-right" ng-click="loadLogs('{{ name }}')"><i
|
||||
class="fa fa-refresh btn-icon"></i></span>
|
||||
</h3>
|
||||
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
|
||||
<textarea name="logs" class="form-control" id="" cols="30"
|
||||
rows="10">{$ logs $}</textarea><br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<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">Container Settings
|
||||
<img id="containerSettingLoading" src="/static/images/loading.gif"
|
||||
style="display: none;">
|
||||
</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 "Memory limit" %}</label>
|
||||
<div class="col-sm-6" ng-init="memory={{ memoryLimit }}">
|
||||
<input name="memory" type="number" class="form-control"
|
||||
ng-model="memory" required>
|
||||
</div>
|
||||
<div class="current-pack ng-binding">MB</div>
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">Start on reboot</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox" ng-init="startOnReboot={{ startOnReboot }}">
|
||||
<label>
|
||||
<input ng-model="startOnReboot" type="checkbox" value=""
|
||||
class="ng-pristine ng-untouched ng-valid ng-empty">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Confirmation" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="envConfirmation" type="checkbox">
|
||||
Editing ENV or Volume will recreate container.
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<span ng-init="envList = {}"></span>
|
||||
{% for env, value in envList.items %}
|
||||
|
||||
<span ng-init="envList[{{ forloop.counter0 }}] = {'name':'{{ env }}' , 'value':'{{ value }}'} "></span>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
<div ng-repeat="env in envList track by $index">
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<label class="col-sm-3 control-label">
|
||||
<div ng-show="$first">
|
||||
{% trans "ENV" %}
|
||||
</div>
|
||||
</label>
|
||||
<div class="col-sm-2">
|
||||
<input name="$index" ng-disabled="!envConfirmation" type="text"
|
||||
class="form-control" ng-model="envList[$index].name"
|
||||
required>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<input name="$index" ng-disabled="!envConfirmation" type="text"
|
||||
class="form-control" ng-model="envList[$index].value"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-offset-3">
|
||||
<button type="button" ng-disabled="!envConfirmation" class="btn btn-info"
|
||||
ng-click="addEnvField()">Add more
|
||||
</button>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<span ng-init="volList = {}"></span>
|
||||
<span ng-init="volListNumber=1"></span>
|
||||
{% for key, value in volList.items %}
|
||||
<span ng-init="volList[{{ forloop.counter0 }}] = {'dest':'{{ value.bind }}' , 'src':'{{ key }}'}"></span>
|
||||
<span ng-init="volListNumber={{ forloop.counter0 }} + 1"></span>
|
||||
{% endfor %}
|
||||
|
||||
<hr>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="form-group text-center">
|
||||
<label class="control-label">
|
||||
{% trans "Map Volumes" %}
|
||||
</label>
|
||||
</div>
|
||||
<div ng-repeat="volume in volList track by $index">
|
||||
<div ng-hide="installationDetailsForm" class="form-group">
|
||||
<div class="col-sm-5">
|
||||
<input type="text" ng-disabled="!envConfirmation"
|
||||
class="form-control"
|
||||
ng-model="volList[$index].dest" placeholder="Destination"
|
||||
required>
|
||||
</div>
|
||||
<div class="col-sm-5">
|
||||
<input type="text" ng-disabled="!envConfirmation"
|
||||
class="form-control"
|
||||
ng-model="volList[$index].src" placeholder="Source" required>
|
||||
</div>
|
||||
<div ng-show="$last">
|
||||
<div class="col-sm-1">
|
||||
<button class="btn btn-primary" ng-disabled="!envConfirmation"
|
||||
type="button"
|
||||
ng-click="removeVolField()"><i
|
||||
style="position: inherit; top: 0px; left: 0px"
|
||||
class="fa fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-hide="installationDetailsForm" class="text-center">
|
||||
<button type="button" ng-disabled="!envConfirmation" class="btn btn-info"
|
||||
ng-click="addVolField()">{% trans "Add field" %}</button>
|
||||
</div>
|
||||
<br>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" ng-disabled="savingSettings" class="btn btn-primary"
|
||||
ng-click="saveSettings()">Save
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings" class="btn btn-default"
|
||||
data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="processes" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog" style="width: 96%;">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content panel-body">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title content-box=header">Container Processes</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
|
||||
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped"
|
||||
id="datatable-example">
|
||||
<thead>
|
||||
<tr>
|
||||
<th ng-repeat="item in topHead track by $index">{$ item $}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr ng-repeat="process in topProcesses track by $index">
|
||||
<th ng-repeat="item in process track by $index">{$ item $}</th>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" ng-disabled="savingSettings" class="btn btn-primary"
|
||||
ng-click="showTop()">
|
||||
Refresh
|
||||
</button>
|
||||
<button type="button" ng-disabled="savingSettings" class="btn btn-default"
|
||||
data-dismiss="modal">
|
||||
Close
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user