Project

General

Profile

« Previous | Next » 

Revision 63304

Added by Michele Artini 2 months ago

table of apis: refactoring

View differences:

modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/html/ngAggrTotalCell.html
1
<div class="ngCellText text-right">
2
	<span ng-class="{'text-success' : row.getProperty(col.field) > 0, 'text-danger' : row.getProperty(col.field) == 0}">
3
		{{row.getProperty(col.field)}}
4
	</span>
5
</div>
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/html/ngRepoCountryCell.html
1
<div class="ngCellText text-center">
2
	<img ng-src="../resources/img/flags/{{row.getProperty(col.field)}}.gif" /> 
3
	{{row.getProperty(col.field)}}
4
</div>
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/html/ngAggrDateCell.html
1
<div class="ngCellText text-center">
2
	<span ng-show="row.getProperty(col.field)">
3
		{{row.getProperty(col.field) | date:'yyyy-MM-dd HH:mm:ss'}}
4
	</span>
5
	<span ng-hide="row.getProperty(col.field)">
6
		<i>not yet available</i>
7
	</span>
8
</div>
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/html/ngRepoNameCell.html
1
<div class="ngCellText">
2
	<span class="label" 
3
		ng-class="{'label-danger': !row.getProperty('active'), 'label-success': row.getProperty('active')}"
4
		style="width: 100px; display: inline-block; padding: 3px;">
5
		{{row.getProperty('compliance')}}
6
	</span> 
7
	<a href="javascript:void(0)" ng-click="showApi(row.getProperty('repoId'), row.getProperty('id'))" ng-hide="m.deleting">
8
		{{row.getProperty(col.field)}}
9
	</a>
10
	
11
</div>
12

  
13

  
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/html/repoList.html
6 6
		<form class="form-inline pull-right" role="form">
7 7
			<div class="form-group">
8 8
				<label class="sr-only" for="apiFilter">Filter...</label>
9
  				<input type="text" class="form-control input-sm" id="apiFilter" ng-model="filterApis.filterText" placeholder="Filter..." />
9
  				<input type="text" class="form-control input-sm" id="apiFilter" ng-model="apiFilter" placeholder="Filter..." />
10 10
  			</div>
11 11
			<button ng-click="updateApis(true)" class="btn btn-sm btn-default" type="button"><span class="glyphicon glyphicon-refresh"></span></button>
12 12
			<button ng-click="go('#')" class="btn btn-sm btn-default" type="button">back</button>
......
15 15
	
16 16
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">&nbsp;</div>
17 17
	
18
	<div id="apisTable" class="col-xs-12 col-sm-12 col-md-12 col-lg-12 control" ng-grid="gridApis"></div>
19

  
18
	<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
19
		<table class="table table-striped table-condensed">
20
			<thead>
21
				<tr>
22
					<th  class="text-center" style="width: 80px;">Country</th>
23
					<th>Datasource Api</th>
24
					<th class="text-center" style="width: 150px;" class="text-center">Namespace Prefix</th>
25
					<th class="text-center" style="width: 150px;" class="text-center">Protocol</th>
26
					<th class="text-center" style="width: 200px;" class="text-center">Last Aggregation Date</th>
27
					<th class="text-center" style="width: 80px;" class="text-center">Total</th>
28
				</tr>			
29
			</thead>
30
			<tbody>
31
				<tr ng-repeat="a in apis | filter:apiFilter">
32
					<td class="text-center">
33
						<img ng-src="../resources/img/flags/{{a.repoCountry}}.gif" /> 
34
						{{a.repoCountry}}
35
					</td>
36
					<td>
37
						<span class="label" ng-class="{'label-danger': !a.active, 'label-success': a.active}" style="width: 100px; display: inline-block; padding: 3px;">
38
							{{a.compliance}}
39
						</span> 
40
						<a href="javascript:void(0)" ng-click="showApi(a.repoId, a.id)">
41
							{{a.repoName}}
42
						</a>
43
					</td>
44
					<td class="text-center">{{a.repoPrefix}}</td>
45
					<td class="text-center">{{a.protocol}}</td>
46
					<td class="text-center">
47
						<span ng-show="a.aggrDate">{{a.aggrDate | date:'yyyy-MM-dd HH:mm:ss'}}</span>
48
						<i ng-hide="a.aggrDate">not yet available</i>
49
					</td>
50
					<td class="text-right">
51
						<span ng-class="{'text-success' : a.aggrTotal > 0, 'text-danger' : a.aggrTotal == 0}">
52
							{{a.aggrTotal}}
53
						</span>
54
					</td>
55
				</tr>			
56
			</tbody>
57
		</table>
58
	</div>
20 59
</div>
21 60

  
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/js/repoApis.js
76 76
	}
77 77
});
78 78

  
79
module.directive('ngRepoCountryCell', function () {
80
	return {
81
		restrict: 'E',
82
		templateUrl: '../resources/html/ngRepoCountryCell.html'
83
	}
84
});
85

  
86
module.directive('ngReponameCell', function () {
87
	return {
88
		restrict: 'E',
89
		templateUrl: '../resources/html/ngRepoNameCell.html'
90
	}
91
});
92

  
93
module.directive('ngAggrDateCell', function () {
94
	return {
95
		restrict: 'E',
96
		templateUrl: '../resources/html/ngAggrDateCell.html'
97
	}
98
});
99

  
100
module.directive('ngAggrTotalCell', function () {
101
	return {
102
		restrict: 'E',
103
		templateUrl: '../resources/html/ngAggrTotalCell.html'
104
	}
105
});
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/js/repoControllers.js
66 66
		common_init($scope, $http, $sce, $location);
67 67

  
68 68
		$scope.apis = [];
69
		$scope.filterApis = {filterText: ''};
70
		$scope.gridApis = {
71
			data: 'apis',
72
			enableRowSelection: false,
73
			enableCellEditOnFocus: false,
74
			enableHighlighting: true,
75
			filterOptions: $scope.filterApis,
76
			columnDefs: [
77
				{field: 'repoCountry', displayName: 'Country', width: '80px', headerClass: 'text-center', cellTemplate: '<ng-repo-country-cell />'},
78
				{field: 'repoName', displayName: 'Datasource Api', cellTemplate: '<ng-reponame-cell />'},
79
				{field: 'repoPrefix', displayName: 'Namespace Prefix', width: '150px', headerClass: 'text-center', cellClass: 'text-center'},
80
				{field: 'protocol', displayName: 'Protocol', width: '160px', headerClass: 'text-center', cellClass: 'text-center'},
81
				{field: 'aggrDate', displayName: 'Last Aggregation Date', width: '200px', headerClass: 'text-center', cellTemplate: '<ng-aggr-date-cell />'},
82
				{field: 'aggrTotal', displayName: 'Total', width: '80px', headerClass: 'text-center', cellTemplate: '<ng-aggr-total-cell />'}
83
			]
84
		};
85

  
69
		
86 70
		$scope.currentApiSelectionParam = $routeParams.param;
87 71
		$scope.currentApiSelectionValue = $routeParams.value;
88 72

  
......
102 86
				function (data) {
103 87
					$scope.hideSpinner();
104 88
					$scope.apis = data;
105
					$scope.resizeMainElement(document.getElementById('apisTable'));
106 89
				}
107 90
			).error(
108 91
				function () {
......
116 99
			location.href = 'workflows.do#/api/' + repoId + '/' + ifaceId;
117 100
		}
118 101

  
119
		window.onresize = function () {
120
			var elem = document.getElementById('apisTable');
121
			if (elem) {
122
				angular.element(elem).scope().resizeMainElement(elem);
123
			}
124
		};
125

  
126 102
		$scope.updateApis(false);
127 103
	}
128 104
]);
modules/dnet-modular-uis/trunk/src/main/resources/eu/dnetlib/web/resources/js/reposCommon.js
24 24
	}
25 25
	
26 26
	initSpinner();
27
		
28
	$scope.resizeMainElement = function(elem) {
29
		var height = 0;
30
		var body = window.document.body;
31
		if (window.innerHeight) {
32
			height = window.innerHeight;
33
		} else if (body.parentElement.clientHeight) {
34
			height = body.parentElement.clientHeight;
35
		} else if (body && body.clientHeight) {
36
			height = body.clientHeight;
37
		}
38
		elem.style.height = ((height - elem.offsetTop - 80) + "px");
39
	}
40

  
41 27
	
42 28
}

Also available in: Unified diff