Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"Power Platform",
"Dynamics 365",
"Xrm",
"DVDT",
"Dev Tools"
],
"qna": "https://github.com/Power-Maverick/DataverseDevTools-VSCode/discussions",
Expand Down
File renamed without changes
File renamed without changes
23 changes: 23 additions & 0 deletions resources/toolIcons/dark/erd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions resources/toolIcons/dark/generic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
Binary file added resources/toolIcons/light/cmt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/toolIcons/light/drb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions resources/toolIcons/light/erd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions resources/toolIcons/light/generic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/toolIcons/light/pd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/toolIcons/light/prt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 3 additions & 58 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import * as vscode from "vscode";
import { CliCommandTreeItem } from "../cliCommands/cliCommandsDataProvider";
import { CLIHelper } from "../helpers/cliHelper";
import { DataverseHelper } from "../helpers/dataverseHelper";
import { DRBHelper } from "../helpers/drbHelper";
import { ErrorHandler } from "../helpers/errorHandler";
import { TemplateHelper } from "../helpers/templateHelper";
import { ToolsHelper } from "../helpers/toolsHelper";
import { TypingsHelper } from "../helpers/typingsHelper";
import { WebResourceHelper } from "../helpers/webResourceHelper";
import { ToolsTreeItem } from "../tools/toolsDataProvider";
Expand All @@ -30,8 +30,8 @@ export async function registerCommands(vscontext: vscode.ExtensionContext, tr: T
const templateHelper = new TemplateHelper(vscontext);
const wrHelper = new WebResourceHelper(vscontext, dvHelper);
const typingHelper = new TypingsHelper(vscontext, dvHelper);
const drbHelper = new DRBHelper(vscontext);
const errorHandler = new ErrorHandler(tr);
const toolsHelper = new ToolsHelper(vscontext);

dvStatusBarItem = vscode.window.createStatusBarItem(connectionStatusBarUniqueId, vscode.StatusBarAlignment.Left);
vscontext.subscriptions.push(dvStatusBarItem);
Expand Down Expand Up @@ -203,46 +203,6 @@ export async function registerCommands(vscontext: vscode.ExtensionContext, tr: T
}
},
},
{
command: "dvdt.commands.openDRB",
callback: async () => {
try {
drbHelper.openDRB(views);
} catch (error) {
errorHandler.log(error, "openDRB");
}
},
},
{
command: "dvdt.commands.launchPRT",
callback: async () => {
try {
cliHelper.launchPRT();
} catch (error) {
errorHandler.log(error, "launchPRT");
}
},
},
{
command: "dvdt.commands.launchCMT",
callback: async () => {
try {
cliHelper.launchCMT();
} catch (error) {
errorHandler.log(error, "launchCMT");
}
},
},
{
command: "dvdt.commands.launchPD",
callback: async () => {
try {
cliHelper.launchPD();
} catch (error) {
errorHandler.log(error, "launchPD");
}
},
},
{
command: "dvdt.explorer.webresources.linkExistingWebResource",
callback: async (uri: vscode.Uri) => {
Expand All @@ -257,22 +217,7 @@ export async function registerCommands(vscontext: vscode.ExtensionContext, tr: T
command: "dvdt.explorer.tools.launchTool",
callback: async (toolItem: ToolsTreeItem) => {
try {
switch (toolItem.toolShortName) {
case "drb":
drbHelper.openDRB(views);
break;
case "prt":
cliHelper.launchPRT();
break;
case "cmt":
cliHelper.launchCMT();
break;
case "pd":
cliHelper.launchPD();
break;
default:
break;
}
toolsHelper.openTool(toolItem);
} catch (error) {
errorHandler.log(error, "launchTool");
}
Expand Down
71 changes: 71 additions & 0 deletions src/commands/registerToolsCommands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import TelemetryReporter from "@vscode/extension-telemetry";
import * as vscode from "vscode";
import { CLIHelper } from "../helpers/cliHelper";
import { ErrorHandler } from "../helpers/errorHandler";
import { ToolsHelper } from "../helpers/toolsHelper";
import { ICommand } from "../utils/Interfaces";
import { ViewBase } from "../views/ViewBase";

export async function registerToolsCommands(vscontext: vscode.ExtensionContext, tr: TelemetryReporter): Promise<void> {
const toolHelper = new ToolsHelper(vscontext);
const views = new ViewBase(vscontext);
const errorHandler = new ErrorHandler(tr);
const cliHelper = new CLIHelper(vscontext);

const cmds: Array<ICommand> = new Array(
{
command: "dvdt.commands.openDRB",
callback: async () => {
try {
toolHelper.openDRB(views);
} catch (error) {
errorHandler.log(error, "openDRB");
}
},
},
// {
// command: "dvdt.commands.openERDGenerator",
// callback: async () => {
// try {
// toolHelper.openERDGenerator();
// } catch (error) {
// errorHandler.log(error, "openERDGenerator");
// }
// },
// },
{
command: "dvdt.commands.launchPRT",
callback: async () => {
try {
cliHelper.launchPRT();
} catch (error) {
errorHandler.log(error, "launchPRT");
}
},
},
{
command: "dvdt.commands.launchCMT",
callback: async () => {
try {
cliHelper.launchCMT();
} catch (error) {
errorHandler.log(error, "launchCMT");
}
},
},
{
command: "dvdt.commands.launchPD",
callback: async () => {
try {
cliHelper.launchPD();
} catch (error) {
errorHandler.log(error, "launchPD");
}
},
},
);

cmds.forEach((c) => {
vscontext.subscriptions.push(vscode.commands.registerCommand(c.command, c.callback));
});
}
23 changes: 12 additions & 11 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import TelemetryReporter from "@vscode/extension-telemetry";
import * as vscode from "vscode";
import { registerCommands } from "./commands/registerCommands";
import { registerToolsCommands } from "./commands/registerToolsCommands";
import { registerTreeDataProviders } from "./commands/registerTreeDataProviders";
import { DataverseHelper } from "./helpers/dataverseHelper";
import * as config from "./utils/Config";
Expand Down Expand Up @@ -32,6 +33,9 @@ export function activate(context: vscode.ExtensionContext) {

registerTreeDataProviders(context, reporter);
registerCommands(context, reporter);
registerToolsCommands(context, reporter);

console.log(`Extension ${extensionId} v${extensionVersion} is now active!`);

// Start periodic token expiration check
startTokenExpirationCheck(context);
Expand Down Expand Up @@ -59,20 +63,17 @@ export function deactivate() {
*/
function startTokenExpirationCheck(context: vscode.ExtensionContext) {
let lastNotifiedExpiration = false;

tokenExpirationTimer = setInterval(() => {
const dvHelper = new DataverseHelper(context);
const isExpired = dvHelper.isCurrentConnectionTokenExpired();

if (isExpired && !lastNotifiedExpiration) {
// Get current connection to create tree item for reconnect
const conn = dvHelper.getCurrentWorkspaceConnection();

// Show notification to user
vscode.window.showWarningMessage(
"Your Dataverse connection token has expired. Please reconnect to continue working.",
"Reconnect"
).then(selection => {
vscode.window.showWarningMessage("Your Dataverse connection token has expired. Please reconnect to continue working.", "Reconnect").then((selection) => {
if (selection === "Reconnect" && conn) {
// Create a tree item with the connection name to pass to the command
const connItem = {
Expand All @@ -81,17 +82,17 @@ function startTokenExpirationCheck(context: vscode.ExtensionContext) {
collapsibleState: vscode.TreeItemCollapsibleState.Collapsed,
level: 2,
current: true,
expired: true
expired: true,
};
vscode.commands.executeCommand("dvdt.explorer.connections.connectDataverse", connItem);
}
});

lastNotifiedExpiration = true;

// Refresh the connection tree to show expired icon
vscode.commands.executeCommand("dvdt.explorer.connections.refreshConnection");

// Update status bar to show expired state
if (conn) {
vscode.commands.executeCommand("dvdt.explorer.connections.updateStatusBar", conn);
Expand Down
28 changes: 0 additions & 28 deletions src/helpers/drbHelper.ts

This file was deleted.

Loading