-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #65 from SanjulaGanepola/feature/payload-file
Add payload support
- Loading branch information
Showing
8 changed files
with
127 additions
and
16 deletions.
There are no files selected for viewing
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
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,33 @@ | ||
import { ThemeIcon, TreeItem, TreeItemCollapsibleState, WorkspaceFolder } from "vscode"; | ||
import { act } from "../../extension"; | ||
import { SettingFile } from "../../settingsManager"; | ||
import { StorageKey } from "../../storageManager"; | ||
import { GithubLocalActionsTreeItem } from "../githubLocalActionsTreeItem"; | ||
import SettingFileTreeItem from "./settingFile"; | ||
|
||
export default class PayloadsTreeItem extends TreeItem implements GithubLocalActionsTreeItem { | ||
static contextValue = 'githubLocalActions.payloads'; | ||
storageKey = StorageKey.PayloadFiles; | ||
|
||
constructor(public workspaceFolder: WorkspaceFolder, payloadFiles: SettingFile[]) { | ||
super('Payloads', TreeItemCollapsibleState.Collapsed); | ||
const selectedPayloadFiles = payloadFiles.filter(payloadFile => payloadFile.selected); | ||
this.description = selectedPayloadFiles.length > 0 ? `${selectedPayloadFiles[0].name}` : ``; | ||
this.contextValue = PayloadsTreeItem.contextValue; | ||
this.iconPath = new ThemeIcon('json'); | ||
} | ||
|
||
async getChildren(): Promise<GithubLocalActionsTreeItem[]> { | ||
const items: GithubLocalActionsTreeItem[] = []; | ||
|
||
const settings = await act.settingsManager.getSettings(this.workspaceFolder, false); | ||
|
||
const payloadFileTreeItems: GithubLocalActionsTreeItem[] = []; | ||
for (const payloadFile of settings.payloadFiles) { | ||
payloadFileTreeItems.push(SettingFileTreeItem.getPayloadTreeItem(this.workspaceFolder, payloadFile)); | ||
} | ||
items.push(...payloadFileTreeItems.sort((a, b) => a.label!.toString().localeCompare(b.label!.toString()))); | ||
|
||
return items; | ||
} | ||
} |
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