QuerySetSuperFilesWidget.js 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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/lang",
  19. "dojo/i18n",
  20. "dojo/i18n!./nls/common",
  21. "dojo/i18n!./nls/QuerySetSuperFilesWidget",
  22. "dojo/_base/array",
  23. "dojo/on",
  24. "dijit/form/Button",
  25. "dgrid/OnDemandGrid",
  26. "dgrid/Keyboard",
  27. "dgrid/Selection",
  28. "dgrid/selector",
  29. "dgrid/extensions/ColumnResizer",
  30. "dgrid/extensions/DijitRegistry",
  31. "hpcc/GridDetailsWidget",
  32. "hpcc/ESPWorkunit",
  33. "hpcc/ESPQuery",
  34. "hpcc/ESPUtil"
  35. ], function (declare, lang, i18n, nlsCommon, nlsSpecific, arrayUtil, on,
  36. Button,
  37. OnDemandGrid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry,
  38. GridDetailsWidget, ESPWorkunit, ESPQuery, ESPUtil) {
  39. return declare("QuerySetSuperFilesWidget", [GridDetailsWidget], {
  40. i18n: lang.mixin(nlsCommon, nlsSpecific),
  41. gridTitle: nlsSpecific.title,
  42. idProperty: "Name",
  43. wu: null,
  44. query: null,
  45. init: function (params) {
  46. if (this.inherited(arguments))
  47. return;
  48. this._refreshActionState();
  49. },
  50. createGrid: function (domID) {
  51. var context = this;
  52. var retVal = new declare([OnDemandGrid, Keyboard, Selection, ColumnResizer, DijitRegistry, ESPUtil.GridHelper])({
  53. allowSelectAll: true,
  54. deselectOnRefresh: false,
  55. store: ESPQuery.CreateQueryStore(),
  56. columns: {
  57. col1: selector({ width: 27, selectorType: 'checkbox' }),
  58. /*Item: {
  59. label: "File", width: 180, sortable: true,
  60. formatter: function (Wuid, row) {
  61. var wu = row.Server === "DFUserver" ? ESPDFUWorkunit.Get(Wuid) : ESPWorkunit.Get(Wuid);
  62. return "<img src='" + wu.getStateImage() + "'>&nbsp;<a href='#' class='" + context.id + "WuidClick'>" + Wuid + "</a>";
  63. }
  64. },*/
  65. LogicalFiles: { label: this.i18n.LogicalFiles, width: 108, sortable: false },
  66. /*State: {
  67. label: "State", width: 180, sortable: true, formatter: function (state, row) {
  68. return state + (row.Duration ? " (" + row.Duration + ")" : "");
  69. }
  70. },*/
  71. /*Owner: { label: "Owner", width: 90, sortable: true },
  72. Jobname: { label: "Job Name", sortable: true }*/
  73. }
  74. }, domID);
  75. var context = this;
  76. on(document, "." + this.id + "WuidClick:click", function (evt) {
  77. if (context._onRowDblClick) {
  78. var row = retVal.row(evt).data;
  79. context._onRowDblClick(row);
  80. }
  81. });
  82. return retVal;
  83. },
  84. createDetail: function (id, row, params) {
  85. if (row.Server === "DFUserver") {
  86. return new DFUWUDetailsWidget.fixCircularDependency({
  87. id: id,
  88. title: row.ID,
  89. closable: true,
  90. hpcc: {
  91. params: {
  92. Wuid: row.ID
  93. }
  94. }
  95. });
  96. }
  97. return new WUDetailsWidget({
  98. id: id,
  99. title: row.Wuid,
  100. closable: true,
  101. hpcc: {
  102. params: {
  103. Wuid: row.Wuid
  104. }
  105. }
  106. });
  107. },
  108. refreshGrid: function (args) {
  109. var context = this;
  110. this.wu.getInfo({
  111. onGetTimers: function (timers) {
  112. // Required to calculate Graphs Total Time ---
  113. },
  114. onGetGraphs: function (graphs) {
  115. context.store.setData(graphs);
  116. context.grid.refresh();
  117. }
  118. });
  119. },
  120. refreshActionState: function (selection) {
  121. this.inherited(arguments);
  122. this.openSafeMode.set("disabled", !selection.length);
  123. }
  124. });
  125. });