Skip to content

Commit

Permalink
HPCC-33164 Remove experimental decorators
Browse files Browse the repository at this point in the history
(Not supported in esbuild / vite)

Signed-off-by: Gordon Smith <[email protected]>
  • Loading branch information
GordonSmith committed Jan 7, 2025
1 parent c6b7163 commit 7cb34d9
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 22 deletions.
9 changes: 5 additions & 4 deletions esp/src/src/DataPatternsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import "dijit/TooltipDialog";
import "hpcc/TableContainer";
import "hpcc/TargetSelectWidget";

import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";
import { WUStatus } from "./WUStatus";

type _TabContainerWidget = {
Expand All @@ -50,11 +50,10 @@ type _TabContainerWidget = {

export const supportedFileType = (contentType: string): boolean => ["flat", "csv", "thor"].indexOf((contentType || "").toLowerCase()) >= 0;

export interface DataPatternsWidget extends _TabContainerWidget {
interface _DataPatternsWidget extends _TabContainerWidget {
}

@declareDecorator("DataPatternsWidget", _TabContainerWidget)
export class DataPatternsWidget {
class _DataPatternsWidget {
templateString = template;
static baseClass = "DataPatternsWidget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -296,3 +295,5 @@ export class DataPatternsWidget {
;
}
}

export const DataPatternsWidget = declareMixin(_DataPatternsWidget, "DataPatternsWidget", _TabContainerWidget);
5 changes: 5 additions & 0 deletions esp/src/src/DeclareDecorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,8 @@ export function declareDecorator(classID: string, ...mixins: object[]) {
return declare(classID, mixins, target.prototype);
};
}

type Constructor<T = object> = new (...args: any[]) => T;
export function declareMixin<T extends Constructor>(target: T, classID: string, ...mixins: object[]): T {
return declare(classID, mixins, target.prototype);
}
9 changes: 5 additions & 4 deletions esp/src/src/ECLArchiveWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { themeIsDark } from "./Utility";
import * as template from "dojo/text!hpcc/templates/ECLArchiveWidget.html";
// @ts-ignore
import * as _Widget from "hpcc/_Widget";
import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";

const TIME_NAMES = ["TimeMaxLocalExecute", "TimeAvgLocalExecute", "TimeLocalExecute"];

Expand All @@ -36,11 +36,10 @@ type _Widget = {
setDisabled(id: string, disabled: boolean, icon?: string, disabledIcon?: string);
};

export interface ECLArchiveWidget extends _Widget {
interface _ECLArchiveWidget extends _Widget {
}

@declareDecorator("ECLArchiveWidget", _Widget)
export class ECLArchiveWidget {
class _ECLArchiveWidget {
protected templateString = template;
static baseClass = "ECLArchiveWidget";
protected i18n = nlsHPCC;
Expand Down Expand Up @@ -714,3 +713,5 @@ export class ECLArchiveWidget {
}
}
}
export const ECLArchiveWidget = declareMixin(_ECLArchiveWidget, "ECLArchiveWidget", _Widget);

8 changes: 4 additions & 4 deletions esp/src/src/Graph7Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import "dijit/layout/ContentPane";
import "dijit/Toolbar";
import "dijit/ToolbarSeparator";

import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";
import nlsHPCC from "./nlsHPCC";
import { WUScopeController } from "./WUScopeController";

Expand All @@ -33,11 +33,10 @@ type _Widget = {
setDisabled(id: string, disabled: boolean, icon?: string, disabledIcon?: string);
};

export interface Graph7Widget extends _Widget {
interface _Graph7Widget extends _Widget {
}

@declareDecorator("Graph7Widget", _Widget)
export class Graph7Widget {
class _Graph7Widget {
templateString = template;
static baseClass = "Graph7Widget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -252,3 +251,4 @@ export class Graph7Widget {
;
}
}
export const Graph7Widget = declareMixin(_Graph7Widget, "Graph7Widget", _Widget);
11 changes: 6 additions & 5 deletions esp/src/src/GraphTree7Widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { hashSum } from "@hpcc-js/util";

// @ts-ignore
import * as _Widget from "hpcc/_Widget";
import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";
import { Grid, maximizeWidget } from "./ESPUtil";
import { GraphStore, GraphTreeStore } from "./GraphStore";
import nlsHPCC from "./nlsHPCC";
Expand Down Expand Up @@ -88,11 +88,10 @@ type _Widget = {
setDisabled(id: string, disabled: boolean, icon?: string, disabledIcon?: string);
};

export interface GraphTree7Widget extends _Widget {
interface _GraphTree7Widget extends _Widget {
}

@declareDecorator("GraphTree7Widget", _Widget)
export class GraphTree7Widget {
class _GraphTree7Widget {
templateString = template;
static baseClass = "GraphTree7Widget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -761,7 +760,7 @@ export class GraphTree7Widget {
}
}

GraphTree7Widget.prototype._syncSelectionFrom = debounce(function (this: GraphTree7Widget, sourceControlOrGlobalIDs) {
_GraphTree7Widget.prototype._syncSelectionFrom = debounce(function (this: _GraphTree7Widget, sourceControlOrGlobalIDs) {
this.inSyncSelectionFrom = true;
const sourceControl = sourceControlOrGlobalIDs instanceof Array ? null : sourceControlOrGlobalIDs;
let selectedGlobalIDs = sourceControlOrGlobalIDs instanceof Array ? sourceControlOrGlobalIDs : [];
Expand Down Expand Up @@ -846,3 +845,5 @@ GraphTree7Widget.prototype._syncSelectionFrom = debounce(function (this: GraphTr
}
this.inSyncSelectionFrom = false;
}, 500, false);

export const GraphTree7Widget = declareMixin(_GraphTree7Widget, "GraphTree7Widget", _Widget);
8 changes: 4 additions & 4 deletions esp/src/src/GraphTreeWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,12 @@ import "dijit/ToolbarSeparator";
import "hpcc/JSGraphWidget";
import "hpcc/TimingTreeMapWidget";

import { declareDecorator } from "./DeclareDecorator";
import { declareMixin } from "./DeclareDecorator";

type _Widget = any;
export interface GraphTreeWidget extends _Widget { }
interface _GraphTreeWidget extends _Widget { }

@declareDecorator("GraphTreeWidget", _Widget)
export class GraphTreeWidget {
class _GraphTreeWidget {
templateString = template;
baseClass = "GraphTreeWidget";
i18n = nlsHPCC;
Expand Down Expand Up @@ -796,3 +795,4 @@ export class GraphTreeWidget {
this.setDisabled(this.id + "ActivityMetric", tab.id !== this.id + "ActivitiesTreeMap");
}
}
export const GraphTreeWidget = declareMixin(_GraphTreeWidget, "GraphTreeWidget", _Widget);
1 change: 0 additions & 1 deletion esp/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"noUnusedLocals": true,
"strictNullChecks": false,
"importHelpers": true,
"experimentalDecorators": true,
"allowJs": true,
"skipLibCheck": true,
"noImplicitUseStrict": true,
Expand Down

0 comments on commit 7cb34d9

Please sign in to comment.