mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Initial transfer from ADO (#13)
This commit is contained in:
11
src/NotebookViewer/NotebookViewer.less
Normal file
11
src/NotebookViewer/NotebookViewer.less
Normal file
@@ -0,0 +1,11 @@
|
||||
@import "../../../../less/Common/Constants";
|
||||
|
||||
.notebookComponentContainer {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
margin: 0px;
|
||||
overflow-x: hidden;
|
||||
font-family: @DataExplorerFont;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
43
src/NotebookViewer/NotebookViewer.tsx
Normal file
43
src/NotebookViewer/NotebookViewer.tsx
Normal file
@@ -0,0 +1,43 @@
|
||||
import React from "react";
|
||||
import * as ReactDOM from "react-dom";
|
||||
import "bootstrap/dist/css/bootstrap.css";
|
||||
import { NotebookMetadata } from "../Contracts/DataModels";
|
||||
import { NotebookViewerComponent } from "../Explorer/Controls/NotebookViewer/NotebookViewerComponent";
|
||||
import { SessionStorageUtility, StorageKey } from "../Shared/StorageUtility";
|
||||
|
||||
const getNotebookUrl = (): string => {
|
||||
const regex: RegExp = new RegExp("[?&]notebookurl=([^&#]*)|&|#|$");
|
||||
const results: RegExpExecArray | null = regex.exec(window.location.href);
|
||||
if (!results || !results[1]) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return decodeURIComponent(results[1]);
|
||||
};
|
||||
|
||||
const onInit = async () => {
|
||||
var notebookMetadata: NotebookMetadata;
|
||||
const notebookMetadataString = SessionStorageUtility.getEntryString(StorageKey.NotebookMetadata);
|
||||
const notebookName = SessionStorageUtility.getEntryString(StorageKey.NotebookName);
|
||||
|
||||
if (notebookMetadataString == "null" || notebookMetadataString != null) {
|
||||
notebookMetadata = (await JSON.parse(notebookMetadataString)) as NotebookMetadata;
|
||||
SessionStorageUtility.removeEntry(StorageKey.NotebookMetadata);
|
||||
SessionStorageUtility.removeEntry(StorageKey.NotebookName);
|
||||
}
|
||||
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
|
||||
const notebookViewerComponent = (
|
||||
<NotebookViewerComponent
|
||||
notebookMetadata={notebookMetadata}
|
||||
notebookName={notebookName}
|
||||
notebookUrl={getNotebookUrl()}
|
||||
hideInputs={urlParams.get("hideinputs") === "true"}
|
||||
/>
|
||||
);
|
||||
ReactDOM.render(notebookViewerComponent, document.getElementById("notebookContent"));
|
||||
};
|
||||
|
||||
// Entry point
|
||||
window.addEventListener("load", onInit);
|
||||
13
src/NotebookViewer/notebookViewer.html
Normal file
13
src/NotebookViewer/notebookViewer.html
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="height=device-height, width=device-width, initial-scale=1.0" />
|
||||
|
||||
<title>Notebook Viewer</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="notebookComponentContainer" id="notebookContent"></div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user