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 @@ -311,17 +311,75 @@

}]).controller('instanceManageCtrl',['$scope','$rootScope','items','$modalInstance','genericServices',function ($scope,$rootScope,items,$modalInstance,genericServices) {
$scope.items=items;
var fltrObj=$rootScope.filterNewEnt;
var reqBody = {};
$scope.IMGNewEnt={
passType:'password',
org:$rootScope.organObject[0]
};
//get configmanagement
var params={
url:'/organization/'+$scope.IMGNewEnt.org.orgid+'/configmanagement/list'
url:'/d4dMasters/organization/'+$scope.IMGNewEnt.org.orgid+'/configmanagement/list'
}
genericServices.promiseGet(params).then(function (list) {
$scope.configOptions=list;
});

$scope.pemFileSelection = function($event) {
if (FileReader) {
var fileContent = new FileReader();
fileContent.onload = function(e) {
$scope.addPemText(e.target.result);
};
fileContent.onerror = function(e) {
toastr.error(e);
};
fileContent.readAsText($event);
} else {
toastr.error('HTMl5 File Reader is not Supported. Please upgrade your browser');
}
};
$scope.ok = function() {
reqBody.orgId = $scope.IMGNewEnt.org.orgid;
reqBody.bgId = $scope.IMGNewEnt.buss.rowid;
reqBody.projectId = $scope.IMGNewEnt.proj.rowId;
reqBody.envId = $scope.IMGNewEnt.env.rowid
reqBody.orgName = $scope.IMGNewEnt.org.name;
reqBody.bgName = $scope.IMGNewEnt.buss.name;
reqBody.projectName = $scope.IMGNewEnt.proj.name;
reqBody.environmentName = $scope.IMGNewEnt.env.name;
reqBody.configManagmentId = $scope.IMGNewEnt.serverTypeInd;

reqBody.credentials = {};
reqBody.credentials.username = $scope.IMGNewEnt.userName;
reqBody.instanceIds = [];
reqBody.instanceIds = $scope.items;

$scope.postMethodImportByIp = function(){
var params = {
inlineLoader: true,
url:'/providers/' + fltrObj.provider.id + '/sync',
data:reqBody
}
genericServices.promisePost(params).then(function (response) {
if(response.data){
toastr.success('Successfully Imported.','Update');
$modalInstance.dismiss(response.data);
}
});
};
if ($scope.IMGNewEnt.passType === "password") {
reqBody.credentials.password = $scope.IMGNewEnt.password;
$scope.postMethodImportByIp();
} else {
$scope.pemFileSelection($scope.pemfile);
}
$scope.addPemText = function(pemfileText){
reqBody.credentials.pemFileData = pemfileText;
$scope.postMethodImportByIp();
};

}
$scope.cancel = function() {
$modalInstance.dismiss('cancel');
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ <h4 class="modal-title"><i class="fa fa-upload"></i> Import Instance</h4>
<label for="">File Upload:<span class="red">*</span> <!-- ngIf: depNewApp.errorMsg.server -->
</label>
<div class="input-groups">
<input type="file" name="coBlueprintName" class="form-control" >
<input type="file" name="autenticationPemfile" class="form-control form-controls" ngf-select="" ng-model="$parent.pemfile" name="file" accept=".pem" required="">
</div>
</div>

Expand Down