Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PowerPages][Desktop]Fetch and Add Current Environment to Action Hub Tree #1098

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

amitjoshi438
Copy link
Contributor

@amitjoshi438 amitjoshi438 commented Jan 24, 2025

This pull request introduces several changes to the ActionsHubTreeDataProvider class, localization files, and related tests. The most significant updates include adding support for the PacTerminal in the ActionsHubTreeDataProvider, updating localization strings, and enhancing error handling and logging.

Key Changes:

Enhancements to ActionsHubTreeDataProvider:

  • Modified initializeActionsHub and ActionsHubTreeDataProvider to include PacTerminal as a parameter, enabling the retrieval of environment information. (src/client/extension.ts, src/client/power-pages/actions-hub/ActionsHubTreeDataProvider.ts) [1] [2] [3]
  • Enhanced getChildren method to fetch and display environment information, with improved error handling and logging. (src/client/power-pages/actions-hub/ActionsHubTreeDataProvider.ts)

Localization Updates:

  • Added new localization string "No environments found" to bundle.l10n.json and vscode-powerplatform.xlf. (l10n/bundle.l10n.json, loc/translations-export/vscode-powerplatform.xlf) [1] [2]
  • Updated Constants.ts to include NO_ENVIRONMENTS_FOUND and ACTIONS_HUB_CURRENT_ENV_FETCH_FAILED for better localization and logging. (src/client/power-pages/actions-hub/Constants.ts)

Testing Improvements:

  • Added comprehensive tests for ActionsHubTreeDataProvider to verify initialization, tree item retrieval, error handling, and disposal of disposables. (src/client/test/Integration/power-pages/actions-hub/ActionsHubTreeDataProvider.test.ts)

Telemetry Constants:

  • Introduced OrganizationFriendlyNameKey to the telemetry constants for better identification of organization-friendly names. (src/common/OneDSLoggerTelemetry/telemetryConstants.ts)

@amitjoshi438 amitjoshi438 requested review from a team as code owners January 24, 2025 09:14
@amitjoshi438 amitjoshi438 enabled auto-merge (squash) January 24, 2025 09:14
@amitjoshi438 amitjoshi438 changed the title Enhance Actions Hub with environment support and unit tests [PowerPages][Desktop]Fetch and Add Current Environment to Action Hub Tree Jan 24, 2025

import { AuthInfo } from "./power-pages/actions-hub/Constants";

class AuthManager {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename this to PacAuthManager since it only manager pac auth?

Comment on lines +6 to +12
import { expect } from "chai";
import * as sinon from "sinon";
import * as vscode from "vscode";
import { ActionsHubTreeDataProvider } from "../../../../power-pages/actions-hub/ActionsHubTreeDataProvider";
import { oneDSLoggerWrapper } from "../../../../../common/OneDSLoggerTelemetry/oneDSLoggerWrapper";
import { Constants } from "../../../../power-pages/actions-hub/Constants";
import { EnvironmentGroupTreeItem } from "../../../../power-pages/actions-hub/tree-items/EnvironmentGroupTreeItem";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: formatting

Comment on lines +37 to +54
export interface AuthInfo {
userType: string;
cloud: string;
tenantId: string;
tenantCountry: string;
user: string;
entraIdObjectId: string;
puid: string;
userCountryRegion: string;
tokenExpires: string;
authority: string;
environmentGeo: string;
environmentId: string;
environmentType: string;
organizationId: string;
organizationUniqueName: string;
organizationFriendlyName: string;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to move this next to AuthManager.ts since it's applicable at Power Platform level. What do you think?

oneDSLoggerWrapper.getLogger().traceInfo(Constants.EventNames.ACTIONS_HUB_INITIALIZED);

return actionsHubTreeDataProvider;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for changing the return type here?

@@ -9,6 +9,7 @@ import { IEnvironmentInfo } from "../models/IEnvironmentInfo";
import { Constants } from "../Constants";

export class EnvironmentGroupTreeItem extends ActionsHubTreeItem {
environmentInfo: any;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason for this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants