activities_current_background.xslt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2014
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:ui="http://developer.cognos.com/schemas/ui/presentation/markup/"
  15. xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  16. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  17. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  18. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  19. xmlns:admui="http://developer.cognos.com/schemas/xts/admui"
  20. exclude-result-prefixes="ui uic xts xtsext admui xsi">
  21. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  22. <xsl:key name="secondary-requests" match="/root/asyncRequestResponse/response/*/*[local-name()='result']/*[local-name()='secondaryRequests']/*[contains(@xsi:type,':asynchSecondaryRequest')]/*[local-name()='name']" use="."/>
  23. <xsl:key name="dispatchers" match="/root/*[local-name()='dispatchers']/*[local-name()='queryResponse']/*[local-name()='dispatcher']" use="*[local-name()='dispatcherID']"/>
  24. <!-- display variables -->
  25. <admui:variables/>
  26. <xsl:variable name="asynchDetailEventRecord" select="/root/asyncRequestResponse/response/*/result/details/*[contains(@xsi:type, ':asynchDetailEventRecord')]"/>
  27. <xsl:variable name="personalOnly" select="key('env-param', 'personalOnly') ='true'"/>
  28. <ui:runnableTemplates/>
  29. <!-- action templates-->
  30. <ui:commonActions/>
  31. <xsl:template match="/root">
  32. <uic:fragment>
  33. <uic:filterInitScript filterName="currentactivities"/>
  34. <!-- add the reload event listener, and override the default fragment.refresh -->
  35. <ui:standardReloadListener/>
  36. <ui:leavingCogadminListener/>
  37. <uic:fragmentHeader>
  38. <uic:title>
  39. <xsl:choose>
  40. <xsl:when test="$personalOnly"><xts:string id="IDS_CUR_BACKGROUND_SHORT_TITLE"/></xsl:when>
  41. <xsl:otherwise><xts:string id="IDS_CUR_BACKGROUND_TITLE"/></xsl:otherwise>
  42. </xsl:choose>
  43. </uic:title>
  44. <uic:headerActions>
  45. <ui:groupActionMsgs/>
  46. <xsl:choose>
  47. <xsl:when test="key('env-param', 'frag-view') = 'details'">
  48. <ui:groupAction action="show_details" state="details"/>
  49. <ui:groupAction action="hide_details" state="details"/>
  50. </xsl:when>
  51. <xsl:otherwise>
  52. <ui:groupAction action="show_details" state="hide"/>
  53. <ui:groupAction action="hide_details" state="hide"/>
  54. </xsl:otherwise>
  55. </xsl:choose>
  56. <uic:headerSeperator/>
  57. <ui:groupAction action="cancel" tablename="current_activities_background" />
  58. <ui:groupAction action="suspend" tablename="current_activities_background" />
  59. <ui:groupAction action="release" tablename="current_activities_background" />
  60. <ui:groupAction action="set_priority" tablename="current_activities_background" setPriorityMode="updateCurrentActivities">
  61. <ui:fragmentLocation>cogadmin/controls/set_priority.xts</ui:fragmentLocation>
  62. </ui:groupAction>
  63. </uic:headerActions>
  64. </uic:fragmentHeader>
  65. <script>
  66. <!-- create a json array of priority criteria for all the rows so that we can determine the priority of the selected entries in javascript-->
  67. var _THIS_entriesArray = [
  68. <xsl:for-each select="$asynchDetailEventRecord">
  69. {'priority':'<xsl:value-of select="priority"/>'}<xsl:if test="position()!=last()">,</xsl:if>
  70. </xsl:for-each>
  71. ];
  72. function _THIS_secondaryRequest(request) {
  73. params = '&amp;secondaryRequest=' + request;
  74. _THIS_.retrieve(params);
  75. }
  76. </script>
  77. <xsl:choose>
  78. <xsl:when test="/root/asyncRequestResponse/status = 'working' or /root/asyncRequestResponse/status = 'stillWorking'">
  79. TODO
  80. </xsl:when>
  81. <xsl:otherwise>
  82. <!-- bulid the chart -->
  83. <uic:barChart/>
  84. <uic:table width="100%">
  85. <uic:features>
  86. <uic:name>current_activities_background</uic:name>
  87. <uic:summary><xts:string id="IDS_CUR_BACKGROUND_TABLE_SUMMARY"/></uic:summary>
  88. <uic:scrollable/>
  89. <uic:type>checkbox</uic:type>
  90. <ui:tableFeatures/>
  91. </uic:features>
  92. <uic:paginations>
  93. <uic:title>
  94. <xts:string id="IDS_PAG_ITEMS"/>
  95. </uic:title>
  96. <uic:fromLabel>
  97. <xts:string id="IDS_PAGER_FROM"/>
  98. </uic:fromLabel>
  99. <uic:toLabel>
  100. <xts:string id="IDS_PAGER_TO"/>
  101. </uic:toLabel>
  102. <uic:from><xsl:value-of select="$asynchDetailEventRecord[1]/runnable/*/position/value"/></uic:from>
  103. <uic:to><xsl:value-of select="$asynchDetailEventRecord[position()=last()]/runnable/*/position/value"/></uic:to>
  104. <uic:goto/>
  105. <uic:first>
  106. <xsl:if test="not(key('secondary-requests','firstPage'))">
  107. <uic:disabled>true</uic:disabled>
  108. </xsl:if>
  109. <uic:link>_THIS_secondaryRequest('firstPage');</uic:link>
  110. </uic:first>
  111. <uic:previous>
  112. <xsl:if test="not(key('secondary-requests','previousPage'))">
  113. <uic:disabled>true</uic:disabled>
  114. </xsl:if>
  115. <uic:link>_THIS_secondaryRequest('previousPage');</uic:link>
  116. </uic:previous>
  117. <uic:next>
  118. <xsl:if test="not(key('secondary-requests','nextPage'))">
  119. <uic:disabled>true</uic:disabled>
  120. </xsl:if>
  121. <uic:link>_THIS_secondaryRequest('nextPage');</uic:link>
  122. </uic:next>
  123. <uic:last>
  124. <xsl:if test="not(key('secondary-requests','lastPage'))">
  125. <uic:disabled>true</uic:disabled>
  126. </xsl:if>
  127. <uic:link>_THIS_secondaryRequest('lastPage');</uic:link>
  128. </uic:last>
  129. </uic:paginations>
  130. <uic:header>
  131. <uic:row>
  132. <uic:column align="center" nowrap="nowrap"/>
  133. <uic:column width="100%" nowrap="nowrap">
  134. <uic:text>
  135. <xts:string id="IDS_CUR_TABLE_NAME"/>
  136. </uic:text>
  137. </uic:column>
  138. <uic:column nowrap="nowrap" sort="startTime">
  139. <uic:text>
  140. <xts:string id="IDS_CUR_TABLE_REQUEST_TIME"/>
  141. </uic:text>
  142. </uic:column>
  143. <xsl:if test="not($personalOnly)">
  144. <uic:column nowrap="nowrap">
  145. <uic:text>
  146. <xts:string id="IDS_CUR_TABLE_RAN_BY"/>
  147. </uic:text>
  148. </uic:column>
  149. </xsl:if>
  150. <uic:column nowrap="nowrap" sort="status">
  151. <uic:text>
  152. <xts:string id="IDS_CUR_TABLE_STATUS"/>
  153. </uic:text>
  154. </uic:column>
  155. <uic:column nowrap="nowrap" sort="priority">
  156. <uic:text>
  157. <xts:string id="IDS_CUR_TABLE_PRIORITY"/>
  158. </uic:text>
  159. </uic:column>
  160. </uic:row>
  161. </uic:header>
  162. <uic:body>
  163. <!-- loop through the asynchDetailEventRecord -->
  164. <xsl:for-each select="$asynchDetailEventRecord">
  165. <xsl:variable name="runnable" select="*[local-name()='runnable']/*"/>
  166. <!-- extract the last Execution time value from the activityHistory where the paths match -->
  167. <xsl:variable name="lastExecutionTime" select="/root/*[local-name()='activityHistory']/*[local-name()='schedule'][*[local-name()='path']=$runnable/searchPath/value]/*[local-name()='lastExecutionTime']"/>
  168. <uic:row label="{$runnable/*[local-name()='defaultName']/*[local-name()='value']}">
  169. <xsl:attribute name="value">
  170. <xsl:value-of select="*[local-name()='eventID']"/>
  171. </xsl:attribute>
  172. <uic:column>
  173. <admui:gen-runnable-icon>
  174. <admui:objectClass><xsl:value-of select="$runnable/*[local-name()='objectClass']/*[local-name()='value']"/></admui:objectClass>
  175. <!-- todo: need to pass in the iconURI once the API supports getting it -->
  176. <admui:iconURI/>
  177. <admui:defaultName><xsl:value-of select="$runnable/defaultName/value"/></admui:defaultName>
  178. <admui:screenTip><xsl:value-of select="$runnable/defaultScreenTip/value"/></admui:screenTip>
  179. <admui:disabled><xsl:value-of select="$runnable/hidden/value"/></admui:disabled>
  180. </admui:gen-runnable-icon>
  181. </uic:column>
  182. <!-- name -->
  183. <uic:column scope="row" abbr="{xtsext:htmlencode($runnable/*[local-name()='defaultName']/*[local-name()='value'])}">
  184. <uic:text>
  185. <xsl:value-of select="$runnable/*[local-name()='defaultName']/*[local-name()='value']"/>
  186. </uic:text>
  187. <!-- show the actions menu -->
  188. <!-- todo: pass in the permission once they get returned in the response by MS -->
  189. <!-- todo: view detailed history -->
  190. <xsl:call-template name="ui:menuActions">
  191. <xsl:with-param name="obj-class" select="$runnable/*[local-name()='objectClass']/*[local-name()='value']"/>
  192. <xsl:with-param name="obj-id" select="$runnable/*[local-name()='storeID']/*[local-name()='value']"/>
  193. <xsl:with-param name="obj-name" select="$runnable/*[local-name()='defaultName']/*[local-name()='value']"/>
  194. <xsl:with-param name="obj-path" select="$runnable/*[local-name()='storeID']/*[local-name()='value']"/>
  195. <xsl:with-param name="priority" select="*[local-name()='priority']"/>
  196. <xsl:with-param name="supportSetPriority" select="true()"/>
  197. <xsl:with-param name="setPriorityMode">updateCurrentActivities</xsl:with-param>
  198. <xsl:with-param name="event-id" select="./history/*[contains(@xsi:type, ':history')]/eventID/value"/>
  199. <xsl:with-param name="supportMonitorServiceHistoryDetails" select="true()"/>
  200. <xsl:with-param name="status" select="*[local-name()='status']"/>
  201. <xsl:with-param name="supportScheduleActions" select="true()"/>
  202. </xsl:call-template>
  203. </uic:column>
  204. <!-- request time -->
  205. <uic:column nowrap="nowrap">
  206. <uic:text>
  207. <xsl:value-of select="xtsext:formatDateFromUTC( string( *[local-name()='requestedStartTime'] ), number( '2' ), number( '3' ), string( $timeZone ), string( $contentLocale ) )"/>
  208. </uic:text>
  209. </uic:column>
  210. <!-- scheduled by -->
  211. <xsl:if test="not($personalOnly)">
  212. <uic:column nowrap="nowrap">
  213. <uic:text>
  214. <xsl:variable name="userInfo" select="*[local-name()='user']/*[contains(@xsi:type,':account')]"/>
  215. <xsl:choose>
  216. <xsl:when test="$userInfo/*[local-name()='userName' or local-name()='defaultName']/*[local-name()='value'] != ''">
  217. <xsl:value-of select="$userInfo/*[local-name()='defaultName']/*[local-name()='value']"/>
  218. <xsl:if test="$userInfo/*[local-name()='userName']/*[local-name()='value'] != ''">
  219. <xsl:value-of select="concat(' (', $userInfo/*[local-name()='userName']/*[local-name()='value'], ')')"/>
  220. </xsl:if>
  221. </xsl:when>
  222. <xsl:otherwise>
  223. <xts:string id="IDS_ADM_USER_UNAVAILABLE"/>
  224. </xsl:otherwise>
  225. </xsl:choose>
  226. </uic:text>
  227. </uic:column>
  228. </xsl:if>
  229. <!-- status -->
  230. <uic:column nowrap="nowrap">
  231. <xsl:call-template name="ui:filterStatus">
  232. <xsl:with-param name="filterStatus" select="*[local-name()='status']"/>
  233. </xsl:call-template>
  234. </uic:column>
  235. <!-- priority -->
  236. <uic:column>
  237. <uic:text><xsl:value-of select="*[local-name()='priority']"/></uic:text>
  238. </uic:column>
  239. </uic:row>
  240. <uic:rowDetails>
  241. <xsl:if test="key('env-param', 'frag-view') = 'details'">
  242. <xsl:attribute name="expanded">true</xsl:attribute>
  243. </xsl:if>
  244. <uic:column/>
  245. <uic:column colspan="1">
  246. <xsl:call-template name="ui:myFolderShortPath">
  247. <xsl:with-param name="myFolderStoreID" select="/root/session/param[@name = 'mrootid']"/>
  248. <xsl:with-param name="ancestors" select="$runnable/ancestors/value/*[contains(@xsi:type,':ancestorInfo')]"/>
  249. </xsl:call-template>
  250. <uic:disabledText>
  251. <xsl:variable name="dispID" select="normalize-space(history/*[contains(@xsi:type,':history')]/dispatcherID/value)"/>
  252. <xsl:if test="$dispID != '' and not($personalOnly)">
  253. <xsl:variable name="dispatcherPath">
  254. <xsl:choose>
  255. <xsl:when test="key('dispatchers',$dispID)">
  256. <xsl:value-of select="key('dispatchers',$dispID)/*[local-name()='dispatcherPath']"/>
  257. </xsl:when>
  258. <xsl:otherwise><xts:string id="IDS_ADM_DISPTACHER_UNAVAILABLE"/></xsl:otherwise>
  259. </xsl:choose>
  260. </xsl:variable>
  261. <xts:string id="IDS_TABLE_DETAILS_DISPATCHER">
  262. <xts:param name="dispatcher"><xsl:value-of select="$dispatcherPath"/></xts:param>
  263. </xts:string>
  264. </xsl:if>
  265. <xsl:if test="processID != '' and not($personalOnly)">
  266. <xsl:variable name="objectClass" select="$runnable/*[local-name()='objectClass']/*[local-name()='value']"/>
  267. <xsl:variable name="processID">
  268. <xsl:choose>
  269. <xsl:when test="processID = 0 or processID = -1">
  270. <xsl:choose>
  271. <xsl:when test="$objectClass = 'jobDefinition'">
  272. <xts:string id="IDS_CUR_PROCESSID_UNAVAILABLE"/>
  273. </xsl:when>
  274. <xsl:otherwise>
  275. <xts:string id="IDS_CUR_PROCESSID_UNKNOWN"/>
  276. </xsl:otherwise>
  277. </xsl:choose>
  278. </xsl:when>
  279. <xsl:otherwise>
  280. <xsl:value-of select="processID"/>
  281. </xsl:otherwise>
  282. </xsl:choose>
  283. </xsl:variable>
  284. <xts:string id="IDS_TABLE_DETAILS_PROCESS_ID">
  285. <xts:param name="processId"><xsl:value-of select="$processID"/></xts:param>
  286. </xts:string>
  287. </xsl:if>
  288. </uic:disabledText>
  289. </uic:column>
  290. <xsl:variable name="detailsSecondColSpan">
  291. <xsl:choose>
  292. <xsl:when test="not($personalOnly)">4</xsl:when>
  293. <xsl:otherwise>3</xsl:otherwise>
  294. </xsl:choose>
  295. </xsl:variable>
  296. <uic:column>
  297. <xsl:attribute name="colspan"><xsl:value-of select="$detailsSecondColSpan"/></xsl:attribute>
  298. <uic:disabledText>
  299. <xsl:if test="history/*[contains(@xsi:type,':history')]/actualExecutionTime/value != ''">
  300. <xts:string id="IDS_TABLE_DETAILS_START_TIME">
  301. <xts:param name="startTime"><xsl:value-of select="xtsext:formatDateFromUTC( string( history/*[contains(@xsi:type,':history')]/actualExecutionTime/value ), number( '2' ), number( '3' ), string( $timeZone ), string( $contentLocale ) )"/></xts:param>
  302. </xts:string>
  303. </xsl:if>
  304. <xts:string id="IDS_SCH_TABLE_LAST_EXECUTION_TIME"/><xsl:value-of select="$lastExecutionTime"/>
  305. </uic:disabledText>
  306. </uic:column>
  307. </uic:rowDetails>
  308. </xsl:for-each>
  309. </uic:body>
  310. <uic:footer displayLastUpdate="true" />
  311. </uic:table>
  312. </xsl:otherwise>
  313. </xsl:choose>
  314. </uic:fragment>
  315. </xsl:template>
  316. </xsl:stylesheet>