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"></wf-process-modal>
23
 
24
            <div class="col-xs-12 col-md-4 col-lg-2">
25
                <ul class="nav  nav-pills nav-stacked">
26
                    <li class="active" style="cursor: pointer">
27
                        <a data-target="#tabInfo" data-toggle="tab" ng-click="refresh()">Workflow Info</a>
28
                    </li>
29
                    <li style="cursor: pointer">
30
                        <a data-target="#tabParameters" data-toggle="tab">Parameters</a>
31
                    </li>
32
                    <li style="cursor: pointer">
33
                        <a data-target="#tabGraph" data-toggle="tab" ng-click="redrawGraph()">Graph</a>
34
                    </li>
35
                    <li style="cursor: pointer">
36
                        <a data-target="#tabHistory" data-toggle="tab" ng-click="updateHistory('{$id}')">History</a>
37
                    </li>
38
                    <li style="cursor: pointer">
39
                        <a data-target="#tabSettings" data-toggle="tab">Other settings</a>
40
                    </li>
41
                </ul>
42
            </div>
43
            <div class="col-xs-12 col-md-8 col-lg-10">
44
                <h5>
45
                    <b>Workflow:</b>
46
                    <xsl:value-of select="concat(' ', $name)"/>
47
                </h5>
48
                <!-- Tab panes -->
49
                <div class="tab-content" style="border: 1px solid #dddddd; border-radius: 4px; padding: 20px">
50
                    <div class="tab-pane active" id="tabInfo">
51
                        <form class="form-horizontal">
52
                        	<xsl:for-each select="//DATASOURCE">
53
                        		<wf-form-row-link name="Datasource" value="{@name}" url="workflows.do#/api/{@id}/{@interface}"/>
54
                        		<wf-form-row-static name="Interface" value="{@interface}"/>
55
                        		<hr/>
56
                        	</xsl:for-each>
57
                        
58
                            <wf-form-row-link name="Profile ID" value="{$id}" url="isManager.do#/profile/{$id}"/>
59
                            <wf-form-row-static name="Workflow name" value="{$name}"/>
60
                            <wf-form-row-static name="Workflow family" value="{//WORKFLOW_FAMILY}"/>
61
                            <wf-form-row-static name="Description" value="{//WORKFLOW_DESCRIPTION}"/>
62
                            <xsl:choose>
63
                                <xsl:when test="//STATUS/LAST_EXECUTION_STATUS = 'SUCCESS'">
64
                                    <wf-form-row-label name="Last execution status" value="SUCCESS" label-class="label-success"/>
65
                                </xsl:when>
66
                                <xsl:when test="//STATUS/LAST_EXECUTION_STATUS = 'FAILURE'">
67
                                    <wf-form-row-label name="Last execution status" value="FAILURE" label-class="label-danger"/>
68
                                </xsl:when>
69
                                <xsl:otherwise>
70
                                    <wf-form-row-static name="Last execution status" value="-"/>
71
                                </xsl:otherwise>
72
                            </xsl:choose>
73
                            <xsl:choose>
74
                                <xsl:when test="//STATUS/LAST_EXECUTION_DATE">
75
                                    <wf-form-row-static name="Last execution date" value="{//STATUS/LAST_EXECUTION_DATE}"/>
76
                                </xsl:when>
77
                                <xsl:otherwise>
78
                                    <wf-form-row-static name="Last execution date" value="not yet executed"
79
                                                        value-style="white-space: nowrap; font-style: italic;"/>
80
                                </xsl:otherwise>
81
                            </xsl:choose>
82
                            <xsl:if test="count(//NODE[@type='LaunchWorkflow']) &gt; 0">
83
                                <wf-sub-workflows children="subWorkflows" ng-init="updateSubWorkflows('{$id}')"/>
84
                            </xsl:if>
85

    
86
                            <div class="form-group">
87
                                <div class="col-sm-offset-3 col-sm-9">
88
                                    <button class="btn btn-primary" ng-click="executeWf('{$id}')">
89
                                        <xsl:if test="$status != 'EXECUTABLE' or $startMode = 'DISABLED'">
90
                                            <xsl:attribute name="disabled">disabled</xsl:attribute>
91
                                        </xsl:if>
92
                                        <span style="margin-right: 8px" class="glyphicon glyphicon-play"></span>
93
                                        Launch
94
                                    </button>
95
                                    <button type="button" class="btn btn-default" ng-click="refresh()" style="margin-left: 5px;">
96
                                        <span class="glyphicon glyphicon-refresh"></span>
97
                                    </button>
98
                                </div>
99
                            </div>
100
                        </form>
101

    
102
                    </div>
103

    
104
                    <div class="tab-pane" id="tabParameters">
105
                        <xsl:choose>
106
                            <xsl:when test="count(//CONFIGURATION/PARAMETERS/PARAM) &gt; 0">
107
                                <form class="form-horizontal" name="wfParamatersForm">
108
                                    <xsl:for-each select="//CONFIGURATION/PARAMETERS/PARAM">
109
                                        <xsl:choose>
110
                                            <xsl:when test="@managedBy='system'">
111
                                                <wf-form-row-static name="{@name}" value="{.}" description="{@description}"/>
112
                                            </xsl:when>
113
                                            <xsl:when test="@type='boolean'">
114
                                                <wf-form-row-select name="{@name}" description="{@description}"
115
                                                                    mandatory="{@required}"
116
                                                                    init-value="{.}"
117
                                                                    ng-model="params.{@name}"
118
                                                                    ng-original-model="originalParams.{@name}"
119
                                                                    values="[{{'id':'true','name':'TRUE'}},{{'id':'false','name':'FALSE'}}]"/>
120
                                            </xsl:when>
121
                                            <xsl:when test="@function">
122
                                                <wf-form-row-select name="{@name}" description="{@description}"
123
                                                                    mandatory="{@required}"
124
                                                                    init-value="{.}"
125
                                                                    ng-model="params.{@name}"
126
                                                                    ng-original-model="originalParams.{@name}"
127
                                                                    values-function="{@function}"/>
128
                                            </xsl:when>
129
                                            <xsl:otherwise>
130
                                                <wf-form-row-text name="{@name}" description="{@description}"
131
                                                                  mandatory="{@required}"
132
                                                                  init-value="{.}"
133
                                                                  ng-model="params.{@name}"
134
                                                                  ng-original-model="originalParams.{@name}">
135
                                                    <xsl:attribute name="type">
136
                                                        <xsl:choose>
137
                                                            <xsl:when test="@type">
138
                                                                <xsl:value-of select="@type"/>
139
                                                            </xsl:when>
140
                                                            <xsl:otherwise>
141
                                                                string
142
                                                            </xsl:otherwise>
143
                                                        </xsl:choose>
144
                                                    </xsl:attribute>
145
                                                </wf-form-row-text>
146
                                            </xsl:otherwise>
147
                                        </xsl:choose>
148

    
149
                                        <xsl:if test="@category">
150
                                            <!-- TODO -->
151
                                            <span ng-repeat="ui in p.uis" ng-show="p.value || !ui.paramRequired">
152
                                                <a class="btn btn-sm btn-primary" href="{{ui.url}}" ng-hide="ui.paramRequired">{{ui.label}}</a>
153
                                                <a class="btn btn-sm btn-primary" href="{{ui.url | sprintf: p.value }}" ng-show="ui.paramRequired">
154
                                                    {{ui.label}}
155
                                                </a>
156
                                            </span>
157
                                        </xsl:if>
158
                                    </xsl:for-each>
159
                                    <xsl:if test="count(//CONFIGURATION/PARAMETERS/PARAM[@managedBy = 'user']) &gt; 0">
160
                                        <div class="form-group">
161
                                            <div class="col-sm-offset-3 col-sm-9">
162
                                                <button class="btn btn-primary" ng-click="updateParameters('{$id}', params)"
163
                                                        ng-disabled="wfParamatersForm.$invalid">
164
                                                    <span class="glyphicon glyphicon-ok" style="margin-right: 8px"></span>
165
                                                    Update
166
                                                </button>
167
                                                <button class="btn btn-default" style="margin-left:5px;" ng-click="resetParameters()">
168
                                                    <span class="glyphicon glyphicon-remove" style="margin-right:8px"></span>
169
                                                    Reset
170
                                                </button>
171
                                            </div>
172
                                        </div>
173
                                    </xsl:if>
174
                                </form>
175
                            </xsl:when>
176
                            <xsl:otherwise>
177
                                No Parameters
178
                            </xsl:otherwise>
179
                        </xsl:choose>
180
                    </div>
181

    
182
                    <div class="tab-pane" id="tabGraph">
183
                        <svg id="graphContainer" ng-init="resetGraph()">
184
                            <defs>
185
                                <marker id="arrowhead" markerWidth="10" markerHeight="10" orient="auto" refX="2" refY="5">
186
                                    <polygon points="0,0 10,5 0,10" class="svgArrow"/>
187
                                </marker>
188
                            </defs>
189
                            <xsl:for-each select="//NODE">
190
                                <xsl:variable name="nodeName" select="@name"/>
191
                                <xsl:choose>
192
                                    <xsl:when test="@isStart = 'true'">
193
                                        <wf-graph-node name="{$nodeName}" type="start"></wf-graph-node>
194
                                    </xsl:when>
195
                                    <xsl:when test="@isJoin = 'true'">
196
                                        <wf-graph-node name="{$nodeName}" type="join"></wf-graph-node>
197
                                    </xsl:when>
198
                                    <xsl:otherwise>
199
                                        <wf-graph-node name="{$nodeName}" type="normal"></wf-graph-node>
200
                                    </xsl:otherwise>
201
                                </xsl:choose>
202
                                <xsl:for-each select=".//ARC">
203
                                    <wf-graph-arc name="{@name}" from="{$nodeName}" to="{@to}"></wf-graph-arc>
204
                                </xsl:for-each>
205
                            </xsl:for-each>
206
                            <wf-graph-node name="success" type="success"/>
207
                        </svg>
208
                    </div>
209

    
210
                    <div class="tab-pane" id="tabHistory">
211
                        <wf-history ng-model="history" on-refresh="updateHistory('{$id}')"/>
212
                    </div>
213

    
214
                    <div class="tab-pane" id="tabSettings">
215
                        <wf-form-update wf-id="{$id}" mode="{$startMode}"
216
                                        priority="{$priority}"
217
                                        email="{$email}"
218
                                        scheduled="{$scheduled}"
219
                                        cron="{$cron}"
220
                                        interval="{$interval}"/>
221
                    </div>
222
                </div>
223
            </div>
224
        </div>
225
    </xsl:template>
226

    
227
</xsl:stylesheet>
228

    
229

    
230

    
(2-2/2)