Skip to content

Commit

Permalink
HPCC-31900 ECL Watch v9 global search DFU WU & File tabs
Browse files Browse the repository at this point in the history
Fix issue where from the global search results, switching to the
DFU Workunits tab would show an empty list and switching to the Files
tab would crash ECL Watch with an unhandled JavaScript exception

Signed-off-by: Jeremy Clements <[email protected]>
  • Loading branch information
jeclrsg committed May 31, 2024
1 parent eb6f491 commit 0403e49
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 11 deletions.
4 changes: 0 additions & 4 deletions esp/src/eclwatch/GetDFUWorkunitsWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,6 @@ define([
initWorkunitsGrid: function () {
var context = this;
var filter = this.filter.toObject();
filter.includeTimings = true;
filter.includeTransferRate = true;
var store = this.params.searchResults ? this.params.searchResults : new ESPDFUWorkunit.CreateWUQueryStore();
this.workunitsGrid = new declare([ESPUtil.Grid(true, true, false, false, "GetDFUWorkunitsWidget")])({
store: store,
Expand Down Expand Up @@ -477,8 +475,6 @@ define([

refreshGrid: function (clearSelection) {
var filter = this.filter.toObject();
filter.includeTimings = true;
filter.includeTransferRate = true;
this.workunitsGrid.set("query", filter);
if (clearSelection) {
this.workunitsGrid.clearSelection();
Expand Down
2 changes: 1 addition & 1 deletion esp/src/eclwatch/templates/DFUQueryWidget.html
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<input id="${id}CopyPreserveCompression" title="${i18n.PreserveCompression}:" checked="true" name="preserveCompression" data-dojo-type="dijit.form.CheckBox" />
<input id="${id}CopyTargetReplicate" title="${i18n.Replicate}:" name="replicate" data-dojo-type="dijit.form.CheckBox" />
<input id="${id}CopyExpireDays" title="${i18n.ExpireDays}:" name="ExpireDays" data-dojo-type="dijit.form.NumberTextBox" />
<input id="${i18n.NoCommon}" title="${i18n.NoCommon}:" checked="true" name="noCommon" data-dojo-type="dijit.form.CheckBox"/>
<input title="${i18n.NoCommon}:" checked="true" name="noCommon" data-dojo-type="dijit.form.CheckBox"/>
<input id="${id}MaxConnections" title="${i18n.MaxConnections}:" name="maxConnections" data-dojo-type="dijit.form.NumberTextBox" />
</div>
</div>
Expand Down
4 changes: 1 addition & 3 deletions esp/src/src-react/components/DFUWorkunits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ function formatQuery(_filter): { [id: string]: any } {
if (filter.Type === true) {
filter.Type = "archived workunits";
}
filter.includeTimings = true;
filter.includeTransferRate = true;
return filter;
}

Expand Down Expand Up @@ -83,7 +81,7 @@ export const DFUWorkunits: React.FunctionComponent<DFUWorkunitsProps> = ({

// Grid ---
const gridStore = React.useMemo(() => {
return store || ESPDFUWorkunit.CreateWUQueryStore({});
return store || ESPDFUWorkunit.CreateWUQueryStore();
}, [store]);

const query = React.useMemo(() => {
Expand Down
32 changes: 30 additions & 2 deletions esp/src/src/ESPDFUWorkunit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import * as FileSpray from "./FileSpray";
import nlsHPCC from "./nlsHPCC";
import * as Utility from "./Utility";

import { FileSprayService, FileSpray as FileSprayNS } from "@hpcc-js/comms";

import { Paged } from "./store/Paged";
import { BaseStore } from "./store/Store";

const i18n = nlsHPCC;

class Store extends ESPRequest.Store {
Expand Down Expand Up @@ -297,14 +302,37 @@ export function isInstanceOfWorkunit(obj) {
export function Get(wuid, data?) {
const store = new Store();
const retVal = store.get(wuid);
if (data) {
if (data && !retVal.__hpcc_id) {
retVal.updateData(data);
}
return retVal;
}

export function CreateWUQueryStore(options) {
export function CreateWUQueryStoreLegacy(options) {
let store = new Store(options);
store = new Observable(store);
return store;
}

const service = new FileSprayService({ baseUrl: "" });

export type WUQueryStore = BaseStore<FileSprayNS.GetDFUWorkunits, typeof Workunit>;

export function CreateWUQueryStore(): BaseStore<FileSprayNS.GetDFUWorkunits, typeof Workunit> {
const store = new Paged<FileSprayNS.GetDFUWorkunits, typeof Workunit>({
start: "PageStartFrom",
count: "PageSize",
sortBy: "Sortby",
descending: "Descending"
}, "ID", request => {
request.includeTimings = true;
request.includeTransferRate = true;
return service.GetDFUWorkunits(request).then(response => {
return {
data: response.results.DFUWorkunit.map(wu => Get(wu.ID, wu)),
total: response.NumWUs
};
});
});
return new Observable(store);
}
2 changes: 1 addition & 1 deletion esp/src/src/ESPLogicalFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export function Get(Cluster, Name, data?) {
}
const store = new Store();
const retVal = store.get(createID(Cluster, Name));
if (data) {
if (data && !retVal.__hpcc_id) {
lang.mixin(data, {
__hpcc_id: createID(data.NodeGroup, data.Name),
__hpcc_isDir: false,
Expand Down
2 changes: 2 additions & 0 deletions esp/src/src/FileSpray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ export function CreateLandingZonesFilterStore(options) {
}

export function GetDFUWorkunits(params) {
params.request.includeTimings = true;
params.request.includeTransferRate = true;
return ESPRequest.send("FileSpray", "GetDFUWorkunits", params);
}

Expand Down

0 comments on commit 0403e49

Please sign in to comment.