Scott Baker | fdaee92 | 2014-11-03 09:43:23 -0800 | [diff] [blame] | 1 | TestApp = new XOSApplication(); |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 2 | |
| 3 | TestApp.addRegions({ |
| 4 | deploymentList: "#deploymentList", |
| 5 | imageList: "#imageList", |
| 6 | networkTemplateList: "#networkTemplateList", |
| 7 | networkList: "#networkList", |
| 8 | nodeList: "#nodeList", |
| 9 | serviceList: "#serviceList", |
| 10 | siteList: "#siteList", |
| 11 | sliceList: "#sliceList", |
| 12 | sliverList: "#sliverList", |
Scott Baker | 3df4194 | 2014-10-28 12:44:13 -0700 | [diff] [blame] | 13 | userList: "#userList", |
Scott Baker | 4aee9a1 | 2014-10-30 00:06:16 -0700 | [diff] [blame] | 14 | detail: "#detail", |
| 15 | linkedObjs1: "#linkedObjs1", |
| 16 | linkedObjs2: "#linkedObjs2", |
| 17 | linkedObjs3: "#linkedObjs3", |
| 18 | linkedObjs4: "#linkedObjs4" |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 19 | }); |
| 20 | |
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 21 | //TestApp.navigateToDetail = function(detailView) { |
| 22 | // $(TestApp.detailBoxId).show();
|
| 23 | // TestApp.detail.show(detailView);
|
| 24 | //};
|
| 25 |
|
| 26 | TestApp.navigateToModel = function(app, detailClass, detailNavLink, model) {
|
| 27 |
|
| 28 | var detailView = new detailClass({
|
| 29 | model: model,
|
| 30 | });
|
| 31 |
|
| 32 | $(app.detailBoxId).show();
|
| 33 | app.detail.show(detailView);
|
| 34 | detailView.showLinkedItems();
|
| 35 | };
|
| 36 |
|
| 37 | TestApp.on("start", function() {
|
Scott Baker | 586878e | 2014-10-31 16:43:07 -0700 | [diff] [blame] | 38 | var objs = ['deployment', 'image', 'networkTemplate', 'network', 'networkSliver', 'networkDeployment', 'node', 'service', 'site', 'slice', 'sliceDeployment', 'slicePrivilege', 'sliver', 'user', 'sliceRole', 'userDeployment']; |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 39 | |
| 40 | for (var index in objs) { |
| 41 | name = objs[index]; |
Scott Baker | 013025a | 2014-10-30 23:50:20 -0700 | [diff] [blame] | 42 | tr_template = '#xosAdmin-' + name + '-listitem-template'; |
| 43 | table_template = '#xosAdmin-' + name + '-list-template'; |
| 44 | detail_template = '#xosAdmin-' + name + '-detail-template'; |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 45 | collection_name = name + "s"; |
| 46 | region_name = name + "List"; |
| 47 | |
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 48 | detailClass = XOSDetailView.extend({ |
Scott Baker | 3df4194 | 2014-10-28 12:44:13 -0700 | [diff] [blame] | 49 | template: detail_template,
|
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 50 | app: TestApp,
|
| 51 | });
|
Scott Baker | 3df4194 | 2014-10-28 12:44:13 -0700 | [diff] [blame] | 52 | |
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 53 | itemViewClass = XOSItemView.extend({ |
Scott Baker | 3df4194 | 2014-10-28 12:44:13 -0700 | [diff] [blame] | 54 | detailClass: detailClass, |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 55 | template: tr_template, |
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 56 | app: TestApp, |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 57 | }); |
| 58 | |
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 59 | listViewClass = XOSListView.extend({ |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 60 | childView: itemViewClass, |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 61 | template: table_template, |
| 62 | collection: xos[collection_name], |
Scott Baker | 4aee9a1 | 2014-10-30 00:06:16 -0700 | [diff] [blame] | 63 | title: name + "s", |
Scott Baker | c411047 | 2014-11-03 23:54:00 -0800 | [diff] [blame^] | 64 | app: TestApp, |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 65 | }); |
Scott Baker | 4aee9a1 | 2014-10-30 00:06:16 -0700 | [diff] [blame] | 66 | TestApp[collection_name + "ListView"] = listViewClass; |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 67 | |
| 68 | var listView = new listViewClass(); |
| 69 | |
Scott Baker | 4aee9a1 | 2014-10-30 00:06:16 -0700 | [diff] [blame] | 70 | if (region_name in TestApp.getRegions()) { |
| 71 | TestApp[region_name].show(listView); |
| 72 | } |
Scott Baker | 33c84ac | 2014-10-28 21:40:20 -0700 | [diff] [blame] | 73 | xos[collection_name].fetch(); //startPolling(); |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 74 | } |
Scott Baker | 3df4194 | 2014-10-28 12:44:13 -0700 | [diff] [blame] | 75 | |
Scott Baker | d044c8f | 2014-10-28 14:46:13 -0700 | [diff] [blame] | 76 | $('#close-detail-view').unbind().bind('click', function() { |
Scott Baker | 3df4194 | 2014-10-28 12:44:13 -0700 | [diff] [blame] | 77 | $('#detailBox').hide(); |
| 78 | }); |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 79 | }); |
| 80 | |
| 81 | $(document).ready(function(){ |
Scott Baker | 013025a | 2014-10-30 23:50:20 -0700 | [diff] [blame] | 82 | TestApp.start(); |
Scott Baker | e41c908 | 2014-10-27 23:02:48 -0700 | [diff] [blame] | 83 | }); |
| 84 | |