Skip to content

Commit

Permalink
Related-Bug: #1476413, Related-Bug: #1483432
Browse files Browse the repository at this point in the history
Contrail View level changes for test infra on behalf of abhishek
1. don't load all views by default during initial loading.
2. allow set rootView and parentView for any view.

UT infra changes and Common test chages:
1. updated network list view test to use the new unit test infra.
2. page level test config is created for running common gridview tests - gridview and gridlistmodel
3. new common controller test utils file for all common test helper fns.

Change-Id: Ib948e25cea38c6ce6765cfbe950db29f5347cb87
  • Loading branch information
skizhak committed Aug 12, 2015
1 parent d0cf4bc commit 7372abf
Show file tree
Hide file tree
Showing 29 changed files with 295 additions and 515 deletions.
8 changes: 2 additions & 6 deletions webroot/common/ui/js/controller.app.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,9 @@ require.config({

'controller-view-config': ctBaseDir + '/common/ui/js/controller.view.config',
'nm-view-config': ctBaseDir + '/monitor/networking/ui/js/nm.view.config',

'controller-init': ctBaseDir + '/common/ui/js/controller.init',
'lls-grid-config': ctBaseDir +
'/config/linklocalservices/ui/js/linkLocalServices.grid.config',
'lls-parsers': ctBaseDir +
'/config/linklocalservices/ui/js/linkLocalServices.parsers',
'controller-render': ctBaseDir + '/common/ui/js/controller.render'
'lls-grid-config': ctBaseDir + '/config/linklocalservices/ui/js/linkLocalServices.grid.config',
'lls-parsers': ctBaseDir + '/config/linklocalservices/ui/js/linkLocalServices.parsers'
},
waitSeconds: 0
});
Expand Down
4 changes: 4 additions & 0 deletions webroot/common/ui/js/controller.graph.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ define([
{
elementId: ctwl.MONITOR_PROJECT_VIEW_ID,
view: "ProjectTabView",
viewPathPrefix: "monitor/networking/ui/js/views/",
app: cowc.APP_CONTRAIL_CONTROLLER,
viewConfig: options
}
Expand Down Expand Up @@ -57,6 +58,7 @@ define([
{
elementId: ctwl.MONITOR_NETWORK_VIEW_ID,
view: "NetworkTabView",
viewPathPrefix: "monitor/networking/ui/js/views/",
app: cowc.APP_CONTRAIL_CONTROLLER,
viewConfig: options
}
Expand Down Expand Up @@ -85,6 +87,7 @@ define([
{
elementId: ctwl.MONITOR_INSTANCE_VIEW_ID,
view: "InstanceTabView",
viewPathPrefix: "monitor/networking/ui/js/views/",
app: cowc.APP_CONTRAIL_CONTROLLER,
viewConfig: options
}
Expand All @@ -108,6 +111,7 @@ define([
{
elementId: ctwl.MONITOR_CONNECTED_NETWORK_VIEW_ID,
view: "ConnectedNetworkTabView",
viewPathPrefix: "monitor/networking/ui/js/views/",
app: cowc.APP_CONTRAIL_CONTROLLER,
viewConfig: elementObj
}
Expand Down
18 changes: 6 additions & 12 deletions webroot/common/ui/js/controller.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ define([
'controller-parsers', 'nm-parsers',
'controller-view-config', 'nm-view-config',
'lls-grid-config', 'lls-parsers'
], function (_, Constants, Labels, Utils, NMUtils, Messages, GridConfig,
NMGridConfig, GraphConfig, NMGraphConfig, Parsers, NMParsers,
ViewConfig, NMViewConfig, LLSGridConfig, LLSParsers) {
], function (_, Constants, Labels, Utils, NMUtils, Messages, GridConfig, NMGridConfig, GraphConfig, NMGraphConfig, Parsers, NMParsers, ViewConfig,
NMViewConfig, LLSGridConfig, LLSParsers) {
ctwc = new Constants();
ctwl = new Labels();

Expand All @@ -39,14 +38,9 @@ define([
llswgc = new LLSGridConfig();
llswp = new LLSParsers();

ctInitComplete = true;
var deferredObj = contentHandler.initFeatureAppDefObjMap[FEATURE_PCK_WEB_CONTROLLER];

require(['controller-render'], function(CtrlRender) {
ctwru = new CtrlRender();
var deferredObj = contentHandler.initFeatureAppDefObjMap[FEATURE_PCK_WEB_CONTROLLER];

if(contrail.checkIfExist(deferredObj)) {
deferredObj.resolve()
}
});
if(contrail.checkIfExist(deferredObj)) {
deferredObj.resolve()
}
});
285 changes: 0 additions & 285 deletions webroot/common/ui/js/controller.render.js

This file was deleted.

24 changes: 24 additions & 0 deletions webroot/common/ui/js/controller.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,30 @@ define([
return contrailListModel;
};

this.renderView = function (renderConfig, renderCallback) {
var parentElement = renderConfig['parentElement'],
viewName = renderConfig['viewName'],
viewPathPrefix = contrail.checkIfExist(renderConfig['viewPathPrefix']) ? renderConfig['viewPathPrefix'] : '/',
model = renderConfig['model'],
viewAttributes = renderConfig['viewAttributes'],
modelMap = renderConfig['modelMap'],
rootView = renderConfig['rootView'],
viewPath = viewPathPrefix + viewName,
onAllRenderCompleteCB = renderConfig['onAllRenderCompleteCB'],
elementView;

require([viewPath], function(ElementView) {
elementView = new ElementView({el: parentElement, model: model, attributes: viewAttributes, rootView: rootView, onAllRenderCompleteCB: onAllRenderCompleteCB});
elementView.viewName = viewName;
elementView.modelMap = modelMap;
elementView.beginMyRendering();
elementView.render();
if(contrail.checkIfFunction(renderCallback)) {
renderCallback(elementView);
}
elementView.endMyRendering()
});
};
};

return CTUtils;
Expand Down

0 comments on commit 7372abf

Please sign in to comment.