Project

General

Profile

1
<?xml version="1.0" encoding="utf-8"?>
2

    
3
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
4
				version="1.0">
5

    
6
	<xsl:output method="html" omit-xml-declaration="yes" encoding="UTF-8" standalone="no"/>
7

    
8
	<xsl:template match="/">
9

    
10
		<xsl:variable name="id" select="//RESOURCE_IDENTIFIER/@value"/>
11
		<xsl:variable name="name" select="//WORKFLOW_NAME"/>
12
		<xsl:variable name="startMode" select="//CONFIGURATION/@start"/>
13
		<xsl:variable name="status" select="//CONFIGURATION/@status"/>
14
		<xsl:variable name="priority" select="//WORKFLOW_PRIORITY"/>
15
		<xsl:variable name="email" select="//ADMIN_EMAIL"/>
16
		<xsl:variable name="scheduled" select="//SCHEDULING/@enabled"/>
17
		<xsl:variable name="cron" select="//SCHEDULING/CRON"/>
18
		<xsl:variable name="interval" select="//SCHEDULING/MININTERVAL"/>
19

    
20
		<div class="row">
21
  			
22
  			<wf-process-modal proc-id="currentProcId" visible="showProcModal" />
23
  			
24
  			<xsl:for-each select="//DATASOURCE">
25
				<repo-access-params-modal ds-id="{@id}" iface="{@interface}" protocol="{@protocol}" visible="showAccessParamsModal" />
26
  			</xsl:for-each>
27
  
28
			<div class="col-xs-12 col-md-4 col-lg-2">
29
				<ul class="nav  nav-pills nav-stacked">
30
					<li class="active" style="cursor: pointer">
31
						<a data-target="#tabInfo" data-toggle="tab" ng-click="refresh()">Workflow Info</a>
32
					</li>
33
					<li style="cursor: pointer">
34
						<a data-target="#tabParameters" data-toggle="tab">Parameters</a>
35
					</li>
36
					<li style="cursor: pointer">
37
						<a data-target="#tabGraph" data-toggle="tab" ng-click="redrawGraph()">Graph</a>
38
					</li>
39
					<li style="cursor: pointer">
40
						<a data-target="#tabHistory" data-toggle="tab" ng-click="updateHistory('{$id}')">History</a>
41
					</li>
42
					<li style="cursor: pointer">
43
						<a data-target="#tabSettings" data-toggle="tab">Other settings</a>
44
					</li>
45
				</ul>
46
			</div>
47
			<div class="col-xs-12 col-md-8 col-lg-10">
48
				<h5>
49
					<b>Workflow:</b>
50
					<xsl:value-of select="concat(' ', $name)"/>
51
				</h5>
52
				<!-- Tab panes -->
53
				<div class="tab-content" style="border: 1px solid #dddddd; border-radius: 4px; padding: 20px">
54
					<div class="tab-pane active" id="tabInfo">
55
						<form class="form-horizontal">
56
							<xsl:for-each select="//DATASOURCE">
57
								<wf-form-row-static name="Datasource" value="{@name}" url="workflows.do#/api/{@id}/{@interface}"/>
58
								<wf-form-row-static name="Interface" value="{@interface}"/>
59
								<wf-form-row-static name="Protocol" value="{@protocol}"/>
60
								
61
								<xsl:if test=".//extraFields/field[@name = 'last_collection_date'] and .//extraFields/field[@name = 'last_collection_mdId'] and .//extraFields/field[@name = 'last_collection_total']">
62
									<wf-form-row-store-link name="Last collection" 
63
										date="{.//extraFields/field[@name = 'last_collection_date']}" 
64
										total="{.//extraFields/field[@name = 'last_collection_total']}" 
65
										url="../inspector/mdstore.do?id={.//extraFields/field[@name = 'last_collection_mdId']}" />
66
								</xsl:if>
67
							
68
								<xsl:if test=".//extraFields/field[@name = 'last_aggregation_date'] and .//extraFields/field[@name = 'last_aggregation_mdId'] and .//extraFields/field[@name = 'last_aggregation_total']">
69
									<wf-form-row-store-link name="Last aggregation" 
70
										date="{.//extraFields/field[@name = 'last_aggregation_date']}" 
71
										total="{.//extraFields/field[@name = 'last_aggregation_total']}" 
72
										url="../inspector/mdstore.do?id={.//extraFields/field[@name = 'last_aggregation_mdId']}" />
73
								</xsl:if>
74
								
75
								<xsl:if test=".//extraFields/field[@name = 'last_download_date'] and .//extraFields/field[@name = 'last_download_objId'] and .//extraFields/field[@name = 'last_download_total']">
76
									<wf-form-row-store-link name="Last download" 
77
										date="{.//extraFields/field[@name = 'last_download_date']}" 
78
										total="{.//extraFields/field[@name = 'last_download_total']}" 
79
										url="objectstoreInspector.do#/inspect.do/{.//extraFields/field[@name = 'last_download_objId']}" />
80
								</xsl:if>
81
								
82
								<div class="form-group">
83
									<div class="col-sm-offset-3 col-sm-9">
84
										<button class="btn btn-sm btn-primary" ng-click="editAccessParams()">access params</button>
85
									</div>
86
								</div>
87
	
88
								<hr/>
89
							</xsl:for-each>
90

    
91
							<wf-form-row-static name="Workflow" value="{$name}" value-description="{//WORKFLOW_DESCRIPTION}" url="isManager.do#/profile/{$id}"/>
92
							<wf-form-row-static name="Family" value="{//WORKFLOW_FAMILY}"/>
93
							
94
							<xsl:choose>
95
								<xsl:when test="//STATUS/LAST_EXECUTION_STATUS = 'SUCCESS'">
96
									<wf-form-row-label name="Last execution" value="SUCCESS" label-class="label-success"  date="{//STATUS/LAST_EXECUTION_DATE}"/>
97
								</xsl:when>
98
								<xsl:when test="//STATUS/LAST_EXECUTION_STATUS = 'FAILURE'">
99
									<wf-form-row-label name="Last execution" value="FAILURE" label-class="label-danger"  date="{//STATUS/LAST_EXECUTION_DATE}"/>
100
								</xsl:when>
101
								<xsl:otherwise>
102
								   <wf-form-row-static name="Last execution" value="not yet executed" value-style="white-space: nowrap; font-style: italic;"/>
103
								</xsl:otherwise>
104
							</xsl:choose>
105
							
106

    
107
							<xsl:if test="count(//NODE[@type='LaunchWorkflow' or @type='LaunchWorkflowTemplate']) &gt; 0">
108
								<hr />
109
								<wf-sub-workflows wf-id="{$id}"/>
110
							</xsl:if>
111

    
112
							<div class="form-group">
113
								<div class="col-sm-offset-3 col-sm-9">
114
									<button class="btn btn-primary" ng-click="executeWf('{$id}')">
115
										<xsl:if test="$status != 'EXECUTABLE' or $startMode = 'DISABLED'">
116
											<xsl:attribute name="disabled">disabled</xsl:attribute>
117
										</xsl:if>
118
										<span style="margin-right: 8px" class="glyphicon glyphicon-play"></span>
119
										Launch
120
									</button>
121
									<button type="button" class="btn btn-default" ng-click="refresh()" style="margin-left: 5px;">
122
										<span class="glyphicon glyphicon-refresh"></span>
123
									</button>
124
								</div>
125
							</div>
126
						</form>
127

    
128
					</div>
129

    
130
					<div class="tab-pane" id="tabParameters">
131
						<xsl:choose>
132
							<xsl:when test="count(//CONFIGURATION/PARAMETERS/PARAM) &gt; 0">
133
								<form class="form-horizontal" name="wfParamatersForm">
134
									<xsl:for-each select="//CONFIGURATION/PARAMETERS/PARAM">
135
							
136
										<xsl:choose>
137
											<xsl:when test="@managedBy='system'">
138
												<wf-form-row-static name="{@name}" value="{.}" description="{@description}" value-style="font-family: monospace">
139
													<xsl:if test="@category">
140
														<xsl:attribute name="category">
141
															<xsl:value-of select="@category" />
142
														</xsl:attribute>
143
													</xsl:if>
144
												</wf-form-row-static>
145
											</xsl:when>
146

    
147
											<xsl:when test="@type='boolean'">
148
												<wf-form-row-select name="{@name}" description="{@description}"
149
																	mandatory="{@required}"
150
																	init-value="{.}"
151
																	ng-model="params.{@name}"
152
																	ng-original-model="originalParams.{@name}"
153
																	values="[{{'id':'true','name':'TRUE'}},{{'id':'false','name':'FALSE'}}]">
154
													<xsl:if test="@category">
155
														<xsl:attribute name="category">
156
															<xsl:value-of select="@category" />
157
														</xsl:attribute>
158
													</xsl:if>																	
159
												</wf-form-row-select>
160
											</xsl:when>
161
											<xsl:when test="@function">
162
												<wf-form-row-select name="{@name}" description="{@description}"
163
																	mandatory="{@required}"
164
																	init-value="{.}"
165
																	ng-model="params.{@name}"
166
																	ng-original-model="originalParams.{@name}"
167
																	values-function="{@function}">
168
													<xsl:if test="@category">
169
														<xsl:attribute name="category">
170
															<xsl:value-of select="@category" />
171
														</xsl:attribute>
172
													</xsl:if>
173
												</wf-form-row-select>
174
											</xsl:when>
175
											<xsl:otherwise>
176
												<wf-form-row-text name="{@name}" description="{@description}"
177
																  mandatory="{@required}"
178
																  init-value="{.}"
179
																  ng-model="params.{@name}"
180
																  ng-original-model="originalParams.{@name}">
181
													<xsl:attribute name="type">
182
														<xsl:choose>
183
															<xsl:when test="@type">
184
																<xsl:value-of select="@type"/>
185
															</xsl:when>
186
															<xsl:otherwise>
187
																string
188
															</xsl:otherwise>
189
														</xsl:choose>
190
													</xsl:attribute>
191
													<xsl:if test="@category">
192
														<xsl:attribute name="category">
193
															<xsl:value-of select="@category" />
194
														</xsl:attribute>
195
													</xsl:if>
196
												</wf-form-row-text>
197
											</xsl:otherwise>
198
										</xsl:choose>
199
									</xsl:for-each>
200
									<xsl:if test="count(//CONFIGURATION/PARAMETERS/PARAM[@managedBy = 'user']) &gt; 0">
201
										<div class="form-group">
202
											<div class="col-sm-offset-3 col-sm-9">
203
												<button class="btn btn-primary" ng-click="updateParameters('{$id}', params)"
204
														ng-disabled="wfParamatersForm.$invalid">
205
													<span class="glyphicon glyphicon-ok" style="margin-right: 8px"></span>
206
													Update
207
												</button>
208
												<button class="btn btn-default" style="margin-left:5px;" ng-click="resetParameters()">
209
													<span class="glyphicon glyphicon-remove" style="margin-right:8px"></span>
210
													Reset
211
												</button>
212
											</div>
213
										</div>
214
									</xsl:if>
215
								</form>
216
							</xsl:when>
217
							<xsl:otherwise>
218
								No Parameters
219
							</xsl:otherwise>
220
						</xsl:choose>
221
					</div>
222

    
223
					<div class="tab-pane" id="tabGraph">
224
						<svg id="graphContainer" ng-init="resetGraph()">
225
							<defs>
226
								<marker id="arrowhead" markerWidth="10" markerHeight="10" orient="auto" refX="2" refY="5">
227
									<polygon points="0,0 10,5 0,10" class="svgArrow"/>
228
								</marker>
229
							</defs>
230
							<xsl:for-each select="//NODE">
231
								<xsl:variable name="nodeName" select="@name"/>
232
								<xsl:choose>
233
									<xsl:when test="@isStart = 'true'">
234
										<wf-graph-node name="{$nodeName}" type="start"></wf-graph-node>
235
									</xsl:when>
236
									<xsl:when test="@isJoin = 'true'">
237
										<wf-graph-node name="{$nodeName}" type="join"></wf-graph-node>
238
									</xsl:when>
239
									<xsl:otherwise>
240
										<wf-graph-node name="{$nodeName}" type="normal"></wf-graph-node>
241
									</xsl:otherwise>
242
								</xsl:choose>
243
								<xsl:for-each select=".//ARC">
244
									<wf-graph-arc name="{@name}" from="{$nodeName}" to="{@to}"></wf-graph-arc>
245
								</xsl:for-each>
246
							</xsl:for-each>
247
							<wf-graph-node name="success" type="success"/>
248
						</svg>
249
					</div>
250

    
251
					<div class="tab-pane" id="tabHistory">
252
						<wf-history ng-model="history" on-refresh="updateHistory('{$id}')"/>
253
					</div>
254

    
255
					<div class="tab-pane" id="tabSettings">
256
						<wf-form-update wf-id="{$id}" mode="{$startMode}"
257
										priority="{$priority}"
258
										email="{$email}"
259
										scheduled="{$scheduled}"
260
										cron="{$cron}"
261
										interval="{$interval}"/>
262
					</div>
263
				</div>
264
			</div>
265
		</div>
266
	</xsl:template>
267

    
268
</xsl:stylesheet>
269

    
270

    
271

    
(2-2/2)