mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-25 06:03:51 +03:00
Added changelog for publications to dashboard
This commit is contained in:
parent
32a04edbf9
commit
b77fa7dfd6
@ -42,7 +42,7 @@ from uds.core.util import permissions
|
|||||||
from uds.REST.model import ModelHandler
|
from uds.REST.model import ModelHandler
|
||||||
from uds.REST import RequestError, ResponseError
|
from uds.REST import RequestError, ResponseError
|
||||||
from uds.core.ui.UserInterface import gui
|
from uds.core.ui.UserInterface import gui
|
||||||
from .user_services import AssignedService, CachedService, Groups, Transports, Publications
|
from .user_services import AssignedService, CachedService, Groups, Transports, Publications, Changelog
|
||||||
from .services import Services
|
from .services import Services
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -61,6 +61,7 @@ class ServicesPools(ModelHandler):
|
|||||||
'groups': Groups,
|
'groups': Groups,
|
||||||
'transports': Transports,
|
'transports': Transports,
|
||||||
'publications': Publications,
|
'publications': Publications,
|
||||||
|
'changelog': Changelog
|
||||||
}
|
}
|
||||||
|
|
||||||
save_fields = ['name', 'comments', 'service_id', 'osmanager_id', 'image_id', 'initial_srvs', 'cache_l1_srvs', 'cache_l2_srvs', 'max_srvs', 'show_transports']
|
save_fields = ['name', 'comments', 'service_id', 'osmanager_id', 'image_id', 'initial_srvs', 'cache_l1_srvs', 'cache_l2_srvs', 'max_srvs', 'show_transports']
|
||||||
|
@ -329,3 +329,25 @@ class Publications(DetailHandler):
|
|||||||
'field': 'state',
|
'field': 'state',
|
||||||
'prefix': 'row-state-'
|
'prefix': 'row-state-'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Changelog(DetailHandler):
|
||||||
|
'''
|
||||||
|
Processes the transports detail requests of a Service Pool
|
||||||
|
'''
|
||||||
|
def getItems(self, parent, item):
|
||||||
|
return [{
|
||||||
|
'revision': i.revision,
|
||||||
|
'stamp': i.stamp,
|
||||||
|
'log': i.log,
|
||||||
|
} for i in parent.changelog.all()]
|
||||||
|
|
||||||
|
def getTitle(self, parent):
|
||||||
|
return _('Changelog')
|
||||||
|
|
||||||
|
def getFields(self, parent):
|
||||||
|
return [
|
||||||
|
{'revision': {'title': _('Revision'), 'type': 'numeric', 'width': '6em'}},
|
||||||
|
{'stamp': {'title': _('Publish date'), 'type': 'datetime'}},
|
||||||
|
{'log': {'title': _('State')}},
|
||||||
|
]
|
||||||
|
@ -209,7 +209,7 @@ class PublicationManager(object):
|
|||||||
dsp = None
|
dsp = None
|
||||||
dsp = servicePool.publications.create(state=State.LAUNCHING, state_date=now, publish_date=now, revision=servicePool.current_pub_revision)
|
dsp = servicePool.publications.create(state=State.LAUNCHING, state_date=now, publish_date=now, revision=servicePool.current_pub_revision)
|
||||||
if changeLog:
|
if changeLog:
|
||||||
servicePool.changelog.create(revision=servicePool.current_pub_revision, log=changeLog)
|
servicePool.changelog.create(revision=servicePool.current_pub_revision, log=changeLog, stamp=now)
|
||||||
DelayedTaskRunner.runner().insert(PublicationLauncher(dsp), 4, PUBTAG + str(dsp.id))
|
DelayedTaskRunner.runner().insert(PublicationLauncher(dsp), 4, PUBTAG + str(dsp.id))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.debug('Caught exception at publish: {0}'.format(e))
|
logger.debug('Caught exception at publish: {0}'.format(e))
|
||||||
|
59
server/src/uds/migrations/0016_auto_20150617_0741.py
Normal file
59
server/src/uds/migrations/0016_auto_20150617_0741.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import models, migrations
|
||||||
|
import django.db.models.deletion
|
||||||
|
import uds.models.Util
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('uds', '0015_ticketstore'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='DeployedServicePublicationChangelog',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
||||||
|
('stamp', models.DateTimeField()),
|
||||||
|
('revision', models.PositiveIntegerField(default=1)),
|
||||||
|
('log', models.TextField(default='')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'abstract': False,
|
||||||
|
'db_table': 'uds__deployed_service_pub_cl',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='group',
|
||||||
|
name='created',
|
||||||
|
field=models.DateTimeField(default=uds.models.Util.getSqlDatetime, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='user',
|
||||||
|
name='created',
|
||||||
|
field=models.DateTimeField(default=uds.models.Util.getSqlDatetime, blank=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='deployedservice',
|
||||||
|
name='image',
|
||||||
|
field=models.ForeignKey(related_name='deployedServices', on_delete=django.db.models.deletion.SET_NULL, blank=True, to='uds.Image', null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='group',
|
||||||
|
name='manager',
|
||||||
|
field=uds.models.Util.UnsavedForeignKey(related_name='groups', to='uds.Authenticator'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='user',
|
||||||
|
name='manager',
|
||||||
|
field=uds.models.Util.UnsavedForeignKey(related_name='users', to='uds.Authenticator'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='deployedservicepublicationchangelog',
|
||||||
|
name='publication',
|
||||||
|
field=models.ForeignKey(related_name='changelog', to='uds.DeployedService'),
|
||||||
|
),
|
||||||
|
]
|
@ -47,7 +47,7 @@ from uds.models.UUIDModel import UUIDModel
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__updated__ = '2015-06-15'
|
__updated__ = '2015-06-17'
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -56,6 +56,7 @@ logger = logging.getLogger(__name__)
|
|||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class DeployedServicePublicationChangelog(models.Model):
|
class DeployedServicePublicationChangelog(models.Model):
|
||||||
publication = models.ForeignKey(DeployedService, on_delete=models.CASCADE, related_name='changelog')
|
publication = models.ForeignKey(DeployedService, on_delete=models.CASCADE, related_name='changelog')
|
||||||
|
stamp = models.DateTimeField()
|
||||||
revision = models.PositiveIntegerField(default=1)
|
revision = models.PositiveIntegerField(default=1)
|
||||||
log = models.TextField(default='')
|
log = models.TextField(default='')
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ gui.servicesPools.link = (event) ->
|
|||||||
groups: "groups-placeholder"
|
groups: "groups-placeholder"
|
||||||
transports: "transports-placeholder"
|
transports: "transports-placeholder"
|
||||||
publications: "publications-placeholder"
|
publications: "publications-placeholder"
|
||||||
|
changelog: "changelog-placeholder"
|
||||||
logs: "logs-placeholder"
|
logs: "logs-placeholder"
|
||||||
)
|
)
|
||||||
gui.setLinksEvents()
|
gui.setLinksEvents()
|
||||||
@ -378,6 +379,8 @@ gui.servicesPools.link = (event) ->
|
|||||||
# * Publications part
|
# * Publications part
|
||||||
#
|
#
|
||||||
publications = null
|
publications = null
|
||||||
|
changelog = null
|
||||||
|
clTable = null
|
||||||
if info.needs_publication
|
if info.needs_publication
|
||||||
$("#publications-placeholder_tab").removeClass "hidden"
|
$("#publications-placeholder_tab").removeClass "hidden"
|
||||||
pubApi = api.servicesPools.detail(servPool.id, "publications")
|
pubApi = api.servicesPools.detail(servPool.id, "publications")
|
||||||
@ -437,20 +440,34 @@ gui.servicesPools.link = (event) ->
|
|||||||
)
|
)
|
||||||
gui.tools.applyCustoms modalId
|
gui.tools.applyCustoms modalId
|
||||||
$(modalId + " .button-accept").click ->
|
$(modalId + " .button-accept").click ->
|
||||||
changelog = encodeURIComponent($('#id_publish_log').val())
|
chlog = encodeURIComponent($('#id_publish_log').val())
|
||||||
$(modalId).modal "hide"
|
$(modalId).modal "hide"
|
||||||
pubApi.invoke "publish", (->
|
pubApi.invoke "publish", (->
|
||||||
refreshFnc()
|
refreshFnc()
|
||||||
|
changelog.refresh()
|
||||||
|
# Also changelog
|
||||||
return
|
return
|
||||||
),
|
),
|
||||||
gui.failRequestModalFnc(gettext("Failed creating publication")),
|
gui.failRequestModalFnc(gettext("Failed creating publication")),
|
||||||
{ params: 'changelog=' + changelog }
|
{ params: 'changelog=' + chlog }
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
return
|
return
|
||||||
)
|
)
|
||||||
prevTables.push publicationsTable
|
prevTables.push publicationsTable
|
||||||
|
|
||||||
|
# changelog
|
||||||
|
clApi = api.servicesPools.detail(servPool.id, "changelog")
|
||||||
|
changelog = new GuiElement(clApi, "changelog", { permission: servPool.permission })
|
||||||
|
clTable = changelog.table(
|
||||||
|
icon: 'publications'
|
||||||
|
container: "changelog-placeholder"
|
||||||
|
rowSelect: "single"
|
||||||
|
)
|
||||||
|
clTables.push clTable
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
$("#publications-placeholder_tab").addClass "hidden"
|
$("#publications-placeholder_tab").addClass "hidden"
|
||||||
|
|
||||||
|
@ -198,7 +198,7 @@
|
|||||||
# What execute on refresh button push
|
# What execute on refresh button push
|
||||||
onRefresh = tblParams.onRefresh or ->
|
onRefresh = tblParams.onRefresh or ->
|
||||||
|
|
||||||
refreshFnc = ->
|
self.refresh = refreshFnc = ->
|
||||||
# Refreshes table content
|
# Refreshes table content
|
||||||
tbl = $("#" + tableId).dataTable()
|
tbl = $("#" + tableId).dataTable()
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<li id="{{ cache }}_tab"><a href="#{{ cache }}" data-toggle="tab">{% endverbatim %}{% trans 'Cache' %}{% verbatim %}</a></li>
|
<li id="{{ cache }}_tab"><a href="#{{ cache }}" data-toggle="tab">{% endverbatim %}{% trans 'Cache' %}{% verbatim %}</a></li>
|
||||||
<li id="{{ groups }}_tab"><a href="#{{ groups }}" data-toggle="tab">{% endverbatim %}{% trans 'Groups' %}{% verbatim %}</a></li>
|
<li id="{{ groups }}_tab"><a href="#{{ groups }}" data-toggle="tab">{% endverbatim %}{% trans 'Groups' %}{% verbatim %}</a></li>
|
||||||
<li><a href="#{{ transports }}" data-toggle="tab">{% endverbatim %}{% trans 'Transports' %}{% verbatim %}</a></li>
|
<li><a href="#{{ transports }}" data-toggle="tab">{% endverbatim %}{% trans 'Transports' %}{% verbatim %}</a></li>
|
||||||
<li id="{{ publications }}_tab"><a href="#{{ publications }}" data-toggle="tab">{% endverbatim %}{% trans 'Publications' %}{% verbatim %}</a></li>
|
<li id="{{ publications }}_tab"><a href="#{{ publications }}_pane" data-toggle="tab">{% endverbatim %}{% trans 'Publications' %}{% verbatim %}</a></li>
|
||||||
<li><a href="#{{ logs }}" data-toggle="tab">{% endverbatim %}{% trans 'Logs' %}{% verbatim %}</a></li>
|
<li><a href="#{{ logs }}" data-toggle="tab">{% endverbatim %}{% trans 'Logs' %}{% verbatim %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
@ -57,7 +57,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="{{ groups }}">...</div>
|
<div class="tab-pane fade" id="{{ groups }}">...</div>
|
||||||
<div class="tab-pane fade" id="{{ transports }}">...</div>
|
<div class="tab-pane fade" id="{{ transports }}">...</div>
|
||||||
<div class="tab-pane fade" id="{{ publications }}">...</div>
|
<div class="tab-pane fade" id="{{ publications }}_pane">
|
||||||
|
<div id="{{ publications }}">
|
||||||
|
</div>
|
||||||
|
<div id="{{ changelog }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="tab-pane fade" id="{{ logs }}">...</div>
|
<div class="tab-pane fade" id="{{ logs }}">...</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user