From 16c63fbfd043c7479d2fc47c745c83a96ccfd2fb Mon Sep 17 00:00:00 2001 From: hrushikesh07 Date: Fri, 28 Oct 2016 11:14:31 +0530 Subject: [PATCH 1/2] Added schedule , start, stop, function for instance --- client/cat3/main.html | 2 + client/cat3/src/main.js | 3 +- .../sections/dashboard/genericServices.js | 32 +++++----- .../popups/controller/scheduleCtrl.js | 19 ++++++ .../dashboard/popups/view/schedule.html | 61 +++++++++++++++++++ .../dashboard/workzone/instance/instance.html | 15 ++++- .../workzone/instance/instanceCtrl.js | 42 ++++++++++++- 7 files changed, 151 insertions(+), 23 deletions(-) create mode 100644 client/cat3/src/partials/sections/dashboard/popups/controller/scheduleCtrl.js create mode 100644 client/cat3/src/partials/sections/dashboard/popups/view/schedule.html diff --git a/client/cat3/main.html b/client/cat3/main.html index 476a55985..ea1233cd7 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -22,6 +22,7 @@ + @@ -97,6 +98,7 @@ + diff --git a/client/cat3/src/main.js b/client/cat3/src/main.js index 429978e2e..ed33c0d92 100644 --- a/client/cat3/src/main.js +++ b/client/cat3/src/main.js @@ -27,7 +27,8 @@ var angularApp = angular.module('catapp', ['ui.router','ngTouch','toastr', 'ui.grid.autoResize','ui.grid.exporter', 'ui.grid.resizeColumns', 'global.uiGridOptions', - 'global.messages' + 'global.messages', + 'ui.grid.selection' ]); angularApp.run(['$rootScope', 'auth', '$state', '$stateParams','$http','$window', diff --git a/client/cat3/src/partials/sections/dashboard/genericServices.js b/client/cat3/src/partials/sections/dashboard/genericServices.js index 6f8dd7a03..c23cdddbd 100644 --- a/client/cat3/src/partials/sections/dashboard/genericServices.js +++ b/client/cat3/src/partials/sections/dashboard/genericServices.js @@ -255,27 +255,25 @@ }); }; - /*genericServices.editRunlist = function(chefRunlist, chefAttribute) { + genericServices.scheduleTime=function (ids) { $modal.open({ - templateUrl: 'src/partials/sections/dashboard/workzone/orchestration/popups/orchestrationUpdateChefRunlist.html', - controller: 'orchestrationUpdateChefRunlistCtrl', + animate: true, + templateUrl: "src/partials/sections/dashboard/popups/view/schedule.html", + controller: "scheduleCtrl as sch", backdrop: 'static', keyboard: false, - resolve : { - cookbookRunlistAttr: function(){ - return { - chefrunlist: chefRunlist, - attributes: chefAttribute - }; + resolve: { + items: function() { + return ids; } } - }).result.then(function (selectedCookBooks) { - //$rootScope.editRunListAttributes = false; - // $rootScope.chefrunlist = selectedCookBooks.list; - // $rootScope.cookbookAttributes = selectedCookBooks.cbAttributes; - }, function () { - console.log('Dismiss time is ' + new Date()); - }); - };*/ + }) + }; + genericServices.instanceStart=function (ids) { + + }; + genericServices.instanceStop=function () { + + }; }]); })(angular); \ No newline at end of file diff --git a/client/cat3/src/partials/sections/dashboard/popups/controller/scheduleCtrl.js b/client/cat3/src/partials/sections/dashboard/popups/controller/scheduleCtrl.js new file mode 100644 index 000000000..ca3657f70 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/popups/controller/scheduleCtrl.js @@ -0,0 +1,19 @@ +(function(){ + "use strict"; + angular.module('dashboard') + .controller('scheduleCtrl', ['$scope', '$modalInstance', 'items','$filter',function($scope, $modalInstance, items,$filter) { + var sch=this; + sch.schedule={ + repeat:'Daily', + repeatTimes:'1', + startsOn:new Date(), + ends:'Never' + } + sch.cancel = function() { + $modalInstance.dismiss('cancel'); + }; + sch.ok=function(){ + + }; + }]); +})(); diff --git a/client/cat3/src/partials/sections/dashboard/popups/view/schedule.html b/client/cat3/src/partials/sections/dashboard/popups/view/schedule.html new file mode 100644 index 000000000..3bf5c0089 --- /dev/null +++ b/client/cat3/src/partials/sections/dashboard/popups/view/schedule.html @@ -0,0 +1,61 @@ +
+
+ + + + + +
+
diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html b/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html index c458a75ae..b80a47e3f 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/instance.html @@ -19,6 +19,17 @@ + + + + + {{chip.key}}: {{chip.value}} @@ -103,7 +114,7 @@

Filter By

-
+
@@ -242,7 +253,7 @@

Filter By

-
+
diff --git a/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js b/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js index feb725056..ca4917a9b 100644 --- a/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js +++ b/client/cat3/src/partials/sections/dashboard/workzone/instance/instanceCtrl.js @@ -8,8 +8,8 @@ "use strict"; angular.module('workzone.instance', ['ui.bootstrap', 'utility.validation', 'filter.currentTime', 'apis.workzone', 'utility.array', 'workzonePermission', 'instanceServices', 'chefDataFormatter', 'utility.pagination', 'ngFileUpload']) .controller('instanceCtrl', ['chefSelectorComponent', '$scope', '$rootScope', '$modal', '$q', 'workzoneServices', 'arrayUtil', 'instancePermission', - 'instanceActions', 'instanceOperations', 'workzoneEnvironment', '$timeout', 'workzoneUIUtils', 'uiGridOptionsService', 'confirmbox', - function(chefSelectorComponent, $scope, $rootScope, $modal, $q, workzoneServices, arrayUtil, instancePerms, instanceActions, instanceOperations, workzoneEnvironment, $timeout, workzoneUIUtils, uiGridOptionsService, confirmbox) { + 'instanceActions', 'instanceOperations', 'workzoneEnvironment', '$timeout', 'workzoneUIUtils', 'uiGridOptionsService', 'confirmbox','genericServices', + function(chefSelectorComponent, $scope, $rootScope, $modal, $q, workzoneServices, arrayUtil, instancePerms, instanceActions, instanceOperations, workzoneEnvironment, $timeout, workzoneUIUtils, uiGridOptionsService, confirmbox,genericServices) { var helper = { attachListOfTaskWithInstance: function(completeData) { var instanceList = completeData.instances; @@ -73,6 +73,7 @@ } } }; + $scope.selectedInstanceId=[]; $scope.instancePageLevelLoader = true; $scope.instStartStopFlag = false; $scope.isImportClickEnabled = true; @@ -91,7 +92,15 @@ $scope.filterChips = []; $scope.providerLoading = false; $scope.regionLoading = false; - + $scope.scheduleInt = function(){ + genericServices.scheduleTime($scope.selectedInstanceId); + }; + $scope.instanceStop=function () { + genericServices.instanceStop($scope.selectedInstanceId); + }; + $scope.instanceStart=function () { + genericServices.instanceStart($scope.selectedInstanceId); + }; $scope.openContainersTab = function() { $scope.$parent.$parent.activateTab('Containers'); }; @@ -112,6 +121,9 @@ $scope.isInstancePageLoading = true; var gridBottomSpace = 5; var instanceUIGridDefaults = uiGridOptionsService.options(); + angular.extend(instanceUIGridDefaults.gridOption, {enableRowSelection: true, + enableSelectAll: true, + selectionRowHeaderWidth: 35,multiSelect:true,enableRowHeaderSelection: true}); $scope.paginationParams = instanceUIGridDefaults.pagination; $scope.currentCardPage = instanceUIGridDefaults.pagination.page; $scope.cardsPerPage = instanceUIGridDefaults.pagination.pageSize; @@ -180,7 +192,23 @@ $scope.instancesGridOptions = angular.extend(instanceUIGridDefaults.gridOption, { onRegisterApi: function(gridApi) { $scope.gridApi = gridApi; + gridApi.selection.on.rowSelectionChanged($scope,function(row){ + if(row.isSelected){ + $scope.selectedInstanceId.push(row.entity._id); + } else { + $scope.selectedInstanceId.splice(row.entity._id,1); + } + }); + gridApi.selection.on.rowSelectionChangedBatch($scope,function(rows){ + angular.forEach(rows,function(row){ + if(row.isSelected){ + $scope.selectedInstanceId.push(row.entity._id); + } else { + $scope.selectedInstanceId.splice(row.entity._id,1); + } + }); + }); //Sorting for sortBy and sortOrder gridApi.core.on.sortChanged($scope, function(grid, sortColumns) { if (sortColumns[0] && sortColumns[0].field && sortColumns[0].sort && sortColumns[0].sort.direction) { @@ -545,8 +573,15 @@ }; $scope.selectCard = function(identi) { $scope.selectedCard = identi; + console.log($scope.selectedInstanceId.indexOf(identi)); + if($scope.selectedInstanceId.indexOf(identi) === -1){ + $scope.selectedInstanceId.push(identi); + } else { + $scope.selectedInstanceId.splice($scope.selectedInstanceId.indexOf(identi),1); + } }; $scope.setCardView = function() { + $scope.selectedInstanceId=[]; $scope.isCardViewActive = true; $scope.instanceCardViewSelection = "instance-tab-active"; $scope.instanceTableViewSelection = ""; @@ -581,6 +616,7 @@ }); }; $scope.instanceTableView = function() { + $scope.selectedInstanceId=[]; $scope.isCardViewActive = false; $scope.instanceTableViewSelection = "instance-tab-active"; $scope.instanceCardViewSelection = ""; From 5fa553a0b7e56e4de7ff9ad960eb6281c015b9e7 Mon Sep 17 00:00:00 2001 From: hrushikesh07 Date: Fri, 28 Oct 2016 11:24:07 +0530 Subject: [PATCH 2/2] Added schedule , start, stop, function for instance --- client/cat3/main.html | 1 - 1 file changed, 1 deletion(-) diff --git a/client/cat3/main.html b/client/cat3/main.html index ea1233cd7..d26af1ea6 100644 --- a/client/cat3/main.html +++ b/client/cat3/main.html @@ -22,7 +22,6 @@ -