Skip to content

Commit 8b5fe2c

Browse files
committed
Some Fixes
1 parent 1499bcb commit 8b5fe2c

File tree

4 files changed

+42
-6
lines changed

4 files changed

+42
-6
lines changed

webapp/autoDeploy/autodeploy/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ def clone(request):
122122
server = Server.objects.get(name=form.cleaned_data["server"])
123123
token=csrf(request).get("csrf_token")
124124
data="{scm: '%s', ip: '%s', port: '%s', project_name: '%s',csrfmiddlewaretoken: '%s' }" % (project.repo_type,server.ip,server.port,project.name,token)
125-
return render_to_response("base.html", {"ajax":True, "data": data, "dataType":"html",
126-
"title":"Cloning "+ project.name, "function":"clone"}, context_instance=RequestContext(request))
125+
return render_to_response("base.html", {"project":project,"ajax":True, "data": data, "dataType":"html",
126+
"title":"Cloning "q+ project.name, "function":"clone"}, context_instance=RequestContext(request))
127127

128128
@login_required(redirect_field_name="redirect")
129129
@csrf_protect
@@ -166,7 +166,7 @@ def listTags(request, server):
166166
table_to_report = RequestConfig(request, paginate={"per_page": 15}).configure(table)
167167
if table_to_report:
168168
return create_report_http_response(table_to_report, request)
169-
return render_to_response("deploy2.html", {"count":len(res),"mode":"tags","tags":table}, context_instance=RequestContext(request))
169+
return render_to_response("deploy2.html", {"project":project,"count":len(res),"mode":"tags","tags":table}, context_instance=RequestContext(request))
170170

171171
@login_required(redirect_field_name="redirect")
172172
def deploy3(request):
@@ -179,7 +179,7 @@ def deploy3(request):
179179

180180
project=Project.objects.get(name=request.session["deploy_project"])
181181
server=Server.objects.get(name=request.session["deploy_server"])
182-
return render_to_response("base.html", {"ajax": True,"data":data,"dataType":"html","function":"deploy","title":"Deploying %s on %s"%(project.name,server.name)}, context_instance=RequestContext(request))
182+
return render_to_response("base.html", {"project":project,"ajax": True,"data":data,"dataType":"html","function":"deploy","title":"Deploying %s on %s"%(project.name,server.name)}, context_instance=RequestContext(request))
183183

184184
@login_required(redirect_field_name="redirect")
185185
def edit_ssh_key(request, sshKey):
@@ -317,7 +317,7 @@ def listCommits(request,filter=None):
317317
table_to_report = RequestConfig(request, paginate={"per_page": 15}).configure(table)
318318
if table_to_report:
319319
return create_report_http_response(table_to_report, request)
320-
return render_to_response("deploy2.html", {"mode":"commits","commits": table,"branchs":branches,"current_branch":filter}, context_instance=RequestContext(request))
320+
return render_to_response("deploy2.html", {"project":project,"mode":"commits","commits": table,"branchs":branches,"current_branch":filter}, context_instance=RequestContext(request))
321321

322322

323323
@login_required(redirect_field_name="redirect")
9.51 KB
Loading

webapp/autoDeploy/templates/base.html

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,52 @@
1414
<link href="{{STATIC_URL}}css/morris.css" rel="stylesheet" type="text/css"/>
1515
<link href="{{STATIC_URL}}css/screen.css" rel="stylesheet" type="text/css"/>
1616
<link href="{{STATIC_URL}}css/autodeploy.css" rel="stylesheet" type="text/css"/>
17+
<link rel="shortcut icon" href="{{STATIC_URL}}img/logo.png">
18+
<link rel="apple-touch-icon" href="{{STATIC_URL}}img/logo.png">
19+
<link rel="icon" type="image/png" href="{{STATIC_URL}}img/logo.png" sizes="192x192">
1720
{% block head %}
1821
{% endblock %}
1922
<script src="{{ STATIC_URL }}js/functions.js" type="text/javascript"></script>
2023
{% if ajax %}
2124
<script type="text/javascript">
25+
function renderNotification(title,msg) {
26+
body = $("<div>").html( msg.text).text();
27+
var options = {
28+
body: body,
29+
// image: "{{ STATIC_URL }}img/sdl_logo.png",
30+
icon: "{{ STATIC_URL }}img/logo.png",
31+
badge: "{{ STATIC_URL }}img/logo.png",
32+
timestamp: new Date();
33+
}
34+
35+
var n = new Notification(title, options);
36+
}
37+
38+
39+
$(document).ready( function () {
40+
Notification.requestPermission().then(function (result) {
41+
update();
42+
});
43+
});
44+
2245
$.ajax({url:"{{ BASE_URL }}api/{{ function }}","method":"GET","dataType":"{{ dataType }}", success:function(data)
2346
{
2447
{{ function }}(data)
48+
{% if function == "clone" %}
49+
renderNotification("Cloned Successfully","Clone of {{ project.name }} done successfully")
50+
{% elif function == "deploy %}
51+
renderNotification("Deployed Successfully","Deployment of {{ project.name }} done successfully")
52+
53+
{% endif %}
2554
},error:function (data) {
2655
renderResult(data.responseText,"Error")
56+
{% if function == "clone" %}
57+
title="Cloing Failed";
58+
body="Cloning of {{ project.name }} failed, please check error";
59+
{% elif function == 'deploy' %}
60+
title="Deployment Failed";
61+
body="Deployment of {{ project.name }} failed, please check error";
62+
{% endif %}
2763
}
2864
{% if data != "" %},data:{{ data|safe }} {% endif %}
2965

webapp/autoDeploy/templates/deploy2.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{% block content %}
1212
<br/>
1313
<div align="left">
14-
<h1>Deploy Project</h1>
14+
<h1>Deploy {{ project.name }}</h1>
1515

1616
{% if result %}
1717
{% if "ERR:" in result %}

0 commit comments

Comments
 (0)