Project

General

Profile

« Previous | Next » 

Revision 39948

changed the baseDir of ajax calls

View differences:

modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/controllers/DnetParamValuesController.java
2 2

  
3 3
import java.io.IOException;
4 4
import java.io.StringReader;
5
import java.util.ArrayList;
6
import java.util.Collections;
7
import java.util.Enumeration;
8
import java.util.List;
9
import java.util.Map;
10

  
5
import java.util.*;
11 6
import javax.annotation.Resource;
12 7
import javax.servlet.http.HttpServletRequest;
13 8
import javax.servlet.http.HttpServletResponse;
14 9

  
10
import com.google.common.collect.Maps;
11
import com.google.gson.Gson;
12
import eu.dnetlib.msro.workflows.util.ValidNodeValuesFetcher;
13
import eu.dnetlib.msro.workflows.util.ValidNodeValuesFetcher.DnetParamValue;
15 14
import org.apache.commons.io.IOUtils;
16 15
import org.apache.commons.logging.Log;
17 16
import org.apache.commons.logging.LogFactory;
......
19 18
import org.springframework.web.bind.annotation.RequestMapping;
20 19
import org.springframework.web.bind.annotation.RequestParam;
21 20

  
22
import com.google.common.collect.Maps;
23
import com.google.gson.Gson;
24

  
25
import eu.dnetlib.msro.workflows.util.ValidNodeValuesFetcher;
26
import eu.dnetlib.msro.workflows.util.ValidNodeValuesFetcher.DnetParamValue;
27

  
28 21
@Controller
29 22
public class DnetParamValuesController {
30 23

  
24
	private static final Log log = LogFactory.getLog(DnetParamValuesController.class);
31 25
	@Resource
32 26
	private List<ValidNodeValuesFetcher> validNodesFetchers;
33 27

  
34
	private static final Log log = LogFactory.getLog(DnetParamValuesController.class);
35

  
36
	@RequestMapping("/ui/**/wf_obtainValidValues.list")
28
	@RequestMapping("/ui/wf/obtainValidValues.list")
37 29
	public void obtainValidValues(final HttpServletRequest request,
38 30
			final HttpServletResponse response,
39 31
			@RequestParam(value = "bean", required = true) final String bean) throws IOException {
......
69 61

  
70 62
	private void sendResponse(final HttpServletResponse response, final List<DnetParamValue> values) throws IOException {
71 63
		Collections.sort(values);
72
		
64

  
73 65
		response.setContentType("application/json;charset=UTF-8");
74
		
66

  
75 67
		IOUtils.copy(new StringReader(new Gson().toJson(values)), response.getOutputStream());
76 68
	}
77 69
}
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/java/eu/dnetlib/functionality/modular/ui/workflows/controllers/WorkflowsController.java
80 80
	@Resource(name = "msroWorkflowLogger")
81 81
	private DnetLogger dnetLogger;
82 82

  
83
	@RequestMapping("/ui/list_workflows.json")
83
	@RequestMapping("/ui/wf/list_workflows.json")
84 84
	public
85 85
	@ResponseBody
86 86
	List<WorkflowPair> listWorflowsForSection(@RequestParam(value = "section", required = false) final String sectionName,
......
95 95
		}
96 96
	}
97 97

  
98
	@RequestMapping("/ui/wf_workflow.html")
98
	@RequestMapping("/ui/wf/workflow.html")
99 99
	public void getWorkflowHtml(HttpServletResponse res, @RequestParam(value = "id", required = true) final String id) throws Exception {
100 100
		final String profile = isLookupClient.getProfile(id);
101 101
		final ApplyXslt xslt = new ApplyXslt(new ClassPathResource("/eu/dnetlib/functionality/modular/workflows/xslt/wf_profile2html.xslt"));
......
111 111
		out.close();
112 112
	}
113 113

  
114
	@RequestMapping("/ui/wf.start")
114
	@RequestMapping("/ui/wf/wf.start")
115 115
	public
116 116
	@ResponseBody
117 117
	ProcessInfo startWorkflow(@RequestParam(value = "id", required = true) final String id) throws Exception {
......
124 124
		}
125 125
	}
126 126

  
127
	@RequestMapping("/ui/update_workflow.do")
127
	@RequestMapping("/ui/wf/update_workflow.do")
128 128
	public
129 129
	@ResponseBody
130 130
	boolean updateWorkflow(@RequestParam(value = "json", required = true) final String json) throws Exception {
......
139 139
		return res;
140 140
	}
141 141

  
142
	@RequestMapping("/ui/wf_proc_node.json")
142
	@RequestMapping("/ui/wf/proc_node.json")
143 143
	public
144 144
	@ResponseBody
145 145
	NodeTokenInfo getProcessWorkflowNode(@RequestParam(value = "id", required = true) final String pid,
......
172 172
		return "-";
173 173
	}
174 174

  
175
	@RequestMapping("/ui/wf_proc.kill")
175
	@RequestMapping("/ui/wf/proc.kill")
176 176
	public
177 177
	@ResponseBody
178 178
	boolean killProcessWorkflow(@RequestParam(value = "id", required = true) final String id) throws Exception {
......
181 181
		return true;
182 182
	}
183 183

  
184
	@RequestMapping("/ui/wf_journal.range")
184
	@RequestMapping("/ui/wf/journal.range")
185 185
	public
186 186
	@ResponseBody
187 187
	Collection<ProcessInfo> rangeWfJournal(@RequestParam(value = "start", required = true) final String start,
......
211 211

  
212 212
	}
213 213

  
214
	@RequestMapping("/ui/wf_journal.find")
214
	@RequestMapping("/ui/wf/journal.find")
215 215
	public
216 216
	@ResponseBody
217 217
	List<ProcessInfo> findWfJournal(@RequestParam(value = "wfs", required = true) final String wfs) {
......
253 253
		return res;
254 254
	}
255 255

  
256
	@RequestMapping("/ui/wf_journal_byFamily.find")
256
	@RequestMapping("/ui/wf/journal_byFamily.find")
257 257
	public
258 258
	@ResponseBody
259 259
	Collection<ProcessInfo> findWfJournalByFamily(@RequestParam(value = "family", required = true) final String family) throws IOException {
......
262 262
		return Lists.newArrayList(iter);
263 263
	}
264 264

  
265
	@RequestMapping("/ui/wf_journal.get")
265
	@RequestMapping("/ui/wf/journal.get")
266 266
	public
267 267
	@ResponseBody
268 268
	ProcessInfo getWfJournalLog(@RequestParam(value = "id", required = true) final String procId) throws Exception {
......
283 283
		return info;
284 284
	}
285 285

  
286
	@RequestMapping(value = "/ui/saveParams.do")
286
	@RequestMapping(value = "/ui/wf/saveParams.do")
287 287
	public
288 288
	@ResponseBody
289 289
	boolean saveWorkflowParams(@RequestParam(value = "wf", required = true) final String wfId,
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/resources/eu/dnetlib/web/resources/js/dnet_workflows.js
13 13
				if (params.wf == '_') {
14 14
					return "../resources/html/wf/empty.html";
15 15
				} else {
16
					return 'wf_workflow.html?id=' + params.wf + '&dt=' + new Date().getTime();
16
					return 'wf/workflow.html?id=' + params.wf + '&dt=' + new Date().getTime();
17 17
				}
18 18
			}
19 19
		})
......
171 171
		link: function (scope) {
172 172
			scope.ngModel = "" + scope.initValue;
173 173
			scope.ngOriginalModel = scope.initValue;
174
			
174

  
175 175
			scope.verifyValue = function () {
176 176
				if (scope.ngModel.length == 0 && scope.mandatory != "true") {
177 177
					return "warning";
......
240 240
			scope.updateWf = function () {
241 241
				showSpinner();
242 242
				$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
243
				$http.post('update_workflow.do', $.param({
243
				$http.post('wf/update_workflow.do', $.param({
244 244
					'json': JSON.stringify(scope.wf)
245 245
				})).success(function (data) {
246 246
					scope.originalWf = angular.copy(scope.wf);
......
291 291

  
292 292
			scope.refresh = function () {
293 293
				showSpinner();
294
				$http.get('wf_journal.get?id=' + scope.proc.procId).success(function (data) {
294
				$http.get('wf/journal.get?id=' + scope.proc.procId).success(function (data) {
295 295
					scope.proc = data;
296 296
					hideSpinner();
297 297
				}).error(function (e) {
......
303 303
			scope.kill = function () {
304 304
				if (confirm("Are you sure ?")) {
305 305
					showSpinner();
306
					$http.get('wf_proc.kill?id=' + scope.proc.procId).success(function (data) {
306
					$http.get('wf/proc.kill?id=' + scope.proc.procId).success(function (data) {
307 307
						scope.currentProc = {};
308 308
						hideSpinner();
309 309
						$('#monitorProcWfModal').modal('hide');
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/resources/eu/dnetlib/web/resources/js/dnet_wf_timeline.js
1 1
var module = angular.module('wfTimelineUI', ['ngGrid']);
2 2

  
3 3
function wfTimelineCtrl($scope, $http, $sce, $filter) {
4
	
4

  
5 5
	commonInitialize($scope, $http, $sce);
6
	
6

  
7 7
	initSpinner();
8
	
8

  
9 9
	// Set date range to [3 days before today, today] inclusive
10 10
	$scope.endDate = new Date();
11 11
	$scope.startDate = new Date();
12
	$scope.startDate.setDate($scope.endDate.getDate()-3);
13
	
14
	$scope.data= [];
15
	$scope.timeline = new links.Timeline(document.getElementById('divTimeline'));		
12
	$scope.startDate.setDate($scope.endDate.getDate() - 3);
13

  
14
	$scope.data = [];
15
	$scope.timeline = new links.Timeline(document.getElementById('divTimeline'));
16 16
	$scope.timelineData = [];
17 17
	$scope.currentLog = [];
18 18
	$scope.currentLogTitle = '';
19
	
20
	$scope.formatDate = function(date) {
19

  
20
	$scope.formatDate = function (date) {
21 21
		var year = date.getFullYear();
22 22
		var month = ("00" + (date.getMonth() + 1)).slice(-2);
23 23
		var day = ("00" + date.getDate()).slice(-2);
24 24
		return year + '-' + month + '-' + day;
25 25
	}
26
	
27
	$scope.gridLogDetails = { 
28
			data: 'currentLog',
29
			enableCellSelection: false,
30
			enableRowSelection: false,
31
			enableCellEditOnFocus: false,
32
			enablePaging: false,
33
			sortInfo: { fields: ['name'], directions: ['asc'] },
34
			columnDefs: [{field: 'name', displayName: 'Key', width: '20%' },
35
			             {field: 'value', displayName: 'Value' }]
26

  
27
	$scope.gridLogDetails = {
28
		data: 'currentLog',
29
		enableCellSelection: false,
30
		enableRowSelection: false,
31
		enableCellEditOnFocus: false,
32
		enablePaging: false,
33
		sortInfo: {fields: ['name'], directions: ['asc']},
34
		columnDefs: [{field: 'name', displayName: 'Key', width: '20%'},
35
			{field: 'value', displayName: 'Value'}]
36 36
	};
37
	
38
	$scope.registerListener = function() {
39
		links.events.addListener($scope.timeline, 'select', function() {
40
	        var sel = $scope.timeline.getSelection();
41
	        if (sel.length) {
42
	            if (sel[0].row != undefined) {
43
	                var row = sel[0].row;
44
	                $scope.showProcess($scope.timelineData[row].procId);
45
	            }
46
	        }
47
	    });
48 37

  
49
        // attach an event listener using the links events handler
50
		links.events.addListener($scope.timeline, 'rangechanged', function(properties) {
38
	$scope.registerListener = function () {
39
		links.events.addListener($scope.timeline, 'select', function () {
40
			var sel = $scope.timeline.getSelection();
41
			if (sel.length) {
42
				if (sel[0].row != undefined) {
43
					var row = sel[0].row;
44
					$scope.showProcess($scope.timelineData[row].procId);
45
				}
46
			}
47
		});
48

  
49
		// attach an event listener using the links events handler
50
		links.events.addListener($scope.timeline, 'rangechanged', function (properties) {
51 51
			if ($scope.formatDate($scope.endDate) != $scope.formatDate(properties.end) || $scope.formatDate($scope.startDate) != $scope.formatDate(properties.start)) {
52 52
				$scope.endDate = properties.end;
53 53
				$scope.startDate = properties.start;
......
55 55
			}
56 56
		});
57 57
	}
58
		
59
	$scope.refresh = function() {
58

  
59
	$scope.refresh = function () {
60 60
		$scope.showSpinner();
61
		$http.get('wf_journal.range?start=' + $scope.formatDate($scope.startDate) + '&end=' + $scope.formatDate($scope.endDate))
62
        .success(
63
            function(data) {
64
            	$scope.data = data;
65
                $scope.drawVisualization($scope.data);
66
                $scope.hideSpinner();
67
            }
68
        ).error(
69
            function() {
70
            	$scope.showError('Something really bad must have happened to our fellow hamster..');
71
            	$scope.hideSpinner();
72
            }
73
        );
61
		$http.get('wf/journal.range?start=' + $scope.formatDate($scope.startDate) + '&end=' + $scope.formatDate($scope.endDate))
62
			.success(
63
				function (data) {
64
					$scope.data = data;
65
					$scope.drawVisualization($scope.data);
66
					$scope.hideSpinner();
67
				}
68
			).error(
69
			function () {
70
				$scope.showError('Something really bad must have happened to our fellow hamster..');
71
				$scope.hideSpinner();
72
			}
73
		);
74 74
	}
75
	
76
	$scope.resizeMainElement = function(elem) {
75

  
76
	$scope.resizeMainElement = function (elem) {
77 77
		var height = 0;
78 78
		var body = window.document.body;
79 79
		if (window.innerHeight) {
......
85 85
		}
86 86
		elem.style.height = ((height - elem.offsetTop - 160) + "px");
87 87
	}
88
	
89
	
90
	$scope.drawVisualization = function(entries) {
88

  
89

  
90
	$scope.drawVisualization = function (entries) {
91 91
		$scope.timelineData = [];
92 92

  
93
		angular.forEach(entries, function(value, key) {
93
		angular.forEach(entries, function (value, key) {
94 94
			var clazz = 'text-success';
95 95
			if (value.status == 'FAILURE') {
96 96
				clazz = 'text-danger';
97 97
			}
98
			
98

  
99 99
			var s = "";
100 100
			if (value.repo) {
101 101
				s += value.repo + " (" + value.name + ")";
102 102
			} else {
103 103
				var s = value.name;
104 104
			}
105
			
105

  
106 106
			var prettyDate = "not yet started";
107 107
			if (value.date > 0 && value.date < 9999999999999) { // sabato 20 novembre 2286 17.46.39 GMT
108
				prettyDate = $filter('date')(new Date(value.date),'yyyy-MM-dd HH:mm:ss');
108
				prettyDate = $filter('date')(new Date(value.date), 'yyyy-MM-dd HH:mm:ss');
109 109
			}
110
						
110

  
111 111
			$scope.timelineData.push({
112 112
				'title': value.name + " (" + prettyDate + ")",
113 113
				'procId': value.procId,
114
                'start': new Date(value.date),
115
                'content': s,
116
                'className': clazz
117
            });
114
				'start': new Date(value.date),
115
				'content': s,
116
				'className': clazz
117
			});
118 118
		});
119
		
119

  
120 120
		$scope.timeline = new links.Timeline(document.getElementById('divTimeline'));
121 121
		$scope.registerListener();
122
		var opts = {'width': '100%', 
123
					'height': '99%', 
124
					'style': 'dot',
125
					'zoomMin': 1000000,
126
					'zoomMax': 1314000000, // a half month
127
					'start': $scope.startDate,
128
					'end': $scope.endDate};
122
		var opts = {
123
			'width': '100%',
124
			'height': '99%',
125
			'style': 'dot',
126
			'zoomMin': 1000000,
127
			'zoomMax': 1314000000, // a half month
128
			'start': $scope.startDate,
129
			'end': $scope.endDate
130
		};
129 131
		$scope.timeline.draw($filter('filter')($scope.timelineData, $scope.filterText), opts);
130
    }
131
	
132
	}
132 133

  
134

  
133 135
	$scope.refresh();
134 136
	//$scope.timeline.setScale(links.Timeline.StepDate.SCALE.DAY, 1);
135 137
	$scope.resizeMainElement(document.getElementById('divTimeline'));
136
	
138

  
137 139
}
138 140

  
139
window.onresize = function() {
141
window.onresize = function () {
140 142
	var elem = document.getElementById('divTimeline');
141
    angular.element(elem).scope().resizeMainElement(elem);
142
    angular.element(elem).scope().timeline.redraw();
143
	angular.element(elem).scope().resizeMainElement(elem);
144
	angular.element(elem).scope().timeline.redraw();
143 145
};
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/resources/eu/dnetlib/web/resources/js/dnet_workflows_controllers.js
10 10
		$scope.history = [];
11 11

  
12 12
		if (sharedProperties.getWorkflows().length == 0) {
13
			$http.get('list_workflows.json?section=' + sharedProperties.getCurrentSection()).success(function (data) {
13
			$http.get('wf/list_workflows.json?section=' + sharedProperties.getCurrentSection()).success(function (data) {
14 14
				if (sharedProperties.getCurrentWorkflowId() == '_' && data.length > 0) {
15 15
					$location.path('/wf/' + sharedProperties.getCurrentSection() + "/" + data[0].wfId);
16 16
				}
......
25 25
		$scope.originalParams = {};
26 26

  
27 27
		$scope.executeWf = function (wfId) {
28
			$http.get('wf.start?id=' + wfId).success(function (data) {
28
			$http.get('wf/wf.start?id=' + wfId).success(function (data) {
29 29
				$scope.currentProc = data;
30 30
				$('#monitorProcWfModal').modal('show');
31 31
			}).error(function (err) {
......
38 38
		};
39 39

  
40 40
		$scope.updateHistory = function (wfId) {
41
			$http.get('wf_journal.find?wfs=' + wfId).success(function (data) {
41
			$http.get('wf/journal.find?wfs=' + wfId).success(function (data) {
42 42
				$scope.history = data;
43 43
			}).error(function (err) {
44 44
				show_notification("error", "Error fetching history: " + err.message);
......
49 49
			showSpinner();
50 50

  
51 51
			$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
52
			$http.post('saveParams.do', $.param({
52
			$http.post('wf/saveParams.do', $.param({
53 53
				'wf': wfId,
54 54
				'params': JSON.stringify(params)
55 55
			})).success(function (b) {
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/resources/eu/dnetlib/web/resources/js/dnet_workflows_common.js
126 126
		$scope.currentNode = null;
127 127
		$scope.showSpinner();
128 128
		$http
129
			.get('wf_workflow_node.json?wf=' + wf + '&node=' + node)
129
			.get('wf/workflow_node.json?wf=' + wf + '&node=' + node)
130 130
			.success(function (data) {
131 131
				$scope.currentNode = data;
132 132
				$scope.hideSpinner();
......
148 148
		$('#monitorProcWfModal').modal('hide');
149 149
		$scope.showSpinner();
150 150
		$http
151
			.get('wf_proc_node.json?id=' + procId + "&node=" + nodeId)
151
			.get('wf/proc_node.json?id=' + procId + "&node=" + nodeId)
152 152
			.success(function (data) {
153 153
				$scope.currentProcNode = data;
154 154
				$scope.hideSpinner();
......
206 206
	};
207 207

  
208 208

  
209
	$scope.getAtomicWorkflow = function (id) {
210
		$scope.currentWorkflow = null;
211
		$scope.currentNode = null;
212

  
213
		$scope.showSpinner();
214
		$http.get('wf_atomic_workflow.json?id=' + id).success(function (data) {
215
			$scope.currentWorkflow = data;
216
			$scope.hideSpinner();
217
			$('#atomWfModal').modal('show')
218
		}).error(function (err) {
219
			$scope.showError(err.message);
220
			$scope.hideSpinner();
221
		});
222
	}
223

  
224

  
225 209
	$scope.prepareWfEdit = function () {
226 210
		$scope.tempWorkflow = angular.copy($scope.currentWorkflow);
227 211
	};
228 212

  
229
	$scope.saveWorkflowsUserParams = function () {
230
		$scope.showSpinner();
231 213

  
232
		$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
233
		$http.post('save_user_params.do', $.param({
234
			'wf': $scope.currentUserParams.wfId,
235
			'params': JSON.stringify($scope.currentUserParams.data)
236
		})).success(function (b) {
237
			$scope.hideSpinner();
238
			$scope.showNotification('Workflow updated !');
239
		}).error(function (err) {
240
			$scope.hideSpinner();
241
			$scope.showError(err.message);
242

  
243
		});
244
	}
245

  
246

  
247 214
	$scope.updateHistory = function (ids) {
248 215
		$scope.currentHistory = [];
249 216
		$scope.showSpinner();
250 217
		$http.defaults.headers.post["Content-Type"] = "application/x-www-form-urlencoded; charset=UTF-8";
251
		$http.post('wf_journal.find', $.param({
218
		$http.post('wf/journal.find', $.param({
252 219
			'wfs': JSON.stringify(ids)
253 220
		})).success(function (data) {
254 221
			$scope.hideSpinner();
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/resources/eu/dnetlib/web/resources/js/dnet_wf_journal.js
1
var module = angular.module('wfJournalUI', ['ngGrid','ui.bootstrap']);
1
var module = angular.module('wfJournalUI', ['ngGrid', 'ui.bootstrap']);
2 2

  
3
module.directive('sliderDateRange', function($compile) {
3
module.directive('sliderDateRange', function ($compile) {
4 4
	var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sept", "Oct", "Nov", "Dec"];
5
	
5

  
6 6
	return {
7 7
		restrict: 'A',
8 8
		scope: {
9
			min   : '=',
10
			max   : '=',
11
			start : '=',
12
			end   : '=',
9
			min: '=',
10
			max: '=',
11
			start: '=',
12
			end: '=',
13 13
			updateFunction: '='
14 14
		},
15
		link: function(scope, elem, attrs) {
16
    		$(elem).dateRangeSlider({
17
    			valueLabels: "change",
18
    			delayOut: 1000,
19
    			"bounds" : {
15
		link: function (scope, elem, attrs) {
16
			$(elem).dateRangeSlider({
17
				valueLabels: "change",
18
				delayOut: 1000,
19
				"bounds": {
20 20
					min: scope.min,
21 21
					max: scope.max
22 22
				},
23
				"defaultValues" : {
23
				"defaultValues": {
24 24
					min: scope.start,
25 25
					max: scope.end
26 26
				},
27 27
				"scales": [{
28
					first: function(value) {
28
					first: function (value) {
29 29
						return value;
30 30
					},
31
					end: function(value) {
31
					end: function (value) {
32 32
						return value;
33 33
					},
34
					next: function(value) {
34
					next: function (value) {
35 35
						var next = new Date(value);
36 36
						return new Date(next.setMonth(value.getMonth() + 1));
37 37
					},
38
					label: function(value) {
38
					label: function (value) {
39 39
						return months[value.getMonth()];
40 40
					},
41
					format:	function(tickContainer, tickStart, tickEnd) {
41
					format: function (tickContainer, tickStart, tickEnd) {
42 42
						tickContainer.addClass("myCustomClass");
43 43
					}
44 44
				}]
45
    		});
46
    		$(elem).bind("valuesChanged", function(e, data){
47
    			scope.updateFunction(data.values.min, data.values.max);
48
    		});
49
    	}
50
    }
45
			});
46
			$(elem).bind("valuesChanged", function (e, data) {
47
				scope.updateFunction(data.values.min, data.values.max);
48
			});
49
		}
50
	}
51 51
});
52 52

  
53 53
function wfJournalCtrl($scope, $http, $sce) {
54
	
54

  
55 55
	commonInitialize($scope, $http, $sce);
56
	
56

  
57 57
	initSpinner();
58
	
58

  
59 59
	$scope.journal = [];
60
	
60

  
61 61
	$scope.currentProcId = '';
62
	
62

  
63 63
	$scope.family = getFamily();
64
	
65
	$scope.filterJournal = { filterText: '' };
66
		
64

  
65
	$scope.filterJournal = {filterText: ''};
66

  
67 67
	$scope.maxDate = new Date();
68 68
	$scope.minDate = new Date(2014, 0, 1);
69
	
69

  
70 70
	$scope.endDate = new Date();
71 71
	$scope.startDate = new Date();
72
	
73
	$scope.updateDates = function(start, end) {
72

  
73
	$scope.updateDates = function (start, end) {
74 74
		$scope.startDate = start;
75 75
		$scope.endDate = end;
76 76
		$scope.$apply();
77 77
		$scope.refresh();
78 78
	}
79
	
79

  
80 80
	// Set date range to [7 days before today, today] inclusive
81
	$scope.startDate.setDate($scope.endDate.getDate()-7);
82
	
81
	$scope.startDate.setDate($scope.endDate.getDate() - 7);
82

  
83 83
	// Grid configuration
84
	$scope.gridWfJournal = { 
85
			data: 'journal',
86
			enableCellSelection: false,
87
			enableRowSelection: false,
88
			enableCellEditOnFocus: false,
89
			enablePaging: false,
90
			enableHighlighting: true,
91
			sortInfo: { fields: ['date'], directions: ['desc']},
92
			filterOptions: $scope.filterJournal,
93
			columnDefs: [{field: 'procId', displayName: 'Process ID'      , width: '15%', cellTemplate: '<div class="ngCellText"><a href="javascript:void(0)" ng-click="showProcess(row.getProperty(col.field))">{{row.getProperty(col.field)}}</a></div>'},
94
			             {field: 'name'  , displayName: 'Workflow name'   , width: '20%',},
95
			             {field: 'family', displayName: 'Workflow family' , width: '15%' },
96
			             {field: 'repo'  , displayName: 'Datasource'  },
97
			             {field: 'status', displayName: 'Status'          , width: '10%', cellTemplate: '<div class="ngCellText"><span class="label label-default" 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>'},
98
			             {field: 'date'  , displayName: 'Date'            , width: '10%', cellTemplate: '<div class="ngCellText">{{ (row.getProperty("date") > 0 && row.getProperty("date") < 9999999999999) ? (row.getProperty("date") | date:"yyyy-MM-dd HH:mm:ss") : "not yet started" }}</div>'}
99
			            ]
84
	$scope.gridWfJournal = {
85
		data: 'journal',
86
		enableCellSelection: false,
87
		enableRowSelection: false,
88
		enableCellEditOnFocus: false,
89
		enablePaging: false,
90
		enableHighlighting: true,
91
		sortInfo: {fields: ['date'], directions: ['desc']},
92
		filterOptions: $scope.filterJournal,
93
		columnDefs: [{
94
			field: 'procId',
95
			displayName: 'Process ID',
96
			width: '15%',
97
			cellTemplate: '<div class="ngCellText"><a href="javascript:void(0)" ng-click="showProcess(row.getProperty(col.field))">{{row.getProperty(col.field)}}</a></div>'
98
		},
99
			{field: 'name', displayName: 'Workflow name', width: '20%',},
100
			{field: 'family', displayName: 'Workflow family', width: '15%'},
101
			{field: 'repo', displayName: 'Datasource'},
102
			{
103
				field: 'status',
104
				displayName: 'Status',
105
				width: '10%',
106
				cellTemplate: '<div class="ngCellText"><span class="label label-default" 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>'
107
			},
108
			{
109
				field: 'date',
110
				displayName: 'Date',
111
				width: '10%',
112
				cellTemplate: '<div class="ngCellText">{{ (row.getProperty("date") > 0 && row.getProperty("date") < 9999999999999) ? (row.getProperty("date") | date:"yyyy-MM-dd HH:mm:ss") : "not yet started" }}</div>'
113
			}
114
		]
100 115
	};
101
	
102
	$scope.formatDate = function(date) {
116

  
117
	$scope.formatDate = function (date) {
103 118
		var year = date.getFullYear();
104 119
		var month = ("00" + (date.getMonth() + 1)).slice(-2);
105 120
		var day = ("00" + date.getDate()).slice(-2);
106 121
		return year + '-' + month + '-' + day;
107 122
	}
108
	
109
	$scope.refresh = function() {
123

  
124
	$scope.refresh = function () {
110 125
		$scope.showSpinner();
111 126
		var url = '';
112
		
127

  
113 128
		if ($scope.family) {
114
			url = 'wf_journal_byFamily.find?family=' + $scope.family;
129
			url = 'wf/journal_byFamily.find?family=' + $scope.family;
115 130
		} else {
116
			url = 'wf_journal.range?start=' + $scope.formatDate($scope.startDate) + '&end=' + $scope.formatDate($scope.endDate);
131
			url = 'wf/journal.range?start=' + $scope.formatDate($scope.startDate) + '&end=' + $scope.formatDate($scope.endDate);
117 132
		}
118 133
		$http.get(url).success(
119
			function(data) {
134
			function (data) {
120 135
				$scope.journal = data;
121 136
				$scope.hideSpinner();
122 137
			}
123 138
		).error(
124
			function() {
139
			function () {
125 140
				$scope.showError('Something really bad must have happened to our fellow hamster..');
126 141
				$scope.hideSpinner();
127 142
			}
128 143
		);
129 144
	}
130
	
131
	$scope.resizeMainElement = function(elem) {
145

  
146
	$scope.resizeMainElement = function (elem) {
132 147
		var height = 0;
133 148
		var body = window.document.body;
134 149
		if (window.innerHeight) {
......
140 155
		}
141 156
		elem.style.height = ((height - elem.offsetTop - 280) + "px");
142 157
	}
143
	
158

  
144 159
	$scope.refresh();
145 160
	$scope.resizeMainElement(document.getElementById('wfJournalTable'));
146
	
161

  
147 162
	if (initProcId()) {
148 163
		$scope.showProcess(initProcId());
149 164
	}
150 165
}
151 166

  
152
window.onresize = function() {
167
window.onresize = function () {
153 168
	var elem = document.getElementById('wfJournalTable');
154
    angular.element(elem).scope().resizeMainElement(elem);
169
	angular.element(elem).scope().resizeMainElement(elem);
155 170
};
modules/dnet-modular-workflows-ui/branches/workflow_templates/src/main/resources/eu/dnetlib/web/resources/js/dnet_param_values_functions.js
18 18
	var strReturn = [];
19 19
	jQuery.ajax({
20 20
		type: "POST",
21
		url: "wf_obtainValidValues.list?bean=" + bean,
21
		url: "wf/obtainValidValues.list?bean=" + bean,
22 22
		async: false,
23 23
		data: params,
24 24
		dataType: "json",

Also available in: Unified diff