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
        <label>
21
            <xsl:value-of select="$name"/>
22
        </label>
23
        
24
        <div ng-init="currentProc = {{}}" class="row">
25
            <wf-proc-modal proc="currentProc"/>
26

    
27
            <div class="col-xs-12 col-md-4 col-lg-2">
28
                <ul class="nav  nav-pills nav-stacked">
29
                    <li class="active" style="cursor: pointer">
30
                        <a data-target="#tabInfo" data-toggle="tab" ng-click="refresh()">Workflow Info</a>
31
                    </li>
32
                    <li style="cursor: pointer">
33
                        <a data-target="#tabParameters" data-toggle="tab">Parameters</a>
34
                    </li>
35
                    <xsl:if test="count(//NODE[@type='LaunchWorkflow']) &gt; 0">
36
                        <li style="cursor: pointer">
37
                            <a data-target="#tabSubWorkflows" data-toggle="tab" ng-click="updateSubWorkflows('{$id}')">Sub Workflows</a>
38
                        </li>
39
                    </xsl:if>
40
                    <li style="cursor: pointer">
41
                        <a data-target="#tabGraph" data-toggle="tab" ng-click="redrawGraph()">Graph</a>
42
                    </li>
43
                    <li style="cursor: pointer">
44
                        <a data-target="#tabHistory" data-toggle="tab" ng-click="updateHistory('{$id}')">History</a>
45
                    </li>
46
                    <li style="cursor: pointer">
47
                        <a data-target="#tabSettings" data-toggle="tab">Other settings</a>
48
                    </li>
49
                </ul>
50
            </div>
51
            <div class="col-xs-12 col-md-8 col-lg-10">
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
                            <wf-form-row-link name="Profile ID" value="{$id}" url="isManager.do#/profile/{$id}"/>
57
                            <wf-form-row-static name="Workflow name" value="{$name}"/>
58
                            <wf-form-row-static name="Workflow family" value="{//WORKFLOW_FAMILY}"/>
59
                            <wf-form-row-static name="Description" value="{//WORKFLOW_DESCRIPTION}"/>
60
                            <xsl:choose>
61
                                <xsl:when test="//STATUS/LAST_EXECUTION_STATUS = 'SUCCESS'">
62
                                    <wf-form-row-label name="Last execution status" value="SUCCESS" label-class="label-success"/>
63
                                </xsl:when>
64
                                <xsl:when test="//STATUS/LAST_EXECUTION_STATUS = 'FAILURE'">
65
                                    <wf-form-row-label name="Last execution status" value="FAILURE" label-class="label-danger"/>
66
                                </xsl:when>
67
                                <xsl:otherwise>
68
                                    <wf-form-row-static name="Last execution status" value="-"/>
69
                                </xsl:otherwise>
70
                            </xsl:choose>
71
                            <xsl:choose>
72
                                <xsl:when test="//STATUS/LAST_EXECUTION_DATE">
73
                                    <wf-form-row-static name="Last execution date" value="{//STATUS/LAST_EXECUTION_DATE}"/>
74
                                </xsl:when>
75
                                <xsl:otherwise>
76
                                    <wf-form-row-static name="Last execution date" value="not yet executed"
77
                                                        value-style="white-space: nowrap; font-style: italic;"/>
78
                                </xsl:otherwise>
79
                            </xsl:choose>
80

    
81
                            <div class="form-group">
82
                                <div class="col-sm-offset-3 col-sm-9">
83
                                    <button class="btn btn-primary" ng-click="executeWf('{$id}')">
84
                                        <xsl:if test="$status != 'EXECUTABLE' or $startMode = 'DISABLED'">
85
                                            <xsl:attribute name="disabled">disabled</xsl:attribute>
86
                                        </xsl:if>
87
                                        <span style="margin-right: 8px" class="glyphicon glyphicon-play"></span>
88
                                        Launch
89
                                    </button>
90
                                    <button type="button" class="btn btn-default" ng-click="refresh()" style="margin-left: 5px;">
91
                                        <span class="glyphicon glyphicon-refresh"></span>
92
                                    </button>
93
                                </div>
94
                            </div>
95
                        </form>
96
                    </div>
97
                    <div class="tab-pane" id="tabParameters">
98
                        <xsl:choose>
99
                            <xsl:when test="count(//CONFIGURATION/PARAMETERS/PARAM) &gt; 0">
100
                                <form class="form-horizontal" name="wfParamatersForm">
101
                                    <xsl:for-each select="//CONFIGURATION/PARAMETERS/PARAM">
102
                                        <xsl:choose>
103
                                            <xsl:when test="@managedBy='system'">
104
                                                <wf-form-row-static name="{@name}" value="{.}" description="{@description}"/>
105
                                            </xsl:when>
106
                                            <xsl:when test="@type='boolean'">
107
                                                <wf-form-row-select name="{@name}" description="{@description}"
108
                                                                    mandatory="{@required}"
109
                                                                    init-value="{.}"
110
                                                                    ng-model="params.{@name}"
111
                                                                    ng-original-model="originalParams.{@name}"
112
                                                                    values="[{{'id':'true','name':'TRUE'}},{{'id':'false','name':'FALSE'}}]"/>
113
                                            </xsl:when>
114
                                            <xsl:when test="@function">
115
                                                <wf-form-row-select name="{@name}" description="{@description}"
116
                                                                    mandatory="{@required}"
117
                                                                    init-value="{.}"
118
                                                                    ng-model="params.{@name}"
119
                                                                    ng-original-model="originalParams.{@name}"
120
                                                                    values-function="{@function}"/>
121
                                            </xsl:when>
122
                                            <xsl:otherwise>
123
                                                <wf-form-row-text name="{@name}" description="{@description}"
124
                                                                  mandatory="{@required}"
125
                                                                  init-value="{.}"
126
                                                                  ng-model="params.{@name}"
127
                                                                  ng-original-model="originalParams.{@name}">
128
                                                    <xsl:attribute name="type">
129
                                                        <xsl:choose>
130
                                                            <xsl:when test="@type">
131
                                                                <xsl:value-of select="@type"/>
132
                                                            </xsl:when>
133
                                                            <xsl:otherwise>
134
                                                                string
135
                                                            </xsl:otherwise>
136
                                                        </xsl:choose>
137
                                                    </xsl:attribute>
138
                                                </wf-form-row-text>
139
                                            </xsl:otherwise>
140
                                        </xsl:choose>
141

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

    
175

    
176
                    <div class="tab-pane" id="tabSubWorkflows">
177
                        <wf-sub-workflows children="subWorkflows" current-proc="currentProc"/>
178
                    </div>
179

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

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

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

    
225
</xsl:stylesheet>
226

    
227

    
228

    
    (1-1/1)