-
Notifications
You must be signed in to change notification settings - Fork 90
/
refresh.ts
42 lines (40 loc) · 2 KB
/
refresh.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* This program and the accompanying materials are made available under the terms of the *
* Eclipse Public License v2.0 which accompanies this distribution, and is available at *
* https://www.eclipse.org/legal/epl-v20.html *
* *
* SPDX-License-Identifier: EPL-2.0 *
* *
* Copyright Contributors to the Zowe Project. *
* *
*/
import { IZoweTree, IZoweTreeNode } from "@zowe/zowe-explorer-api";
import { PersistentFilters } from "../PersistentFilters";
import { Profiles } from "../Profiles";
import { syncSessionNode } from "../utils/ProfilesUtils";
import { ZoweExplorerApiRegister } from "../ZoweExplorerApiRegister";
import { resetValidationSettings, returnIconState } from "./actions";
import { labelRefresh } from "./utils";
import * as contextually from "../shared/context";
/**
* View (DATA SETS, JOBS, USS) refresh button
* Refreshes treeView and profiles including their validation setting
*
* @param {IZoweTree} treeProvider
*/
export async function refreshAll(treeProvider: IZoweTree<IZoweTreeNode>) {
treeProvider.mSessionNodes.forEach(async (sessNode) => {
const setting = (await PersistentFilters.getDirectValue("Zowe-Automatic-Validation")) as boolean;
if (contextually.isSessionNotFav(sessNode)) {
labelRefresh(sessNode);
sessNode.children = [];
sessNode.dirty = true;
resetValidationSettings(sessNode, setting);
returnIconState(sessNode);
await syncSessionNode(Profiles.getInstance())((profileValue) =>
ZoweExplorerApiRegister.getCommonApi(profileValue).getSession()
)(sessNode);
}
});
treeProvider.refresh();
}