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

TreeView for PortalMetadata #981

Draft
wants to merge 15 commits into
base: main
Choose a base branch
from
Draft
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
5 changes: 4 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@
"onStartupFinished",
"workspaceContains:**/**.portalconfig",
"onDebug",
"onFileSystem:powerplatform-vfs"
"onFileSystem:powerplatform-vfs",
"onCommand:extension.openWebpage",
"onCommand:extension.openFile"
],
"capabilities": {
"untrustedWorkspaces": {
Expand Down Expand Up @@ -167,6 +169,18 @@
"dark": "src/web/client/assets/microsoftTeamsIcon/dark/microsoftTeams.svg"
}
},
{
"command": "extension.openWebpage",
"title": "Open Webpage"
},
{
"command": "extension.openFile",
"title": "Open File"
},
{
"command": "extension.activateDirectory",
"title": "Activate Directory"
},
{
"command": "powerpages.collaboration.openMail",
"title": "Open Mail",
Expand Down Expand Up @@ -944,6 +958,10 @@
}
],
"explorer": [
{
"id": "exampleView",
"name": "Example View"
},
{
"id": "powerpages.powerPagesFileExplorer",
"name": "%microsoft-powerplatform-portals.navigation-loop.powerPagesFileExplorer.title%",
Expand Down Expand Up @@ -1053,7 +1071,7 @@
"eslint": "^8.11.0",
"eslint-plugin-header": "^3.1.1",
"fancy-log": "^1.3.3",
"fs-extra": "^9.0.1",
"fs-extra": "^9.1.0",
"get-func-name": "^2.0.2",
"gulp": "^4.0.2",
"gulp-eslint": "^6.0.0",
Expand Down Expand Up @@ -1088,6 +1106,7 @@
"@fluidframework/azure-client": "^1.2.0",
"@microsoft/1ds-core-js": "4.0.5",
"@microsoft/1ds-post-js": "4.0.5",
"@maker-studio/powerportals-preview-engine": "^3.7.24",
"@microsoft/generator-powerpages": "1.21.19",
"@types/jwt-decode": "2.2.0",
"@types/node-fetch": "^2.6.2",
Expand All @@ -1100,6 +1119,7 @@
"glob": "^7.1.7",
"gpt-tokenizer": "^2.1.1",
"https-browserify": "^1.0.0",
"js-yaml": "^4.1.0",
"liquidjs": "^10.2.0",
"n-readlines": "^1.0.1",
"puppeteer-core": "^14.4.1",
Expand Down
2 changes: 1 addition & 1 deletion src/client/PortalWebView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export class PortalWebView {
return html;
}

private static getPortalRootFolder(): vscode.Uri | null {
public static getPortalRootFolder(): vscode.Uri | null {
const fileBeingEdited = vscode.window.activeTextEditor as vscode.TextEditor;
if (fileBeingEdited) {
for (let i = 0; !!(vscode.workspace.workspaceFolders) && (i < vscode.workspace.workspaceFolders?.length); i++) {
Expand Down
7 changes: 6 additions & 1 deletion src/client/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { ActiveOrgOutput } from "./pac/PacTypes";
import { telemetryEventNames } from "./telemetry/TelemetryEventNames";
import { IArtemisAPIOrgResponse } from "../common/services/Interfaces";
import { ArtemisService } from "../common/services/ArtemisService";
import { treeView } from "../common/TreeStructure/DataMapper";

let client: LanguageClient;
let _context: vscode.ExtensionContext;
Expand Down Expand Up @@ -69,6 +70,10 @@ export async function activate(
context.subscriptions.push(_telemetry);
// Logging telemetry in US cluster for unauthenticated scenario
oneDSLoggerWrapper.instantiate("us");
oneDSLoggerWrapper.getLogger().traceInfo("Instantiating tree view", {
"instantiate": performance.now()
});
await treeView();

_telemetry.sendTelemetryEvent("Start", {
"pac.userId": readUserSettings().uniqueId,
Expand Down Expand Up @@ -483,4 +488,4 @@ class CliAcquisitionContext implements ICliAcquisitionContext {
comment: ["Do not translate 'dotnet' or 'sdk'"]
});
}
}
}
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/dark/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/client/portal_fileicons/icons/dark/css.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/dark/file-submodule.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/client/portal_fileicons/icons/dark/html.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/client/portal_fileicons/icons/dark/js.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/client/portal_fileicons/icons/dark/json.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/client/portal_fileicons/icons/dark/list-flat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/dark/mp4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/dark/note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/dark/png.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/client/portal_fileicons/icons/dark/referrences.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/dark/yml.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/light/book.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/light/file-submodule.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/light/json.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/client/portal_fileicons/icons/light/list-flat.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/client/portal_fileicons/icons/light/note.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/client/power-pages/commonUtility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,16 @@ export function getRegExPattern(fileNameArray: string[]): RegExp[] {

return patterns;
}

export const findObjectIndexByProperty = (array: any, key: string, value: any): number => {
for (let i=0; i<array.length; i++) {
if (array[i][key] === value) {
return i;
}
}
return -1;
}

export const removeExtension = (fileName: string, extn: string): string => {
return fileName.slice(0, -extn.length);
}
34 changes: 34 additions & 0 deletions src/common/TreeStructure/CovertIItemToJson.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { IItem } from './TreeView/Types/Entity/IItem';

const componentTypeMap: { [key: string]: string } = {
'08': 'web-temmplates',
'07': 'content-snippets',
'015': 'basic-forms',
'017': 'lists',
'019': 'advanced-forms'
};

export function generateJsonFromIItem(item: IItem): any {
const result: any = {
label: item.label
};

if (item.children && item.children.length > 0) {
result.children = item.children.map(child => {
const childResult = generateJsonFromIItem(child);
if (item.label === 'References') {
childResult['type'] = componentTypeMap[child.component];
}
return childResult;
});
}

if (item.parentList && item.parentList.length > 0) {
result.parentList = item.parentList.map(parent => ({
type: parent.title,
label: parent.label,
}));
}

return result;
}
Loading