mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +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
@@ -36,6 +36,7 @@ export interface IGalleryItem {
|
||||
downloads: number;
|
||||
favorites: number;
|
||||
views: number;
|
||||
newCellId: string;
|
||||
}
|
||||
|
||||
export interface IUserGallery {
|
||||
@@ -162,7 +163,7 @@ export class JunoClient {
|
||||
return this.getNotebooks(`${this.getNotebooksUrl()}/gallery/public`);
|
||||
}
|
||||
|
||||
public async getNotebook(id: string): Promise<IJunoResponse<IGalleryItem>> {
|
||||
public async getNotebookInfo(id: string): Promise<IJunoResponse<IGalleryItem>> {
|
||||
const response = await window.fetch(this.getNotebookInfoUrl(id));
|
||||
|
||||
let data: IGalleryItem;
|
||||
@@ -292,19 +293,31 @@ export class JunoClient {
|
||||
tags: string[],
|
||||
author: string,
|
||||
thumbnailUrl: string,
|
||||
content: string
|
||||
content: string,
|
||||
isLinkInjectionEnabled: boolean
|
||||
): Promise<IJunoResponse<IGalleryItem>> {
|
||||
const response = await window.fetch(`${this.getNotebooksAccountUrl()}/gallery`, {
|
||||
method: "PUT",
|
||||
headers: JunoClient.getHeaders(),
|
||||
body: JSON.stringify({
|
||||
name,
|
||||
description,
|
||||
tags,
|
||||
author,
|
||||
thumbnailUrl,
|
||||
content: JSON.parse(content)
|
||||
} as IPublishNotebookRequest)
|
||||
|
||||
body: isLinkInjectionEnabled
|
||||
? JSON.stringify({
|
||||
name,
|
||||
description,
|
||||
tags,
|
||||
author,
|
||||
thumbnailUrl,
|
||||
content: JSON.parse(content),
|
||||
addLinkToNotebookViewer: isLinkInjectionEnabled
|
||||
} as IPublishNotebookRequest)
|
||||
: JSON.stringify({
|
||||
name,
|
||||
description,
|
||||
tags,
|
||||
author,
|
||||
thumbnailUrl,
|
||||
content: JSON.parse(content)
|
||||
} as IPublishNotebookRequest)
|
||||
});
|
||||
|
||||
let data: IGalleryItem;
|
||||
|
||||
Reference in New Issue
Block a user