-
Notifications
You must be signed in to change notification settings - Fork 54
[PowerPages][create-site] Preview and Edit Site Page and Command Registration #1061
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
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b5eff91
Enhance CreateSiteCommand to include extension context and add Readon…
17aaad6
Implement EditableFileSystemProvider for site page editing and update…
b9d7301
Integrate CreateSiteCommand into CommandRegistry and update related c…
8b32d09
Disable copy functionality in EditableFileSystemProvider implementation
2636dcd
Remove ReadonlyFileSystemProvider implementation
7b26d08
Add telemetry constant for previewing site pages and refactor related…
66240c4
Refactor CommandRegistry and add command registration utility for cha…
255c97e
Add constants for site creation parameters and refactor NL2SiteServic…
7653622
Refactor CreateSiteCommand and CreateSiteHelper to use structured opt…
537414c
Add error telemetry constant for previewing site pages and handle err…
0f73785
Rename fileContentMap to _fileContentMap for consistency and clarity …
ec005a6
Remove unused getUpdatedPageContent function from CreateSiteHelper to…
fd3bbe3
Merge branch 'main' into users/amitjoshi/sitePreviewInChat
amitjoshi438 15c8842
Add ESLint disable comments for any type usage in CreateSiteHelper an…
1ddcfd0
Merge branch 'users/amitjoshi/sitePreviewInChat' of https://github.co…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/common/chat-participants/powerpages/commands/create-site/CreateSiteConstants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /* | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| */ | ||
|
|
||
| export const EDITABLE_SCHEME = 'editable'; | ||
| export const ENGLISH = "English"; | ||
| export const MIN_PAGES = 7; | ||
| export const MAX_PAGES = 7; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/common/chat-participants/powerpages/commands/create-site/CreateSiteTypes.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| /* | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| */ | ||
|
|
||
| import { ITelemetry } from "../../../../OneDSLoggerTelemetry/telemetry/ITelemetry"; | ||
| import * as vscode from 'vscode'; | ||
|
|
||
| export interface ICreateSiteOptions { | ||
| intelligenceEndpoint: string; | ||
| intelligenceApiToken: string; | ||
| userPrompt: string; | ||
| sessionId: string; | ||
| stream: vscode.ChatResponseStream; | ||
| telemetry: ITelemetry; | ||
| orgId: string; | ||
| envId: string; | ||
| userId: string; | ||
| extensionContext: vscode.ExtensionContext; | ||
| } | ||
|
|
||
| export interface IPreviewSitePagesContentOptions { | ||
| // siteName: string; | ||
| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| sitePages: any[]; | ||
| stream: vscode.ChatResponseStream; | ||
| extensionContext: vscode.ExtensionContext; | ||
| telemetry: ITelemetry; | ||
| sessionId: string; | ||
| orgId: string; | ||
| envId: string; | ||
| userId: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /* | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.txt in the project root for license information. | ||
| */ | ||
|
|
||
| /* eslint-disable @typescript-eslint/no-unused-vars */ | ||
|
|
||
| import * as vscode from 'vscode'; | ||
|
|
||
|
|
||
| export class EditableFileSystemProvider implements vscode.FileSystemProvider { | ||
| private _fileContentMap: { [key: string]: Uint8Array } = {}; | ||
| private _onDidChangeEmitter = new vscode.EventEmitter<vscode.FileChangeEvent[]>(); | ||
| readonly onDidChangeFile = this._onDidChangeEmitter.event; | ||
|
|
||
| watch(uri: vscode.Uri, options: { readonly recursive: boolean; readonly excludes: readonly string[]; }): vscode.Disposable { | ||
| // For simplicity, this implementation does not support file watching. | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-function | ||
| return new vscode.Disposable(() => {}); | ||
| } | ||
|
|
||
| copy(source: vscode.Uri, destination: vscode.Uri, options: { readonly overwrite: boolean; }): void | Thenable<void> { | ||
| // Copy is not supported in this implementation | ||
| } | ||
|
|
||
| // Read file content | ||
| readFile(uri: vscode.Uri): Uint8Array { | ||
| const filePath = uri.path; | ||
| return this._fileContentMap[filePath] || new Uint8Array(); | ||
| } | ||
|
|
||
| // Write file content | ||
| writeFile(uri: vscode.Uri, content: Uint8Array): void { | ||
| const filePath = uri.path; | ||
| this._fileContentMap[filePath] = content; | ||
| this._onDidChangeEmitter.fire([{ type: vscode.FileChangeType.Changed, uri }]); | ||
| } | ||
|
|
||
| // Other required methods for FileSystemProvider | ||
| stat(uri: vscode.Uri): vscode.FileStat { | ||
| return { type: vscode.FileType.File, ctime: Date.now(), mtime: Date.now(), size: this._fileContentMap[uri.path]?.length || 0 }; | ||
| } | ||
|
|
||
| readDirectory(uri: vscode.Uri): [string, vscode.FileType][] { | ||
| return []; | ||
| } | ||
|
|
||
| // eslint-disable-next-line @typescript-eslint/no-empty-function | ||
| createDirectory(uri: vscode.Uri): void {} | ||
|
|
||
| delete(uri: vscode.Uri): void { | ||
| // Delete is not supported in this implementation | ||
| } | ||
|
|
||
| rename(oldUri: vscode.Uri, newUri: vscode.Uri, options: { readonly overwrite: boolean; }): void { | ||
| // Rename is not supported in this implementation | ||
| } | ||
|
|
||
| // Method to get file content as string | ||
| getFileContent(uri: vscode.Uri): string { | ||
| const filePath = uri.path; | ||
| const content = this._fileContentMap[filePath]; | ||
| return content ? Buffer.from(content).toString('utf8') : ''; | ||
| } | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.