Skip to content
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ <h4 class="modal-title" ng-if="isEditMode">
<div class="modal-body">
<loading name="isNewTaskPageLoading" size="large" type="block" align="center"></loading>
<div class="row new-task-wrapper" ng-show="!isNewTaskPageLoading">
<div class="col-lg-4 col-md-4 col-sm-12 col-xs-12 border no-padding">
<div class="col-lg-5 col-md-5 col-sm-12 col-xs-12 border no-padding">
<section class="jobDetailsBox">
<header class="jobDetailsHeader">
<h5>Job Details</h5>
Expand Down Expand Up @@ -49,6 +49,38 @@ <h5>Job Details</h5>
<input type="text" name="taskName" class="form-control" required autofocus ng-model="name" maxlength="50" />
</span>
</div>
<div class="col-md-12 col-sm-12 col-xs-12 margintop15">
<label class="control-label">Add to Service Delivery : </label>
<input type="checkbox" class="checkbox-list" ng-model="checkBotType" ng-click="botStatus()"/>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 " ng-show="checkBotStatus">
<label class="control-label">Bot Type
<span class="control-label red">&nbsp;*</span>
<span ng-show="newTaskForm.botType.$touched && newTaskForm.botType.$invalid" class="inputValidationMsg">required
</span>
</label>
<br />
<span class="col-md-12 col-sm-12 col-xs-12 no-padding">
<select name="botType" class="form-control" ng-model="botType" ng-required="checkBotStatus" ng-disabled="isEditMode">
<option selected="selected" value="Task">Task</option>
<option ng-show="!createChefJob" value="Check">Check</option>
<option ng-show="!createChefJob" value="Learning">Learning</option>
<option ng-show="!createChefJob" value="Composite">Composite</option>
<option ng-show="!createChefJob" value="Built with other">Built with other</option>
</select>
</span>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6 " ng-show="checkBotStatus">
<label class="control-label">Short Description
<span class="control-label red">&nbsp;*</span>
<span ng-show="newTaskForm.shortDesc.$touched && newTaskForm.shortDesc.$invalid" class="inputValidationMsg">required
</span>
</label>
<br />
<span class="col-md-12 col-sm-12 col-xs-12 no-padding">
<input type="text" name="shortDesc" class="form-control" ng-required="checkBotStatus" autofocus ng-model="shortDesc" maxlength="50" />
</span>
</div>
<div class="col-md-6 col-sm-6 col-xs-6 margintop15" ng-if="taskType==='jenkins'">
<label class="control-label">Server
<span class="control-label red">&nbsp;*</span>
Expand Down Expand Up @@ -106,23 +138,23 @@ <h5>Job Details</h5>
</div>
</div>
<!--scriptType ending here -->
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 margintop15">
<div class="col-lg-12 col-md-12col-sm-12 col-xs-12 margintop15">
<label class="control-label">Job Description</label>
<textarea id="chefDescription" rows="9" cols="15" name="description" ng-model="description"></textarea>
</div>
</div>
</section>
</div>
<!--Second Column:Chef -->
<div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 left-padding">
<div class="col-lg-7 col-md-7 col-sm-12 col-xs-12 left-padding">
<div class="col-md-12 col-sm-12 col-xs-12 border no-padding" ng-if="taskType==='chef'">
<section class="Chef">
<header class="jobDetailsHeader">
<h5>Chef Server Details for - RLChefServer</h5>
</header>
<div class="jobDetailsContent">
<div class="chef-details-top">
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="col-lg-7 col-md-7 col-sm-7 col-xs-12">
<loading name="isTargetTypesLoading" size="medium" type="block" align="left"></loading>
<div ng-show="!isTargetTypesLoading" class="row margin0">

Expand Down Expand Up @@ -183,7 +215,7 @@ <h5>Chef Server Details for - RLChefServer</h5>

</div>
</div>
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="col-lg-5 col-md-5 col-sm-5 col-xs-12">
<label>
<i class="fa fa-list-ul addRunList-icon"></i>
<lable class="control-label" ng-if="!isEditMode">Add Runlist</lable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
var toggleStatus = $scope.isAllSelected;
angular.forEach($scope.chefInstanceList, function(itm){ itm._isNodeSelected = toggleStatus;});
};
$scope.botStatus = function() {
if($scope.checkBotType){
$scope.checkBotStatus = true;
}else{
$scope.checkBotStatus = false;
}

};
$scope.optionToggled = function(){
$scope.isAllSelected = $scope.chefInstanceList.every(function(itm){ return itm._isNodeSelected; })
};
Expand Down Expand Up @@ -244,13 +252,21 @@
}
},
ok: function () {
$scope.taskSaving = true;
//these values are common across all task types
var taskJSON = {
taskType: $scope.taskType,
name: $scope.name,
description: $scope.description,
botType: $scope.botType,
shortDesc: $scope.shortDesc,
description: $scope.description
};
if($scope.checkBotType){
taskJSON.botType = $scope.botType;
taskJSON.shortDesc= $scope.shortDesc;
$scope.taskSaving = true;
}else{
$scope.taskSaving = true;
}
//checking for name of the task
if (!taskJSON.name.trim()) {
$scope.inputValidationMsg='Please enter the name of the task.';
Expand Down Expand Up @@ -407,7 +423,9 @@
}
});
$scope.name = "";
$scope.shortDesc = "";
$scope.taskType = "chef";//default Task type selection;
$scope.botType = "Task";//default Task type selection;
$scope.isEditMode = false;//default edit mode is false;
$scope.taskSaving = false;//to disable submit button, dfault false
$scope.autoSync = {
Expand Down Expand Up @@ -435,7 +453,6 @@
workzoneServices.getEnvironmentTaskList().then(function (response) {
var data, selectorList = [],
optionList = [];

if (response.data) {
data = response.data;
} else {
Expand Down Expand Up @@ -563,6 +580,12 @@
$scope.description = items.description;
$scope.taskType = items.taskType;
$scope.name = items.name;
if(items.shortDesc && (items.shortDesc !== '' || items.shortDesc !== null)){
$scope.checkBotStatus = true;
$scope.checkBotType = true;
}
$scope.botType = items.botType;
$scope.shortDesc = items.shortDesc;
//properties specific to jenkins
if (items.taskType === "jenkins") {
$scope.jobUrl = items.taskConfig.jobURL;
Expand Down
8 changes: 8 additions & 0 deletions server/app/model/classes/tasks/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ var taskSchema = new Schema({
required: true,
trim: true
},
shortDesc: {
type: String
},
botType: {
type: String
},
description: {
type: String
},
Expand Down Expand Up @@ -672,6 +678,8 @@ taskSchema.statics.updateTaskById = function(taskId, taskData, callback) {
name: taskData.name,
taskConfig: taskConfig,
taskType: taskData.taskType,
shortDesc: taskData.shortDesc,
botType: taskData.botType,
description: taskData.description,
jobResultURLPattern: taskData.jobResultURL,
blueprintIds: taskData.blueprintIds
Expand Down