Skip to content

Commit

Permalink
Merge branch 'release/3.1' into port-3438
Browse files Browse the repository at this point in the history
  • Loading branch information
zFernand0 authored Feb 18, 2025
2 parents dc10fe9 + f03137b commit bea241b
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
1 change: 1 addition & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
### Bug fixes

- Fixed an issue where a TypeError occurred when applying VS Code proxy settings to an invalid session. [#3425](https://github.com/zowe/zowe-explorer-vscode/issues/3425)
- Fixed a bug where edit history does not show the correct information. [#3432](https://github.com/zowe/zowe-explorer-vscode/issues/3432)

## `3.1.0`

Expand Down
19 changes: 17 additions & 2 deletions packages/zowe-explorer/src/trees/shared/SharedHistoryView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class SharedHistoryView extends WebView {
}

protected async onDidReceiveMessage(message: any): Promise<void> {
ZoweLogger.trace("HistoryView.onDidReceiveMessage called.");
switch (message.command) {
case "refresh":
await this.refreshView(message);
Expand All @@ -59,7 +60,7 @@ export class SharedHistoryView extends WebView {
this.showError(message);
break;
case "update-selection":
this.updateSelection(message);
await this.updateSelection(message);
break;
case "add-item":
await this.addItem(message);
Expand Down Expand Up @@ -93,11 +94,23 @@ export class SharedHistoryView extends WebView {
}

private getTreeProvider(type: string): Definitions.TreeProvider {
ZoweLogger.trace("HistoryView.getTreeProvider called.");
return this.treeProviders[type === "jobs" ? "job" : type] as Definitions.TreeProvider;
}

private getHistoryData(type: string): Definitions.History {
ZoweLogger.trace("HistoryView.getHistoryData called.");
const treeProvider = this.treeProviders[type] as Definitions.TreeProvider;
if (!treeProvider) {
ZoweLogger.error(`No tree provider found for type: ${type}`);
return {
search: [],
sessions: [],
fileHistory: [],
favorites: [],
encodingHistory: [],
};
}
return {
search: treeProvider.getSearchHistory(),
sessions: treeProvider.getSessions(),
Expand All @@ -108,6 +121,7 @@ export class SharedHistoryView extends WebView {
}

private fetchEncodingHistory(): string[] {
ZoweLogger.trace("HistoryView.fetchEncodingHistory called.");
return ZoweLocalStorage.getValue<string[]>(Definitions.LocalStorageKey.ENCODING_HISTORY) ?? [];
}

Expand All @@ -116,9 +130,10 @@ export class SharedHistoryView extends WebView {
Gui.errorMessage(message.attrs.errorMsg);
}

private updateSelection(message): void {
private async updateSelection(message): Promise<void> {
ZoweLogger.trace("HistoryView.updateSelection called.");
this.currentSelection[message.attrs.type] = message.attrs.selection;
await this.refreshView(message);
}

private async addItem(message): Promise<void> {
Expand Down
11 changes: 9 additions & 2 deletions packages/zowe-explorer/src/webviews/src/edit-history/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import * as l10n from "@vscode/l10n";
export function App(): JSXInternal.Element {
const [timestamp, setTimestamp] = useState<Date | undefined>();
const [currentTab, setCurrentTab] = useState<{ [key: string]: string }>({});

useEffect(() => {
window.addEventListener("message", (event) => {
const handleMessage = (event: MessageEvent) => {
if (!isSecureOrigin(event.origin)) {
return;
}
Expand All @@ -41,9 +42,15 @@ export function App(): JSXInternal.Element {
contents: contents,
});
}
});
};

window.addEventListener("message", handleMessage);
PersistentVSCodeAPI.getVSCodeAPI().postMessage({ command: "ready" });
PersistentVSCodeAPI.getVSCodeAPI().postMessage({ command: "GET_LOCALIZATION" });

return () => {
window.removeEventListener("message", handleMessage);
};
}, []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function PersistentDataPanel({ type }: Readonly<{ type: Readonly<
};

useEffect(() => {
window.addEventListener("message", (event) => {
const handleMessage = (event: MessageEvent) => {
if (!isSecureOrigin(event.origin)) {
return;
}
Expand All @@ -64,16 +64,20 @@ export default function PersistentDataPanel({ type }: Readonly<{ type: Readonly<
}));
}
}
});
}, []);
};

useEffect(() => {
setPersistentProp(() => data[type][selection[type]]);
}, [data]);
window.addEventListener("message", handleMessage);

return () => {
window.removeEventListener("message", handleMessage);
};
}, [type]);

useEffect(() => {
setPersistentProp(() => data[type][selection[type]]);
}, [selection]);
if (data[type] && selection[type]) {
setPersistentProp(() => data[type][selection[type]] || []);
}
}, [data, selection, type]);

if (type == "cmds") {
return (
Expand Down

0 comments on commit bea241b

Please sign in to comment.