Feature: add deployment + deployment logs

This commit is contained in:
2015-11-25 15:13:00 +00:00
parent 9c8ed27c1b
commit e135c5d2c6
19 changed files with 416 additions and 68 deletions

View File

@@ -0,0 +1,11 @@
Deployments = new Mongo.Collection('deployments');
DeploymentService = {
list: function(id) {
var deployments = Deployments.find(),
altered = deployments.map(function(doc, index, cursor) {
return _.extend(doc, {index: deployments.count() - index});
});
return altered;
}
};

View File

@@ -14,7 +14,7 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active">
<a href="/management">Projects <span class="sr-only">(current)</span></a>
<a href="/projects">Projects <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>

View File

@@ -0,0 +1,21 @@
Template.deploymentsList.helpers({
deployments: function () {
return DeploymentService.list();
}
});
Template.deploymentDetails.helpers({
format: function() {
return this.data.replace(/\n/g, '<br />');
},
running: function() {
var string = this.status;
return string.charAt(0).toUpperCase() + string.slice(1);
}
});
Template.deploymentBtn.helpers({
running: function() {
return this.status === 'pending' ? 'visible' : 'hidden';
}
})

View File

@@ -0,0 +1,55 @@
<template name="projectDetails">
<ol class="breadcrumb">
<li><a href="/projects">Projects</a></li>
<li class="active">{{label}}</li>
</ol>
<h1>
{{label}}
<a href="{{git_url}}" target="_blank">
<i class="fa fa-fw fa-github" title="Go to GIT repository"></i>
</a>
</h1>
{{> deploymentsList}}
</template>
<template name="deploymentsList">
<div>
<ul class="nav nav-tabs" role="tablist">
{{#each deployments}}
{{> deploymentBtn}}
{{/each}}
</ul>
<div class="tab-content">
{{#each deployments}}
{{> deploymentDetails}}
{{/each}}
</div>
</div>
</template>
<template name="deploymentBtn">
<li role="presentation">
<a id="heading{{index}}" role="tab" data-toggle="tab" href="#collapseDeployment{{index}}" aria-controls="collapseDeployment{{index}}">
# {{index}}
<i class="fa fa-cog fa-spin {{running}}"></i>
</a>
</li>
</template>
<template name="deploymentDetails">
<div role="tabpanel" class="tab-pane" id="collapseDeployment{{index}}">
<div class="well">
<h4>Deployment # {{index}} - {{tm_cal timestamp}}</h4>
{{#each output}}
<p>
<samp>{{{format}}}</samp>
</p>
{{/each}}
<div class="pull-right">
<h5>Status : <small>{{running}}</small></h5>
</div>
</div>
</div>
</template>

View File

@@ -1,4 +1,4 @@
Template.management.helpers({
Template.projects.helpers({
projects: function () {
return ProjectService.list();
}
@@ -13,10 +13,7 @@ Template.projectForm.events({
event.preventDefault();
var form = event.target;
if( form.id.value ) {
Meteor.call('editProject',form.id.value, form.label.value, form.git_url.value, form.public_url.value, form.commands.value, function(errors, result) {
console.log(errors);
console.log(result);
});
Meteor.call('editProject',form.id.value, form.label.value, form.git_url.value, form.public_url.value, form.commands.value);
form.id.value = '';
} else {
Meteor.call('addProject', form.label.value, form.git_url.value, form.public_url.value, form.commands.value);

View File

@@ -3,5 +3,9 @@ Projects = new Mongo.Collection('projects');
ProjectService = {
list: function() {
return Projects.find({}, {sort: {label: 1}});
},
get: function(id) {
return Projects.findOne({_id: id});
}
};

View File

@@ -1,4 +1,8 @@
<template name="management">
<template name="projects">
<ol class="breadcrumb">
<li class="active">Projects</li>
</ol>
<div class="row">
<div class="col-sm-6">
<h2>Register or edit a project</h2>
@@ -97,6 +101,9 @@
<a href="#" class="edit" title="Edit the project">
<i class="fa fa-fw fa-pencil"></i>
</a>
<a href="/project/{{_id}}" title="View project">
<i class="fa fa-fw fa-eye"></i>
</a>
</li>
</template>