diff --git a/README.md b/README.md index 452de338..093c56d2 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,9 @@ Installing this extension will also make the latest Power Platform CLI (aka pac) [Power Platform CLI Exposed](https://www.youtube.com/playlist?list=PLlrxD0HtieHhEdLHxQOU96ySSZpMCyAxf) ## Release Notes +2.0.7: + - QFE for styling files load for new data model schema + 2.0.6: - QFE for styles rendering of power pages sites diff --git a/src/web/client/common/constants.ts b/src/web/client/common/constants.ts index b8c420e4..ce8e5f5f 100644 --- a/src/web/client/common/constants.ts +++ b/src/web/client/common/constants.ts @@ -84,4 +84,9 @@ export enum SurveyConstants { SURVEY_NAME = "PowerPages-NPS", EVENT_NAME = "VscodeWeb", AUTHORIZATION_ENDPOINT = "https://microsoft.onmicrosoft.com/cessurvey/user", +} + +export enum portalSchemaVersion { + V1 = "portalschemav1", + V2 = "portalschemav2", } \ No newline at end of file diff --git a/src/web/client/dal/remoteFetchProvider.ts b/src/web/client/dal/remoteFetchProvider.ts index 82f03808..a675bc05 100644 --- a/src/web/client/dal/remoteFetchProvider.ts +++ b/src/web/client/dal/remoteFetchProvider.ts @@ -9,6 +9,8 @@ import { GetFileContent, GetFileNameWithExtension, getSanitizedFileName, + isPortalVersionV1, + isPortalVersionV2, isWebfileContentLoadNeeded, setFileContent, } from "../utilities/commonUtil"; @@ -515,11 +517,11 @@ async function fetchMappingEntityContent( const result = await response.json(); const data = result.value ?? result; - if (result[Constants.ODATA_COUNT] !== 0 && data.length >= 1) { + if (isPortalVersionV1() && result[Constants.ODATA_COUNT] > 0 && data.length > 0) { return data[0]; } - return data ?? Constants.NO_CONTENT; + return isPortalVersionV2() ? data : Constants.NO_CONTENT; } export async function preprocessData( diff --git a/src/web/client/utilities/commonUtil.ts b/src/web/client/utilities/commonUtil.ts index 43960686..170137b8 100644 --- a/src/web/client/utilities/commonUtil.ts +++ b/src/web/client/utilities/commonUtil.ts @@ -9,7 +9,8 @@ import { DATA, MULTI_FILE_FEATURE_SETTING_NAME, NO_CONTENT, - VERSION_CONTROL_FOR_WEB_EXTENSION_SETTING_NAME + VERSION_CONTROL_FOR_WEB_EXTENSION_SETTING_NAME, + portalSchemaVersion } from "../common/constants"; import { IAttributePath } from "../common/interfaces"; import { schemaEntityName } from "../schema/constants"; @@ -168,4 +169,12 @@ export function isWebfileContentLoadNeeded(fileName: string, fsPath: string): bo return fileExtension !== undefined ? validImageExtensions.includes(fileExtension.toLowerCase()) || doesFileExist(fsPath) : false; +} + +export function isPortalVersionV1(): boolean { + return WebExtensionContext.currentSchemaVersion.toLowerCase() === portalSchemaVersion.V1; +} + +export function isPortalVersionV2(): boolean { + return WebExtensionContext.currentSchemaVersion.toLowerCase() === portalSchemaVersion.V2; } \ No newline at end of file