Connect page pagination added.

This commit is contained in:
magicsquirrel
2022-07-25 17:04:51 +08:00
parent d9c336e1d6
commit 97dc846d65
3 changed files with 139 additions and 56 deletions

View File

@@ -12,15 +12,15 @@ public class WorkerInfo {
private String namesrvAddr;
private List<WorkerConnector> workingConnectors;
private List<WorkerConnector> allocatedConnectors;
private List<WorkerTask> existingTasks;
private List<WorkerTask> allocatedTasks;
public WorkerInfo(String ipAddr, String namesrvAddr, List<WorkerConnector> workingConnectors, List<WorkerTask> existingTasks) {
public WorkerInfo(String ipAddr, String namesrvAddr, List<WorkerConnector> allocatedConnectors, List<WorkerTask> allocatedTasks) {
this.ipAddr = ipAddr;
this.namesrvAddr = namesrvAddr;
this.workingConnectors = workingConnectors;
this.existingTasks = existingTasks;
this.allocatedConnectors = allocatedConnectors;
this.allocatedTasks = allocatedTasks;
}
public WorkerInfo() {
@@ -46,20 +46,20 @@ public class WorkerInfo {
this.namesrvAddr = namesrvAddr;
}
public List<WorkerConnector> getWorkingConnectors() {
return workingConnectors;
public List<WorkerConnector> getAllocatedConnectors() {
return allocatedConnectors;
}
public void setWorkingConnectors(List<WorkerConnector> workingConnectors) {
this.workingConnectors = workingConnectors;
public void setAllocatedConnectors(List<WorkerConnector> allocatedConnectors) {
this.allocatedConnectors = allocatedConnectors;
}
public List<WorkerTask> getExistingTasks() {
return existingTasks;
public List<WorkerTask> getAllocatedTasks() {
return allocatedTasks;
}
public void setExistingTasks(List<WorkerTask> existingTasks) {
this.existingTasks = existingTasks;
public void setAllocatedTasks(List<WorkerTask> allocatedTasks) {
this.allocatedTasks = allocatedTasks;
}
@Override
@@ -67,8 +67,8 @@ public class WorkerInfo {
return "WorkerInfo{" +
"ipAddr='" + ipAddr + '\'' +
", namesrvAddr='" + namesrvAddr + '\'' +
", workingConnectors=" + workingConnectors +
", existingTasks=" + existingTasks +
", workingConnectors=" + allocatedConnectors +
", existingTasks=" + allocatedTasks +
'}';
}
}

View File

@@ -19,10 +19,78 @@ var module = app;
module.controller('connectController', ['$scope', 'ngDialog', '$http', 'Notification', function ($scope, ngDialog, $http, Notification) {
$scope.allTopicList = [];
$scope.allWorkerList = [];
$scope.selectedTopic = [];
$scope.key = "";
$scope.connectorList = [];
$scope.workerTaskList = [];
$scope.allWorkerList = [];
$scope.respConnectors = [];
$scope.respTasks = [];
$scope.respWorkers = [];
$scope.connectorPaginationConf = {
currentPage: 1,
totalItems: 0,
itemsPerPage: 10,
pagesLength: 15,
perPageOptions: [10],
rememberPerPage: 'perPageItems',
onChange: function () {
$scope.queryWorkerConnectorList(this.currentPage, this.totalItems);
}
};
$scope.taskPaginationConf = {
currentPage: 1,
totalItems: 0,
itemsPerPage: 10,
pagesLength: 15,
perPageOptions: [10],
rememberPerPage: 'perPageItems',
onChange: function () {
$scope.queryWorkerTaskList(this.currentPage, this.totalItems);
}
};
$scope.workerPaginationConf = {
currentPage: 1,
totalItems: 0,
itemsPerPage: 10,
pagesLength: 15,
perPageOptions: [10],
rememberPerPage: 'perPageItems',
onChange: function () {
$scope.queryWorkerList(this.currentPage, this.totalItems);
}
};
$scope.queryWorkerConnectorList = function (currentPage, totalItem) {
var perPage = $scope.connectorPaginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage;
var to = (from + perPage) > totalItem ? totalItem : from + perPage;
$scope.connectorList = $scope.respConnectors.slice(from, to);
$scope.connectorPaginationConf.totalItems = totalItem;
};
$scope.queryWorkerTaskList = function (currentPage, totalItem) {
var perPage = $scope.taskPaginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage;
var to = (from + perPage) > totalItem ? totalItem : from + perPage;
$scope.workerTaskList = $scope.respTasks.slice(from, to);
$scope.taskPaginationConf.totalItems = totalItem;
};
$scope.queryWorkerList = function (currentPage, totalItem) {
var perPage = $scope.workerPaginationConf.itemsPerPage;
var from = (currentPage - 1) * perPage;
var to = (from + perPage) > totalItem ? totalItem : from + perPage;
$scope.allWorkerList = $scope.respWorkers.slice(from, to);
$scope.workerPaginationConf.totalItems = totalItem;
};
function queryTopicName() {
$http({
@@ -38,53 +106,58 @@ module.controller('connectController', ['$scope', 'ngDialog', '$http', 'Notifica
});
}
function queryWorkerConnectorList() {
$scope.showWorkerTaskList = function () {
$http({
method: "GET",
url: "connect/workerTasks.query",
}).success(function (resp) {
if (resp.status === 0) {
console.log(resp);
$scope.respTasks = resp.data;
$scope.queryWorkerTaskList($scope.taskPaginationConf.currentPage, $scope.respTasks.length);
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
});
};
$scope.showWorkerConnectorList = function () {
$http({
method: "GET",
url: "connect/WorkerConnectors.query",
}).success(function (resp) {
if (resp.status === 0) {
console.log(resp);
$scope.messageShowList = resp.data;
$scope.respConnectors = resp.data;
$scope.queryWorkerConnectorList($scope.connectorPaginationConf.currentPage, $scope.respConnectors.length);
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
});
}
};
function queryWorkerList() {
$scope.showWorkerList = function () {
$http({
method: "GET",
url: "connect/worker.query",
}).success(function (resp) {
if (resp.status == 0) {
if (resp.status === 0) {
console.log(resp);
$scope.allWorkerList = resp.data;
$scope.workerTaskList = resp.data;
$scope.respWorkers = resp.data;
$scope.queryWorkerList($scope.workerPaginationConf.currentPage, $scope.respWorkers.length);
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
});
};
$scope.queryWorkerTaskList = function () {
$http({
method: "GET",
url: "connect/workerTasks.query",
}).success(function (resp) {
if (resp.status == 0) {
console.log(resp);
$scope.workerTaskList = resp.data;
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
});
};
$scope.queryWorkerConnectorList = queryWorkerConnectorList;
$scope.queryWorkerList = queryWorkerList;
$scope.queryConnectorStatus = function (name) {
$http({
@@ -121,7 +194,7 @@ module.controller('connectController', ['$scope', 'ngDialog', '$http', 'Notifica
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
queryWorkerConnectorList();
$scope.showWorkerConnectorList();
})
};
@@ -139,7 +212,7 @@ module.controller('connectController', ['$scope', 'ngDialog', '$http', 'Notifica
} else {
Notification.error({message: resp.errMsg, delay: 2000});
}
queryWorkerConnectorList();
$scope.queryWorkerConnectorList();
})
};
@@ -185,7 +258,7 @@ module.controller('connectController', ['$scope', 'ngDialog', '$http', 'Notifica
$scope.openCreationDialog = function () {
queryWorkerList();
$scope.showWorkerList();
queryTopicName();
ngDialog.open({
template: 'connectorCreationDialog',
@@ -208,7 +281,7 @@ module.controller('connectController', ['$scope', 'ngDialog', '$http', 'Notifica
if (resp.status == 0) {
if (resp.data === "success") {
Notification.info({message: "success!", delay: 2000});
queryWorkerConnectorList();
$scope.queryWorkerConnectorList();
ngDialog.close(this);
} else {
Notification.error(resp.data);

View File

@@ -26,7 +26,7 @@
<button id="reloadAppButton" type="button"
class="btn btn-raised btn-sm btn-primary"
data-toggle="modal"
ng-click="queryWorkerConnectorList()">
ng-click="showWorkerConnectorList()">
<span class="glyphicon glyphicon-search"></span>{{ 'REFRESH' | translate}}
</button>
<button id="createConnector" type="button"
@@ -51,7 +51,7 @@
<th class="text-center">Update Time</th>
<th class="text-center">Operation</th>
</tr>
<tr ng-repeat="item in messageShowList">
<tr ng-repeat="item in connectorList">
<td class="text-center">{{item.connectorName}}</td>
<td class="text-center">{{item.connectorClass}}</td>
<td class="text-center">{{item.connectTopicname}}</td>
@@ -69,9 +69,9 @@
confirmed-click="stopThisConnector(item.connectorName)"> {{ 'STOP' | translate }}
</button>
</td>
</tr>
</table>
<tm-pagination conf="connectorPaginationConf"></tm-pagination>
</div>
</md-content>
</md-tab>
@@ -81,7 +81,7 @@
<button id="reloadTaskButton" type="button"
class="btn btn-raised btn-sm btn-primary"
data-toggle="modal"
ng-click="queryWorkerTaskList()">
ng-click="showWorkerTaskList()">
<span class="glyphicon glyphicon-search"></span>{{ 'REFRESH' | translate}}
</button>
<table class="table table-bordered">
@@ -106,6 +106,7 @@
</td>
</tr>
</table>
<tm-pagination conf="taskPaginationConf"></tm-pagination>
</md-content>
</md-tab>
@@ -114,23 +115,19 @@
<button id="reloadWorkerButton" type="button"
class="btn btn-raised btn-sm btn-primary"
data-toggle="modal"
ng-click="queryWorkerList()">
ng-click="showWorkerList()">
<span class="glyphicon glyphicon-search"></span>{{ 'REFRESH' | translate}}
</button>
<table class="table table-bordered">
<tr>
<th class="text-center">Cluster IP</th>
<th class="text-center">Namesrv Addr</th>
<!-- <th class="text-center">Working Connectors</th>-->
<!-- <th class="text-center">Existing Tasks</th>-->
<th class="text-center">Operation</th>
</tr>
<tr ng-repeat="item in workerTaskList">
<tr ng-repeat="item in allWorkerList">
<td class="text-center">{{item.ipAddr}}</td>
<td class="text-center">{{item.namesrvAddr}}</td>
<!-- <td class="text-center">1</td>-->
<!-- <td class="text-center">1</td>-->
<td class="text-center">
<button class="btn btn-raised btn-sm btn-primary" type="button"
ng-click="workerDetail(item)">{{ 'DETAIL' | translate}}
@@ -138,6 +135,7 @@
</td>
</tr>
</table>
<tm-pagination conf="workerPaginationConf"></tm-pagination>
</md-content>
</md-tab>
</md-tabs>
@@ -260,6 +258,18 @@
<label class="form-control">{{ngDialogData.namesrvAddr}}</label>
</div>
</div>
<!-- <div class="form-group">-->
<!-- <label class="control-label col-sm-2">Allocated Connectors:</label>-->
<!-- <div class="col-sm-10">-->
<!-- <label class="form-control">{{ngDialogData.connectors}}</label>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class="form-group">-->
<!-- <label class="control-label col-sm-2">Allocated Tasks:</label>-->
<!-- <div class="col-sm-10">-->
<!-- <label class="form-control">{{ngDialogData.tasks}}</label>-->
<!-- </div>-->
<!-- </div>-->
</form>
</div>