mirror of
https://github.com/Febbweiss/ProjectDeployer.git
synced 2026-03-04 22:25:38 +00:00
Feature: add deployment + deployment logs
This commit is contained in:
11
client/deployment.service.js
Normal file
11
client/deployment.service.js
Normal 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;
|
||||
}
|
||||
};
|
||||
@@ -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>
|
||||
|
||||
21
client/project_details.controller.js
Normal file
21
client/project_details.controller.js
Normal 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';
|
||||
}
|
||||
})
|
||||
55
client/project_details.view.html
Normal file
55
client/project_details.view.html
Normal 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>
|
||||
@@ -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);
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user