-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Andrew Twydell <[email protected]>
- Loading branch information
1 parent
616e791
commit 7282897
Showing
11 changed files
with
1,499 additions
and
275 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* 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 { commands, ExtensionContext } from "vscode"; | ||
import { ToggleResourceTreeWebView } from "../trees/ToggleResourceTreeWebView"; | ||
|
||
export function getToggleResourcesCommand(context: ExtensionContext) { | ||
return commands.registerCommand("cics-extension-for-zowe.toggleResources", () => { | ||
return new ToggleResourceTreeWebView(context); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* 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 { WebView } from '@zowe/zowe-explorer-api'; | ||
import { getMetas } from '../doc'; | ||
import { PersistentStorage } from '../utils/PersistentStorage'; | ||
import { commands, ExtensionContext } from 'vscode'; | ||
|
||
export class ToggleResourceTreeWebView extends WebView { | ||
|
||
persistentStorage: PersistentStorage; | ||
|
||
constructor(context: ExtensionContext) { | ||
super('Toggle Resources', "toggle-resources", context, { | ||
onDidReceiveMessage: (message: { command: string; metas?: any[]; }) => this.onDidReceiveMessage(message), | ||
retainContext: true, | ||
}); | ||
this.persistentStorage = new PersistentStorage("zowe.cics.persistent"); | ||
} | ||
|
||
async onDidReceiveMessage(message: { command: string; metas?: any[]; }) { | ||
if (message.command === "metas") { | ||
await this.persistentStorage.init(); | ||
const visibles = this.persistentStorage.getVisibleResources(); | ||
|
||
await this.panel.webview.postMessage({ | ||
metas: getMetas().map((meta) => { return { ...meta, visible: visibles.includes(meta.resourceName) }; }) | ||
}); | ||
} else if (message.command === "save") { | ||
const visibleResources = message.metas.filter((meta) => meta.visible).map((meta) => meta.resourceName); | ||
await this.persistentStorage.setVisibleResources(visibleResources); | ||
this.panel.dispose(); | ||
commands.executeCommand("cics-extension-for-zowe.refreshTree"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"types": ["node", "jest"], | ||
"outDir": "./lib" | ||
}, | ||
"include": [ | ||
"./src/**/*.ts" | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"types": [ | ||
"node", | ||
"jest" | ||
], | ||
} | ||
"outDir": "./lib" | ||
}, | ||
"include": [ | ||
"./src/**/*.ts" | ||
], | ||
"exclude": [ | ||
"src/webviews/**", | ||
] | ||
} |