mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-22 10:21:37 +00:00
Added support for notebook viewer link injection (#124)
* Added support for notebook viewer link injection * updated tests
This commit is contained in:
committed by
GitHub
parent
455a6ac81b
commit
95f1efc03f
@@ -26,6 +26,7 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
|
||||
private imageSrc: string;
|
||||
private notebookObject: ImmutableNotebook;
|
||||
private parentDomElement: HTMLElement;
|
||||
private isLinkInjectionEnabled: boolean;
|
||||
|
||||
constructor(private container: Explorer, private junoClient: JunoClient) {
|
||||
this.parameters = ko.observable(Date.now());
|
||||
@@ -62,19 +63,21 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
|
||||
name: string,
|
||||
author: string,
|
||||
notebookContent: string | ImmutableNotebook,
|
||||
parentDomElement: HTMLElement
|
||||
parentDomElement: HTMLElement,
|
||||
isLinkInjectionEnabled: boolean
|
||||
): void {
|
||||
this.name = name;
|
||||
this.author = author;
|
||||
if (typeof notebookContent === "string") {
|
||||
this.content = notebookContent as string;
|
||||
} else {
|
||||
this.content = JSON.stringify(toJS(notebookContent as ImmutableNotebook));
|
||||
this.content = JSON.stringify(toJS(notebookContent));
|
||||
this.notebookObject = notebookContent;
|
||||
}
|
||||
this.parentDomElement = parentDomElement;
|
||||
|
||||
this.isOpened = true;
|
||||
this.isLinkInjectionEnabled = isLinkInjectionEnabled;
|
||||
this.triggerRender();
|
||||
}
|
||||
|
||||
@@ -102,7 +105,8 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
|
||||
this.tags?.split(","),
|
||||
this.author,
|
||||
this.imageSrc,
|
||||
this.content
|
||||
this.content,
|
||||
this.isLinkInjectionEnabled
|
||||
);
|
||||
if (!response.data) {
|
||||
throw new Error(`Received HTTP ${response.status} when publishing ${name} to gallery`);
|
||||
|
||||
Reference in New Issue
Block a user