-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge notebooks frontend to observability (#109)
- Loading branch information
1 parent
7f699c0
commit a059f2a
Showing
93 changed files
with
14,484 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains 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 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,29 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
export const NOTEBOOKS_API_PREFIX = '/api/observability/notebooks'; | ||
export const NOTEBOOKS_SELECTED_BACKEND = 'DEFAULT'; // ZEPPELIN || DEFAULT | ||
export const NOTEBOOKS_FETCH_SIZE = 1000; | ||
export const CREATE_NOTE_MESSAGE = 'Enter a name to describe the purpose of this notebook.'; | ||
export const NOTEBOOKS_DOCUMENTATION_URL = 'https://opensearch.org/docs/dashboards/notebooks/'; | ||
|
||
export const zeppelinURL = 'http://localhost:8080'; | ||
|
||
export const wreckOptions = { | ||
baseUrl: zeppelinURL, | ||
headers: { 'Content-Type': 'application/json' }, | ||
}; | ||
|
||
const BASE_NOTEBOOKS_URI = '/_plugins/_notebooks'; | ||
export const OPENSEARCH_NOTEBOOKS_API = { | ||
GET_NOTEBOOKS: `${BASE_NOTEBOOKS_URI}/notebooks`, | ||
NOTEBOOK: `${BASE_NOTEBOOKS_URI}/notebook`, | ||
}; |
This file contains 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 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,59 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { RefObject } from 'react'; | ||
import { DashboardStart } from "../../../../src/plugins/dashboard/public"; | ||
import { NavigationPublicPluginStart } from "../../../../src/plugins/navigation/public"; | ||
|
||
export interface NotebooksPluginSetup { | ||
getGreeting: () => string; | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface NotebooksPluginStart {} | ||
|
||
export interface optionsType { | ||
baseUrl: string; | ||
payload?: any; | ||
headers?: any; | ||
redirects?: number; | ||
beforeRedirect?: any; | ||
redirected?: any; | ||
timeout?: number; // default: unlimited | ||
maxBytes?: number; // default: unlimited | ||
rejectUnauthorized?: boolean; | ||
secureProtocol?: string; // The SSL method to use | ||
ciphers?: string; // The TLS ciphers to support | ||
} | ||
|
||
export type ParaType = { | ||
uniqueId: string; | ||
isRunning: boolean; | ||
inQueue: boolean; | ||
isSelected: boolean; | ||
isInputHidden: boolean; | ||
isOutputHidden: boolean; | ||
showAddPara: boolean; | ||
isVizualisation: boolean; | ||
vizObjectInput: string; | ||
id: number; | ||
inp: string; | ||
lang: string; | ||
editorLanguage: string; | ||
typeOut: Array<string>; | ||
out: any[]; | ||
isInputExpanded: boolean; | ||
isOutputStale: boolean; | ||
paraRef: RefObject<React.ReactElement>; | ||
paraDivRef: RefObject<HTMLDivElement>; | ||
visStartTime?: string; | ||
visEndTime?: string; | ||
visSavedObjId?: string; | ||
}; |
This file contains 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 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 |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
"urlForwarding", | ||
"navigation", | ||
"uiActions", | ||
"dashboard", | ||
"visualizations" | ||
] | ||
} |
This file contains 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 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 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 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
65 changes: 65 additions & 0 deletions
65
public/components/notebooks/components/__test__/default_parser.test.tsx
This file contains 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 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
*/ | ||
|
||
import { defaultParagraphParser } from '../helpers/default_parser'; | ||
import { | ||
sampleNotebook1, | ||
sampleNotebook2, | ||
sampleNotebook3, | ||
sampleNotebook4, | ||
sampleNotebook5, | ||
sampleParsedParagraghs1, | ||
sampleParsedParagraghs2, | ||
} from './sampleDefaultNotebooks'; | ||
|
||
// Perfect schema | ||
describe('Testing default backend parser function with perfect schema', () => { | ||
test('defaultParagraphParserTest1', (done) => { | ||
const parsedParagraphs1 = defaultParagraphParser(sampleNotebook1.paragraphs); | ||
const parsedParagraphs2 = defaultParagraphParser(sampleNotebook2.paragraphs); | ||
const parsedParagraphs3 = defaultParagraphParser([]); | ||
expect(parsedParagraphs1).toEqual(sampleParsedParagraghs1); | ||
expect(parsedParagraphs2).toEqual(sampleParsedParagraghs2); | ||
expect(parsedParagraphs3).toEqual([]); | ||
done(); | ||
}); | ||
}); | ||
|
||
// Issue in schema | ||
describe('Testing default backend parser function with wrong schema', () => { | ||
test('defaultParagraphParserTest2', (done) => { | ||
expect(() => { | ||
const parsedParagraphs1 = defaultParagraphParser(sampleNotebook3.paragraphs); | ||
}).toThrow(Error); | ||
expect(() => { | ||
const parsedParagraphs2 = defaultParagraphParser(sampleNotebook4.paragraphs); | ||
}).toThrow(Error); | ||
expect(() => { | ||
const parsedParagraphs3 = defaultParagraphParser(sampleNotebook5.paragraphs); | ||
}).toThrow(Error); | ||
done(); | ||
}); | ||
}); |
Oops, something went wrong.