Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Desktop Deploy Notifications #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
34 changes: 29 additions & 5 deletions app/views/deployments/_status.html.erb
Expand Up @@ -26,14 +26,14 @@
</p>
<p>
<b>Stage:</b>
<%= link_to @deployment.stage.name, project_stage_path(@project, @stage) %>
<%= link_to @deployment.stage.name, project_stage_path(@project, @stage) %>
</p>
<p>
<b>Deployed by:</b>
<b>Deployed by:</b>
<%= user_info(@deployment.user) rescue '' %>
</p>
<p>
<b>Revision:</b>
<b>Revision:</b>
<%= @deployment.revision %>
</p>
<p>
Expand Down Expand Up @@ -92,10 +92,34 @@



<% unless @deployment.completed? and @deployment.completed_at < 1.minute.ago %>
<script type="text/javascript">
(function() {
var opts, noti;
// icon & iconUrl both provided for different versions of the draft standard
opts = {
title: '<%=@project.name%>/<%=@deployment.stage.name%>: <%=@deployment.task%>',
body: 'Status: <%=@deployment.status%>',
iconUrl: '<%=image_path("peritor_theme/status_#{@deployment.status}.gif")%>',
icon: '<%=image_path("peritor_theme/status_#{@deployment.status}.gif")%>',
tag: '<%=@project.id%>-<%=@deployment.stage.id%>-<%=@deployment.id%>',
titleDir: 'auto',
bodyDir: 'auto'
}
if( this.Notification ) {
noti = new this.Notification(opts['title'], opts )
noti.onshow = function() { setTimeout(noti.close, 15000) }
noti.show()
} else {
console.log('no Notification API available')
}
}).call(this);
</script>
<% end %>

<% unless @deployment.completed? %>
<script type="text/javascript">

function update_status(){
new Ajax.Updater('status_info','<%=h project_stage_deployment_path(@project, @stage, @deployment) %>.js',{
method: 'get',
Expand All @@ -106,7 +130,7 @@
}
});
}

setTimeout(update_status, 3000);
check_auto_scroll_log();
</script>
Expand Down