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
22 changes: 22 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@
"command": "dvdt.explorer.webresources.compareWebResource",
"when": "resourceExtname in devtools.resourcesExtn && resourceFilename in devtools.linkedResources",
"group": "%dvdt.menus.group.wr%@3"
},
{
"command": "dvdt.explorer.plugins.linkPlugin",
"when": "resourceExtname == .csproj",
"group": "%dvdt.menus.group.plugin%@1"
},
{
"command": "dvdt.explorer.plugins.pushPlugin",
"when": "resourceExtname == .csproj",
"group": "%dvdt.menus.group.plugin%@2"
}
],
"view/title": [
Expand Down Expand Up @@ -523,6 +533,18 @@
"light": "resources/light/play.svg",
"dark": "resources/dark/play.svg"
}
},
{
"command": "dvdt.explorer.plugins.linkPlugin",
"title": "Link to Existing Dataverse Plugin",
"when": "false",
"category": "%dvdt.explorer.category%"
},
{
"command": "dvdt.explorer.plugins.pushPlugin",
"title": "Push Plugin to Dataverse",
"when": "false",
"category": "%dvdt.explorer.category%"
}
],
"configuration": {
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"dvdt.explorer.category": "Explorer",
"dvdt.menus.group.ts": "dvdevtools-ts",
"dvdt.menus.group.wr": "dvdevtools-wr",
"dvdt.menus.group.plugin": "dvdevtools-plugin",
"dvdt.config.title": "Dataverse DevTools",
"dvdt.config.enablePreview": "Enable a preview features for Dataverse DevTools. See [documentation for all available preview features](https://github.com/Power-Maverick/DataverseDevTools-VSCode#-early-access-preview).\n\n> _Note: these features are not fully tested; so if you encounter any bugs please report them on GitHub (your name will appear on the contributors list)._",
"dvdt.config.defaultTSTemplate": "Specifies how Dataverse DevTools should behave when you initiate a TypeScript project. This will skip the extra question during TS project initialization when you either select `Plain TypeScript` or `Webpack`"
Expand Down
2 changes: 2 additions & 0 deletions resources/templates/dvdt.linker.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<DVDT>
<WebResources>
</WebResources>
<Plugins>
</Plugins>
<Settings>
</Settings>
</DVDT>
23 changes: 23 additions & 0 deletions src/commands/registerCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CliCommandTreeItem } from "../cliCommands/cliCommandsDataProvider";
import { CLIHelper } from "../helpers/cliHelper";
import { DataverseHelper } from "../helpers/dataverseHelper";
import { ErrorHandler } from "../helpers/errorHandler";
import { PluginHelper } from "../helpers/pluginHelper";
import { TemplateHelper } from "../helpers/templateHelper";
import { ToolsHelper } from "../helpers/toolsHelper";
import { TypingsHelper } from "../helpers/typingsHelper";
Expand All @@ -29,6 +30,7 @@ export async function registerCommands(vscontext: vscode.ExtensionContext, tr: T
const cliHelper = new CLIHelper(vscontext);
const templateHelper = new TemplateHelper(vscontext);
const wrHelper = new WebResourceHelper(vscontext, dvHelper);
const pluginHelper = new PluginHelper(vscontext);
const typingHelper = new TypingsHelper(vscontext, dvHelper);
const errorHandler = new ErrorHandler(tr);
const toolsHelper = new ToolsHelper(vscontext);
Expand Down Expand Up @@ -253,13 +255,34 @@ export async function registerCommands(vscontext: vscode.ExtensionContext, tr: T
}
},
},
{
command: "dvdt.explorer.plugins.linkPlugin",
callback: async (uri: vscode.Uri) => {
try {
await pluginHelper.linkPlugin(uri.fsPath);
} catch (error) {
errorHandler.log(error, "linkPlugin");
}
},
},
{
command: "dvdt.explorer.plugins.pushPlugin",
callback: async (uri: vscode.Uri) => {
try {
await pluginHelper.pushPlugin(uri.fsPath);
} catch (error) {
errorHandler.log(error, "pushPlugin");
}
},
},
);
cmds.forEach((c) => {
vscontext.subscriptions.push(vscode.commands.registerCommand(c.command, c.callback));
});

updateConnectionStatusBar(await dvHelper.reloadWorkspaceConnection());
vscode.commands.executeCommand("setContext", `${extensionPrefix}.linkedResources`, await wrHelper.getLinkedResourceStrings("@_localFileName"));
vscode.commands.executeCommand("setContext", `${extensionPrefix}.linkedPlugins`, await pluginHelper.getLinkedProjectPaths());
}

/**
Expand Down
28 changes: 25 additions & 3 deletions src/helpers/dataverseHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import {
customDataverseClientId,
entityDefinitionsStoreKey,
environmentTypes,
pluginAssembliesStoreKey,
pluginPackagesStoreKey,
reservedWords,
solDefinitionsStoreKey,
wrDefinitionsStoreKey,
Expand All @@ -24,6 +26,8 @@ import {
IEntityMetadata,
IOptionSet,
IOptionSetMetadata,
IPluginAssemblies,
IPluginPackages,
ISolutionComponents,
ISolutions,
IWebResource,
Expand Down Expand Up @@ -145,8 +149,8 @@ export class DataverseHelper {
this.vsstate.saveInWorkspace(connectionCurrentStoreKey, conn);
progress.report({ increment: 30, message: "Getting entity metadata..." });
await this.getEntityDefinitions();
progress.report({ increment: 70, message: "Getting web resources..." });
await this.getWebResources();
progress.report({ increment: 70, message: "Getting web resources & plugins..." });
await Promise.all([this.getWebResources(), this.getPluginAssemblies(), this.getPluginPackages()]);

vscode.commands.executeCommand("dvdt.explorer.connections.refreshConnection");
return new Promise<IConnection>((resolve) => {
Expand Down Expand Up @@ -178,7 +182,7 @@ export class DataverseHelper {
const connFromWS: IConnection = this.vsstate.getFromWorkspace(connectionCurrentStoreKey);
if (connFromWS) {
await this.getEntityDefinitions();
await this.getWebResources();
await Promise.all([this.getWebResources(), this.getPluginAssemblies(), this.getPluginPackages()]);
return connFromWS;
}
return undefined;
Expand Down Expand Up @@ -341,6 +345,24 @@ export class DataverseHelper {
vscode.commands.executeCommand("dvdt.explorer.webresources.loadWebResources");
}

/**
* Get plugin assemblies (unmanaged) from the current connection.
*/
public async getPluginAssemblies(): Promise<IPluginAssemblies | undefined> {
const respData = await this.request.requestData<IPluginAssemblies>("pluginassemblies?$select=pluginassemblyid,name&$filter=ismanaged%20eq%20false%20and%20_packageid_value%20eq%20null");
this.vsstate.saveInWorkspace(pluginAssembliesStoreKey, respData);
return respData;
}

/**
* Get plugin packages (unmanaged) from the current connection.
*/
public async getPluginPackages(): Promise<IPluginPackages | undefined> {
const respData = await this.request.requestData<IPluginPackages>("pluginpackages?$select=pluginpackageid,name&$filter=ismanaged%20eq%20false");
this.vsstate.saveInWorkspace(pluginPackagesStoreKey, respData);
return respData;
}

/**
* Gets the web resource content
* @param {string} wrId - The ID of the web resource to retrieve.
Expand Down
Loading
Loading