bunch of functionlity
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<template name='configurationList'>
|
||||
<div class="row">
|
||||
{{#each configurations}}
|
||||
{{> configurationListItem}}
|
||||
{{else}}
|
||||
You don't have any configurations for this machine.
|
||||
{{/each}}
|
||||
</div>
|
||||
{{#unless newConfigurationRequested}}
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<button class='add-new-config-btn'>Add new configuration</button>
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
{{#if newConfigurationRequested}}
|
||||
{{> newConfigurationDialog machineId=machineId}}
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
Template.configurationList.events({
|
||||
"click .add-new-config-btn": function(event, template) {
|
||||
console.log('should add new configuration');
|
||||
Session.set('newConfigurationRequested', true);
|
||||
}
|
||||
});
|
||||
|
||||
Template.configurationList.helpers({
|
||||
newConfigurationRequested: function() {
|
||||
return Session.get('newConfigurationRequested');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
<template name='configurationListItem'>
|
||||
<div class="col-lg-4" style='text-align: center'>
|
||||
<a href=/machine/{{machineId}}/config/{{_id}}>
|
||||
<img src="http://gopherwarestudios.com/wp-content/uploads/2015/05/apache-icon.gif" alt="">
|
||||
<div>
|
||||
{{ type }}
|
||||
</div>
|
||||
<div>
|
||||
{{ description }}
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
</template>
|
||||
15
web/client/views/shared/machineDetails/machineDetails.html
Normal file
15
web/client/views/shared/machineDetails/machineDetails.html
Normal file
@@ -0,0 +1,15 @@
|
||||
<template name="machineDetails">
|
||||
<div class="col-lg-4" style="text-align: center;">
|
||||
<a href=machine/{{ machineId }}>
|
||||
<img src='https://d13yacurqjgara.cloudfront.net/users/595800/screenshots/1702094/linux_1x.png' style="width: 200px; 130px;" />
|
||||
<br />
|
||||
<div style="text-align: center;" class="machine-name">
|
||||
{{name}}
|
||||
</div>
|
||||
|
||||
</a>
|
||||
<div style="text-align: center;" class="machine-status">
|
||||
status: {{status}}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
5
web/client/views/shared/machineList/machineList.html
Normal file
5
web/client/views/shared/machineList/machineList.html
Normal file
@@ -0,0 +1,5 @@
|
||||
<template name='machineList'>
|
||||
<div class="row">
|
||||
{{#each machines}} {{> machineDetails}} {{/each}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,29 @@
|
||||
<template name='newConfigurationDialog'>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3">
|
||||
|
||||
Configuration type
|
||||
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
|
||||
<select name="configurationTypes" class='config-type'>
|
||||
|
||||
<option value="apache">Apache</option>
|
||||
<option value="nginx">Nginx</option>
|
||||
<option value="elasticsearch">Elasticsearch</option>
|
||||
<option value="unicorn">Unicorn</option>
|
||||
<option value="passenger">Passenger</option>
|
||||
<option value="hosts">HOSTS file</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="colg-lg-3">
|
||||
<input type="text" class='configuration-description form-control' placeholder="Description" />
|
||||
</div>
|
||||
<div class="col-lg-3">
|
||||
<button class="save-config-btn">Save</button>
|
||||
<button class="cancel-save-config-btn">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,36 @@
|
||||
Template.newConfigurationDialog.events({
|
||||
"click .save-config-btn": function(event, template) {
|
||||
// console.log(template.data.machineId);
|
||||
// var text = template.find('.machine-name').value; //vent.target.machineName.value;
|
||||
var machine = Machines.findOne({
|
||||
machineId: template.data.machineId
|
||||
});
|
||||
|
||||
var configDescription = template.find('.configuration-description').value;
|
||||
var configType = template.find('.config-type').value;
|
||||
|
||||
if (machine) {
|
||||
Machines.update({
|
||||
_id: machine._id
|
||||
}, {
|
||||
$push: {
|
||||
configurations: {
|
||||
machineId: machine.machineId,
|
||||
_id: (new Mongo.ObjectID()).toHexString(),
|
||||
description: configDescription,
|
||||
type: configType
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// db.students.update(
|
||||
// { _id: 1 },
|
||||
// { $push: { scores: 89 } }
|
||||
// )
|
||||
}
|
||||
Session.set('newConfigurationRequested', false);
|
||||
},
|
||||
"click .cancel-save-config-btn": function(event, template) {
|
||||
Session.set('newConfigurationRequested', false);
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
<template name="newMachine">
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h3>Add new machine</h3>
|
||||
<form class="new-machine">
|
||||
<input type="text" name="machineName" class='machine-name' placeholder="Machine Name" />
|
||||
<button type='button' name='btnAddNewMachine' class='new-machine-save-btn'>Add new machine</button>
|
||||
|
||||
{{#if newMachineAdded}}
|
||||
<div>You have successfully added a new machine. Please run <b>'chub init {{newMachineAdded}}'</b> on your computer. </div>
|
||||
<button type='button' class='close-new-machine-btn'>Ok! Got It.</button>
|
||||
{{/if}}
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user