Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyuanlu committed Apr 27, 2023
1 parent b76965d commit 0bff276
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 46 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
var app = angular.module('sentinelDashboardApp');
const timeInterval = 5;
app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interval', '$timeout',
function ($scope, $stateParams, MetricService, $interval, $timeout) {
moment.locale('zh-cn');

const timeInterval = 5;

$scope.serviceQuery = '';
$scope.loading = false;
$scope.custom = false;
$scope.quick = false;
Expand All @@ -22,8 +24,8 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
return moment(date).format('YYYY/MM/DD HH:mm:ss');
}

function formatTime(date) {
return moment(date).format('HH:mm:ss');
function formatShowDate(date) {
return moment(date).format('YYYY-MM-DD HH:mm:ss');
}

function startDateOnSetTime (newDate, oldDate) {
Expand Down Expand Up @@ -76,7 +78,7 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv

function showSelectedTime() {
let showSelectedTime = document.getElementById('showSelectedTime');
showSelectedTime.innerHTML = formatDate($scope.startTime) + "~" + formatTime($scope.endTime);
showSelectedTime.innerHTML = formatShowDate($scope.startTime) + "~" + formatShowDate($scope.endTime);
}

$scope.app = $stateParams.app;
Expand Down Expand Up @@ -127,7 +129,12 @@ app.controller('MetricCtl', ['$scope', '$stateParams', 'MetricService', '$interv
};

let searchT;
let searchKeyword = '';
$scope.searchService = function () {
if (searchKeyword === $scope.serviceQuery) {
return;
}
searchKeyword = $scope.serviceQuery;
$timeout.cancel(searchT);
searchT = $timeout(function () {
reInitIdentityDatas();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ body {
}

.inputs-header {
padding: 0 0;
padding: 9px 0;
height: 50px;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
Expand Down
72 changes: 31 additions & 41 deletions sentinel-dashboard/src/main/webapp/resources/app/views/metric.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
</div>
<div class="col-md-6">
<div class="pagination-footer" style="margin-top:35px;float:right;font-size:12px;">
<dir-pagination-controls boundary-links="true" template-url="app/views/pagination.tpl.html" pagination-id="servicesPagination"
on-page-change="pageChanged(newPageNumber)">
</dir-pagination-controls>
<div class="tools" style="">
<span>找到 {{emptyObjs.length}} 条结果, </span>
<span>
Expand All @@ -27,41 +24,40 @@
<div class="row" style="margin-top: 20px; margin-bottom: 20px;">
<div class="col-md-12">
<div class="card" style="border:0px">
<div class="inputs-header">
<div class="inputs-header" style="padding: 0 0;height:45px;">
<span class="brand" style="font-size: 13px;cursor: pointer">
<i class="fa fa-sort-amount-asc" aria-hidden="true" ng-show="!isDescOrder" ng-click="setDescOrder()"></i>
<i class="fa fa-sort-amount-desc" aria-hidden="true" ng-show="isDescOrder" ng-click="setAscOrder()"></i>
{{metricTypeDesc}}&nbsp;&nbsp; <label id="showSelectedTime"></label>
&nbsp;<img src="./assets/img/loading.gif" data-ng-show="loading">
</span>

<button class="btn btn-primary" style="float: right;margin-right: 10px;height: 30px;font-size: 12px;"
<!--<button class="btn btn-primary" style="float: right;margin-right: 5px;height: 30px;font-size: 12px;"
data-disabled="!loading" data-ng-show="display" data-ng-click="searchService()">
<span class="spinner-border spinner-border-sm"></span>
查询
</button>
</button>-->

<!--<button class="btn btn-outline-primary" style="float: right;margin-right: 10px;height: 30px;font-size: 12px;" ng-click="setDescOrder()"
<!--<button class="btn btn-outline-primary" style="float: right;margin-right: 5px;height: 30px;font-size: 12px;" ng-click="setDescOrder()"
ng-if="!isDescOrder">降序</button>
<button class="btn btn-outline-primary" style="float: right;margin-right: 10px;height: 30px;font-size: 12px;" ng-click="setAscOrder()"
<button class="btn btn-outline-primary" style="float: right;margin-right: 5px;height: 30px;font-size: 12px;" ng-click="setAscOrder()"
ng-if="isDescOrder">升序</button>-->

<select class="form-control" id="refreshInterval"
style="height:30px;width: 100px; max-width: 100px !important;"
ng-model="selectedItem"
ng-init="selectedItem = refreshItems[0]"
ng-change="onRefreshIntervalChange(selectedItem)"
ng-options="x.text for x in refreshItems">
</select>

<!--<div class="form-group" style="float: right;margin-right: 10px;" ng-show="quick">
<label id="showSelectedTime"></label>
&nbsp;&nbsp;
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(1, 60)">+1h</button>
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(1, 30)">+30m</button>
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(1, 5)">+5m</button>
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(0, 0)">now</button>
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(-1, 5)">-5m</button>
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(-1, 30)">-30m</button>
<button type="button" class="btn btn-default" ng-click="quickOnSetTime(-1, 60)">-1h</button>
</div>-->
<input class="form-control witdh-150" placeholder="关键字" ng-model="serviceQuery"
ng-blur="searchService()"
style="margin-right: 5px;">

<div class="dropdown form-group dropdown-end-parent"
style="width: 195px;float: right;margin-right: 10px;" ng-show="custom">
style="width: 195px;float: right;margin-right: 5px;" ng-show="custom">
<a class="dropdown-toggle" style="text-decoration:none;"
id="dropdownEnd" role="button" data-toggle="dropdown" data-target=".dropdown-end-parent">
<div class="input-group date">
Expand All @@ -80,7 +76,7 @@
</div>

<div class="dropdown form-group dropdown-start-parent"
style="width: 195px;float: right;margin-right: 10px;" ng-show="custom">
style="width: 195px;float: right;margin-right: 5px;" ng-show="custom">
<a class="dropdown-toggle" style="text-decoration:none;"
id="dropdownStart" role="button" data-toggle="dropdown" data-target=".dropdown-start-parent">
<div class="input-group date">
Expand All @@ -97,25 +93,14 @@
</ul>
</div>

<select class="form-control" id="refreshInterval"
style="height:30px;width: 100px; max-width: 100px !important;"
ng-model="selectedItem"
ng-init="selectedItem = refreshItems[0]"
ng-change="onRefreshIntervalChange(selectedItem)"
ng-options="x.text for x in refreshItems">
</select>

<input class="form-control witdh-200" placeholder="关键字" ng-model="serviceQuery" ng-change="searchService()"
style="margin-right: 10px;">

<div class="form-group" style="float: right;margin-right: 10px;margin-top:5px;" ng-show="quick">
[<a ng-click="quickOnSetTime(-1, 1440)">-1d</a>]
[<a ng-click="quickOnSetTime(-1, 60)">-1h</a>]
[<a ng-click="quickOnSetTime(-1, 5)">-5m</a>]
[<a ng-click="quickOnSetTime(1, 5)">+5m</a>]
[<a ng-click="quickOnSetTime(1, 60)">+1h</a>]
[<a ng-click="quickOnSetTime(1, 1440)">+1d</a>]
[<a ng-click="quickOnSetTime(0, 0)">now</a>]
<div class="form-group" style="float: right;margin-right: 5px;" ng-show="quick">
<button type="button" class="btn btn-success" ng-click="quickOnSetTime(-1, 1440)">-1d</button>
<button type="button" class="btn btn-success" ng-click="quickOnSetTime(-1, 60)">-1h</button>
<button type="button" class="btn btn-success" ng-click="quickOnSetTime(-1, 5)">-5m</button>
<button type="button" class="btn btn-warning" ng-click="quickOnSetTime(1, 5)">+5m</button>
<button type="button" class="btn btn-warning" ng-click="quickOnSetTime(1, 60)">+1h</button>
<button type="button" class="btn btn-warning" ng-click="quickOnSetTime(1, 1440)">+1d</button>
<button type="button" class="btn btn-primary" ng-click="quickOnSetTime(0, 0)">now</button>
</div>
</div>
<!--.tools-header -->
Expand Down Expand Up @@ -189,7 +174,12 @@
pagination-id="servicesPagination"></li>
</div>


<div class="pagination-footer" style="float:right;margin-right:5px;font-size:12px;">
<dir-pagination-controls boundary-links="true" template-url="app/views/pagination.tpl.html" pagination-id="servicesPagination"
on-page-change="pageChanged(newPageNumber)">
</dir-pagination-controls>
<!-- .tools -->
</div>
<!-- pagination-footer -->
<!--<div class="row" style="margin-bottom:20px"></div>-->
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0bff276

Please sign in to comment.