Skip to content
Open
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
10 changes: 10 additions & 0 deletions src/common/ecs-features/ecsFeatureGates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,13 @@ export const {
disallowedDuplicateFileHandlingOrgs: "",
}
});

export const {
feature: EnableBlogSupport
} = getFeatureConfigs({
teamName: PowerPagesClientName,
description: 'Enable blog file support in VSCode (web & desktop)',
fallback: {
enableBlogSupport: false,
}
});
2 changes: 2 additions & 0 deletions src/web/client/schema/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export enum schemaEntityName {
BASICFORMS = "basicforms",
ADVANCEDFORMS = "advancedforms",
ADVANCEDFORMSTEPS = "advancedformsteps",
BLOGS = "blogs",
}

export enum MultiFileSupportedEntityName {
Expand All @@ -63,6 +64,7 @@ export enum MultiFileSupportedEntityName {
LISTS = "lists",
BASICFORMS = "basicforms",
ADVANCEDFORMS = "advancedforms",
BLOGS = "blogs",
}

// This decides the folder hierarchy a file being displayed in File explorer will follow.
Expand Down
43 changes: 43 additions & 0 deletions src/web/client/schema/portalSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

import { ECSFeaturesClient } from "../../../common/ecs-features/ecsFeatureClient";
import { EnableBlogSupport } from "../../../common/ecs-features/ecsFeatureGates";

export const portal_schema_V1 = {
entities: {
dataSourceProperties: {
Expand Down Expand Up @@ -232,6 +235,26 @@ export const portal_schema_V1 = {
_attributes: "adx_registerstartupscript",
_attributesExtension: new Map([["adx_registerstartupscript", "advancedformstep.customjs.js"]]),
},
...(ECSFeaturesClient.getConfig(EnableBlogSupport).enableBlogSupport ? [
{
relationships: "",
_vscodeentityname: "blogs",
_dataverseenityname: "adx_blogs",
_displayname: "Blog",
_etc: "10061",
_primaryidfield: "adx_blogid",
_primarynamefield: "adx_name",
_disableplugins: "true",
_foldername: "blogs",
_exporttype: "SingleFolder",
_fetchQueryParameters:
"?$filter=adx_blogid eq {entityId}&$select=adx_name,adx_summary",
_multiFileFetchQueryParameters:
"?$filter=_adx_websiteid_value eq {websiteId} &$select=adx_name,adx_summary,adx_blogid&$count=true",
_attributes: "adx_summary",
_attributesExtension: new Map([["adx_summary", "html"]]),
},
] : []),
],
"_xmlns:xsi": "http://www.w3.org/2001/XMLSchema-instance",
},
Expand Down Expand Up @@ -470,6 +493,26 @@ export const portal_schema_V2 = {
_attributes: "content.registerstartupscript",
_attributesExtension: new Map([["content.registerstartupscript", "advancedformstep.customjs.js"]]),
},
...(ECSFeaturesClient.getConfig(EnableBlogSupport).enableBlogSupport ? [
{
relationships: "",
_vscodeentityname: "blogs",
_dataverseenityname: "adx_blogs",
_displayname: "Blog",
_etc: "10061",
_primaryidfield: "adx_blogid",
_primarynamefield: "adx_name",
_disableplugins: "true",
_foldername: "blogs",
_exporttype: "SingleFolder",
_fetchQueryParameters:
"?$filter=adx_blogid eq {entityId}&$select=adx_name,adx_summary",
_multiFileFetchQueryParameters:
"?$filter=_adx_websiteid_value eq {websiteId} &$select=adx_name,adx_summary,adx_blogid&$count=true",
_attributes: "adx_summary",
_attributesExtension: new Map([["adx_summary", "html"]]),
},
] : []),
],
},
};
3 changes: 2 additions & 1 deletion src/web/client/utilities/commonUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ export function isExtensionNeededInFileName(entity: string) {
|| entity === schemaEntityName.BASICFORMS
|| entity === schemaEntityName.WEBPAGES
|| entity === schemaEntityName.CONTENTSNIPPETS
|| entity === schemaEntityName.SERVERLOGICS;
|| entity === schemaEntityName.SERVERLOGICS
|| entity === schemaEntityName.BLOGS;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down
21 changes: 17 additions & 4 deletions src/web/client/utilities/folderHelperUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ export function getFolderSubUris(): string[] {

for (const entry of Object.entries(MultiFileSupportedEntityName)) {
const entityDetails = WebExtensionContext.schemaEntitiesMap.get(entry[1]);
const subUri = entityDetails?.get(

// Skip if entity is not in schema (e.g., blogs when feature flag is off)
if (!entityDetails) {
continue;
}

const subUri = entityDetails.get(
schemaEntityKey.FILE_FOLDER_NAME
) as string;

subUris.push(subUri);
if (subUri) {
subUris.push(subUri);
}
}

return subUris;
Expand Down Expand Up @@ -56,10 +64,15 @@ export function getRequestUrlForEntities(
for (const entry of Object.entries(MultiFileSupportedEntityName)) {
const entityDetails = WebExtensionContext.schemaEntitiesMap.get(entry[1]);

const folderName = entityDetails?.get(
// Skip if entity is not in schema (e.g., blogs when feature flag is off)
if (!entityDetails) {
continue;
}

const folderName = entityDetails.get(
schemaEntityKey.FILE_FOLDER_NAME
);
if (folderName && folderName?.length > 0) {
if (folderName && folderName.length > 0) {
const requestURL = getRequestURL(
dataverseOrgUrl,
entityDetails?.get(
Expand Down