Project

General

Profile

« Previous | Next » 

Revision 27037

cleaning and refactoring js

View differences:

modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflows/common/wf_journal.st
1
<div id="currentLogDetailsModal" class="modal fade" tabindex="-1" role="dialog">
2
	<div class="modal-dialog modal-lg">
3
		<div class="modal-content">
4
			<div class="modal-header">
5
				<button type="button" class="close" data-dismiss="modal">&times;</button>
6
				<h4 id="currentLogDetailsLabel">{{currentWorkflow.name}}: <i>{{currentLogDate}}</i></h4>
7
			</div>
8
			<div class="modal-body">
9
				<div id="wfCurrentLogDetails" class="control gridStyle" ng-grid="gridCurrentLogDetails" style="height: 300px"></div>
10
			</div>
11
			<div class="modal-footer">
12
				<button class="btn btn-default" 
13
					data-dismiss="modal"
14
					data-toggle="modal" data-target="#journalWfModal">Back</button>
15
			</div>
16
		</div>
17
	</div>
18
</div>
19

  
modules/dnet-modular-workflows-ui/trunk/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/controllers/WorkflowsController.java
285 285
		return "-";
286 286
	}
287 287

  
288

  
288 289
	@RequestMapping("/ui/wf_proc.img")
289 290
	public void showProcessWorkflow(final HttpServletResponse response, @RequestParam(value = "id", required = true) final String id) throws Exception {
290 291
		BufferedImage image = processGraphGenerator.getProcessImage(id);
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflows.st
17 17
		$ui/workflows/common/wf_monitor()$
18 18
		$ui/workflows/common/wf_monitor_proc()$
19 19
		$ui/workflows/common/wf_monitor_proc_node()$
20
		$ui/workflows/common/wf_journal()$
20
		$ui/workflows/common/wf_journal_entry()$
21 21

  
22 22
		<div class="row">
23 23
			<div class="col-xs-12 col-sm-12 col-md-4 col-lg-3">$ui/workflows/common/left_menu()$</div>
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflow_timeline.st
1 1
$common/master( header={
2
	<script type="text/javascript" src="../resources/js/angular.min.js"></script>
2

  
3
	$ui/workflows/common/header()$
3 4
	<script type="text/javascript" src="../resources/js/dnet_wf_timeline.js"></script>
4 5
	<script type="text/javascript" src="http://www.google.com/jsapi"></script>
5 6
	<script type="text/javascript" src="../resources/js/timeline.js"></script>
6
	<script type="text/javascript" src="../resources/js/ng-grid-2.0.7.min.js"></script>
7 7
	<script type="text/javascript" src="../resources/js/ui-bootstrap.js"></script>
8
	<script type="text/javascript" src="../resources/js/dnet-datepicker.js"></script>
8
	
9
	
9 10
	<link rel="stylesheet" type="text/css" href="../resources/css/dnet-datepicker.css" />
10 11
	<link rel="stylesheet" type="text/css" href="../resources/css/timeline.css" />
11 12
	
......
31 32

  
32 33
}, body={
33 34
	<div ng-app="wfTimelineUI" ng-controller="wfTimelineCtrl">
35
	
36
		$ui/workflows/common/wf_monitor()$
37
		$ui/workflows/common/wf_monitor_proc()$
38
		$ui/workflows/common/wf_monitor_proc_node()$
39
		$ui/workflows/common/wf_journal_entry()$
40
	
41
	
34 42
		<div class="row">
35 43
			<div class="col-xs-12 col-md-6">
36 44
				<form class="form-inline" role="form">
......
54 62
			<div id="divTimeline" class="col-xs-12 col-sm-12 col-md-12 col-lg-12"></div>
55 63
		</div>
56 64
	</div>
57
		
58
	<!-- Details Modal -->
59
	<div id="logDetailsModal" class="modal fade" tabindex="-1" role="dialog">
60
		<div class="modal-dialog modal-lg">
61
			<div class="modal-header">
62
				<button type="button" class="close" data-dismiss="modal">&times;</button>
63
				<h4 class="modal-title" id="logDetailsLabel">{{currentLogTitle}}</h4>
64
			</div>
65
			<div class="modal-body">
66
				<div id="wfLogDetails" class="gridStyle" ng-grid="gridLogDetails"></div>
67
			</div>
68
			<div class="modal-footer">
69
				<button class="btn btn-default" data-dismiss="modal">Close</button>
70
			</div>
71
		</div>
72
	</div>
65

  
73 66
} )$
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflow_journal.st
35 35
		$ui/workflows/common/wf_monitor()$
36 36
		$ui/workflows/common/wf_monitor_proc()$
37 37
		$ui/workflows/common/wf_monitor_proc_node()$
38
		$ui/workflows/common/wf_journal()$
38
		$ui/workflows/common/wf_journal_entry()$
39 39
	
40 40
		<div class="row">
41 41
			<div class="col-xs-12 col-md-6">
......
60 60
				<div id="wfJournalTable" class="gridStyle" ng-grid="gridWfJournal"></div>
61 61
			</div>
62 62
		</div>
63
	
64
				
65
		<!-- Modal for log message details -->
66
		<div id="logDetailsModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-title" aria-hidden="true">
67
			<div class="modal-dialog modal-lg">
68
				<div class="modal-content">
69
					<div class="modal-header">
70
						<button type="button" class="close" data-dismiss="modal">&times;</button>
71
						<h4 class="modal-title" id="logDetailsLabel">Final environment of process <i>{{currentProcId}}</i></h4>
72
					</div>
73
					<div class="modal-body">
74
						<div id="wfLogDetails" class="gridStyle" ng-grid="gridLogDetails"></div>
75
					</div>
76
					<div class="modal-footer">
77
						<button class="btn btn-default" ng-click="currentLog=currentAdvancedLog" ng-show="currentLog.length < currentAdvancedLog.length">Show all parameters</button>
78
						<button class="btn btn-default" data-dismiss="modal">Close</button>
79
					</div>
80
				</div>
81
			</div>
82
		</div><!-- modal end -->
63

  
83 64
	</div>
84 65

  
85 66
} )$
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/functionality/modular/ui/views/ui/workflows/common/wf_journal_entry.st
1
<div id="currentLogDetailsModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modal-title" aria-hidden="true">
2
	<div class="modal-dialog modal-lg">
3
		<div class="modal-content">
4
			<div class="modal-header">
5
				<button type="button" class="close" data-dismiss="modal">&times;</button>
6
				<h4 class="modal-title" id="logDetailsLabel">Final environment of process <i>{{currentProcId}}</i></h4>
7
			</div>
8
			<div class="modal-body">
9
				<div id="wfLogDetails" class="gridStyle" ng-grid="gridCurrentLogDetails"></div>
10
			</div>
11
			<div class="modal-footer">
12
				<button class="btn btn-default" ng-click="currentLog=currentAdvancedLog" ng-show="currentLog.length < currentAdvancedLog.length">Show all parameters</button>
13
				<button class="btn btn-default" data-dismiss="modal">Close</button>
14
			</div>
15
		</div>
16
	</div>
17
</div>
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_wf_timeline.js
4 4
	return date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate();
5 5
}
6 6

  
7
function wfTimelineCtrl($scope, $http, $filter) {
7
function wfTimelineCtrl($scope, $http, $sce, $filter) {
8
	
9
	commonInitialize($scope, $http, $sce);
10
	
8 11
	initSpinner();
9 12
	
10 13
	// Set date range to [3 days before today, today] inclusive
......
41 44
	        if (sel.length) {
42 45
	            if (sel[0].row != undefined) {
43 46
	                var row = sel[0].row;
44
	                $scope.showLogDetails($scope.timelineData[row]);
47
	                $scope.showProcess($scope.timelineData[row].procId, $scope.timelineData[row].prettyDate);
45 48
	            }
46 49
	        }
47 50
	    });
......
125 128
		$scope.timeline.draw($filter('filter')($scope.timelineData, $scope.filterText), opts);
126 129
    }
127 130
	
128
	$scope.showLogDetails = function(data) {
129
		$scope.showSpinner();
130
		$scope.currentLogTitle = data.title;
131
		$http.get('wf_journal.get?id=' + data.procId)
132
        .success(
133
            function(data) {
134
            	$scope.hideSpinner();
135
            	if (data.graph) {
136
    				$scope.currentProc = data.graph;
137
    				$('#monitorProcWfModal').modal('show');
138
    			} else if (data.journal) {
139
            		$scope.currentLog = data.journal;
140
            		$('#logDetailsModal').modal('show');
141
    			}
142
            }
143
        ).error(
144
            function() {
145
            	$scope.showError('Something really bad must have happened to our fellow hamster..');
146
            	$scope.hideSpinner();
147
            }
148
        );	
149
	}
150 131

  
151 132
	$scope.refresh();
152 133
	//$scope.timeline.setScale(links.Timeline.StepDate.SCALE.DAY, 1);
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_workflows_common.js
15 15
	$scope.currentTab = 'metawf';
16 16
	$scope.currentHistory = [];
17 17

  
18
	$scope.currentLogDetails = [];
18
	$scope.currentLog = [];
19
	$scope.currentSimpleLog = [];
20
	$scope.currentAdvancedLog = [];
21
	
19 22
	$scope.validParamValuesCache = {};
20 23

  
21 24
	$scope.filterMetaWfHistory = {
......
23 26
	};
24 27

  
25 28
	$scope.gridCurrentLogDetails = {
26
		data : 'currentLogDetails',
29
		data : 'currentLog',
27 30
		enableCellSelection : false,
28 31
		enableRowSelection : false,
29 32
		enableCellEditOnFocus : false,
30 33
		enablePaging : false,
31
		sortInfo : {
32
			fields : [ 'k' ],
33
			directions : [ 'asc' ]
34
		},
35
		columnDefs : [ {
36
			field : 'k',
37
			displayName : 'Key',
38
			width : '20%'
39
		}, {
40
			field : 'v',
41
			displayName : 'Value'
42
		} ]
34
		sortInfo : { fields : [ 'k' ], directions : [ 'asc' ] },
35
		columnDefs : [ 
36
		              {	field : 'k', displayName : 'Key', width : '20%' },
37
		              {	field : 'v', displayName : 'Value' } 
38
		             ]
43 39
	};
44 40
	
45 41
	$scope.to_trusted = function(html_code) {
......
145 141
	$scope.showProcess = function(id, date) {
146 142
		$('#journalWfModal').modal('hide');
147 143
		$('#monitorWfModal').modal('hide');
148

  
144
		
149 145
		$scope.showSpinner();
150 146

  
151 147
		$http.get('wf_journal.get?id=' + id).success(function(data) {
......
155 151
				$('#monitorProcWfModal').modal('show');
156 152
			} else if (data.journal) {
157 153
				$scope.currentLogDate = date;
158
				$scope.currentLogDetails = data.journal;
154
				$scope.currentAdvancedLog = data.journal;
155
				$scope.currentSimpleLog = [];
156
				angular.forEach($scope.currentAdvancedLog, function(value, key){
157
					if ((/^dataprovider\:/).test(value.k) || (/^mainlog\:/).test(value.k)) {
158
						$scope.currentSimpleLog.push(value);
159
					}
160
				});
161
				$scope.currentLog = $scope.currentSimpleLog;
162
				$scope.hideSpinner();
159 163
				$('#currentLogDetailsModal').modal('show');
160 164
			}
161 165
		}).error(function() {
......
185 189
	$scope.killProcess = function(procId) {
186 190
		if (confirm("Are you sure ?")) {
187 191
			$scope.showSpinner();
188
			$http
189
					.get('wf_proc.kill?id=' + procId)
190
					.success(function(data) {
191
						$scope.currentProc = data;
192
						$scope.hideSpinner();
193
						$('#monitorProcWfModal').modal('show');
194
					})
195
					.error(
196
							function() {
197
								$scope
198
										.showError('Something really bad must have happened to our fellow hamster..');
199
								$scope.hideSpinner();
200
							});
192
			$http.get('wf_proc.kill?id=' + procId).success(function(data) {
193
				$scope.currentProc = data;
194
				$scope.hideSpinner();
195
				$('#monitorProcWfModal').modal('show');
196
			}).error(function() {
197
				$scope.showError('Something really bad must have happened to our fellow hamster..');
198
				$scope.hideSpinner();
199
			});
201 200
		}
202 201
	}
203 202

  
modules/dnet-modular-workflows-ui/trunk/src/main/resources/eu/dnetlib/web/resources/js/dnet_wf_journal.js
11 11
	initSpinner();
12 12
	
13 13
	$scope.journal = [];
14
	$scope.currentLog = [];
15
	$scope.currentSimpleLog = [];
16
	$scope.currentAdvancedLog = [];
14
	
17 15
	$scope.currentProcId = '';
18 16
	
19 17
	$scope.filterJournal = {
......
41 39
			enableHighlighting: true,
42 40
			sortInfo: { fields: ['date'], directions: ['desc']},
43 41
			filterOptions: $scope.filterJournal,
44
			columnDefs: [{field: 'procId',   displayName: 'Process ID'     , width: '15%', cellTemplate: '<div class="ngCellText"><a href="#" ng-click="showLogDetails(row.getProperty(col.field))">{{row.getProperty(col.field)}}</a></div>'},
42
			columnDefs: [{field: 'procId',   displayName: 'Process ID'     , width: '15%', cellTemplate: '<div class="ngCellText"><a href="#" ng-click="showProcess(row.getProperty(col.field), row.getProperty(\'prettyDate\'))">{{row.getProperty(col.field)}}</a></div>'},
45 43
			             {field: 'name',   displayName: 'Workflow name' },
46 44
			             {field: 'family', displayName: 'Workflow family', width: '15%' },
47 45
			             {field: 'status', displayName: 'Status'         , width: '10%', cellTemplate: '<div class="ngCellText"><span class="label" ng-class="{ \'label-success\': row.getProperty(col.field) == \'SUCCESS\', \'label-danger\': row.getProperty(col.field) == \'FAILURE\', \'label-info\': row.getProperty(col.field) == \'EXECUTING\'}">{{row.getProperty(col.field)}}</span></div>'},
48 46
			             {field: 'date',     displayName: 'Date'           , width: '15%', cellTemplate: '<div class="ngCellText">{{row.getProperty("prettyDate")}}</div>'}
49 47
			            ]
50
		};
51
	
52
	$scope.gridLogDetails = { 
53
			data: 'currentLog',
54
			enableCellSelection: false,
55
			enableRowSelection: false,
56
			enableCellEditOnFocus: false,
57
			enablePaging: false,
58
			sortInfo: { fields: ['k'], directions: ['asc'] },
59
			columnDefs: [{field: 'k', displayName: 'Key', width: '20%' },
60
			             {field: 'v', displayName: 'Value' }]
61 48
	};
49

  
62 50
		
63 51
	$scope.showError = function(error) {
64 52
		show_notification("error", error);
......
93 81
        );
94 82
	}
95 83
	
96
	$scope.showLogDetails = function(procId) {
97
		$scope.showSpinner();
98
		$scope.currentProcId = procId;
99
		
100
		$http.get('wf_journal.get?id=' + procId)
101
        .success(
102
            function(data) {
103
            	$scope.hideSpinner();
104
            	if (data.graph) {
105
    				$scope.currentProc = data.graph;
106
    				$('#monitorProcWfModal').modal('show');
107
    			} else if (data.journal) {
108
    				$scope.currentAdvancedLog = data.journal;
109
                    $scope.currentSimpleLog = [];
110
                    angular.forEach($scope.currentAdvancedLog, function(value, key){
111
    	            	if ((/^dataprovider\:/).test(value.k) || (/^mainlog\:/).test(value.k)) {
112
    	            		$scope.currentSimpleLog.push(value);
113
    					}
114
    				});
115
                    $scope.currentLog = $scope.currentSimpleLog;
116
                    $scope.hideSpinner();
117
                    $('#logDetailsModal').modal('show');
118
    			}
119
            }
120
        ).error(
121
            function() {
122
            	$scope.showError('Something really bad must have happened to our fellow hamster..');
123
            	$scope.hideSpinner();
124
            }
125
        );
126
	}
127
	
128 84
	$scope.resizeMainElement = function(elem) {
129 85
		var height = 0;
130 86
		var body = window.document.body;
......
142 98
	$scope.resizeMainElement(document.getElementById('wfJournalTable'));
143 99
	
144 100
	if (initProcId()) {
145
		$scope.showLogDetails(initProcId());
101
		$scope.showProcess(initProcId(), '');
146 102
	}
147 103
}
148 104

  

Also available in: Unified diff