Skip to content

[Power Pages][Actions Hub][Code Site] Skip properties when present in powerpages.config.json #1204

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

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

Conversation

priyanshu92
Copy link
Contributor

This pull request introduces enhancements to the Power Pages code upload functionality, including improved configuration file handling, better error management, and expanded test coverage. The changes aim to make the upload process more robust and user-friendly.

Enhancements to Configuration Handling:

  • Added a new interface, IPowerPagesConfig, to define the structure of the Power Pages configuration file, and IPowerPagesConfigData to represent parsed configuration data. (src/client/power-pages/actions-hub/models/IPowerPagesConfig.ts)
  • Implemented a new readPowerPagesConfig function to read and parse the powerpages.config.json file, ensuring proper handling of missing or invalid configurations. (src/client/power-pages/actions-hub/ActionsHubCommandHandlers.ts)
  • Introduced the constant POWER_PAGES_CONFIG_FILE_NAME to standardize the configuration file name. (src/client/power-pages/actions-hub/Constants.ts)

Improvements to Code Upload Process:

  • Refactored the uploadCodeSite function to use a dynamic command builder (buildUploadCodeSiteCommand) based on the parsed configuration data, reducing hardcoded logic and improving flexibility. (src/client/power-pages/actions-hub/ActionsHubCommandHandlers.ts)

Error Management Enhancements:

  • Added error tracing for configuration parsing failures with the new event POWER_PAGES_CONFIG_PARSE_FAILED. (src/client/power-pages/actions-hub/Constants.ts)
  • Improved error handling during the upload process, including user notifications for failed operations. (src/client/power-pages/actions-hub/ActionsHubCommandHandlers.ts)

Expanded Test Coverage:

  • Added integration tests to verify the behavior of the code upload process when configuration selection is canceled or errors occur during upload. (src/client/test/Integration/power-pages/actions-hub/ActionsHubCommandHandlers.test.ts)

- ✨ Introduced IPowerPagesConfig and IPowerPagesConfigData interfaces for configuration structure.
- 🛠️ Implemented readPowerPagesConfig function to parse the powerpages.config.json file.
- 🔧 Enhanced uploadCodeSite function to utilize configuration data for building upload commands.
- 📜 Added POWER_PAGES_CONFIG_FILE_NAME constant for configuration file name.

-Priyanshu
- 🧪 Implement test for cancellation of compiledPath selection
- 🐛 Add error handling test during code site upload
- ✅ Ensure proper handling of public site visibility case sensitivity
- -Priyanshu
@priyanshu92 priyanshu92 requested review from a team as code owners May 30, 2025 06:32
@priyanshu92 priyanshu92 requested a review from Copilot May 30, 2025 06:32
@priyanshu92 priyanshu92 enabled auto-merge (squash) May 30, 2025 06:33
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Enhance the Power Pages code upload flow by using a config file to skip prompts when properties are defined, improve error handling, and add tests for cancellation and failure scenarios.

  • Introduce IPowerPagesConfig/IPowerPagesConfigData and POWER_PAGES_CONFIG_FILE_NAME constant
  • Add readPowerPagesConfig and buildUploadCodeSiteCommand, refactor uploadCodeSite
  • Add integration tests for compiledPath cancellation and upload errors

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/client/test/Integration/power-pages/actions-hub/ActionsHubCommandHandlers.test.ts Tests for skipping upload when folder selection is canceled and for error paths
src/client/power-pages/actions-hub/models/IPowerPagesConfig.ts New interfaces defining raw vs. parsed config structure
src/client/power-pages/actions-hub/Constants.ts Added POWER_PAGES_CONFIG_FILE_NAME and POWER_PAGES_CONFIG_PARSE_FAILED event
src/client/power-pages/actions-hub/ActionsHubCommandHandlers.ts Added config‐read and command‐build functions, refactored uploadCodeSite
Comments suppressed due to low confidence (1)

src/client/power-pages/actions-hub/ActionsHubCommandHandlers.ts:33

  • The implementation uses fs, path, and UTF8_ENCODING but these are not imported or defined. Add import * as fs from 'fs';, import * as path from 'path'; and ensure UTF8_ENCODING is defined or imported to prevent runtime errors.
import { IPowerPagesConfig, IPowerPagesConfigData } from './models/IPowerPagesConfig';

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