Skip to content

Commit

Permalink
Some Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkalioby committed Jan 15, 2019
1 parent 1499bcb commit 8b5fe2c
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 6 deletions.
10 changes: 5 additions & 5 deletions webapp/autoDeploy/autodeploy/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ def clone(request):
server = Server.objects.get(name=form.cleaned_data["server"])
token=csrf(request).get("csrf_token")
data="{scm: '%s', ip: '%s', port: '%s', project_name: '%s',csrfmiddlewaretoken: '%s' }" % (project.repo_type,server.ip,server.port,project.name,token)
return render_to_response("base.html", {"ajax":True, "data": data, "dataType":"html",
"title":"Cloning "+ project.name, "function":"clone"}, context_instance=RequestContext(request))
return render_to_response("base.html", {"project":project,"ajax":True, "data": data, "dataType":"html",
"title":"Cloning "q+ project.name, "function":"clone"}, context_instance=RequestContext(request))

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

@login_required(redirect_field_name="redirect")
def deploy3(request):
Expand All @@ -179,7 +179,7 @@ def deploy3(request):

project=Project.objects.get(name=request.session["deploy_project"])
server=Server.objects.get(name=request.session["deploy_server"])
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))
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))

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


@login_required(redirect_field_name="redirect")
Expand Down
Binary file added webapp/autoDeploy/static/img/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions webapp/autoDeploy/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,52 @@
<link href="{{STATIC_URL}}css/morris.css" rel="stylesheet" type="text/css"/>
<link href="{{STATIC_URL}}css/screen.css" rel="stylesheet" type="text/css"/>
<link href="{{STATIC_URL}}css/autodeploy.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="{{STATIC_URL}}img/logo.png">
<link rel="apple-touch-icon" href="{{STATIC_URL}}img/logo.png">
<link rel="icon" type="image/png" href="{{STATIC_URL}}img/logo.png" sizes="192x192">
{% block head %}
{% endblock %}
<script src="{{ STATIC_URL }}js/functions.js" type="text/javascript"></script>
{% if ajax %}
<script type="text/javascript">
function renderNotification(title,msg) {
body = $("<div>").html( msg.text).text();
var options = {
body: body,
// image: "{{ STATIC_URL }}img/sdl_logo.png",
icon: "{{ STATIC_URL }}img/logo.png",
badge: "{{ STATIC_URL }}img/logo.png",
timestamp: new Date();
}

var n = new Notification(title, options);
}


$(document).ready( function () {
Notification.requestPermission().then(function (result) {
update();
});
});

$.ajax({url:"{{ BASE_URL }}api/{{ function }}","method":"GET","dataType":"{{ dataType }}", success:function(data)
{
{{ function }}(data)
{% if function == "clone" %}
renderNotification("Cloned Successfully","Clone of {{ project.name }} done successfully")
{% elif function == "deploy %}
renderNotification("Deployed Successfully","Deployment of {{ project.name }} done successfully")

{% endif %}
},error:function (data) {
renderResult(data.responseText,"Error")
{% if function == "clone" %}
title="Cloing Failed";
body="Cloning of {{ project.name }} failed, please check error";
{% elif function == 'deploy' %}
title="Deployment Failed";
body="Deployment of {{ project.name }} failed, please check error";
{% endif %}
}
{% if data != "" %},data:{{ data|safe }} {% endif %}

Expand Down
2 changes: 1 addition & 1 deletion webapp/autoDeploy/templates/deploy2.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{% block content %}
<br/>
<div align="left">
<h1>Deploy Project</h1>
<h1>Deploy {{ project.name }}</h1>

{% if result %}
{% if "ERR:" in result %}
Expand Down

0 comments on commit 8b5fe2c

Please sign in to comment.