design port to docker manager

This commit is contained in:
usmannasir 2019-02-05 12:21:37 +05:00
parent 75c9ef9da9
commit f2a1b09964
7 changed files with 122 additions and 98 deletions

View File

@ -18,7 +18,7 @@
{% trans "Install Docker" %} <img ng-hide="installDockerStatus"
src="{% static 'images/loading.gif' %}">
</h3>
<div class="example-box-wrapper text-center">
<div class="example-box-wrapper text-center" style="white-space: normal;">
{% if conErr == 1 %}

View File

@ -19,12 +19,12 @@
<div class="panel">
<div class="panel-body">
<h3 class="title-hero">
<h3 class="content-box-header">
{% trans "Containers" %} <img id="imageLoading" src="/static/images/loading.gif" style="display: none;">
</h3>
<div ng-controller="listContainers" class="example-box-wrapper">
<div ng-controller="listContainers" class="example-box-wrapper table-responsive">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="datatable-example">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped" id="datatable-example" style="padding:0px;">
<thead>
<tr>
<th>Name</th>
@ -39,25 +39,25 @@
<tr ng-repeat="web in ContainerList track by $index">
<td ng-bind="web.name"></td>
<td><a href="/docker/view/{$ web.name $}"><img width="30px" height="30" class="center-block" src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}"></a></td>
<td><a href="/docker/view/{$ web.name $}"><img width="30px" height="30" class="" src="{% static 'baseTemplate/assets/image-resources/webPanel.png' %}"></a></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"></i></button>
<button class="btn btn-primary" ng-click="showLog(web.name)"><i class="fa fa-file"></i></button>
<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">
<div class="row text-center">
<div class="col-sm-4 col-sm-offset-8">
@ -79,12 +79,12 @@
</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>
@ -94,8 +94,8 @@
</tr>
</thead>
<tbody>
{% for container in unlistedContainers %}
{% for container in unlistedContainers %}
<tr>
<td>{{container.name}}</td>
<td>{{container.status}}</td>
@ -109,7 +109,7 @@
</tbody>
</table>
{% endif %}
<div id="logs" class="modal fade" role="dialog">
@ -131,8 +131,8 @@
</div>
</div>
</div>
</div>
<div id="assign" class="modal fade" role="dialog">
<div class="modal-dialog">
@ -163,15 +163,15 @@
</div>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}

View File

@ -27,7 +27,7 @@
<h4 class="modal-title">Image history</h4>
</div>
<div class="modal-body">
<table cellpadding="0" cellspacing="0" border="0" class="table table-responsive table-striped table-bordered" id="datatable-example">
<table cellpadding="0" cellspacing="0" border="0" class="table table-responsive table-striped" id="datatable-example" style="padding:0px;">
<thead>
<tr>
<th>ID</th>
@ -45,7 +45,7 @@
<th ng-bind="history.Created"></th>
<th ng-bind="history.Comment"></th>
<th ng-bind="history.Size"></th>
</tr>
</tbody>
@ -57,29 +57,28 @@
</div>
</div>
</div>
</div>
<div class="panel">
<div class="panel-body">
<h3 class="title-hero">
<h3 class="content-box-header">
{% trans "Images" %}
{% trans "Images" %} <img id="imageLoading" src="/static/images/loading.gif" style="display: none;">
<button class="btn btn-warning pull-right" ng-click="rmImage(0)" title="{% trans 'Delete unused images' %}">Prune</button>
</h3><br>
<div class="row">
<div class="col-sm-2"></div>
<label class="col-sm-2 control-label">Search Image</label>
<div class="row mx-10">
<label class="col-sm-2 control-label text-right">Search Image</label>
<div class="col-sm-6">
<input type="text" ng-change="searchImages()" ng-model="searchString" class="form-control">
</div>
<div class="col-sm-2"></div>
</div>
<br>
<div class="example-box-wrapper">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="searchResult">
<div class="example-box-wrapper table-responsive">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped " id="searchResult" style="padding:0px;">
<thead>
<tr>
<th>Name (search)</th>
@ -88,28 +87,28 @@
</tr>
</thead>
<tbody>
<tr ng-repeat="image in images track by $index">
<td>
<span ng-bind="image.name"></span>
<span ng-show="image.is_official == true"><i class="fa fa-check-circle" title="{% trans 'Official image' %}"></i></span>
<span><i class="fa fa-exclamation-circle" ng-attr-title="{$ image.description $}"></i></span>
<span ng-show="image.is_official == true"><i class="fa fa-check-circle btn-icon" title="{% trans 'Official image' %}"></i></span>
<!--<span><i class="fa fa-exclamation-circle" ng-attr-title="{$ image.description $}"></i></span>-->
</td>
<td>
<select ng-focus="loadTags($event)" ng-click="selectTag()" ng-model="imageTag[image.name2]" ng-options="tag for tag in tagList[image.name2]" ng-attr-id="{$ image.name2 $}" data-pageloaded='0' class="form-control ng-pristine ng-valid ng-empty ng-touched">
<select ng-focus="loadTags($event)" ng-click="selectTag()" ng-model="imageTag[image.name2]" ng-options="tag for tag in tagList[image.name2]" ng-attr-id="{$ image.name2 $}" data-pageloaded='0' class="form-control ng-pristine ng-valid ng-empty ng-touched">
</select>
</td>
<td>
<a ng-click="pullImage(image.name, imageTag[image.name2])" class="btn btn-primary">{% trans "Pull" %}</a>
</td>
</tr>
</tr>
</tbody>
</table>
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="imageList">
<table cellpadding="0" cellspacing="0" border="0" class="table table-striped " id="imageList" style="padding:0px;">
<thead>
<tr>
<th>Name (Locally Available)</th>
@ -118,27 +117,27 @@
</tr>
</thead>
<tbody>
{% for name, image in images.items %}
{% for name, image in images.items %}
<tr>
<td>{{image.name}}</td>
<td>
<select class="form-control tagList" id="{{forloop.counter}}">
<select class="form-control tagList" id="{{forloop.counter}}">
{% for tag in image.tags%}
<option>{{tag}}</option>
{% endfor %}
</select>
</td>
<td>
<button class="btn btn-primary" title="History" ng-click="getHistory({{forloop.counter}})"><i class="fa fa-history"></i></button>
<button class="btn btn-primary" title="Delete" ng-click="rmImage({{forloop.counter}})"><i class="fa fa-trash"></i></button>
<button class="btn btn-primary" title="History" ng-click="getHistory({{forloop.counter}})"><i class="fa fa-history btn-icon"></i></button>
<button class="btn btn-primary" title="Delete" ng-click="rmImage({{forloop.counter}})"><i class="fa fa-trash btn-icon"></i></button>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
@ -148,4 +147,4 @@
{% endblock %}
{% endblock %}

View File

@ -14,13 +14,13 @@
<h2 id="domainNamePage">{% trans "Manage Container" %}</h2>
<p>{% trans "Currently managing: " %} {{ name }}</p>
</div>
<div class="example-box-wrapper">
<div class="content-box">
<div class="panel panel-body">
<h3 class="content-box-header bg-blue">
<h3 class="content-box-header">
{% trans "Container Information" %}
<img id="infoLoading" src="/static/images/loading.gif" style="display: none;">
</h3>
@ -28,7 +28,7 @@
<div class="content-box-wrapper">
<div class="row">
<div class="col-md-6">
<div class="panel">
<div class="panel-body">
@ -61,29 +61,29 @@
</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}}
{% trans "Image" %}: {{image}}
<span ng-show="'{{image}}' == 'unknown:unknown'" title="Actions involving container recreation cannot be executed">
<i class="fa fa-warning"></i>
<i class="fa fa-warning btn-icon"></i>
</span>
<br>
{% if ports %}
{% trans "Ports" %}: <br>
{% 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"></i> Settings</button>
<button class="btn btn-warning" ng-click="recreate()"><i class="fa fa-refresh"></i> Recreate</button>
<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="recreate()"><i class="fa fa-refresh btn-icon"></i> Recreate</button>
</div>
</div>
@ -95,19 +95,19 @@
</div>
</div>
<div class="example-box-wrapper">
<div class="content-box">
<div class="panel panel-body">
<h3 class="content-box-header bg-blue">
<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">
@ -116,30 +116,30 @@
<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"></i></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"></i> Start</button>
<button ng-disabled="status!='running'" class="btn btn-primary" ng-click="cAction('restart')"><i class="fa fa-refresh"></i> Restart</button>
<button ng-disabled="status!='running'" class="btn btn-primary" ng-click="cAction('stop')"><i class="fa fa-stop"></i> Stop</button>
<button class="btn btn-block btn-primary" ng-click="cRemove()">Remove</button>
<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-block btn-primary">Export file</a>
<button class="btn btn-block btn-primary" ng-disabled="loadingTop" ng-click="showTop()">View Process</button>
<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>
@ -147,29 +147,29 @@
</div>
<div class="example-box-wrapper">
<div class="content-box">
<div class="content-box panel-body">
<h3 class="content-box-header bg-blue" ng-init="loadLogs('{{name}}')">
<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"></i></span>
<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>
<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">
@ -182,7 +182,7 @@
</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>
@ -191,7 +191,7 @@
</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">
@ -202,7 +202,7 @@
</div>
</div>
</div>
<hr>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Confirmation" %}</label>
@ -210,7 +210,7 @@
<div class="checkbox">
<label>
<input ng-model="envConfirmation" type="checkbox">
Editing ENV or Volume will recreate container <i class="fa fa-warning" title="If you tick this checkbox, your container will be recreated with saved information. Data saved inside container will be deleted (Not avaialble for container created outside of cyberpanel)"></i>
Editing ENV or Volume will recreate container.
</label>
</div>
</div>
@ -290,7 +290,6 @@
<button type="button" ng-disabled="savingSettings" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
@ -298,14 +297,14 @@
<div class="modal-dialog" style="width: 96%;">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-content panel-body">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Container Processes</h4>
<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 table-bordered" id="datatable-example">
<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>

View File

@ -7,8 +7,8 @@ class ServiceManager:
def __init__(self, extraArgs):
self.extraArgs = extraArgs
def managePDNS(self):
return 0
type = self.extraArgs['type']
path = '/etc/pdns/pdns.conf'

View File

@ -99,7 +99,7 @@ def fetchStatus(request):
data_ret['slaveIPData'] = pdns.also_notify
except:
PDNSStatus(serverStatus=1).save()
data_ret['installCheck'] = 0
data_ret['installCheck'] = 1
data_ret['slaveIPData'] = ''
json_data = json.dumps(data_ret)
@ -173,10 +173,10 @@ def saveStatus(request):
sm = ServiceManager(extraArgs)
sm.managePDNS()
command = 'sudo systemctl start pdns'
command = 'sudo systemctl enable pdns'
subprocess.call(shlex.split(command))
command = 'sudo systemctl enable pdns'
command = 'sudo systemctl restart pdns'
subprocess.call(shlex.split(command))
else:

View File

@ -746,6 +746,31 @@ WantedBy=multi-user.target"""
except:
pass
@staticmethod
def manageServiceMigrations():
try:
connection, cursor = Upgrade.setupConnection('cyberpanel')
query = """CREATE TABLE `manageServices_pdnsstatus` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`serverStatus` int(11) NOT NULL,
`type` varchar(6) NOT NULL,
`allow_axfr_ips` varchar(500) NOT NULL,
`also_notify` varchar(500) NOT NULL,
PRIMARY KEY (`id`)
)"""
try:
cursor.execute(query)
except:
pass
try:
connection.close()
except:
pass
except:
pass
@staticmethod
def enableServices():
try:
@ -1038,6 +1063,7 @@ WantedBy=multi-user.target"""
Upgrade.applyLoginSystemMigrations()
Upgrade.s3BackupMigrations()
Upgrade.containerMigrations()
Upgrade.manageServiceMigrations()
Upgrade.enableServices()
Upgrade.installPHP73()