Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #91 from newrelic/maria/add-viz
Browse files Browse the repository at this point in the history
Add command to create a custom visualization
  • Loading branch information
mbazhlekova committed Mar 15, 2021
2 parents 4df50f1 + edcb37b commit 227eb82
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"theme": "light"
},
"license": "SEE LICENSE IN LICENSE.txt",
"version": "1.0.7",
"version": "1.0.9",
"publisher": "new-relic",
"engines": {
"vscode": "^1.44.0"
Expand All @@ -42,7 +42,8 @@
"onCommand:nr1.generateUuid",
"onCommand:nr1.openDeveloperDocs",
"onCommand:nr1.listSubscriptions",
"onCommand:nr1.searchDeveloperDocs"
"onCommand:nr1.searchDeveloperDocs",
"onCommand:nr1.createVisualization"
],
"main": "./out/extension.js",
"contributes": {
Expand Down Expand Up @@ -124,6 +125,10 @@
{
"command": "nr1.listSubscriptions",
"title": "New Relic (profile): show subscribed nerdpacks"
},
{
"command": "nr1.createVisualization",
"title": "New Relic (nerdpack): create a visualization"
}
]
},
Expand Down
1 change: 1 addition & 0 deletions src/constants/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const COMMANDS = {
CREATE_NERDPACK: "nr1.createNerdpack",
CREATE_NERDLET: "nr1.createNerdlet",
CREATE_LAUNCHER: "nr1.createLauncher",
CREATE_VISUALIZATION: "nr1.createVisualization",
PUBLISH_NERDPACK: "nr1.publishNerdpack",
DEPLOY_NERDPACK: "nr1.deployNerdpack",
UNDEPLOY_NERDPACK: "nr1.undeployNerdpack",
Expand Down
17 changes: 17 additions & 0 deletions src/extension-commands/create-visualization.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import * as vscode from "vscode";
import { NAME_REQUIRED } from "./../constants/errors";
import * as cliCommands from "./nr1-cli-commands";
import runCommand from "../utils/run-command";
import { getNameInput } from "../utils/get-nerdpack-name-input";

const createVisualization = async () => {
const visualizationName = await getNameInput();

if (!visualizationName) {
return vscode.window.showErrorMessage(NAME_REQUIRED("visualization"));
}

runCommand(cliCommands.createVisualization(visualizationName));
};

export default createVisualization;
1 change: 1 addition & 0 deletions src/extension-commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export { default as showCatalogInfo } from "./show-catalog-info";
export { default as subscribeNerdpack } from "./subscribe-nerdpack";
export { default as undeployNerdpack } from "./undeploy-nerdpack";
export { default as unsubscribeNerdpack } from "./unsubscribe-nerdpack";
export { default as createVisualization } from "./create-visualization";
3 changes: 3 additions & 0 deletions src/extension-commands/nr1-cli-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export const createNerdlet = (nerdletName: string) =>
export const createLauncher = (launcherName: string) =>
`nr1 create -t launcher -n ${launcherName}`;

export const createVisualization = (visualizationName: string) =>
`nr1 create -t visualization -n ${visualizationName}`;

export const publishNerdpack = (channel: string) =>
`nr1 nerdpack:publish -t ${channel}`;

Expand Down
5 changes: 5 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
subscribeNerdpack,
undeployNerdpack,
unsubscribeNerdpack,
createVisualization,
} from "./extension-commands/index";

/**********
Expand Down Expand Up @@ -69,6 +70,10 @@ export function activate(context: vscode.ExtensionContext) {
vscode.commands.registerCommand(
COMMANDS.SEARCH_DEVELOPER_DOCS,
searchDevDocs
),
vscode.commands.registerCommand(
COMMANDS.CREATE_VISUALIZATION,
createVisualization
)
);
}
Expand Down

0 comments on commit 227eb82

Please sign in to comment.