Skip to content

Commit

Permalink
Switch Auth Panel to use Universal profiles (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
tehcrashxor authored Jun 10, 2022
1 parent ddfcde7 commit 17986da
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 38 deletions.
8 changes: 4 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,13 @@ async function snapshot() {
process.chdir(orgDir);
}
}
const cliVersion = '1.15.3';
const cliVersion = '1.15.7-daily-22060700';

const recompile = gulp.series(
clean,
async () => nugetInstall('CAP_ISVExp_Tools_Stable', 'Microsoft.PowerApps.CLI',cliVersion, path.resolve(distdir, 'pac')),
async () => nugetInstall('CAP_ISVExp_Tools_Stable', 'Microsoft.PowerApps.CLI.Core.osx-x64', cliVersion, path.resolve(distdir, 'pac')),
async () => nugetInstall('CAP_ISVExp_Tools_Stable', 'Microsoft.PowerApps.CLI.Core.linux-x64', cliVersion, path.resolve(distdir, 'pac')),
async () => nugetInstall('CAP_ISVExp_Tools_Daily', 'Microsoft.PowerApps.CLI',cliVersion, path.resolve(distdir, 'pac')),
async () => nugetInstall('CAP_ISVExp_Tools_Daily', 'Microsoft.PowerApps.CLI.Core.osx-x64', cliVersion, path.resolve(distdir, 'pac')),
async () => nugetInstall('CAP_ISVExp_Tools_Daily', 'Microsoft.PowerApps.CLI.Core.linux-x64', cliVersion, path.resolve(distdir, 'pac')),
translationsExport,
translationsImport,
translationsGenerate,
Expand Down
12 changes: 3 additions & 9 deletions loc/translations-export/vscode-powerplatform.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
</trans-unit>
<trans-unit id="pacCLI.authPanel.welcome.whenInteractiveSupported">
<source xml:lang="en">No auth profiles found on this computer.
[Add Dataverse Auth Profile](command:pacCLI.authPanel.newDataverseAuthProfile)</source>
[Add Auth Profile](command:pacCLI.authPanel.newAuthProfile)</source>
<note>This is a Markdown formatted string, and the formatting must persist across translations.
The second line should be '[TRANSLATION HERE](command:pacCLI.authPanel.newDataverseAuthProfile)', keeping brackets and the text in the parentheses unmodified</note>
The second line should be '[TRANSLATION HERE](command:pacCLI.authPanel.newAuthProfile)', keeping brackets and the text in the parentheses unmodified</note>
</trans-unit>
<trans-unit id="pacCLI.authPanel.welcome.whenInteractiveNotSupported">
<source xml:lang="en">No auth profiles found on this computer.
Expand All @@ -55,7 +55,7 @@ The third line should be '[TRANSLATION HERE](command:pacCLI.pacAuthHelp)', keepi
<source xml:lang="en">Refresh</source>
</trans-unit>
<trans-unit id="pacCLI.authPanel.newDataverseAuthProfile.title">
<source xml:lang="en">New Dataverse Auth Profile</source>
<source xml:lang="en">New Auth Profile</source>
</trans-unit>
<trans-unit id="pacCLI.authPanel.selectAuthProfile.title">
<source xml:lang="en">Select Auth Profile</source>
Expand Down Expand Up @@ -126,12 +126,6 @@ The third line should be '[TRANSLATION HERE](command:pacCLI.pacAuthHelp)', keepi
<trans-unit id="pacCLI.authPanel.clearAuthProfile.cancel">
<source xml:lang="en">Cancel</source>
</trans-unit>
<trans-unit id="pacCLI.authPanel.newDataverseAuthProfile.title">
<source xml:lang="en">Create new Dataverse Auth Profile</source>
</trans-unit>
<trans-unit id="pacCLI.authPanel.newDataverseAuthProfile.prompt">
<source xml:lang="en">Enter Environment URL</source>
</trans-unit>
<trans-unit id="pacCLI.authPanel.deleteAuthProfile.confirm">
<source xml:lang="en">Confirm</source>
</trans-unit>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"icon": "$(refresh)"
},
{
"command": "pacCLI.authPanel.newDataverseAuthProfile",
"command": "pacCLI.authPanel.newAuthProfile",
"category": "Power Platform CLI",
"title": "%pacCLI.authPanel.newDataverseAuthProfile.title%",
"icon": "$(add)"
Expand Down Expand Up @@ -244,7 +244,7 @@
"when": "never"
},
{
"command": "pacCLI.authPanel.newDataverseAuthProfile",
"command": "pacCLI.authPanel.newAuthProfile",
"when": "pacCLI.authPanel.interactiveLoginSupported"
},
{
Expand Down Expand Up @@ -302,7 +302,7 @@
],
"view/title": [
{
"command": "pacCLI.authPanel.newDataverseAuthProfile",
"command": "pacCLI.authPanel.newAuthProfile",
"when": "view == pacCLI.authPanel && pacCLI.authPanel.interactiveLoginSupported",
"group": "navigation@0"
},
Expand Down
8 changes: 4 additions & 4 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

"pacCLI.authPanel.title": "Auth Profiles",
"pacCLI.authPanel.welcome.whenInteractiveSupported": {
"message": "No auth profiles found on this computer.\n[Add Dataverse Auth Profile](command:pacCLI.authPanel.newDataverseAuthProfile)",
"message": "No auth profiles found on this computer.\n[Add Auth Profile](command:pacCLI.authPanel.newAuthProfile)",
"comment": [
"This is a Markdown formatted string, and the formatting must persist across translations.",
"The second line should be '[TRANSLATION HERE](command:pacCLI.authPanel.newDataverseAuthProfile)', keeping brackets and the text in the parentheses unmodified"
"The second line should be '[TRANSLATION HERE](command:pacCLI.authPanel.newAuthProfile)', keeping brackets and the text in the parentheses unmodified"
]
},
"pacCLI.authPanel.welcome.whenInteractiveNotSupported": {
Expand All @@ -25,12 +25,12 @@
"This is a Markdown formatted string, and the formatting must persist across translations.",
"The second line should not translate the argument `--deviceCode`",
"The third line should be '[TRANSLATION HERE](command:pacCLI.pacAuthHelp)', keeping brackets and the text in the parentheses unmodified"

]
},
"pacCLI.authPanel.clearAuthProfile.title": "Clear Auth Profiles",
"pacCLI.authPanel.refresh.title": "Refresh",
"pacCLI.authPanel.newDataverseAuthProfile.title": "New Dataverse Auth Profile",
"pacCLI.authPanel.newDataverseAuthProfile.title": "New Auth Profile",
"pacCLI.authPanel.selectAuthProfile.title": "Select Auth Profile",
"pacCLI.authPanel.deleteAuthProfile.title": "Delete Auth Profile",
"pacCLI.authPanel.nameAuthProfile.title": "Name/Rename Auth Profile",
Expand Down
15 changes: 4 additions & 11 deletions src/client/lib/PacActivityBarUI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,10 @@ export function RegisterPanels(pacWrapper: PacWrapper): vscode.Disposable[] {
envAndSolutionPanel.refresh();
}
}),
vscode.commands.registerCommand("pacCLI.authPanel.newDataverseAuthProfile", async () => {
const environmentUrl = await vscode.window.showInputBox({
title: localize("pacCLI.authPanel.newDataverseAuthProfile.title", "Create new Dataverse Auth Profile"),
prompt: localize("pacCLI.authPanel.newDataverseAuthProfile.prompt", "Enter Environment URL"),
placeHolder: "https://example.crm.dynamics.com/"
});
if (environmentUrl) {
await pacWrapper.authCreateNewDataverseProfile(environmentUrl);
authPanel.refresh();
envAndSolutionPanel.refresh();
}
vscode.commands.registerCommand("pacCLI.authPanel.newAuthProfile", async () => {
await pacWrapper.authCreateNewAuthProfile();
authPanel.refresh();
envAndSolutionPanel.refresh();
}),
vscode.commands.registerCommand("pacCLI.authPanel.selectAuthProfile", async (item: AuthProfileTreeItem) => {
await pacWrapper.authSelectByIndex(item.model.Index);
Expand Down
2 changes: 1 addition & 1 deletion src/client/lib/PanelComponents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class AuthProfileTreeItem extends vscode.TreeItem {
private static createLabel(profile: AuthProfileListing): string {
if (profile.Name) {
return `${profile.Kind}: ${profile.Name}`;
} else if (profile.Kind === "ADMIN") {
} else if (profile.Kind === "ADMIN" || profile.Kind === "UNIVERSAL") {
return `${profile.Kind}: ${profile.User}`;
} else {
return `${profile.Kind}: ${profile.Resource}`;
Expand Down
8 changes: 2 additions & 6 deletions src/client/pac/PacWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,9 @@ export class PacWrapper {
return this.executeCommandAndParseResults<PacAuthListOutput>(new PacArguments("auth", "list"));
}

public async authCreateNewDataverseProfile(environmentUrl: string): Promise<PacAuthListOutput> {
public async authCreateNewAuthProfile(): Promise<PacAuthListOutput> {
return this.executeCommandAndParseResults<PacAuthListOutput>(
new PacArguments("auth", "create", "--kind", "DATAVERSE", "--url", environmentUrl));
}

public async authCreateNewAdminProfile(): Promise<PacAuthListOutput> {
return this.executeCommandAndParseResults<PacAuthListOutput>(new PacArguments("auth", "create", "--kind", "ADMIN"));
new PacArguments("auth", "create"));
}

public async authSelectByIndex(index: number): Promise<PacOutput>{
Expand Down

0 comments on commit 17986da

Please sign in to comment.