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

Introducing interfaces & context class structure for portal metadata #1033

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
104 changes: 104 additions & 0 deletions src/common/portal-metadata-context/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/


import * as vscode from 'vscode';

export interface IPortalMetadata {
webpages?: IWebpage[];
contentSnippets?: IContentSnippet[];
webTemplates?: IWebTemplate[];
webFiles?: IWebFile[];
entityLists?: IEntityList[];
entityForms?: IEntityForm[];
webForms?: IWebForm[];
website?: IWebsite;
pageTemplates?: IPageTemplate[];
}

export interface IWebsite {
adx_name: string;
adx_defaultlanguage: string;
adx_headerwebtemplateid?: string;
adx_websiteid: string;
adx_website_language: number;
adx_footerwebtemplateid?: string;
}

export interface IPageTemplate {
adx_webtemplateid?: string;
adx_name: string;
adx_type?: number;
adx_pagetemplateid: string;
}

export interface IWebFile {
adx_name: string;
adx_parentpageid?: string;
adx_webfileid: string;
}

export interface IContentSnippet {
adx_value?: string;
adx_name: string;
adx_contentsnippetlanguageid?: string;
adx_contentsnippetid: string;
}

export interface IWebTemplate {
adx_source?: string;
adx_webtemplateid: string;
adx_name: string;
}

export interface IWebpage {
adx_customcss?: string;
adx_entityform?: string;
adx_webpagelanguageid?: string;
adx_image?: string;
adx_webform?: string;
adx_customjavascript?: string;
adx_isroot: boolean;
adx_summary?: string;
adx_parentpageid?: string;
adx_entitylist?: string;
adx_name: string;
adx_pagetemplateid: string;
adx_copy?: string;
adx_rootwebpageid?: string;
adx_webpageid: string;
}


export interface IEntityList {
adx_registerstartupscript?: string;
adx_entitylistid: string;
adx_name: string;
}

export interface IWebForm {
adx_name: string;
adx_webformid: string;
adx_startstep?: string;
}

export interface IEntityForm {
adx_entityformid: string;
adx_name: string;
adx_registerstartupscript?: string;
}

export interface IContextItem {
Copy link
Contributor

Choose a reason for hiding this comment

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

lets rename this to IPortalMetaDataContext

label: string;
title: string;
id: string;
isFile: boolean;
content: string;
path?: vscode.Uri;
component: string;
children: IContextItem[];
error: string;
parentList: IContextItem[];
}
37 changes: 37 additions & 0 deletions src/common/portal-metadata-context/PortalMetadataContext.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*/

import { IContextItem, IPortalMetadata } from "./Interfaces";

export class PortalMetadataContext {

private portalMetadata: IPortalMetadata;
private portalMetadataContext: IContextItem;
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be an array right?



public getPortalMetadataContext() {
Copy link
Contributor

Choose a reason for hiding this comment

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

lets have a set funciton for initilization here - also this should be a singleton class -check WebExtensionContext for referecen

// returns portalMetadataContext
}

public onFileUpdate() {
// updates metadatacontext when file updates
}

private updatePortalMetadataContext() {
// updates portalMetadataContext
}

private updatePortalMetadata() {
Copy link
Contributor

Choose a reason for hiding this comment

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

we need get/set for portalMetadata too in addtion to update. Moreover update should target at more granular updates and not entire list reset

// updates portalMetadata
}

private createPortalMetadataContext() {
Copy link
Contributor

Choose a reason for hiding this comment

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

create is not the right terminology - lets use get/set/update for both of these members and use singleton class as suggested above.

// creates portalMetadataContext
}

private createPortalMetadata() {
// creates portalMetadata
}
}
Loading