mirror of
https://github.com/dkmstr/openuds.git
synced 2025-01-08 21:18:00 +03:00
Added changelog at publish stage (needs to show it on admin)
This commit is contained in:
parent
3ff281ffa3
commit
32a04edbf9
@ -281,7 +281,7 @@ class Publications(DetailHandler):
|
||||
self.accessDenied()
|
||||
|
||||
logger.debug('Custom "publish" invoked for {}'.format(parent))
|
||||
parent.publish() # Can raise exceptions that will be processed on response
|
||||
parent.publish(changeLog) # Can raise exceptions that will be processed on response
|
||||
return self.success()
|
||||
|
||||
def cancel(self, parent, uuid):
|
||||
|
@ -209,7 +209,7 @@ class PublicationManager(object):
|
||||
dsp = None
|
||||
dsp = servicePool.publications.create(state=State.LAUNCHING, state_date=now, publish_date=now, revision=servicePool.current_pub_revision)
|
||||
if changeLog:
|
||||
dsp.changelog.create(revision=servicePool.current_pub_revision, log=changeLog)
|
||||
servicePool.changelog.create(revision=servicePool.current_pub_revision, log=changeLog)
|
||||
DelayedTaskRunner.runner().insert(PublicationLauncher(dsp), 4, PUBTAG + str(dsp.id))
|
||||
except Exception as e:
|
||||
logger.debug('Caught exception at publish: {0}'.format(e))
|
||||
|
@ -1,54 +0,0 @@
|
||||
# -*- 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)),
|
||||
('revision', models.PositiveIntegerField(default=1)),
|
||||
('log', models.TextField(default='')),
|
||||
],
|
||||
),
|
||||
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
|
||||
|
||||
__updated__ = '2015-04-30'
|
||||
__updated__ = '2015-06-15'
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@ -59,6 +59,13 @@ class DeployedServicePublicationChangelog(models.Model):
|
||||
revision = models.PositiveIntegerField(default=1)
|
||||
log = models.TextField(default='')
|
||||
|
||||
class Meta(UUIDModel.Meta):
|
||||
'''
|
||||
Meta class to declare default order and unique multiple field index
|
||||
'''
|
||||
db_table = 'uds__deployed_service_pub_cl'
|
||||
app_label = 'uds'
|
||||
|
||||
def __str__(self):
|
||||
return 'Revision log for publication {0}, rev {1}: {2}'.format(self.publication.name, self.revision, self.log)
|
||||
|
||||
|
@ -373,9 +373,13 @@ class DetailModelRestApi extends BasicModelRest
|
||||
return
|
||||
|
||||
# Generic "Invoke" method (with no args, if needed, put them on "method" after "?" as normal url would be
|
||||
invoke: (method, success_fnc, fail_fnc) ->
|
||||
invoke: (method, success_fnc, fail_fnc, options) ->
|
||||
options = options or {}
|
||||
meth = method
|
||||
if options.params
|
||||
meth += '?' + options.params
|
||||
@get
|
||||
id: method
|
||||
id: meth
|
||||
success: success_fnc
|
||||
fail: fail_fnc
|
||||
|
||||
|
@ -428,13 +428,25 @@ gui.servicesPools.link = (event) ->
|
||||
"xls"
|
||||
]
|
||||
onNew: (action, tbl, refreshFnc) ->
|
||||
gui.promptModal gettext("Publish"), gettext("Launch new publication?"),
|
||||
onYes: ->
|
||||
# Ask for "reason" for publication
|
||||
api.templates.get "publish", (tmpl) ->
|
||||
content = api.templates.evaluate(tmpl,
|
||||
)
|
||||
modalId = gui.launchModal(gettext("Publish"), content,
|
||||
actionButton: "<button type=\"button\" class=\"btn btn-success button-accept\">" + gettext("Publish") + "</button>"
|
||||
)
|
||||
gui.tools.applyCustoms modalId
|
||||
$(modalId + " .button-accept").click ->
|
||||
changelog = encodeURIComponent($('#id_publish_log').val())
|
||||
$(modalId).modal "hide"
|
||||
pubApi.invoke "publish", (->
|
||||
refreshFnc()
|
||||
return
|
||||
), gui.failRequestModalFnc(gettext("Failed creating publication"))
|
||||
return
|
||||
),
|
||||
gui.failRequestModalFnc(gettext("Failed creating publication")),
|
||||
{ params: 'changelog=' + changelog }
|
||||
|
||||
return
|
||||
|
||||
return
|
||||
)
|
||||
|
@ -1,9 +1,10 @@
|
||||
{% load i18n html5 %}
|
||||
{% image_size as size %}
|
||||
<h3 class="text-center">{% trans 'Publish service' %}</h3>
|
||||
<div class="center-block" style="width: 60%">
|
||||
<form class="form-horizontal" role="form">
|
||||
<div class="form-group">
|
||||
<label for="id_publish_log" class="col-sm-3 control-label" data-toggle="tooltip" data-title="{% trans 'reason of publication'%}">{% trans 'Reason' %}</label>
|
||||
<input id="id_publish_log" name="image_name" type="text" class="form-control" placeholder="{% trans 'Image name' %}" autofocus required>
|
||||
<div class="col-sm-9">
|
||||
<input id="id_publish_log" name="image_name" type="text" class="form-control" placeholder="{% trans 'Reason for publication (can be empty)' %}" autofocus required maxlength="96">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
Loading…
Reference in New Issue
Block a user