mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
Add hideInputs query param in notebookViewer and other minor updates (#82)
* Add hideInputs query param in notebookViewer * Fix test and other minor changes * Make GalleryHeaderComponent more functional
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
import { IGalleryItem, JunoClient } from "../Juno/JunoClient";
|
||||
import * as GalleryUtils from "../Utils/GalleryUtils";
|
||||
import { GalleryHeaderComponent } from "../Explorer/Controls/Header/GalleryHeaderComponent";
|
||||
import { FileSystemUtil } from "../Explorer/Notebook/FileSystemUtil";
|
||||
|
||||
const onInit = async () => {
|
||||
initializeIcons();
|
||||
@@ -17,28 +18,34 @@ const onInit = async () => {
|
||||
const galleryViewerProps = GalleryUtils.getGalleryViewerProps(window.location.search);
|
||||
const notebookViewerProps = GalleryUtils.getNotebookViewerProps(window.location.search);
|
||||
const backNavigationText = galleryViewerProps.selectedTab && GalleryUtils.getTabTitle(galleryViewerProps.selectedTab);
|
||||
const hideInputs = notebookViewerProps.hideInputs;
|
||||
|
||||
const notebookUrl = decodeURIComponent(notebookViewerProps.notebookUrl);
|
||||
render(notebookUrl, backNavigationText);
|
||||
render(notebookUrl, backNavigationText, hideInputs);
|
||||
|
||||
const galleryItemId = notebookViewerProps.galleryItemId;
|
||||
if (galleryItemId) {
|
||||
const junoClient = new JunoClient();
|
||||
const notebook = await junoClient.getNotebook(galleryItemId);
|
||||
render(notebookUrl, backNavigationText, notebook.data);
|
||||
render(notebookUrl, backNavigationText, hideInputs, notebook.data);
|
||||
}
|
||||
};
|
||||
|
||||
const render = (notebookUrl: string, backNavigationText: string, galleryItem?: IGalleryItem) => {
|
||||
const render = (notebookUrl: string, backNavigationText: string, hideInputs: boolean, galleryItem?: IGalleryItem) => {
|
||||
const props: NotebookViewerComponentProps = {
|
||||
junoClient: galleryItem ? new JunoClient() : undefined,
|
||||
notebookUrl,
|
||||
galleryItem,
|
||||
backNavigationText,
|
||||
hideInputs,
|
||||
onBackClick: undefined,
|
||||
onTagClick: undefined
|
||||
};
|
||||
|
||||
if (galleryItem) {
|
||||
document.title = FileSystemUtil.stripExtension(galleryItem.name, "ipynb");
|
||||
}
|
||||
|
||||
const element = (
|
||||
<>
|
||||
<header>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>Notebook Viewer</title>
|
||||
<link rel="shortcut icon" href="images/CosmosDB_rgb_ui_lighttheme.ico" type="image/x-icon" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user