Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ <h4 class="modal-title"><i class="fa fa-calendar"></i>&nbsp;Schedule your Task</
<legend class="repo-job-details-wrapper-inner"><i class="fa fa-hourglass-start" ></i> Interval </legend>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
<label>Repeats: <span class="red">*</span></label>
<select class="form-control-date" ng-model="repeatsType">
<select class="form-control-date" ng-model="repeatsType" ng-change="checkFrequency();">
<option selected="selected" value="Minutes" title="Repeat in Minutes">Minutes</option>
<option value="Hourly" title="Repeats Hourly">Hourly</option>
<option value="Daily" title="Repeats Daily">Daily</option>
<option value="Weekly" title="Repeats Weekly">Weekly</option>
<option value="Monthly" title="Repeats Monthly">Monthly</option>
<!-- <option value="Yearly" title="Repeats Yearly">Yearly</option> -->
<!-- <option value="Yearly" title="Repeats Yearly">Yearly</option>-->
</select>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
Expand Down Expand Up @@ -57,27 +58,35 @@ <h4 class="modal-title"><i class="fa fa-calendar"></i>&nbsp;Schedule your Task</
</div> -->
<!--repeat on yearly for month ends-->
<!--starts at dropdown-->
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 margintop10" ng-show="repeatsType!=='Minutes'">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 margintop10" ng-show="checkFrequencyCheck">
<label>Time(Hrs):
<span class="red">&nbsp;*</span>
<span ng-show="newSchedule.timeEventHour.$touched && newSchedule.timeEventHour.$invalid" class="inputValidationMsg">required
</span>
</label>
<select name="timeEventHour" class="form-control-date" ng-model="timeEventType">
<!-- <select name="timeEventHour" class="form-control-date" ng-model="timeEventType">
<option value="" selected="selected">Choose Start Hour</option>
<option ng-repeat="timeNumber in repeatCount(23)" value="{{timeNumber}}" title="Time Starts {{timeNumber}} {{repeatsType}}">{{timeNumber}}</option>
</select>
</select>-->
<select name="timeEventHour" class="form-control-date" ng-model="timeEventHour" required>
<option value="" selected="selected">Choose the Hour</option>
<option ng-repeat="timeEventHour in repeatHourCount(23)" value="{{timeEventHour}}" title="Repeat Every {{timeEventHour}}">{{timeEventHour}}</option>
</select>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 margintop10" ng-show="repeatsType!=='Minutes'">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 margintop10" ng-show="checkFrequencyCheck">
<label>Time(Mins):
<span class="red">&nbsp;*</span>
<span ng-show="newSchedule.timeEventMinute.$touched && newSchedule.timeEventMinute.$invalid" class="inputValidationMsg">required
</span>
</label>
<select name="timeEventMinute" class="form-control-date" ng-model="timeEventMinute">
<!-- <select name="timeEventMinute" class="form-control-date" ng-model="timeEventMinute">
<option value="" selected="selected">Choose Start Minute</option>
<option ng-repeat="timeNumberMinutes in repeatCount(59)" value="{{timeNumberMinutes}}" title="Time Starts {{timeNumberMinutes}} {{repeatsType}}">{{timeNumberMinutes}}</option>
</select>
</select>-->
<select name="timeEventMinute" class="form-control-date" ng-model="timeEventMinute" required>
<option value="" selected="selected">Choose the Minute</option>
<option ng-repeat="timeEventMinute in repeatHourCount(59)" value="{{timeEventMinute}}" title="Repeat Every {{timeEventMinute}}">{{timeEventMinute}}</option>
</select>
</div>
<!--repeat on weekly -->
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 margintop10" ng-show="repeatsType==='Weekly'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,42 @@
angular.module('workzone.orchestration')
.controller('addChefJobEventCtrl',['$scope', '$modalInstance', 'items' ,'toastr',function($scope, $modalInstance , items , toastr){
console.log(items);
$scope.checkFrequencyCheck=false;
$scope.defaultSelection = function() {
$scope.repeatsType = 'Minutes';//default selection.
$scope.schedulerStartOn=moment(new Date()).format('MM/DD/YYYY');
$scope.schedulerEndOn=moment(new Date()).format('MM/DD/YYYY');
};
if(items.type !== 'new'){
if(items.chefJenkScriptTaskObj){
if(items.chefJenkScriptTaskObj.cronStartOn && items.chefJenkScriptTaskObj.cronEndOn) {
if(items.type !== 'new') {
if (items.chefJenkScriptTaskObj) {
if (items.chefJenkScriptTaskObj.cronStartOn && items.chefJenkScriptTaskObj.cronEndOn) {
var newStartOn = parseInt(items.chefJenkScriptTaskObj.cronStartOn);
var newDate = new Date(newStartOn).toLocaleDateString();
var datearray = newDate.split("/");
var newdate = datearray[1] + '/' + datearray[0] + '/' + datearray[2];
$scope.schedulerStartOn = newdate;
var newEndOn = parseInt(items.chefJenkScriptTaskObj.cronEndOn);
var newEndData = new Date(newEndOn).toLocaleDateString();
var newEndData = new Date(newEndOn).toLocaleDateString();
var datearrayNew = newEndData.split("/");
var newdateEnd = datearrayNew[1] + '/' + datearrayNew[0] + '/' + datearrayNew[2];
$scope.schedulerEndOn = newdateEnd;
} else {
$scope.schedulerStartOn = items.chefJenkScriptTaskObj.cronStart;
$scope.schedulerEndOn = items.chefJenkScriptTaskObj.cronEnd;
$scope.schedulerEndOn = items.chefJenkScriptTaskObj.cronEnd;
}

$scope.repeatBy = items.chefJenkScriptTaskObj.repeatBy || items.chefJenkScriptTaskObj.cronRepeatEvery.toString();
$scope.repeatsType = items.chefJenkScriptTaskObj.repeats || items.chefJenkScriptTaskObj.cronFrequency;
$scope.timeEventType = items.chefJenkScriptTaskObj.startTime;
$scope.timeEventMinute = items.chefJenkScriptTaskObj.startTimeMinute;
$scope.weekOfTheDay = items.chefJenkScriptTaskObj.dayOfWeek;
$scope.currentDate = items.chefJenkScriptTaskObj.startDate;
$scope.selectedDayOfTheMonth = items.chefJenkScriptTaskObj.selectedDayOfTheMonth;
$scope.selectedMonth = items.chefJenkScriptTaskObj.monthOfYear;
$scope.timeEventHour = items.chefJenkScriptTaskObj.cronHour;
$scope.timeEventMinute = items.chefJenkScriptTaskObj.cronMinute;
$scope.weekOfTheDay = items.chefJenkScriptTaskObj.cronWeekDay;
$scope.currentDate = items.chefJenkScriptTaskObj.cronDate;
$scope.selectedDayOfTheMonth = items.chefJenkScriptTaskObj.cronMonth;
$scope.selectedMonth = items.chefJenkScriptTaskObj.cronYear;
if ($scope.repeatsType === 'Minutes' || $scope.repeatsType === 'Hourly') {
$scope.checkFrequencyCheck = false;
} else {
$scope.checkFrequencyCheck = true;
}
} else {
$scope.defaultSelection();
}
Expand All @@ -59,6 +64,14 @@

};

$scope.checkFrequency = function(){
if($scope.repeatsType === 'Minutes' || $scope.repeatsType === 'Hourly'){
$scope.checkFrequencyCheck = false;
}else{
$scope.checkFrequencyCheck = true;
}
};

$scope.repeatCount = function(max, step) {
step = step || 1;
var input = [];
Expand All @@ -67,6 +80,14 @@
}
return input;
};
$scope.repeatHourCount = function(max, step) {
step = step || 1;
var input = [];
for (var i = 0; i <= max; i += step) {
input.push(i);
}
return input;
};
$scope.isDaySelected = {
flag:true
}
Expand All @@ -83,7 +104,7 @@
repeatBy: $scope.repeatBy,
cronStart: $scope.schedulerStartOn,
cronEnd: $scope.schedulerEndOn,
startTime: $scope.timeEventType,
startTime: $scope.timeEventHour,
startTimeMinute: $scope.timeEventMinute,
dayOfWeek: $scope.weekOfTheDay,
selectedDayOfTheMonth: $scope.selectedDayOfTheMonth,
Expand All @@ -93,4 +114,4 @@
};
}
]);
})(angular);
})(angular);
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,21 @@ <h4 class="modal-title"><i class="fa fa-th-list"></i> Add Script Params</h4>
<tr>
<th class="headParamTable">Key</th>
<th class="headParamTable">Value</th>
<th class="headParamTable">Delete</th>
<th class="headParamTable">Description</th>
<!-- <th class="headParamTable">Delete</th>-->
</tr>
</thead>
<tbody>
<tr ng-repeat="param in params track by $index">
<td class="booleanParam"><label class="control-label" for="choiceName">Parameter {{$index+1}}:<span class="red">*</span></label></td>
<td><input id="value" type="text" class="form-control" name="value" ng-model="params[$index]"></td>
<td><button ng-show="$index>0" class="scriptParamsDelete" title="Delete Row" type="button" ng-click="removeScriptInputParams(params[$index]);"><i class=" fa fa-trash-o"></i></button></td>
<td><input id="paramVal" type="text" class="form-control" name="paramVal" ng-model="param.paramVal"></td>
<td><input id="paramDesc" type="text" class="form-control" name="paramDesc" ng-model="param.paramDesc"></td>
<!--<td><button ng-show="$index>0" class="scriptParamsDelete" title="Delete Row" type="button" ng-click="removeScriptInputParams(param);"><i class=" fa fa-trash-o"></i></button></td>-->
</tr>
</tbody>
</table>
</div>
<a id="addParams" class="marginleft23" type="button" id="add" ng-click="add()">Add More</a>
<!--<a id="addParams" class="marginleft23" type="button" id="add" ng-click="add()">Add More</a>-->
</div>
</fieldset>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
(function(angular){
"use strict";
angular.module('workzone.orchestration')
.controller('addScriptParamsCtrl',['$scope', '$modalInstance', 'toastr',function($scope, $modalInstance, toastr){
.controller('addScriptParamsCtrl',['$scope', '$modalInstance','items', 'toastr',function($scope, $modalInstance,$items, toastr){
//default selection type
$scope.params=[''];
$scope.params=[];
for(var i =0; i < $items.noOfParams; i++){
$scope.params.push({});
}
$scope.add = function() {
$scope.params.push('');
$scope.params.push({});
};
$scope.removeScriptInputParams = function(paramInput) {
if($scope.params.length > 1){
Expand All @@ -28,7 +31,7 @@
$scope.ok=function(){
var checkParam = false;
for(var i =0; i<$scope.params.length; i++){
if($scope.params[i] === '' || $scope.params[i] === null){
if(Object.keys($scope.params[i]).length === 0){
checkParam = false;
toastr.error('Please enter parameters');
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ <h5>Job Details</h5>
<select class="form-control" name="scriptType" ng-model="$parent.scriptTypeSelelct" ng-change="changeNodeScriptList();" required>
<option value="">Select</option>
<option value="Bash">Bash</option>
<option value="Python">Python</option>
</select>
</span>
</div>
Expand Down Expand Up @@ -540,8 +541,8 @@ <h5>Script Details</h5>
<ul>
<li ng-repeat="script in scriptTaskList">
<label class="checkbox check-list">
<input type="checkbox" ng-change="optionScriptToggled()" ng-checked="script._isScriptSelected" ng-model="script._isScriptSelected" ng-click="addRemoveScriptTable(script)" class="checkbox-list"/>{{script.name}}
<a class="pull-right cursorPointer" ng-show="script._isScriptSelected" type="button" id="add" ng-click="showScriptParams(script)" title="Show Params">&nbsp;Params</a>
<input type="checkbox" ng-change="optionScriptToggled()" ng-checked="script.isParametrized" ng-model="script._isScriptSelected" ng-click="addRemoveScriptTable(script)" class="checkbox-list"/>{{script.name}}
<a class="pull-right cursorPointer" ng-show="script.isParametrized" type="button" id="add" ng-click="showScriptParams(script)" title="Show Params">&nbsp;Params</a>
</label>
</li>
</ul>
Expand All @@ -561,13 +562,15 @@ <h5>Script Details</h5>
<thead>
<tr class="rowCustomStyle" role="row">
<td class="sorting_disabled" rowspan="1" colspan="1" aria-label="Parameter">Parameter</td>
<td class="sorting_disabled" rowspan="1" colspan="1" aria-label="Description">Description</td>
<td class="sorting_disabled" rowspan="1" colspan="1" aria-label="Action">Action</td>
</tr>
</thead>
<tbody>
<tr ng-repeat="param in scriptParamsObj[selectedScript._id] track by $index">
<td ng-if="param !== ''">{{param}}</td>
<td ng-if="param === ''">.....</td>
<td ng-if="param.paramVal !== ''">{{param.paramVal}}</td>
<td ng-if="param.paramVal === ''">.....</td>
<td>{{param.paramDesc}}</td>
<td>
<button title="Delete" type="button" ng-click="removeScriptParams(selectedScript._id,param);"><i class=" fa fa-trash-o"></i></button>
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@
templateUrl: 'src/partials/sections/dashboard/workzone/orchestration/popups/addScriptParams.html',
controller: 'addScriptParamsCtrl',
backdrop: 'static',
keyboard: false
keyboard: false,
resolve: {
items: function () {
return scriptObject;
}
}
}).result.then(function (addScriptParams) {
$scope.scriptParamsObj[scriptObject._id] = $scope.scriptParamsObj[scriptObject._id].concat(addScriptParams);
}, function () {
Expand Down Expand Up @@ -271,9 +276,12 @@
cronEndOn : $scope.chefJenkScriptTaskObj.cronEnd,
cronRepeatEvery : $scope.chefJenkScriptTaskObj.repeatBy,
cronFrequency: $scope.chefJenkScriptTaskObj.repeats,
cronTime: typeof startTimeHour !=='undefined'? startTimeHour : new Date().getHours() + ':' + typeof startTimeMinute !=='undefined'? startTimeMinute:new Date().getMinutes(),
cronDays: $scope.chefJenkScriptTaskObj.dayOfWeek,
cronMonth: $scope.chefJenkScriptTaskObj.monthOfYear
cronMinute:startTimeMinute,
cronHour: startTimeHour,
cronWeekDay:dayOfWeek,
cronDate: selectedDayOfTheMonth,
cronMonth: selectedMonth,
cronYear: $scope.chefJenkScriptTaskObj.monthOfYear
}
}, function () {
console.log('Dismiss time is ' + new Date());
Expand Down
37 changes: 36 additions & 1 deletion client/htmls/private/ajax/Settings/scriptList.html
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,15 @@ <h4 class="modal-title">
<select id="scriptType" name="scriptType" class="required form-control width-100" style="vertical-align:central">
<option value="">Choose Type</option>
<option value="Bash">Bash</option>
<option value="Python">Python</option>
</select>
</div>
</div>
<div class="col-lg-6 col-md-6 col-xs-6 margintop15">
<label for="">Script Description:</label>
<input type="text" name="scriptDescription" class="scriptDescription form-control" id="scriptDescription">
</div>
<div class="col-lg-12 col-md-12 col-xs-12 margintop15">
<div class="col-lg-6 col-md-6 col-xs-6 margintop15">
<label for="scriptFile">Script File:<span class="control-label redSpan">&nbsp;*</span></label>
<div class="input-groups">
<input type="file" name="scriptFile" id="scriptFile" class="required form-control form-controls" onchange="setfilename(this.value);"/>
Expand All @@ -94,6 +95,40 @@ <h4 class="modal-title">
</span>
<div id="fileNameDisplay" class="file-name"></div>
</div>
<div class="col-lg-6 col-md-6 col-xs-6 margintop15">
<label for="">Is Script Parametrized?:</label>
<div class="input-groups">
<div class="radio">
<label><input type="radio" value="No" checked="true" name="isParametrized" >No</label>
</div>
<div class="radio">
<label><input type="radio" value="Yes" name="isParametrized">Yes</label>
</div>
</div>
</div>
<div class="col-lg-6 col-md-6 col-xs-6" id="divParam">
</div>
<div class="col-lg-6 col-md-6 col-xs-6" id="checkScriptParam">
<div class="col-lg-1 col-md-1 col-xs-1"></div>
<div class="col-lg-11 col-md-11 col-xs-11">
<label for="">No Of Parameters:<span class="control-label redSpan">&nbsp;*</span></label>
<div class="input-groups">
<select id="noOfParams" name="noOfParams" class="form-control width-100" style="vertical-align:central">
<option value="">Choose Number</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
<option value="10">10</option>
</select>
</div>
</div>
</div>
<input type="hidden" id="scriptHiddenInputId">
<input type="hidden" id="fileHiddenInputId">
<input type="hidden" id="scriptEditHiddenInput">
Expand Down
Loading