You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@griffin.apache.org by gu...@apache.org on 2017/06/14 06:45:41 UTC
incubator-griffin git commit: Job
Repository: incubator-griffin
Updated Branches:
refs/heads/master 742d03346 -> 51dbb8b02
Job
Author: Yang <xi...@ebay.com>
Closes #74 from RachelYang2/job.
Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/51dbb8b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/51dbb8b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/51dbb8b0
Branch: refs/heads/master
Commit: 51dbb8b02779de618349ad449e3b07d015ea2370
Parents: 742d033
Author: Yang <xi...@ebay.com>
Authored: Wed Jun 14 14:45:34 2017 +0800
Committer: Lionel Liu <bh...@163.com>
Committed: Wed Jun 14 14:45:34 2017 +0800
----------------------------------------------------------------------
ui/css/main.css | 17 ++++++
ui/js/controllers/createjob-ac-ctrl.js | 20 ++++---
ui/js/controllers/createrule-ac-ctrl.js | 6 +-
ui/js/controllers/job-ctrl.js | 40 ++++++++++++-
ui/js/services/services.js | 4 +-
ui/pages/dataassets/dataassets.html | 2 +-
ui/pages/jobs/jobs.html | 86 ++++++++++++++++++++--------
7 files changed, 134 insertions(+), 41 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/css/main.css
----------------------------------------------------------------------
diff --git a/ui/css/main.css b/ui/css/main.css
index 3458335..d8461a2 100644
--- a/ui/css/main.css
+++ b/ui/css/main.css
@@ -1052,3 +1052,20 @@ a:hover {
tbody {
word-break:break-all;
}
+
+
+/*style of job*/
+.page{
+ cursor: pointer;
+ float: left;
+ border-bottom-left-radius: 4px;
+ border-top-left-radius: 4px;
+ color: #fff;
+ text-decoration: underline;
+}
+
+.page-active{
+ background-color: #2a9fd6;
+ border-color: transparent;
+ cursor: default;
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/js/controllers/createjob-ac-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/createjob-ac-ctrl.js b/ui/js/controllers/createjob-ac-ctrl.js
index c8bb581..57aa240 100644
--- a/ui/js/controllers/createjob-ac-ctrl.js
+++ b/ui/js/controllers/createjob-ac-ctrl.js
@@ -98,10 +98,16 @@ define(['./module'], function(controllers) {
period = $scope.periodTime * 3600;
else period = $scope.periodTime;
var rule = '';
+ var startTime = '';
+ var year = $scope.jobStartTime.substr(0,4);
+ var month = $scope.jobStartTime.substr(4,2);
+ var day = $scope.jobStartTime.substr(6,2);
+ startTime = year +'-'+ month + '-'+ day + ' '+ $scope.jobStartTime.split(' ')[0];
+ startTime = Date.parse(startTime);
this.data={
"sourcePat":$scope.sourcePat,
"targetPat":$scope.targetPat,
- "jobStartTime":$scope.jobStartTime,
+ "jobStartTime":startTime,
"periodTime":period,
"groupName":'BA',
};
@@ -132,10 +138,10 @@ define(['./module'], function(controllers) {
// if(data.status=='0')
// {
console.log(data);
- if(data=='fail'){
- toaster.pop('error', 'Please modify the name of job, because there is already a same model in database ', data.message);
- return;
- }
+ // if(data=='fail'){
+ // toaster.pop('error', 'Please modify the name of job, because there is already a same model in database ', data.message);
+ // return;
+ // }
$('#confirm-job').on('hidden.bs.modal', function(e) {
$('#confirm-job').off('hidden.bs.modal');
@@ -151,7 +157,7 @@ define(['./module'], function(controllers) {
}).error(function(data){
// errorMessage(0, 'Save model failed, please try again!');
- toaster.pop('error', 'Save model failed, please try again!', data.message);
+ toaster.pop('error', 'Save job failed, please try again!', data.message);
});
},
@@ -159,7 +165,7 @@ define(['./module'], function(controllers) {
}
var errorMessage = function(i, msg) {
- var errorMsgs = ['Please select at least one attribute!', 'Please select at least one attribute in target, make sure target is different from source!', 'Please make sure to map each target to a unique source.', 'please complete the form in this step before proceeding'];
+ var errorMsgs = ['Please select at least one measure!', 'please complete the form in this step before proceeding'];
if (!msg) {
toaster.pop('error', 'Error', errorMsgs[i - 1], 0);
} else {
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/js/controllers/createrule-ac-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/createrule-ac-ctrl.js b/ui/js/controllers/createrule-ac-ctrl.js
index 6d04368..47f49de 100644
--- a/ui/js/controllers/createrule-ac-ctrl.js
+++ b/ui/js/controllers/createrule-ac-ctrl.js
@@ -144,7 +144,7 @@ define(['./module'], function(controllers) {
//
// }
if (newValue) {
- $http.get(schemaDefinitionUrl + '/table/' + newValue.name).success(function(data) {
+ $http.get(schemaDefinitionUrl + '/' + newValue.parent[0].dbName+'/table/'+newValue.name).success(function(data) {
console.log(data);
$scope.schemaCollectionTarget = data.sd.cols;
console.log($scope.schemaCollectionTarget);
@@ -457,9 +457,7 @@ define(['./module'], function(controllers) {
//::TODO: Need to save the data to backend with POST/PUT method
console.log(JSON.stringify($scope.form.data));
-// var newModel = $config.uri.newAccuracyModel;
- var BACKEND_SERVER = '';
- var newModel = BACKEND_SERVER + '/measures/add';
+ var newModel = $config.uri.addModels;
$http.post(newModel, this.data).success(function(data) {
// if(data.status=='0')
// {
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/js/controllers/job-ctrl.js
----------------------------------------------------------------------
diff --git a/ui/js/controllers/job-ctrl.js b/ui/js/controllers/job-ctrl.js
index d739fb8..4c185b1 100644
--- a/ui/js/controllers/job-ctrl.js
+++ b/ui/js/controllers/job-ctrl.js
@@ -25,7 +25,7 @@ define(['./module'], function (controllers) {
var number = 10;
var originalRowCollection = undefined;
- $scope.paging = function(tableState){
+ $scope.pagingJob = function(tableState){
console.log(tableState);
ts = tableState;
@@ -35,6 +35,11 @@ define(['./module'], function (controllers) {
if(start == 0 && !$scope.rowCollection){
$http.get(allJobs).success(function(data) {
+ data.sort(function(a,b){
+ var dateA = Date.parse(new Date(a.jobName.split('-')[3]))/1000;
+ var dateB = Date.parse(new Date(b.jobName.split('-')[3]))/1000;
+ return -(dateA-dateB);
+ });
originalRowCollection = angular.copy(data);
$scope.rowCollection = angular.copy(data);
@@ -46,6 +51,35 @@ define(['./module'], function (controllers) {
}
};
+ $scope.showInstances = function showInstances(row,number){
+ var p_index = $scope.displayed.indexOf(row);
+ $('#'+p_index+'-'+number).addClass('page-active');
+ $('#'+p_index+'-'+number).siblings().removeClass('page-active');
+ $scope.currentJob = row;
+ var allInstances = $config.uri.getInstances + 'BA/' + row.jobName +'/0/100';
+ $http.get(allInstances).success(function(data){
+ row.instances = data;
+ row.pageCount = new Array();
+ for(var i = 0;i<Math.ceil(row.instances.length/10);i++){
+ row.pageCount.push(i);
+ }
+ $('#'+p_index+'-'+number).addClass('page-active');
+ $('#'+p_index+'-'+number).siblings().removeClass('page-active');
+ });
+ var url = $config.uri.getInstances + 'BA/' + row.jobName + '/'+number+'/10';
+ $http.get(url).success(function(data){
+ // row.instances = data;
+ row.currentInstances = data;
+ $('#'+p_index+'-'+number).addClass('page-active');
+ $('#'+p_index+'-'+number).siblings().removeClass('page-active');
+ });
+ $('#'+p_index+'-'+number).addClass('page-active');
+ $('#'+p_index+'-'+number).siblings().removeClass('page-active');
+ $timeout(function(){
+ $('#'+p_index+'-'+number).addClass('page-active');
+ $('#'+p_index+'-'+number).siblings().removeClass('page-active');
+ },200);
+ }
@@ -61,8 +95,8 @@ define(['./module'], function (controllers) {
}
$scope.confirmDelete = function(){
- var row = $scope.deletedBriefRow;
- var deleteModelUrl = $config.uri.deleteJob + row.groupName+'/jobs/'+row.jobName;
+ var row = $scope.deletedBriefRow;
+ var deleteModelUrl = $config.uri.deleteJob + row.groupName+'/'+row.jobName;
$http.delete(deleteModelUrl).success(function(){
var index = $scope.rowCollection.indexOf(row);
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/js/services/services.js
----------------------------------------------------------------------
diff --git a/ui/js/services/services.js b/ui/js/services/services.js
index fe9f9ab..3981b8f 100644
--- a/ui/js/services/services.js
+++ b/ui/js/services/services.js
@@ -70,6 +70,7 @@ define(['./module'], function (services) {
//Models
allModels: BACKEND_SERVER + '/measures',
+ addModels: BACKEND_SERVER + '/measures/add',
deleteModel:BACKEND_SERVER + '/measures/deleteByName',
getModel: BACKEND_SERVER + '/measures/findByName',
enableModel: BACKEND_SERVER + API_ROOT_PATH + '/models/enableModel',
@@ -78,7 +79,8 @@ define(['./module'], function (services) {
allJobs:BACKEND_SERVER + '/jobs/',
addJobs:BACKEND_SERVER+'/jobs/add/',
getMeasuresByOwner:BACKEND_SERVER+'/measures/owner/',
- deleteJob:BACKEND_SERVER + '/jobs/groups/',
+ deleteJob:BACKEND_SERVER + '/jobs/del/',
+ getInstances:BACKEND_SERVER + '/jobs/instances/',
// allJobs:'/jobs.json',
newAccuracyModel: BACKEND_SERVER + API_ROOT_PATH + '/models' ,
newValidityModel: BACKEND_SERVER + API_ROOT_PATH + '/models' ,
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/pages/dataassets/dataassets.html
----------------------------------------------------------------------
diff --git a/ui/pages/dataassets/dataassets.html b/ui/pages/dataassets/dataassets.html
index 4ed697b..0cb05a5 100644
--- a/ui/pages/dataassets/dataassets.html
+++ b/ui/pages/dataassets/dataassets.html
@@ -42,7 +42,7 @@ limitations under the License.
<i ng-show="row.showDetail" class="fa fa-chevron-circle-down blue"></i>
{{row.tableName}}</td>
<td>{{row.dbName || 'N/A'}}</td>
- <td>{{row.owner || 'N/A'}}</td>
+ <td>{{row.owner || 'N/A'}}</td>
<td>{{(row.createTime | date: 'short') || 'N/A'}}</td>
<td>{{(row.lastAccessTime | date: 'short') || 'N/A' }}</td>
<td>{{row.sd.location || 'N/A'}}</td>
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/51dbb8b0/ui/pages/jobs/jobs.html
----------------------------------------------------------------------
diff --git a/ui/pages/jobs/jobs.html b/ui/pages/jobs/jobs.html
index b6fc4bb..14384e3 100644
--- a/ui/pages/jobs/jobs.html
+++ b/ui/pages/jobs/jobs.html
@@ -20,7 +20,7 @@ limitations under the License.
</p>
<div id="modelContainer">
- <table st-table="displayed" st-pipe="paging" class="table table-striped">
+ <table st-table="displayed" st-pipe="pagingJob" class="table table-striped">
<thead>
<tr style="background-color:#7D95CC">
<th st-ratio="15">Job Name</th>
@@ -36,31 +36,67 @@ limitations under the License.
</tr>
</thead>
<tbody>
- <tr ng-if="!rowCollection || rowCollection.length == 0">
- <td colspan="7" style="text-align:center">No content!</td>
- </tr>
- <tr ng-repeat="row in displayed">
- <td>{{row.jobName}}</a></td>
- <td>{{row.sourcePat}}</a></td>
- <td>{{row.targetPat|strmap:'modeltype'}}</td>
- <td>{{(row.previousFireTime | date: 'short') || 'N/A' }}</td>
-
- <td>{{(row.nextFireTime | date: 'short') || 'N/A' }}</td>
- <td>{{row.triggerState}}</td>
-
- <td>{{row.periodTime}}</td>
- <td>
+ <tr ng-if="!rowCollection || rowCollection.length == 0">
+ <td colspan="7" style="text-align:center">No content!</td>
+ </tr>
+ </tbody>
+ <tbody ng-repeat="row in displayed" ng-init="p_index=$index">
+ <tr ng-click = "showInstances(row,0)">
+ <td ng-class="{accordion:true}" ng-click="row.showDetail=!(row.showDetail)" style="cursor: pointer;">
+ <i ng-show="!row.showDetail" class="fa fa-chevron-circle-right blue"></i>
+ <i ng-show="row.showDetail" class="fa fa-chevron-circle-down blue"></i>
+ {{row.jobName}}</td>
+ <td>{{row.sourcePat}}</td>
+ <td>{{row.targetPat|strmap:'modeltype'}}</td>
+ <td ng-show="row.previousFireTime==-1">--/--/-- --:--</td>
+ <td ng-show="row.previousFireTime!=-1">{{(row.previousFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</td>
+ <td>{{(row.nextFireTime | date: 'yyyy/MM/dd HH:mm:ss') || 'N/A' }}</td>
+ <td>{{row.triggerState}}</td>
+ <td>{{row.periodTime}}</td>
+ <td>
- <a ng-class="" href="" ng-click="remove(row)" title="delete" style="text-decoration:none">
- <i class="fa fa-trash-o"></i>
- </a>
+ <a ng-class="" href="" ng-click="remove(row)" title="delete" style="text-decoration:none">
+ <i class="fa fa-trash-o"></i>
+ </a>
- <!--<a href="#/viewrule/{{row.name}}" title="subscribe">-->
- <!--<i class="fa fa-eye"></i>-->
- <!--</a>-->
- </td>
- </tr>
- </tbody>
+ </td>
+ </tr>
+ <tr ng-show="row.showDetail">
+ <td colspan="7" style="padding:20px 30px 10px 30px;">
+ <table st-table="row.currentInstances"
+ class="table table-striped" style="word-wrap: break-word;" >
+ <thead>
+ <tr style="background-color:#7D95CC">
+ <th style="width:25%" >ID</th>
+ <th style="width:35%" >Time</th>
+ <th style="width:30%" >Group Name</th>
+ <th style="width:25%" >State</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr ng-if="!row.currentInstances || row.currentInstances.length == 0">
+ <td colspan="7" style="text-align:center">No content.</td>
+ </tr>
+ <tr ng-repeat="item in row.currentInstances" >
+ <td>{{item.id}}</td>
+ <td>{{item.timestamp | date: 'yyyy/MM/dd HH:mm:ss'}}</td>
+ <td>{{item.groupName}}</td>
+ <td>{{item.state}}</td>
+ </tr>
+ <br>
+
+ </tbody>
+ <tfoot>
+ <tr>
+ <td colspan="2" class="text-right">
+ <td ng-repeat="item in row.pageCount" ng-click="showInstances(row,item)" ng-init="c_index=$index" class="page" id={{p_index}}-{{c_index}}>{{item+1}}</td>
+ </td>
+ </tr>
+ </tfoot>
+ </table>
+ </td>
+ </tr>
+ </tbody>
<tfoot>
<tr>
<td colspan="8" class="text-right">
@@ -75,7 +111,7 @@ limitations under the License.
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
- <h4 class="modal-title">Delete the model with the below information?</h4>
+ <h4 class="modal-title">Delete the job with the below information?</h4>
</div>
<div class="modal-body">
<ng-include src="'/pages/jobs/delete-confirm.html'"/>