QuerySetSuperFilesWidget.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*##############################################################################
  2. # HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. ############################################################################## */
  16. define([
  17. "dojo/_base/declare",
  18. "dojo/_base/array",
  19. "dojo/on",
  20. "dijit/form/Button",
  21. "dgrid/OnDemandGrid",
  22. "dgrid/Keyboard",
  23. "dgrid/Selection",
  24. "dgrid/selector",
  25. "dgrid/extensions/ColumnResizer",
  26. "dgrid/extensions/DijitRegistry",
  27. "hpcc/GridDetailsWidget",
  28. "hpcc/ESPWorkunit",
  29. "hpcc/ESPQuery",
  30. "hpcc/ESPUtil"
  31. ], function (declare, arrayUtil, on,
  32. Button,
  33. OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
  34. GridDetailsWidget, ESPWorkunit, ESPQuery, ESPUtil) {
  35. return declare("QuerySetSuperFilesWidget", [GridDetailsWidget], {
  36. gridTitle: "Super Files",
  37. idProperty: "Name",
  38. wu: null,
  39. query: null,
  40. init: function (params) {
  41. if (this.inherited(arguments))
  42. return;
  43. this._refreshActionState();
  44. },
  45. createGrid: function (domID) {
  46. var context = this;
  47. var retVal = new declare([OnDemandGrid, Keyboard, Selection, ColumnResizer, DijitRegistry, ESPUtil.GridHelper])({
  48. allowSelectAll: true,
  49. deselectOnRefresh: false,
  50. store: ESPQuery.CreateQueryStore(),
  51. columns: {
  52. col1: selector({ width: 27, selectorType: 'checkbox' }),
  53. /*Item: {
  54. label: "File", width: 180, sortable: true,
  55. formatter: function (Wuid, row) {
  56. var wu = row.Server === "DFUserver" ? ESPDFUWorkunit.Get(Wuid) : ESPWorkunit.Get(Wuid);
  57. return "<img src='../files/" + wu.getStateImage() + "'>&nbsp;<a href='#' class='" + context.id + "WuidClick'>" + Wuid + "</a>";
  58. }
  59. },*/
  60. LogicalFiles: { label: "Logical Files", width: 108, sortable: false },
  61. /*State: {
  62. label: "State", width: 180, sortable: true, formatter: function (state, row) {
  63. return state + (row.Duration ? " (" + row.Duration + ")" : "");
  64. }
  65. },*/
  66. /*Owner: { label: "Owner", width: 90, sortable: true },
  67. Jobname: { label: "Job Name", sortable: true }*/
  68. }
  69. }, domID);
  70. var context = this;
  71. on(document, "." + this.id + "WuidClick:click", function (evt) {
  72. if (context._onRowDblClick) {
  73. var row = retVal.row(evt).data;
  74. context._onRowDblClick(row);
  75. }
  76. });
  77. return retVal;
  78. },
  79. createDetail: function (id, row, params) {
  80. if (row.Server === "DFUserver") {
  81. return new DFUWUDetailsWidget.fixCircularDependency({
  82. id: id,
  83. title: row.ID,
  84. closable: true,
  85. hpcc: {
  86. params: {
  87. Wuid: row.ID
  88. }
  89. }
  90. });
  91. }
  92. return new WUDetailsWidget({
  93. id: id,
  94. title: row.Wuid,
  95. closable: true,
  96. hpcc: {
  97. params: {
  98. Wuid: row.Wuid
  99. }
  100. }
  101. });
  102. },
  103. refreshGrid: function (args) {
  104. var context = this;
  105. this.wu.getInfo({
  106. onGetTimers: function (timers) {
  107. // Required to calculate Graphs Total Time ---
  108. },
  109. onGetGraphs: function (graphs) {
  110. context.store.setData(graphs);
  111. context.grid.refresh();
  112. }
  113. });
  114. },
  115. refreshActionState: function (selection) {
  116. this.inherited(arguments);
  117. this.openSafeMode.set("disabled", !selection.length);
  118. }
  119. });
  120. });