Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.2.x' into candidate-…
Browse files Browse the repository at this point in the history
…9.4.x

Signed-off-by: Gordon Smith <[email protected]>

# Conflicts:
#	helm/hpcc/Chart.yaml
#	helm/hpcc/templates/_helpers.tpl
#	version.cmake
  • Loading branch information
GordonSmith committed Aug 8, 2024
2 parents f3be12c + b927601 commit 5910934
Show file tree
Hide file tree
Showing 18 changed files with 366 additions and 207 deletions.
303 changes: 146 additions & 157 deletions esp/src/package-lock.json

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions esp/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,23 @@
"@fluentui/react-hooks": "8.8.10",
"@fluentui/react-icons-mdl2": "1.3.72",
"@fluentui/react-migration-v8-v9": "9.6.22",
"@hpcc-js/chart": "2.83.4",
"@hpcc-js/codemirror": "2.62.1",
"@hpcc-js/common": "2.71.18",
"@hpcc-js/comms": "2.94.1",
"@hpcc-js/chart": "2.84.1",
"@hpcc-js/codemirror": "2.63.0",
"@hpcc-js/common": "2.72.0",
"@hpcc-js/comms": "2.95.0",
"@hpcc-js/dataflow": "8.1.7",
"@hpcc-js/eclwatch": "2.74.8",
"@hpcc-js/graph": "2.85.16",
"@hpcc-js/html": "2.42.21",
"@hpcc-js/layout": "2.49.23",
"@hpcc-js/map": "2.77.22",
"@hpcc-js/other": "2.15.23",
"@hpcc-js/phosphor": "2.18.9",
"@hpcc-js/react": "2.53.17",
"@hpcc-js/tree": "2.40.18",
"@hpcc-js/util": "2.51.1",
"@hpcc-js/wasm": "2.18.0",
"@hpcc-js/eclwatch": "2.75.3",
"@hpcc-js/graph": "2.86.0",
"@hpcc-js/html": "2.43.0",
"@hpcc-js/layout": "2.50.1",
"@hpcc-js/map": "2.78.1",
"@hpcc-js/other": "2.16.1",
"@hpcc-js/phosphor": "2.19.1",
"@hpcc-js/react": "2.54.0",
"@hpcc-js/timeline": "2.53.0",
"@hpcc-js/tree": "2.41.0",
"@hpcc-js/util": "2.52.0",
"@hpcc-js/wasm": "2.18.1",
"@kubernetes/client-node": "0.20.0",
"clipboard": "2.0.11",
"d3-dsv": "3.0.1",
Expand Down
9 changes: 8 additions & 1 deletion esp/src/src-react/components/Frame.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import { useUserSession } from "../hooks/user";
const logger = scopedLogger("../components/Frame.tsx");
const envLogger = scopedLogger("environment");

const USER_COOKIE_CONSENT = "user_cookie_consent";

export function resetCookieConsent() {
const store = userKeyValStore();
return store.delete(USER_COOKIE_CONSENT);
}

interface FrameProps {
}

Expand Down Expand Up @@ -111,7 +118,7 @@ export const Frame: React.FunctionComponent<FrameProps> = () => {
/>}
/>
<CookieConsent showCookieConsent={showCookieConsent} onApply={(n: boolean) => {
userKeyValStore().set("user_cookie_consent", n ? "1" : "0");
userKeyValStore().set(USER_COOKIE_CONSENT, n ? "1" : "0");
}} />
</ThemeProvider >
</FluentProvider >;
Expand Down
43 changes: 20 additions & 23 deletions esp/src/src-react/components/Metrics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { bundleIcon, Folder20Filled, Folder20Regular, FolderOpen20Filled, Folder
import { Database } from "@hpcc-js/common";
import { WorkunitsServiceEx, IScope, splitMetric } from "@hpcc-js/comms";
import { CellFormatter, ColumnFormat, ColumnType, DBStore, RowType, Table } from "@hpcc-js/dgrid";
import { compare, scopedLogger } from "@hpcc-js/util";
import { scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
import { WUTimelineNoFetch } from "src/Timings";
import * as Utility from "src/Utility";
Expand Down Expand Up @@ -89,7 +89,7 @@ class TableEx extends Table {
}

_rawDataMap: { [id: number]: string } = {};
metrics(metrics: any[], options: MetricsOptionsT, timelineFilter: string, scopeFilter: string, matchCase: boolean): this {
metrics(metrics: any[], options: MetricsOptionsT, scopeFilter: string, matchCase: boolean): this {
this
.columns(["##"]) // Reset hash to force recalculation of default widths
.columns(["##", nlsHPCC.Type, "StdDevs", nlsHPCC.Scope, ...options.properties, "__StdDevs"])
Expand All @@ -106,8 +106,7 @@ class TableEx extends Table {
.data(metrics
.filter(m => this.scopeFilterFunc(m, scopeFilter, matchCase))
.filter(row => {
return (timelineFilter === "" || row.name?.indexOf(timelineFilter) === 0) &&
(options.scopeTypes.indexOf(row.type) >= 0);
return options.scopeTypes.indexOf(row.type) >= 0;
}).map((row, idx) => {
if (idx === 0) {
this._rawDataMap = {
Expand Down Expand Up @@ -175,7 +174,6 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
selection
}) => {
const [_uiState, _setUIState] = React.useState({ ...defaultUIState });
const [timelineFilter, setTimelineFilter] = React.useState("");
const [selectedMetricsSource, setSelectedMetricsSource] = React.useState<SelectedMetricsSource>("");
const [selectedMetrics, setSelectedMetrics] = React.useState<IScope[]>([]);
const [selectedMetricsPtr, setSelectedMetricsPtr] = React.useState<number>(-1);
Expand Down Expand Up @@ -227,13 +225,15 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
.maxZoom(Number.MAX_SAFE_INTEGER)
);

const [scopeFilter, setScopeFilter] = React.useState("");
React.useEffect(() => {
timeline
.on("click", (row, col, sel) => {
setTimelineFilter(sel ? row[7].__hpcc_id : "");
if (sel) {
timeline.selection([]);
setSelectedMetricsSource("scopesTable");
pushUrl(`${parentUrl}/${row[7].Id}`);
setScopeFilter(`name:${row[7].__hpcc_id}`);
pushUrl(`${parentUrl}/${row[7].id}`);
}
}, true)
;
Expand All @@ -247,7 +247,6 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
}, [metrics, timeline]);

// Scopes Table ---
const [scopeFilter, setScopeFilter] = React.useState("");
const onChangeScopeFilter = React.useCallback((event: React.FormEvent<HTMLInputElement | HTMLTextAreaElement>, newValue?: string) => {
setScopeFilter(newValue || "");
}, []);
Expand All @@ -259,7 +258,7 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({

const scopesTable = useConst(() => new TableEx()
.multiSelect(true)
.metrics([], options, timelineFilter, scopeFilter, matchCase)
.metrics([], options, scopeFilter, matchCase)
.sortable(true)
);

Expand All @@ -274,24 +273,22 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
}, [scopesSelectionChanged, scopesTable]);

React.useEffect(() => {
if (!scopeFilter || scopeFilter.indexOf("name:") === 0) {
setScopeFilter(timelineFilter ? `name:${timelineFilter}` : "");
}
scopesTable
.metrics(metrics, options, timelineFilter, scopeFilter, matchCase)
.metrics(metrics, options, scopeFilter, matchCase)
.lazyRender()
;
}, [matchCase, metrics, options, scopeFilter, scopesTable, timelineFilter]);
}, [matchCase, metrics, options, scopeFilter, scopesTable]);

const updateScopesTable = React.useCallback((selection: IScope[]) => {
if (scopesTable?.renderCount() > 0) {
const prevSelection = scopesTable.selection().map(row => row.__lparam.id);
const newSelection = selection.map(row => row.id);
const diffs = compare(prevSelection, newSelection);
if (diffs.enter.length || diffs.exit.length) {
scopesTable.selection(scopesTable.data().filter(row => {
scopesTable.selection([]);
if (selection.length) {
const selRows = scopesTable.data().filter(row => {
return selection.indexOf(row[row.length - 1]) >= 0;
}));
});
scopesTable.render(() => {
scopesTable.selection(selRows);
});
}
}
}, [scopesTable]);
Expand Down Expand Up @@ -508,7 +505,7 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
}
}
setIsLayoutComplete(true);
});
}).catch(err => logger.error(err));
}
return () => {
cancelled = true;
Expand Down Expand Up @@ -622,13 +619,13 @@ export const Metrics: React.FunctionComponent<MetricsProps> = ({
const setShowMetricOptionsHook = React.useCallback((show: boolean) => {
setShowMetricOptions(show);
scopesTable
.metrics(metrics, options, timelineFilter, scopeFilter, matchCase)
.metrics(metrics, options, scopeFilter, matchCase)
.render(() => {
updateScopesTable(selectedMetrics);
})
;

}, [matchCase, metrics, options, scopeFilter, scopesTable, selectedMetrics, timelineFilter, updateScopesTable]);
}, [matchCase, metrics, options, scopeFilter, scopesTable, selectedMetrics, updateScopesTable]);

return <HolyGrail fullscreen={fullscreen}
header={<>
Expand Down
87 changes: 87 additions & 0 deletions esp/src/src-react/components/Reset.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import * as React from "react";
import { PrimaryButton, DefaultButton, mergeStyleSets, Checkbox, Stack } from "@fluentui/react";
import { resetCookies, resetModernMode } from "src/Session";
import nlsHPCC from "src/nlsHPCC";
import { pushUrl, replaceUrl } from "../util/history";
import { resetMetricsViews } from "../hooks/metrics";
import { resetHistory } from "../util/history";
import { MessageBox } from "../layouts/MessageBox";
import { resetTheme, useUserTheme } from "../hooks/theme";
import { resetFavorites } from "../hooks/favorite";
import { resetCookieConsent } from "./Frame";
import { resetWorkunitOptions } from "./Workunits";

export interface ResetDialogProps {
}

export const ResetDialog: React.FunctionComponent<ResetDialogProps> = ({
}) => {

const [show, setShow] = React.useState(true);
const [checkMetricOptions, setCheckMetricOptions] = React.useState(true);
const [checkWorkunitOptions, setCheckWorkunitOptions] = React.useState(true);
const [checkHistory, setCheckHistoryCheckbox] = React.useState(true);
const [checkFavorites, setCheckFavorites] = React.useState(true);
const [checkEclWatchVersion, setCheckEclWatchVersion] = React.useState(true);
const [checkTheme, setCheckTheme] = React.useState(true);
const [checkCookies, setCheckCookies] = React.useState(false);
const { theme } = useUserTheme();

const styles = React.useMemo(() => mergeStyleSets({
root: {
height: "100%",
backgroundColor: theme.semanticColors.bodyBackground
},
}), [theme.semanticColors.bodyBackground]);

return <div className={styles.root}>
<MessageBox show={show} setShow={setShow} title={`${nlsHPCC.ResetUserSettings}?`} footer={
<>
<PrimaryButton text={nlsHPCC.Reset} onClick={async () => {
if (checkMetricOptions) {
await resetMetricsViews();
}
if (checkWorkunitOptions) {
await resetWorkunitOptions();
}
if (checkHistory) {
await resetHistory();
}
if (checkFavorites) {
await resetFavorites();
}
if (checkHistory) {
await resetHistory();
}
if (checkEclWatchVersion) {
await resetModernMode();
}
if (checkTheme) {
await resetTheme();
}
if (checkCookies) {
await resetCookies();
await resetCookieConsent();
}
setShow(false);
replaceUrl("/");
window.location.reload();
}} />
<DefaultButton text={nlsHPCC.Cancel} onClick={() => {
setShow(false);
pushUrl("/");
}} />
</>
}>
<Stack tokens={{ childrenGap: 10 }}>
<Checkbox label={nlsHPCC.MetricOptions} checked={checkMetricOptions} onChange={(ev, checked) => setCheckMetricOptions(checked)} />
<Checkbox label={nlsHPCC.WorkunitOptions} checked={checkWorkunitOptions} onChange={(ev, checked) => setCheckWorkunitOptions(checked)} />
<Checkbox label={nlsHPCC.History} checked={checkHistory} onChange={(ev, checked) => setCheckHistoryCheckbox(checked)} />
<Checkbox label={nlsHPCC.Favorites} checked={checkFavorites} onChange={(ev, checked) => setCheckFavorites(checked)} />
<Checkbox label={nlsHPCC.ECLWatchVersion} checked={checkEclWatchVersion} onChange={(ev, checked) => setCheckEclWatchVersion(checked)} />
<Checkbox label={nlsHPCC.Theme} checked={checkTheme} onChange={(ev, checked) => setCheckTheme(checked)} />
<Checkbox label={nlsHPCC.Cookies} checked={checkCookies} onChange={(ev, checked) => setCheckCookies(checked)} />
</Stack>
</MessageBox>
</div>;
};
6 changes: 6 additions & 0 deletions esp/src/src-react/components/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ export const DevTitle: React.FunctionComponent<DevTitleProps> = ({
isChecked: true,
onClick: onTechPreviewClick
},
{ key: "divider_4", itemType: ContextualMenuItemType.Divider },
{
key: "reset",
href: "/esp/files/index.html#/reset",
text: nlsHPCC.ResetUserSettings
},
{ key: "about", text: nlsHPCC.About, onClick: () => setShowAbout(true) }
],
directionalHintFixed: true
Expand Down
10 changes: 9 additions & 1 deletion esp/src/src-react/components/Workunits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SizeMe } from "react-sizeme";
import { CreateWUQueryStore, defaultSort, emptyFilter, Get, WUQueryStore, formatQuery } from "src/ESPWorkunit";
import * as WsWorkunits from "src/WsWorkunits";
import { formatCost } from "src/Session";
import { userKeyValStore } from "src/KeyValStore";
import nlsHPCC from "src/nlsHPCC";
import { useConfirm } from "../hooks/confirm";
import { useMyAccount } from "../hooks/user";
Expand Down Expand Up @@ -45,6 +46,13 @@ const defaultUIState = {
hasNotCompleted: false
};

const WORKUNITS_SHOWTIMELINE = "workunits_showTimeline";

export function resetWorkunitOptions() {
const store = userKeyValStore();
return store?.delete(WORKUNITS_SHOWTIMELINE);
}

interface WorkunitsProps {
filter?: { [id: string]: any };
sort?: QuerySortItem;
Expand All @@ -64,7 +72,7 @@ export const Workunits: React.FunctionComponent<WorkunitsProps> = ({
const [showFilter, setShowFilter] = React.useState(false);
const { currentUser } = useMyAccount();
const [uiState, setUIState] = React.useState({ ...defaultUIState });
const [showTimeline, setShowTimeline] = useUserStore<boolean>("workunits_showTimeline", true);
const [showTimeline, setShowTimeline] = useUserStore<boolean>(WORKUNITS_SHOWTIMELINE, true);
const {
selection, setSelection,
pageNum, setPageNum,
Expand Down
3 changes: 2 additions & 1 deletion esp/src/src-react/components/controls/Grid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ const FluentStoreGrid: React.FunctionComponent<FluentStoreGridProps> = ({
setTotal(total);
});
storeQuery.then(items => {
const selectedIndices = selectionHandler.getSelectedIndices();
setItems(items);
setSelection(selectionHandler.getSelection());
selectedIndices.forEach(index => selectionHandler.setIndexSelected(index, true, false));
});
}, [count, selectionHandler, start, store], [query, sorted]);

Expand Down
5 changes: 5 additions & 0 deletions esp/src/src-react/hooks/favorite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import { hashHistory } from "../util/history";
const STORE_FAVORITES_ID = "favorites";
const STORE_CACHE_TIMEOUT = 10000;

export function resetFavorites() {
const store = userKeyValStore();
return store?.delete(STORE_FAVORITES_ID);
}

interface Payload {
// TODO: Will be used for labels and extra info...
}
Expand Down
12 changes: 9 additions & 3 deletions esp/src/src-react/hooks/metrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ import { useCounter } from "./util";

const logger = scopedLogger("src-react/hooks/metrics.ts");

const MetricOptionsVersion = 2;
const METRIC_OPTIONS_VERSION = 2;
const METRIC_OPTIONS_KEY = `MetricOptions-${METRIC_OPTIONS_VERSION}`;

export function resetMetricsViews() {
const store = userKeyValStore();
return store?.delete(METRIC_OPTIONS_KEY);
}

export interface MetricsOptions {
scopeTypes: string[];
Expand Down Expand Up @@ -58,15 +64,15 @@ export function useMetricsOptions(): [MetricsOptions, (opts: MetricsOptions) =>

const save = React.useCallback(() => {
if (checkLayout(options)) {
store?.set(`MetricOptions-${MetricOptionsVersion}`, JSON.stringify(options), true);
store?.set(METRIC_OPTIONS_KEY, JSON.stringify(options), true);
}
}, [store]);

const reset = React.useCallback((toDefaults: boolean = false) => {
if (toDefaults) {
setOptions({ ...defaults });
} else {
store?.get(`MetricOptions-${MetricOptionsVersion}`).then(opts => {
store?.get(METRIC_OPTIONS_KEY).then(opts => {
const options = JSON.parse(opts);
checkLayout(options);
setOptions({ ...defaults, ...options });
Expand Down
Loading

0 comments on commit 5910934

Please sign in to comment.