Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KYLIN-3418 User interface for hybrid model - Frontend
- Loading branch information
Emiya0306
committed
Jul 25, 2018
1 parent
c9d9b2e
commit 8c56e7b
Showing
19 changed files
with
1,062 additions
and
45 deletions.
There are no files selected for viewing
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
KylinApp.controller('HybridInstanceCtrl', function ( | ||
$scope, $q, $location, | ||
ProjectModel, hybridInstanceManager, SweetAlert, HybridInstanceService, loadingRequest | ||
) { | ||
$scope.projectModel = ProjectModel; | ||
$scope.hybridInstanceManager = hybridInstanceManager; | ||
|
||
//trigger init with directive [] | ||
$scope.list = function () { | ||
var defer = $q.defer(); | ||
var queryParam = {}; | ||
if (!$scope.projectModel.isSelectedProjectValid()) { | ||
defer.resolve([]); | ||
return defer.promise; | ||
} | ||
|
||
if (!$scope.projectModel.projects.length) { | ||
defer.resolve([]); | ||
return defer.promise; | ||
} | ||
queryParam.project = $scope.projectModel.selectedProject; | ||
return hybridInstanceManager.list(queryParam).then(function (resp) { | ||
defer.resolve(resp); | ||
hybridInstanceManager.loading = false; | ||
return defer.promise; | ||
}); | ||
}; | ||
|
||
$scope.list(); | ||
|
||
$scope.$watch('projectModel.selectedProject', function() { | ||
$scope.list(); | ||
}); | ||
|
||
$scope.editHybridInstance = function(hybridInstance){ | ||
$location.path("/hybrid-cube/edit/" + hybridInstance.name); | ||
}; | ||
|
||
$scope.dropHybridInstance = function (hybridInstance) { | ||
|
||
SweetAlert.swal({ | ||
title: '', | ||
text: 'Are you sure to drop this hybrid?', | ||
type: '', | ||
showCancelButton: true, | ||
confirmButtonColor: '#DD6B55', | ||
confirmButtonText: "Yes", | ||
closeOnConfirm: true | ||
}, function (isConfirm) { | ||
if (isConfirm) { | ||
var schema = { | ||
hybrid: hybridInstance.name, | ||
model: hybridInstance.model, | ||
project: hybridInstance.project, | ||
}; | ||
|
||
loadingRequest.show(); | ||
HybridInstanceService.drop(schema, {}, function (result) { | ||
loadingRequest.hide(); | ||
SweetAlert.swal('Success!', 'Hybrid drop is done successfully', 'success'); | ||
location.reload(); | ||
}, function (e) { | ||
loadingRequest.hide(); | ||
if (e.data && e.data.exception) { | ||
var message = e.data.exception; | ||
var msg = !!(message) ? message : 'Failed to take action.'; | ||
SweetAlert.swal('Oops...', msg, 'error'); | ||
} else { | ||
SweetAlert.swal('Oops...', "Failed to take action.", 'error'); | ||
} | ||
}); | ||
} | ||
|
||
}); | ||
}; | ||
}); |
Oops, something went wrong.