From ebaca787c3be336e8b72867a563913f475fb583a Mon Sep 17 00:00:00 2001 From: zombieJ Date: Wed, 25 Jan 2017 15:01:27 +0800 Subject: [PATCH 1/5] add queue list --- .../webapp/app/apps/jpm/ctrl/queueCtrl.js | 69 +++++++++++++++++++ .../src/main/webapp/app/apps/jpm/index.js | 12 +++- .../app/apps/jpm/partials/queue/overview.html | 19 +++++ 3 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/queueCtrl.js create mode 100644 eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/queue/overview.html diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/queueCtrl.js b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/queueCtrl.js new file mode 100644 index 0000000000..f894e7aadf --- /dev/null +++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/ctrl/queueCtrl.js @@ -0,0 +1,69 @@ +/* + * 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. + */ + +(function () { + /** + * `register` without params will load the module which using require + */ + register(function (jpmApp) { + jpmApp.controller("queueCtrl", function ($q, $wrapState, $element, $scope, $timeout, PageConfig, Time, Entity, JPM) { + PageConfig.title = "Queue"; + PageConfig.subTitle = "Overview"; + + $scope.site = $wrapState.param.siteId; + + $scope.refresh = function () { + console.log('refresh!!!'); + + var startTime = new Time('startTime'); + var endTime = new Time('endTime'); + var intervalMin = Time.diffInterval(startTime, endTime) / 1000 / 60; + JPM.aggMetricsToEntities( + JPM.groups('RunningQueueService', { site: $scope.site }, ['queue', 'parentQueue'], 'max(absoluteUsedCapacity)', intervalMin, startTime, endTime) + )._promise.then(function (list) { + /* $scope.topUserJobCountTrendSeries = $.map(list, function (subList) { + return JPM.metricsToSeries(subList[0].tags.user, subList, { + stack: "user", + areaStyle: {normal: {}} + }); + }); + + var flatten = flattenTrendSeries("User", $scope.topUserJobCountTrendSeries); + $scope.topUserJobCountSeries = flatten.series; + $scope.topUserJobCountSeriesCategory = flatten.category; */ + console.log('~>', list); + + $scope.queueTrendSeries = $.map(list, function (subList) { + // console.log('>>>', subList); + + return JPM.metricsToSeries(subList[0].tags.queue, subList, { + stack: "queue", + areaStyle: {normal: {}} + }); + }); + console.log('=>', $scope.queueTrendSeries); + }); + }; + + Time.onReload(function () { + $scope.refresh(); + }, $scope); + $scope.refresh(); + }); + }); +})(); diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/index.js b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/index.js index 7348853e47..b494dc30a1 100644 --- a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/index.js +++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/index.js @@ -55,18 +55,25 @@ reloadOnSearch: false, templateUrl: "partials/job/compare.html", controller: "compareCtrl" + + }).route("jpmQueue", { + url: "/jpm/queue?startTime&endTime", + site: true, + templateUrl: "partials/queue/overview.html", + controller: "queueCtrl", + resolve: { time: true } }); jpmApp.portal({name: "YARN Jobs", icon: "taxi", list: [ {name: "Overview", path: "jpm/overview"}, {name: "Job Statistics", path: "jpm/statistics"}, - {name: "Job List", path: "jpm/list"} + {name: "Job List", path: "jpm/list"}, + {name: "Queue", path: "jpm/queue"} ]}, true); jpmApp.service("JPM", function ($q, $http, Time, Site, Application) { var JPM = window._JPM = {}; - // TODO: timestamp support JPM.QUERY_LIST = '${baseURL}/rest/entities?query=${query}[${condition}]{${fields}}&pageSize=${limit}&startTime=${startTime}&endTime=${endTime}'; JPM.QUERY_GROUPS = '${baseURL}/rest/entities?query=${query}[${condition}]<${groups}>{${field}}${order}${top}&pageSize=${limit}&startTime=${startTime}&endTime=${endTime}'; JPM.QUERY_GROUPS_INTERVAL = '${baseURL}/rest/entities?query=${query}[${condition}]<${groups}>{${field}}${order}${top}&pageSize=${limit}&startTime=${startTime}&endTime=${endTime}&intervalmin=${intervalMin}&timeSeries=true'; @@ -484,4 +491,5 @@ jpmApp.require("ctrl/detailCtrl.js"); jpmApp.require("ctrl/jobTaskCtrl.js"); jpmApp.require("ctrl/compareCtrl.js"); + jpmApp.require("ctrl/queueCtrl.js"); })(); diff --git a/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/queue/overview.html b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/queue/overview.html new file mode 100644 index 0000000000..77919179e1 --- /dev/null +++ b/eagle-jpm/eagle-jpm-web/src/main/webapp/app/apps/jpm/partials/queue/overview.html @@ -0,0 +1,19 @@ + + +Hello World!!! \ No newline at end of file From 3e9f56d64a4d739950a1b52a1dcc0c79c2c4fa56 Mon Sep 17 00:00:00 2001 From: zombieJ Date: Mon, 6 Feb 2017 14:41:25 +0800 Subject: [PATCH 2/5] udpate nav page --- .../src/main/webapp/app/dev/index.html | 6 +-- .../main/webapp/app/dev/public/css/main.css | 9 ++++ .../app/dev/public/js/services/pageSrv.js | 41 ++++++++++++++++++- eagle-server/src/main/webapp/app/package.json | 2 +- 4 files changed, 53 insertions(+), 5 deletions(-) diff --git a/eagle-server/src/main/webapp/app/dev/index.html b/eagle-server/src/main/webapp/app/dev/index.html index 74d5c579e2..26b12ee0e8 100644 --- a/eagle-server/src/main/webapp/app/dev/index.html +++ b/eagle-server/src/main/webapp/app/dev/index.html @@ -162,13 +162,13 @@