feature #4184: Add labels filter support to cloud view

This commit is contained in:
Daniel Molina authored and Ruben S. Montero committed 2016-01-04 17:26:52 +01:00
1 parent ebfa4bda06
commit 569cd96d77
4 files changed
+66 -14

No files matched your search

+31 -5
View File
@@ -35,6 +35,7 @@ define(function(require) {
var DisksResize = require('utils/disks-resize');
var NicsSection = require('utils/nics-section');
var TemplateUtils = require('utils/template-utils');
var LabelsUtils = require('utils/labels/utils');
var ProvisionQuotaWidget = require('./provision-tab/users/quota-widget');
@@ -56,6 +57,7 @@ define(function(require) {
var TemplateGroupInfo = require('hbs!./provision-tab/group/info');
var TAB_ID = require('./provision-tab/tabId');
var TEMPLATE_LABELS_COLUMN = 4;
var povision_actions = {
"Provision.User.create" : {
@@ -1206,7 +1208,9 @@ define(function(require) {
"aoColumns": [
{ "mDataProp": "VMTEMPLATE.ID" },
{ "mDataProp": "VMTEMPLATE.NAME" },
{ "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" }
{ "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" },
{ "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" },
{ "mDataProp": "VMTEMPLATE.TEMPLATE.LABELS", "sDefaultContent" : "-" }
],
"fnPreDrawCallback": function (oSettings) {
initializeTemplateCards(this, "provision_system_templates")
@@ -1214,6 +1218,8 @@ define(function(require) {
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
appendTemplateCard(aData, "provision_system_templates");
return nRow;
},
"fnDrawCallback": function(oSettings) {
}
});
@@ -1229,7 +1235,8 @@ define(function(require) {
{ "mDataProp": "VMTEMPLATE.ID" },
{ "mDataProp": "VMTEMPLATE.NAME" },
{ "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" },
{ "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" }
{ "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" },
{ "mDataProp": "VMTEMPLATE.TEMPLATE.LABELS", "sDefaultContent" : "-" }
],
"fnPreDrawCallback": function (oSettings) {
initializeTemplateCards(this, "provision_vdc_templates")
@@ -1252,7 +1259,8 @@ define(function(require) {
{ "mDataProp": "VMTEMPLATE.ID" },
{ "mDataProp": "VMTEMPLATE.NAME" },
{ "mDataProp": "VMTEMPLATE.TEMPLATE.SAVED_TEMPLATE_ID", "sDefaultContent" : "-" },
{ "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" }
{ "mDataProp": "VMTEMPLATE.PERMISSIONS.GROUP_U" },
{ "mDataProp": "VMTEMPLATE.TEMPLATE.LABELS", "sDefaultContent" : "-" }
],
"fnPreDrawCallback": function (oSettings) {
initializeTemplateCards(this, "provision_saved_templates")
@@ -1264,12 +1272,30 @@ define(function(require) {
});
$('#provision_create_template_search').on('input',function(){
$('#provision_create_system_template_search').on('input',function(){
provision_system_templates_datatable.fnFilter( $(this).val() );
provision_saved_templates_datatable.fnFilter( $(this).val() );
})
$('#provision_create_vdc_template_search').on('input',function(){
provision_vdc_templates_datatable.fnFilter( $(this).val() );
})
$('#provision_create_saved_template_search').on('input',function(){
provision_saved_templates_datatable.fnFilter( $(this).val() );
})
$('[href="#provision_system_templates_selector"]').on('click', function() {
ProvisionTemplatesList.updateDatatable(provision_system_templates_datatable);
})
$('[href="#provision_saved_templates_selector"]').on('click', function() {
ProvisionTemplatesList.updateDatatable(provision_saved_templates_datatable);
})
$('[href="#provision_vdc_templates_selector"]').on('click', function() {
ProvisionTemplatesList.updateDatatable(provision_vdc_templates_datatable);
})
$("#provision_create_template_refresh_button").click(function(){
OpenNebula.Action.clear_cache("VMTEMPLATE");
ProvisionTemplatesList.updateDatatable(provision_system_templates_datatable);
@@ -22,10 +22,12 @@ define(function(require) {
var Notifier = require('utils/notifier');
var Humanize = require('utils/humanize');
var ResourceSelect = require('utils/resource-select');
var LabelsUtils = require('utils/labels/utils');
var TemplateTemplatesList = require('hbs!./list');
var _accordionId = 0;
var TEMPLATE_LABELS_COLUMN = 4;
return {
'generate': generate_provision_templates_list,
@@ -90,6 +92,9 @@ define(function(require) {
'</div>');
} else {
datatable.fnAddData(item_list);
LabelsUtils.clearLabelsFilter(datatable, TEMPLATE_LABELS_COLUMN);
var context = $('.labels-dropdown', datatable.closest('.content'));
LabelsUtils.insertLabelsMenu(context, datatable, TEMPLATE_LABELS_COLUMN, "VMTEMPLATE.TEMPLATE.LABELS");
}
},
error: Notifier.onError
@@ -13,7 +13,6 @@
{{! See the License for the specific language governing permissions and }}
{{! limitations under the License. }}
{{! -------------------------------------------------------------------------- }}
<form id="provision_create_vm" class="hidden section_content">
<div class="row">
<div class="large-10 large-centered columns">
@@ -51,27 +50,38 @@
<a href="#provision_saved_templates_selector">{{tr "Saved"}}</a>
</dd>
</dl>
<div class="row">
<div class="large-12 large-centered columns">
<h3 class="subheader text-right">
<input type="search" class="provision-search-input right" placeholder="Search" id="provision_create_template_search"/>
</h3>
<br></div>
</div>
<div class="tabs-content">
<div class="content active" id="provision_system_templates_selector">
<div class="row">
<div class="large-12 columns">
<button href="#" data-options="align:right" data-dropdown="provisionSystemLabelsDropdown" class="right small secondary button dropdown radius">
<i class="fa fa-tags"/> {{tr "Labels"}}</button>
<ul id="provisionSystemLabelsDropdown" class="labels-dropdown f-dropdown" data-dropdown-content></ul>
<input type="search" class="right provision-search-input" placeholder="Search" id="provision_create_system_template_search"/>
</div>
</div>
<table id="provision_system_templates_table">
<thead class="hidden">
<tr>
<th>{{tr "ID"}}</th>
<th>{{tr "Name"}}</th>
<th>{{tr "Saved"}}</th>
<th>{{tr "Shared"}}</th>
<th>{{tr "Labels"}}</th>
</tr>
</thead>
<tbody class="hidden"></tbody>
</table>
</div>
<div class="content" id="provision_vdc_templates_selector">
<div class="row">
<div class="large-12 columns">
<button href="#" data-options="align:right" data-dropdown="provisionSystemLabelsDropdown" class="right small secondary button dropdown radius">
<i class="fa fa-tags"/> {{tr "Labels"}}</button>
<ul id="provisionVdcLabelsDropdown" class="labels-dropdown f-dropdown" data-dropdown-content></ul>
<input type="search" class="right provision-search-input" placeholder="Search" id="provision_create_vdc_template_search"/>
</div>
</div>
<table id="provision_vdc_templates_table">
<thead class="hidden">
<tr>
@@ -79,12 +89,21 @@
<th>{{tr "Name"}}</th>
<th>{{tr "Saved"}}</th>
<th>{{tr "Shared"}}</th>
<th>{{tr "Labels"}}</th>
</tr>
</thead>
<tbody class="hidden"></tbody>
</table>
</div>
<div class="content" id="provision_saved_templates_selector">
<div class="row">
<div class="large-12 columns">
<button href="#" data-options="align:right" data-dropdown="provisionSystemLabelsDropdown" class="right small secondary button dropdown radius">
<i class="fa fa-tags"/> {{tr "Labels"}}</button>
<ul id="provisionSavedLabelsDropdown" class="labels-dropdown f-dropdown" data-dropdown-content></ul>
<input type="search" class="right provision-search-input" placeholder="Search" id="provision_create_saved_template_search"/>
</div>
</div>
<table id="provision_saved_templates_table">
<thead class="hidden">
<tr>
@@ -92,6 +111,7 @@
<th>{{tr "Name"}}</th>
<th>{{tr "Saved"}}</th>
<th>{{tr "Shared"}}</th>
<th>{{tr "Labels"}}</th>
</tr>
</thead>
<tbody class="hidden"></tbody>
@@ -127,4 +147,4 @@
</div>
</div>
<br>
<br></form>
<br></form>
+1
View File
@@ -1426,6 +1426,7 @@ hr {
.labels-dropdown {
margin: 0px;
padding-top: 1em;
h6 {
margin: 0.5em 1em;