1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-22 13:33:52 +03:00

Feature #4217: Add marketplaceapps-tab

This commit is contained in:
Daniel Molina 2016-02-08 10:44:01 +01:00
parent 333713d1df
commit b20b96e76e
8 changed files with 391 additions and 7 deletions

View File

@ -25,6 +25,7 @@ enabled_tabs:
- oneflow-services-tab
- oneflow-templates-tab
- marketplaces-tab
- marketplaceapps-tab
- settings-tab
- support-tab
autorefresh: true
@ -597,10 +598,35 @@ tabs:
- 7 # Driver
#- 8 # Labels
actions:
Datastore.refresh: true
#Datastore.create_dialog: true
Datastore.rename: true
Datastore.chown: true
Datastore.chgrp: true
Datastore.chmod: true
Datastore.delete: true
MarketPlace.refresh: true
#MarketPlace.create_dialog: true
MarketPlace.rename: true
MarketPlace.chown: true
MarketPlace.chgrp: true
MarketPlace.chmod: true
MarketPlace.delete: true
marketplaceapps-tab:
panel_tabs:
#marketplaces_info_tab: true
#marketplaces_apps_tab: true
table_columns:
- 0 # Checkbox
- 1 # ID
- 2 # Owner
- 3 # Group
- 4 # Name
#- 5 # Version
- 6 # Size
- 7 # State
#- 8 # Type
- 9 # Registration
- 10 # Marketplace
#- 11 # Labels
actions:
MarketPlaceApp.refresh: true
#MarketPlaceApp.create_dialog: true
MarketPlaceApp.rename: true
MarketPlaceApp.chown: true
MarketPlaceApp.chgrp: true
MarketPlaceApp.chmod: true
MarketPlaceApp.delete: true

View File

@ -24,6 +24,7 @@ enabled_tabs:
- oneflow-services-tab
- oneflow-templates-tab
- marketplaces-tab
- marketplaceapps-tab
- settings-tab
#- support-tab
autorefresh: true
@ -591,3 +592,36 @@ tabs:
- 6 # Apps
- 7 # Driver
#- 8 # Labels
actions:
MarketPlace.refresh: true
#MarketPlace.create_dialog: true
MarketPlace.rename: true
MarketPlace.chown: true
MarketPlace.chgrp: true
MarketPlace.chmod: true
MarketPlace.delete: true
marketplaceapps-tab:
panel_tabs:
#marketplaces_info_tab: true
#marketplaces_apps_tab: true
table_columns:
- 0 # Checkbox
- 1 # ID
- 2 # Owner
- 3 # Group
- 4 # Name
#- 5 # Version
- 6 # Size
- 7 # State
#- 8 # Type
- 9 # Registration
- 10 # Marketplace
#- 11 # Labels
actions:
MarketPlaceApp.refresh: true
#MarketPlaceApp.create_dialog: true
MarketPlaceApp.rename: true
MarketPlaceApp.chown: true
MarketPlaceApp.chgrp: true
MarketPlaceApp.chmod: true
MarketPlaceApp.delete: true

View File

@ -143,6 +143,7 @@ require.config({
'tabs/oneflow-services-tab',
'tabs/oneflow-templates-tab',
'tabs/marketplaces-tab',
'tabs/marketplaceapps-tab',
'tabs/settings-tab',
'tabs/support-tab'
]

View File

@ -0,0 +1,58 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
var Locale = require('utils/locale');
var Buttons = require('./marketplaceapps-tab/buttons');
var Actions = require('./marketplaceapps-tab/actions');
var Table = require('./marketplaceapps-tab/datatable');
var TAB_ID = require('./marketplaceapps-tab/tabId');
var DATATABLE_ID = "dataTableMarketplaceApps";
var _dialogs = [
];
var _panels = [
//require('./marketplaceapps-tab/panels/info')
];
var _panelsHooks = [
require('../utils/hooks/header')
];
var _formPanels = [
//require('./datastores-tab/form-panels/create')
];
var Tab = {
tabId: TAB_ID,
title: '<i class="fa fa-lg fa-fw fa-shopping-cart"></i>&emsp;' + Locale.tr("Apps"),
listHeader: '<i class="fa fa-fw fa-shopping-cart"></i>&emsp;'+Locale.tr("Apps"),
infoHeader: '<i class="fa fa-fw fa-shopping-cart"></i>&emsp;'+Locale.tr("App"),
subheader: '<span/> <small></small>&emsp;',
resource: 'MarketPlace',
buttons: Buttons,
actions: Actions,
dataTable: new Table(DATATABLE_ID, {actions: true, info: true, oneSelection: true}),
panels: _panels,
panelsHooks: _panelsHooks,
formPanels: _formPanels,
dialogs: _dialogs
};
return Tab;
});

View File

@ -0,0 +1,48 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
var Sunstone = require('sunstone');
var Notifier = require('utils/notifier');
var Locale = require('utils/locale');
var CommonActions = require('utils/common-actions');
var OpenNebulaResource = require('opennebula/marketplaceapp');
var RESOURCE = "MarketPlaceApp";
var XML_ROOT = "MARKETPLACEAPP";
var TAB_ID = require('./tabId');
//var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId');
var _commonActions = new CommonActions(OpenNebulaResource, RESOURCE, TAB_ID, XML_ROOT);
var _actions = {
//"MarketPlaceApp.create" : _commonActions.create(CREATE_DIALOG_ID),
//"MarketPlaceApp.create_dialog" : _commonActions.showCreate(CREATE_DIALOG_ID),
"MarketPlaceApp.list" : _commonActions.list(),
"MarketPlaceApp.show" : _commonActions.show(),
"MarketPlaceApp.refresh" : _commonActions.refresh(),
"MarketPlaceApp.delete" : _commonActions.del(),
"MarketPlaceApp.chown": _commonActions.multipleAction('chown'),
"MarketPlaceApp.chgrp": _commonActions.multipleAction('chgrp'),
"MarketPlaceApp.chmod": _commonActions.singleAction('chmod'),
//"MarketPlaceApp.update" : _commonActions.updateTemplate(),
//"MarketPlaceApp.update_template" : _commonActions.updateTemplate(),
//"MarketPlaceApp.append_template" : _commonActions.appendTemplate(),
"MarketPlaceApp.rename": _commonActions.singleAction('rename')
}
return _actions;
});

View File

@ -0,0 +1,52 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
var Locale = require('utils/locale');
var MarketPlaceAppButtons = {
"MarketPlaceApp.refresh" : {
type: "action",
layout: "refresh",
alwaysActive: true
},
//"MarketPlaceApp.create_dialog" : {
// type: "create_dialog",
// layout: "create"
//},
"MarketPlaceApp.chown" : {
type: "confirm_with_select",
text: Locale.tr("Change owner"),
select: "User",
layout: "user_select",
tip: Locale.tr("Select the new owner") + ":"
},
"MarketPlaceApp.chgrp" : {
type: "confirm_with_select",
text: Locale.tr("Change group"),
select: "Group",
layout: "user_select",
tip: Locale.tr("Select the new group") + ":"
},
"MarketPlaceApp.delete" : {
type: "confirm",
text: Locale.tr("Delete"),
layout: "del"
}
};
return MarketPlaceAppButtons;
})

View File

@ -0,0 +1,146 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require) {
/*
DEPENDENCIES
*/
var TabDataTable = require('utils/tab-datatable');
var SunstoneConfig = require('sunstone-config');
var Locale = require('utils/locale');
var OpenNebulaMarketPlaceApp = require('opennebula/marketplaceapp');
var OpenNebulaMarketPlace = require('opennebula/marketplace');
var LabelsUtils = require('utils/labels/utils');
var Humanize = require('utils/humanize');
/*
CONSTANTS
*/
var RESOURCE = "MarketPlaceApp";
var XML_ROOT = "MARKETPLACEAPP";
var TAB_NAME = require('./tabId');
var LABELS_COLUMN = 11;
var TEMPLATE_ATTR = 'TEMPLATE';
/*
CONSTRUCTOR
*/
/*
@dataTableId
@param {String} dataTableId unique identifier
@param {Object} conf
conf = {
'info': true, enable on click row will show the element
'action': true, enable actions on row elements
'select': true, enable selecting elements from the table
'selectOptions': {
'filter_fn': function(ds) { return ds.TYPE == 0; }
}
}
@returns {Table} A new table object
*/
function Table(dataTableId, conf) {
this.conf = conf || {};
this.tabId = TAB_NAME;
this.dataTableId = dataTableId;
this.resource = RESOURCE;
this.xmlRoot = XML_ROOT;
this.labelsColumn = LABELS_COLUMN;
this.dataTableOptions = {
"bAutoWidth": false,
"bSortClasses" : false,
"bDeferRender": true,
"aoColumnDefs": [
{"bSortable": false, "aTargets": ["check"]},
{"sWidth": "35px", "aTargets": [0]},
{"sWidth": "250px", "aTargets": [5]},
{"bVisible": true, "aTargets": SunstoneConfig.tabTableColumns(TAB_NAME)},
{"bVisible": false, "aTargets": ['_all']}
]
}
this.columns = [
Locale.tr("ID"),
Locale.tr("Owner"),
Locale.tr("Group"),
Locale.tr("Name"),
Locale.tr("Version"),
Locale.tr("Size"),
Locale.tr("State"),
Locale.tr("Type"),
Locale.tr("Registration Time"),
Locale.tr("Marketplace"),
Locale.tr("Labels")
]
this.selectOptions = {
"id_index": 1,
"name_index": 4,
"uname_index": 2,
"select_resource": Locale.tr("Please select an appliance from the list"),
"you_selected": Locale.tr("You selected the following appliance:"),
"select_resource_multiple": Locale.tr("Please select one or more appliances from the list"),
"you_selected_multiple": Locale.tr("You selected the following appliances:")
}
TabDataTable.call(this);
};
Table.prototype = Object.create(TabDataTable.prototype);
Table.prototype.constructor = Table;
Table.prototype.elementArray = _elementArray;
return Table;
/*
FUNCTION DEFINITIONS
*/
function _elementArray(element_json) {
var element = element_json[XML_ROOT];
return [
'<input class="check_item" type="checkbox" id="'+RESOURCE.toLowerCase()+'_' +
element.ID + '" name="selected_items" value="' +
element.ID + '"/>',
element.ID,
element.UNAME,
element.GNAME,
element.NAME,
element.VERSION,
Humanize.sizeFromMB(element.SIZE),
OpenNebulaMarketPlaceApp.stateStr(element.STATE),
OpenNebulaMarketPlaceApp.typeStr(element.TYPE),
Humanize.prettyTime(element.REGTIME),
OpenNebulaMarketPlace.getName(element.MARKETPLACE_ID),
(LabelsUtils.labelsStr(element[TEMPLATE_ATTR])||'')
];
}
function _lengthOf(ids){
var l = 0;
if ($.isArray(ids))
l = ids.length;
else if (!$.isEmptyObject(ids))
l = 1;
return l;
}
});

View File

@ -0,0 +1,19 @@
/* -------------------------------------------------------------------------- */
/* Copyright 2002-2015, OpenNebula Project, OpenNebula Systems */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); you may */
/* not use this file except in compliance with the License. You may obtain */
/* a copy of the License at */
/* */
/* http://www.apache.org/licenses/LICENSE-2.0 */
/* */
/* Unless required by applicable law or agreed to in writing, software */
/* distributed under the License is distributed on an "AS IS" BASIS, */
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
/* See the License for the specific language governing permissions and */
/* limitations under the License. */
/* -------------------------------------------------------------------------- */
define(function(require){
return 'marketplaceapps-tab';
});