-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add actions Edit, Copy to clipboard for features; use type instead of…
… value in the tree item view
- Loading branch information
1 parent
607a915
commit c480ee7
Showing
12 changed files
with
169 additions
and
39 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,40 @@ | ||
import * as vscode from "vscode"; | ||
import { Disposable } from "vscode"; | ||
import { ICommand } from "./ICommand"; | ||
import { FeatureListTreeItem } from "../features/FeatureListTreeDataProvider"; | ||
import { | ||
getGrowthBookConfig, | ||
getWorkspaceRootPath, | ||
} from "../utils/vscode-utils"; | ||
|
||
export class CopyFeatureKeyCommand implements ICommand { | ||
register(): Disposable { | ||
return vscode.commands.registerCommand( | ||
"growthbook.copyFeatureKey", | ||
(treeItem: FeatureListTreeItem) => { | ||
const rootPath = getWorkspaceRootPath(); | ||
if (!rootPath) { | ||
vscode.window.showErrorMessage( | ||
"Must be in a folder in order to create a GrowthBook configuration file" | ||
); | ||
return; | ||
} | ||
|
||
const config = getGrowthBookConfig(rootPath); | ||
if (!config) { | ||
vscode.window.showErrorMessage( | ||
"The .growthbook.json file appears to be misconfigured" | ||
); | ||
return; | ||
} | ||
|
||
const feature = treeItem.getFeature(); | ||
|
||
vscode.env.clipboard.writeText(feature.id); | ||
vscode.window.showInformationMessage( | ||
`Feature key "${feature.id}" copied to clipboard` | ||
); | ||
} | ||
); | ||
} | ||
} |
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,39 @@ | ||
import * as vscode from "vscode"; | ||
import { Disposable, Uri } from "vscode"; | ||
import { ICommand } from "./ICommand"; | ||
import { | ||
getGrowthBookConfig, | ||
getWorkspaceRootPath, | ||
} from "../utils/vscode-utils"; | ||
import { FeatureListTreeItem } from "../features/FeatureListTreeDataProvider"; | ||
|
||
export class EditFeatureCommand implements ICommand { | ||
register(): Disposable { | ||
return vscode.commands.registerCommand( | ||
"growthbook.editFeature", | ||
(treeItem: FeatureListTreeItem) => { | ||
const rootPath = getWorkspaceRootPath(); | ||
if (!rootPath) { | ||
vscode.window.showErrorMessage( | ||
"Must be in a folder in order to create a GrowthBook configuration file" | ||
); | ||
return; | ||
} | ||
|
||
const config = getGrowthBookConfig(rootPath); | ||
if (!config) { | ||
vscode.window.showErrorMessage( | ||
"The .growthbook.json file appears to be misconfigured" | ||
); | ||
return; | ||
} | ||
|
||
const feature = treeItem.getFeature(); | ||
const url = `${config.appHost}/features/${feature.id}`; | ||
const uri = Uri.parse(url); | ||
|
||
vscode.env.openExternal(uri); | ||
} | ||
); | ||
} | ||
} |
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,13 +1,17 @@ | ||
import * as vscode from "vscode"; | ||
import { Disposable } from "vscode"; | ||
import { ICommand } from "./ICommand"; | ||
import { FeatureListTreeItem } from "../features/FeatureListTreeDataProvider"; | ||
|
||
export class RefreshGrowthBookCommand implements ICommand { | ||
constructor(private performRefresh: () => Promise<void>) {} | ||
|
||
register(): Disposable { | ||
return vscode.commands.registerCommand("growthbook.refreshFeatures", () => { | ||
this.performRefresh(); | ||
}); | ||
return vscode.commands.registerCommand( | ||
"growthbook.refreshFeatures", | ||
(_treeItem: FeatureListTreeItem) => { | ||
this.performRefresh(); | ||
} | ||
); | ||
} | ||
} |
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