Skip to content

Commit

Permalink
renamed js and jst files more accurately. rockstor#560
Browse files Browse the repository at this point in the history
  • Loading branch information
schakrava committed Apr 20, 2016
1 parent 9e1c234 commit e87f474
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 26 deletions.
6 changes: 3 additions & 3 deletions src/rockstor/storageadmin/static/storageadmin/js/router.js
Expand Up @@ -450,23 +450,23 @@ var AppRouter = Backbone.Router.extend({
showNetworks: function() {
this.renderSidebar("system", "network");
this.cleanup();
this.currentLayout = new NewNetworksView();
this.currentLayout = new NetworkView();
$('#maincontent').empty();
$('#maincontent').append(this.currentLayout.render().el);
},

editNetwork: function(connectionId) {
this.renderSidebar("system", "network");
this.cleanup();
this.currentLayout = new NewNetworkConnectionView({connectionId: connectionId});
this.currentLayout = new NetworkConnectionView({connectionId: connectionId});
$('#maincontent').empty();
$('#maincontent').append(this.currentLayout.render().el);
},

addNetworkConnection: function() {
this.renderSidebar("system", "network");
this.cleanup();
this.currentLayout = new NewNetworkConnectionView();
this.currentLayout = new NetworkConnectionView();
$('#maincontent').empty();
$('#maincontent').append(this.currentLayout.render().el);
},
Expand Down
Expand Up @@ -46,7 +46,7 @@
<td class="accordion-toggle" data-toggle="collapse" data-parent="#connections" data-target="#accordion-{{this.id}}"><a> {{this.name}}</a>&nbsp;&nbsp; <a href="#network/edit/{{this.id}}"><i class="glyphicon glyphicon-pencil"></i></a>
<a id="{{this.id}}" data-action="delete" rel="tooltip" title="Delete connection"><i class="glyphicon glyphicon-trash"></i></a></td>
<td>{{this.uuid}}</td>
<td>{{this.ctype}} {{#if this.team_profile}}[{{this.team_profile}}]{{/if}}</td>
<td>{{this.ctype}} {{#if this.team_profile}}[{{this.team_profile}}]{{/if}}{{#if this.bond_profile}}[{{this.bond_profile}}]{{/if}}</td>
<td>{{this.state}}&nbsp;&nbsp;
<input type="checkbox" data-connection-id="{{this.id}}" data-name="{{this.name}}" data-size="mini" {{getState this.state}}>
<div class="command-status" data-connection-id="{{this.id}}">&nbsp;</div>
Expand All @@ -65,7 +65,10 @@
{{#if this.team_profile}}
<h4>Team Profile: {{this.team_profile}}</h4>
{{/if}}
<p>member Connections</p>
{{#if this.bond_profile}}
<h4>Bond Profile: {{this.bond_profile}}</h4>
{{/if}}
<p>member Connections</p>
<table class="table table-bordered">
<tr>
<th>Name</th>
Expand Down
Expand Up @@ -73,9 +73,9 @@
<div class="form-group">
<label class="col-sm-4 control-label" for="bond_profile">Bond Profile<span class="required"> *</span></label>
<div class="col-sm-4">
<select class="form-control" id="bond_profile" name="bond_profile">
<select class="form-control" id="bond_profile" name="bond_profile" {{#if connection}}disabled{{/if}}>
{{#each bondProfiles}}
<option value="{{this}}">{{this}}</option>
<option value="{{this}}" {{#if ../connection}}{{selectedBondProfile this}}{{/if}}>{{this}}</option>
{{/each}}
</select>
</div>
Expand Down
Expand Up @@ -231,6 +231,14 @@ NetworkConnectionView = RockstorLayoutView.extend({
return new Handlebars.SafeString(html);
});

Handlebars.registerHelper('selectedBondProfile', function(profile) {
var html = '';
if (profile == _this.connection.get('bond_profile')) {
html = 'selected="selected"';
}
return new Handlebars.SafeString(html);
});

Handlebars.registerHelper('selectedDevice', function(device) {
var html = '';
if (device.cname == _this.connection.get('name')) {
Expand Down
39 changes: 20 additions & 19 deletions src/rockstor/storageadmin/static/storageadmin/js/views/network.js
Expand Up @@ -127,25 +127,26 @@ NetworkView = Backbone.View.extend({
},

deleteConnection: function(event){
alert("Are you sure to delete the connection?");
var _this = this;
var button = $(event.currentTarget);
var connectionId = button.attr('id');
if (buttonDisabled(button)) return false;
disableButton(button);
$.ajax({
url: "/api/network/connections/" + connectionId,
type: "DELETE",
dataType: "json",
success: function() {
_this.collection.fetch({reset: true});
enableButton(button);
_this.render();
},
error: function(xhr, status, error) {
enableButton(button);
}
});
if (confirm("Are you sure to delete the connection?")) {
var _this = this;
var button = $(event.currentTarget);
var connectionId = button.attr('id');
if (buttonDisabled(button)) return false;
disableButton(button);
$.ajax({
url: "/api/network/connections/" + connectionId,
type: "DELETE",
dataType: "json",
success: function() {
_this.collection.fetch({reset: true});
enableButton(button);
_this.render();
},
error: function(xhr, status, error) {
enableButton(button);
}
});
}
},

initHandlebarHelpers: function(){
Expand Down

0 comments on commit e87f474

Please sign in to comment.