Skip to content

Commit

Permalink
KYLIN-3418 User interface for hybrid model - Frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
Emiya0306 committed Jul 25, 2018
1 parent c9d9b2e commit 8c56e7b
Show file tree
Hide file tree
Showing 19 changed files with 1,062 additions and 45 deletions.
Binary file added webapp/app/fonts/kylin.eot
Binary file not shown.
13 changes: 13 additions & 0 deletions webapp/app/fonts/kylin.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added webapp/app/fonts/kylin.ttf
Binary file not shown.
Binary file added webapp/app/fonts/kylin.woff
Binary file not shown.
15 changes: 15 additions & 0 deletions webapp/app/image/checkbox+.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions webapp/app/image/checkbox-.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions webapp/app/index.html
Expand Up @@ -149,6 +149,7 @@
<script src="js/services/acl.js"></script>
<!--New GUI-->
<script src="js/services/models.js"></script>
<script src="js/services/hybridInstance.js"></script>
<script src="js/services/dashboard.js"></script>

<script src="js/model/cubeConfig.js"></script>
Expand All @@ -172,6 +173,7 @@

<!--New GUI-->
<script src="js/model/modelsManager.js"></script>
<script src="js/model/hybridInstanceManager.js"></script>
<script src="js/services/badQuery.js"></script>
<script src="js/utils/utils.js"></script>
<script src="js/controllers/page.js"></script>
Expand Down Expand Up @@ -210,6 +212,8 @@

<!--New GUI-->
<script src="js/controllers/models.js"></script>
<script src="js/controllers/hybridInstanceSchema.js"></script>
<script src="js/controllers/hybridInstance.js"></script>
<script src="js/controllers/dashboard.js"></script>

<!-- endref -->
Expand Down Expand Up @@ -256,6 +260,24 @@ <h4>Model Schema</h4>
</div>
</script>

<!-- static template for hybrid cube save/update result notification -->
<script type="text/ng-template" id="hybridResultError.html">
<div class="callout callout-info">
<h4>Error Message</h4>
<p>{{text}}</p>
</div>
<div class="callout callout-danger">
<h4>Hybrid Instance Schema</h4>
<pre>{{schema}}</pre>
</div>
</script>

<script type="text/ng-template" id="hybridResultSuccess.html">
<div class="callout callout-info">
<p>{{text}}</p>
</div>
</script>

<!-- static template for cube save/update result notification -->
<script type="text/ng-template" id="streamingResultError.html">
<div class="callout">
Expand Down
96 changes: 96 additions & 0 deletions webapp/app/js/controllers/hybridInstance.js
@@ -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');
}
});
}

});
};
});

0 comments on commit 8c56e7b

Please sign in to comment.