Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
226 commits
Select commit Hold shift + click to select a range
1a1a572
intial commit for UI framework for integrations
derek-ho Mar 8, 2023
e441589
make organized
derek-ho Mar 9, 2023
62bdf29
clean up and add left nav
derek-ho Mar 9, 2023
23efb75
add barebones for integration specific page
derek-ho Mar 9, 2023
5f7d236
fix margins
derek-ho Mar 10, 2023
117eb1c
add toggle and begin work on card view
derek-ho Mar 17, 2023
a144420
get initial card view working
derek-ho Mar 17, 2023
3090a5f
generalize and figure out rows for card view
derek-ho Mar 17, 2023
15fad6b
make general for any number of records
derek-ho Mar 17, 2023
80348c3
clean up
derek-ho Mar 22, 2023
45685b1
get added table working
derek-ho Mar 22, 2023
46844f0
get modal to pop up on add
derek-ho Mar 22, 2023
33ecdf7
get modal mostly working
derek-ho Mar 23, 2023
b726616
cleanup
derek-ho Mar 23, 2023
05ab45a
almost done with POC
derek-ho Mar 23, 2023
ccfefd9
cleanup
derek-ho Mar 23, 2023
81a6e5e
fix formatting for cards
derek-ho Mar 24, 2023
ed08cba
final fix up
derek-ho Mar 28, 2023
9248bd9
added integration specific page
derek-ho Apr 4, 2023
208a9ca
add link fix
derek-ho Apr 4, 2023
6a4f60a
push up some work
derek-ho May 5, 2023
1fe6720
integrations left nav registration
derek-ho May 10, 2023
b5a64f4
get integrations hooked up to modules
derek-ho May 10, 2023
6876428
fix links
derek-ho May 10, 2023
ed28346
check
derek-ho May 11, 2023
63e3651
Read and serve local ndjson as integration
Swiddis May 11, 2023
0b581fb
Apply lint feedback
Swiddis May 11, 2023
aae4daf
Add populated add-endpoint handling
Swiddis May 11, 2023
0d46dcb
Fix asset linking bug
Swiddis May 12, 2023
972070c
Clean NDJson parsing logic
Swiddis May 12, 2023
81db074
Remove unused testing file
Swiddis May 12, 2023
2505abc
Simplify routing logic
Swiddis May 12, 2023
43ed7e2
Add testing for wrappedData method
Swiddis May 12, 2023
91fb275
Remove extraneous test ndjson
Swiddis May 15, 2023
c5b98f7
Fix broken type checking for placeholder
Swiddis May 15, 2023
478c1c3
Add documentation for placeholder's helper methods
Swiddis May 15, 2023
b7eeee9
Rename handleWithCallback
Swiddis May 15, 2023
1c174dc
Add more strict typing
Swiddis May 16, 2023
98adfdd
Revert faulty client change
Swiddis May 16, 2023
a668f87
Merge commit '98adfdd7' into get-added
Swiddis May 16, 2023
7fda8aa
Update typing for adaptor methods
Swiddis May 16, 2023
ea56bce
Move client creation code
Swiddis May 16, 2023
941337e
Extract java backend away from adaptor
Swiddis May 17, 2023
cb8374d
Update docs
Swiddis May 17, 2023
b5d9a42
Stub kibana backend
Swiddis May 17, 2023
1188515
Fix placeholder tests
Swiddis May 17, 2023
ebbd000
Add integration template type to saved objects
Swiddis May 17, 2023
f0e78c3
Move asset retrieval to kibana backend
Swiddis May 17, 2023
5a7eb74
Add actual catalog query to getIntegrationTemplates
Swiddis May 17, 2023
064124c
Remove management info from integration template type
Swiddis May 17, 2023
0385a79
Merge branch 'main' into placeholder
derek-ho May 19, 2023
3fa5d87
Use FS for repository
Swiddis May 19, 2023
93405c7
Merge branch 'get-added' into placeholder
Swiddis May 19, 2023
8220d9c
Update integration types to store instances in kibana
Swiddis May 19, 2023
4c4a005
Rename Placeholder references to Integrations
Swiddis May 22, 2023
e49ddd8
Perform minor code maintenance
Swiddis May 22, 2023
aae466b
Merge branch 'osints/rename' into osints/dev
Swiddis May 22, 2023
8f445f1
Add revised typing for integration objects
Swiddis May 22, 2023
b41c45d
Remove unused java backend
Swiddis May 22, 2023
0a32fc8
Modify integration type based on front-end data
Swiddis May 22, 2023
8f44117
Merge branch 'osints/un-java' into osints/dev
Swiddis May 22, 2023
9e94420
Stub load integration method
Swiddis May 22, 2023
cc4c9b3
Add integration statics class
Swiddis May 23, 2023
4859a09
Revert "Stub load integration method"
Swiddis May 23, 2023
ea74319
Convert interfaces to types
Swiddis May 23, 2023
94f9d55
Merge branch 'osints/typing' into osints/dev
Swiddis May 23, 2023
74f22b8
Change assets to map
Swiddis May 23, 2023
2a33e65
Adjust repository for new typing
Swiddis May 23, 2023
6c7d55e
Stub template load method
Swiddis May 23, 2023
8c08939
Move integration template conversion stub to class
Swiddis May 24, 2023
2f8b40c
Add implementation for post_assets
Swiddis May 24, 2023
fd4a7ad
Patch new integrations into E2E workflow
Swiddis May 24, 2023
5e46e9e
Tweak frontend for integration type changes
Swiddis May 24, 2023
a257722
Merge branch 'osints/loading' into osints/dev
Swiddis May 24, 2023
575a416
Fix integration data deserialization
Swiddis May 24, 2023
27dbf00
Add stubs for handling statics
Swiddis May 25, 2023
07095b1
Fill in body of getStatic
Swiddis May 25, 2023
7eef35c
Remove unused load method
Swiddis May 25, 2023
e34e874
Merge remote-tracking branch 'upstream/main' into osints/dev
Swiddis May 25, 2023
b66e04c
Index loaded integrations in .kibana
Swiddis May 25, 2023
069a7a4
Merge branch 'osints/statics' into osints/dev
Swiddis May 25, 2023
eb90827
Merge branch 'osints/querying' into osints/dev
Swiddis May 25, 2023
bf901f0
Remove unused NDJson parsing code
Swiddis May 25, 2023
149f6c7
Remove unused instance store
Swiddis May 25, 2023
cbfe3a4
Move repository logic to own class
Swiddis May 25, 2023
69ba83f
Add tests for IntegrationsRepository
Swiddis May 25, 2023
46e15f6
Add tests for kibana backend
Swiddis May 25, 2023
d516761
Merge branch 'osints/testing' into osints/dev
Swiddis May 25, 2023
e56b040
Hotfix: Clear repository between runs in testing
Swiddis May 25, 2023
734d5a3
fix tests and import
derek-ho May 26, 2023
c126f51
add sanity test cypress test
derek-ho May 26, 2023
2d21b7d
clean up code
derek-ho May 26, 2023
8bb223a
Add tests for integration builder
Swiddis May 26, 2023
8601766
Merge branch 'osints/better-loading' into osints/dev
Swiddis May 26, 2023
eb46a5b
Hotfix: Swap jest test to it
Swiddis May 26, 2023
4434f92
{
derek-ho May 26, 2023
78efa6e
Stub out sample integration data for front-end
Swiddis May 26, 2023
bac1f28
Use more realistic integration sample
Swiddis May 26, 2023
8772f94
Add full traversal to fields list
Swiddis May 26, 2023
0b58ff9
Add license to integration template
Swiddis May 26, 2023
6510b1d
Merge remote-tracking branch 'upstream/main' into HEAD
derek-ho May 30, 2023
e4f0b30
add some unit testing framework
derek-ho May 30, 2023
372cac7
fix up the testing name
derek-ho May 30, 2023
a350aec
fix up table view and add a test
derek-ho May 30, 2023
a41a40a
add an added integration table test using dummy data
derek-ho May 30, 2023
b09395c
add integration specific types and clean up code
derek-ho May 30, 2023
fd802b0
clean up code and use integration specific types
derek-ho May 30, 2023
883ac35
Merge remote-tracking branch 'origin/placeholder' into osints/dev
Swiddis May 30, 2023
1ecf4cb
Route integrations page to actual repository
Swiddis May 30, 2023
d456486
Merge branch 'osints/template-view' into osints/dev
Swiddis May 30, 2023
ccadd75
Hotfix: Remove unused import
Swiddis May 30, 2023
3596ce8
Hotfix: Use loading spinner
Swiddis May 30, 2023
59eff7f
Merge remote-tracking branch 'upstream/main' into osints/dev
Swiddis May 30, 2023
09642ea
add some changes to UI according to figma
derek-ho May 30, 2023
8e6fb41
add license headers and hook up get to specific instance for added page
derek-ho May 31, 2023
3c9863c
add screenshots and fix up mappings and breadcrumbs
derek-ho May 31, 2023
4c0a53e
Add failing test case for empty object
Swiddis May 31, 2023
2f0c140
Make template test pass
Swiddis May 31, 2023
14804af
use flyout according to figma and connect flyout input to backend cre…
derek-ho Jun 1, 2023
37d70fc
implement delete
derek-ho Jun 1, 2023
3ff7345
fix up tests for changes
derek-ho Jun 1, 2023
ebab4db
get added page to working order
derek-ho Jun 1, 2023
5f8ad0a
Add template validator via Ajv
Swiddis Jun 1, 2023
fd2f153
Fix builder tests for new validation
Swiddis Jun 1, 2023
a64794a
Merge branch 'osints/template-validation' into osints/dev
Swiddis Jun 1, 2023
d751c0d
add unit test coverage
derek-ho Jun 2, 2023
a35e329
Merge pull request #1 from derek-ho/figma-unit-cypress
Swiddis Jun 2, 2023
3de6e44
update page and tests to remove added by for integration instances
derek-ho Jun 5, 2023
0067564
deleting an instance also deletes its children saved objects
derek-ho Jun 5, 2023
69227ff
Add integration instance validation
Swiddis Jun 5, 2023
2a76983
Merge branch 'osints/instance-validation' into osints/dev
Swiddis Jun 5, 2023
8aa0279
update components and snapshots with data-test-subj for cypress tests…
derek-ho Jun 5, 2023
02375c4
remove unecessary console logging
derek-ho Jun 5, 2023
48fc6fd
Merge pull request #2 from derek-ho/cypress
Swiddis Jun 5, 2023
5f9a57a
Hotfix: Minor code cleanup
Swiddis Jun 5, 2023
f653072
dynamically handle id generation to allow for multiple instances of t…
derek-ho Jun 5, 2023
363d829
Merge pull request #3 from derek-ho/dynamic-ids
Swiddis Jun 5, 2023
23b05ac
Update integration with fixed panels
Swiddis Jun 6, 2023
1127b19
Apply minor behavior tweaks
Swiddis Jun 6, 2023
226d758
Refactor repository for new format
Swiddis Jun 7, 2023
b6f8e80
fix empty assets bug
derek-ho Jun 7, 2023
dce5109
Merge pull request #4 from derek-ho/fix-empty-assets-bug
Swiddis Jun 7, 2023
e2ff003
Write basic FS latest integration queries
Swiddis Jun 7, 2023
92c7f96
Merge branch 'osints/schema-tweaks' into osints/dev
Swiddis Jun 7, 2023
1498a69
Merge branch 'osints/dev' into osints/new-repository
Swiddis Jun 7, 2023
cb1233a
Merge branch 'osints/dev' of https://github.com/Swiddis/dashboards-ob…
Swiddis Jun 7, 2023
2a7c450
Update integration template type and validator
Swiddis Jun 7, 2023
ba12592
Add template retrieval to repository fs
Swiddis Jun 7, 2023
10fee47
Add copyright notice to repository_fs
Swiddis Jun 8, 2023
eed5663
fix escape
derek-ho Jun 8, 2023
ca7763c
revert file
derek-ho Jun 8, 2023
ec0cc3b
fix test
derek-ho Jun 8, 2023
6373cac
Merge pull request #5 from derek-ho/add-flow-update
Swiddis Jun 8, 2023
b5f6ce1
Stub composite repository class
Swiddis Jun 9, 2023
96f6050
Apply minor condition refactor
Swiddis Jun 9, 2023
48e9853
Fill in basic implementation for integration class
Swiddis Jun 9, 2023
d6f0b6f
Add tests for integration class
Swiddis Jun 9, 2023
4febf1e
Fix type errors on repository tests
Swiddis Jun 9, 2023
7ce5b18
Patch: Handle files with invalid version formats
Swiddis Jun 9, 2023
64fc77d
Refactor displayAssets to assets
Swiddis Jun 9, 2023
33c30b7
Add basic getAssets implementation
Swiddis Jun 9, 2023
672ea07
Add handling for invalid config error case
Swiddis Jun 9, 2023
1687731
Add handling for failed saved object loading
Swiddis Jun 9, 2023
b702426
Add basic getStatic method
Swiddis Jun 9, 2023
3b7568a
Fix handling for missing statics
Swiddis Jun 9, 2023
5ad9114
Remove outdated repository classes
Swiddis Jun 9, 2023
081d328
Add docs for the integration class
Swiddis Jun 9, 2023
0e595fd
Hook up router to new static loading
Swiddis Jun 9, 2023
7d57590
Clarify content-type docs
Swiddis Jun 9, 2023
21bc172
Fix details page crashes due to outdated schema
Swiddis Jun 9, 2023
8167792
Infer mime type for statics
Swiddis Jun 9, 2023
8f02159
Fix screenshot loading on integrations details page
Swiddis Jun 9, 2023
ca30e60
Merge branch 'osints/composite-repository' into osints/dev
Swiddis Jun 9, 2023
494e62f
Hotfix: Remove mimetypes from nginx 1.0.0
Swiddis Jun 9, 2023
19efb8c
Add getSchemas method with tests
Swiddis Jun 12, 2023
8c29aca
Make minor modifications to integration typing
Swiddis Jun 12, 2023
62d8cc2
Add integration deep check
Swiddis Jun 12, 2023
b624d30
Refactor integration builder
Swiddis Jun 12, 2023
ded0817
Fix remap ID method
Swiddis Jun 12, 2023
500f67a
Fix loading process
Swiddis Jun 12, 2023
8e1ec1d
Refactor tests for new integrations backend
Swiddis Jun 12, 2023
fe2f35a
Fix type errors in test suite
Swiddis Jun 12, 2023
0bacce1
Merge branch 'osints/repository-fixes' into osints/dev
Swiddis Jun 12, 2023
4d3fd7e
Merge remote-tracking branch 'upstream/main' into osints/dev
Swiddis Jun 12, 2023
c785d98
hook up datasource creation from flyout to backend
derek-ho Jun 13, 2023
dec5e7d
remove nullable
derek-ho Jun 13, 2023
fe774bc
Add schema route to router
Swiddis Jun 13, 2023
a59c403
Merge pull request #6 from derek-ho/hookup-data-source
Swiddis Jun 13, 2023
1754e43
Fix frontend request routing for new API
Swiddis Jun 13, 2023
e1033c5
Merge branch 'osints/dev' of https://github.com/Swiddis/dashboards-ob…
Swiddis Jun 13, 2023
48c1e8f
Merge branch 'osints/schema-routing' into osints/dev
Swiddis Jun 13, 2023
618d7c6
Hotfix: Fix added integration errors
Swiddis Jun 13, 2023
44a2cd9
Hotfix: Add an actual screenshot
Swiddis Jun 13, 2023
0e497f4
Hotfix: Remove unused assets folder
Swiddis Jun 13, 2023
dfd65b9
Hotfix: Use Oui images
Swiddis Jun 13, 2023
b6bfb02
Make integration instance deletion more robust
Swiddis Jun 13, 2023
bba3865
Remove asset map (again
Swiddis Jun 13, 2023
f9df173
Fix remap data source
Swiddis Jun 13, 2023
9666e15
Correct deletion for actual 404 behavior
Swiddis Jun 13, 2023
cf398c0
Add display name field to integrations
Swiddis Jun 13, 2023
d3d3ea7
Apply display name through frontend
Swiddis Jun 13, 2023
0e9b8c0
Hotfix: Use display name on table view
Swiddis Jun 13, 2023
d646e55
Remove unused code in flyout
Swiddis Jun 14, 2023
a040395
Stub mapping validation on frontend
Swiddis Jun 14, 2023
8cfec7c
Add error message for failed validation result
Swiddis Jun 14, 2023
243eade
Fix request to proxy
Swiddis Jun 14, 2023
501cdf2
Add more detailed handling for missing schemas
Swiddis Jun 14, 2023
d5c0298
Apply integration type in validation
Swiddis Jun 14, 2023
8001168
Add full schema validation
Swiddis Jun 14, 2023
83c46dd
Add unit tests for mapping validation
Swiddis Jun 14, 2023
39f0f5c
Fix type checking in unit tests
Swiddis Jun 14, 2023
4e36d5d
Merge branch 'osints/mapping-validation' into osints/dev
Swiddis Jun 14, 2023
62f5c14
create dataSource UI option
derek-ho Jun 15, 2023
0c1a56f
Hotfix: Update route for listing added integrations
Swiddis Jun 15, 2023
320012c
Hotfix: Fix component tests
Swiddis Jun 15, 2023
dcd1156
Merge branch 'osints/dev' into createDataSource
derek-ho Jun 15, 2023
3e1c5ff
Add basic status querying
Swiddis Jun 15, 2023
6d25604
Add unit tests for availability queries
Swiddis Jun 15, 2023
b2ad24b
Merge branch 'status-querying' into osints/dev
Swiddis Jun 15, 2023
a92d384
create ss4o index from ui
derek-ho Jun 15, 2023
f8a6751
code cleanup
derek-ho Jun 15, 2023
72d4bd3
use user input
derek-ho Jun 15, 2023
5817a93
Merge pull request #7 from derek-ho/createDataSource
Swiddis Jun 15, 2023
5cc0cf6
Hotfix: Sync package versions with osd
Swiddis Jun 15, 2023
d183dea
Fix path-dependent tests on windows
Swiddis Jun 15, 2023
1b60578
Hotfix: Repair template naming on index autocreation
Swiddis Jun 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions .cypress/integration/8_integrations.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

/// <reference types="cypress" />

import {
TEST_INTEGRATION_INSTANCE,
} from '../utils/constants';

const moveToIntegrationsHome = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-integrations#/`);
};

const moveToAvailableNginxIntegration = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-integrations#/available/nginx`);
};

const moveToInstalledeIntegrations = () => {
cy.visit(`${Cypress.env('opensearchDashboards')}/app/observability-integrations#/installed`);
};



describe('Basic sanity test for integrations plugin', () => {
it('Navigates to integrations plugin and expects the correct header', () => {
moveToIntegrationsHome();
cy.get('[data-test-subj="integrations-header"]').should('exist');
});

it('Navigates to integrations plugin and tests that clicking the nginx cards navigates to the nginx page', () => {
moveToIntegrationsHome();
cy.get('[data-test-subj="integration_card_nginx"]').click();
cy.url().should('include', '/available/nginx')
})

it('Navigates to nginx page and asserts the page to be as expected', () => {
moveToAvailableNginxIntegration();
cy.get('[data-test-subj="nginx-overview"]').should('exist')
cy.get('[data-test-subj="nginx-details"]').should('exist')
cy.get('[data-test-subj="nginx-screenshots"]').should('exist')
cy.get('[data-test-subj="nginx-assets"]').should('exist')
cy.get('[data-test-subj="nginx-fields"]').should('exist')
})
});

describe('Tests the add nginx integration instance flow', () => {
it('Navigates to nginx page and triggers the adds the instance flow', () => {
moveToAvailableNginxIntegration();
cy.get('[data-test-subj="add-integration-button"]').click();
cy.get('[data-test-subj="instance-name"]').should('have.value', 'nginx');
cy.get('[data-test-subj="addIntegrationFlyoutTitle"]').should('exist')
cy.get('[data-test-subj="instance-name"]').type('-test');
cy.get('[data-test-subj="createInstanceButton"]').click();
cy.get('.euiToastHeader__title').should('contain', 'successfully');
})

it('Navigates to installed integrations page and verifies that nginx-test exists', () => {
moveToInstalledeIntegrations();
cy.contains(TEST_INTEGRATION_INSTANCE).should('exist');
cy.get('[data-test-subj="nginx-testIntegrationLink"]').click();
})

it('Navigates to installed integrations page and verifies that nginx-test exists and linked asset works as expected', () => {
moveToInstalledeIntegrations();
cy.contains(TEST_INTEGRATION_INSTANCE).should('exist');
cy.get('[data-test-subj="nginx-testIntegrationLink"]').click();
cy.get(`[data-test-subj="IntegrationAssetLink"]`).click();
cy.url().should('include', '/dashboards#/')

})

it('Navigates to installed nginx-test instance page and deletes it', () => {
moveToInstalledeIntegrations();
cy.contains(TEST_INTEGRATION_INSTANCE).should('exist');
cy.get('[data-test-subj="nginx-testIntegrationLink"]').click();
cy.get('[data-test-subj="deleteInstanceButton"]').click();

cy.get('button[data-test-subj="popoverModal__deleteButton"]').should('be.disabled');

cy.get('input.euiFieldText[placeholder="delete"]').focus().type('delete', {
delay: 50,
});
cy.get('button[data-test-subj="popoverModal__deleteButton"]').should('not.be.disabled');
cy.get('button[data-test-subj="popoverModal__deleteButton"]').click();
cy.get('.euiToastHeader__title').should('contain', 'successfully');
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
})
});



1 change: 1 addition & 0 deletions .cypress/utils/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {

// notebooks
export const TEST_NOTEBOOK = 'Test Notebook';
export const TEST_INTEGRATION_INSTANCE = 'nginx-test';
export const SAMPLE_URL = 'https://github.com/opensearch-project/sql/tree/main/sql-jdbc';
export const NOTEBOOK_TEXT = 'Use Notebooks to interactively and collaboratively develop rich reports backed by live data. Common use cases for notebooks includes creating postmortem reports, designing run books, building live infrastructure reports, or even documentation.';
export const OPENSEARCH_URL = 'https://opensearch.org/docs/latest/observability-plugin/notebooks/';
Expand Down
12 changes: 12 additions & 0 deletions common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const DSL_SEARCH = '/search';
export const DSL_CAT = '/cat.indices';
export const DSL_MAPPING = '/indices.getFieldMapping';
export const OBSERVABILITY_BASE = '/api/observability';
export const INTEGRATIONS_BASE = '/api/integrations';
export const EVENT_ANALYTICS = '/event_analytics';
export const SAVED_OBJECTS = '/saved_objects';
export const SAVED_QUERY = '/query';
Expand Down Expand Up @@ -51,6 +52,10 @@ export const observabilityPanelsID = 'observability-dashboards';
export const observabilityPanelsTitle = 'Dashboards';
export const observabilityPanelsPluginOrder = 5095;

export const observabilityIntegrationsID = 'observability-integrations';
export const observabilityIntegrationsTitle = 'Integrations';
export const observabilityIntegrationsPluginOrder = 5096;

// Shared Constants
export const SQL_DOCUMENTATION_URL = 'https://opensearch.org/docs/latest/search-plugins/sql/index/';
export const PPL_DOCUMENTATION_URL =
Expand All @@ -69,6 +74,13 @@ export const PPL_NEWLINE_REGEX = /[\n\r]+/g;

// Observability plugin URI
const BASE_OBSERVABILITY_URI = '/_plugins/_observability';
const BASE_INTEGRATIONS_URI = '/_plugins/_integrations';
export const OPENSEARCH_INTEGRATIONS_API = {
OBJECT: `${BASE_INTEGRATIONS_URI}/object`,
ALL: `${BASE_INTEGRATIONS_URI}/store/list_all`,
ADDED: `${BASE_INTEGRATIONS_URI}/store/list_added`,
ADDED_POP: `${BASE_INTEGRATIONS_URI}/store/list_added_pop`,
};
export const OPENSEARCH_PANELS_API = {
OBJECT: `${BASE_OBSERVABILITY_URI}/object`,
};
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
"@reduxjs/toolkit": "^1.6.1",
"ag-grid-community": "^27.3.0",
"ag-grid-react": "^27.3.0",
"ajv": "^8.11.0",
"antlr4": "4.8.0",
"antlr4ts": "^0.5.0-alpha.4",
"mime": "^3.0.0",
"performance-now": "^2.1.0",
"plotly.js-dist": "^2.2.0",
"postinstall": "^0.7.4",
Expand All @@ -41,6 +43,7 @@
"devDependencies": {
"@cypress/skip-test": "^2.6.1",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/mime": "^3.0.1",
"@types/react-plotly.js": "^2.5.0",
"@types/react-test-renderer": "^16.9.1",
"antlr4ts-cli": "^0.5.0-alpha.4",
Expand All @@ -50,6 +53,7 @@
"husky": "6.0.0",
"jest-dom": "^4.0.0",
"lint-staged": "^13.1.0",
"mock-fs": "^4.12.0",
"ts-jest": "^29.1.0"
},
"resolutions": {
Expand All @@ -70,4 +74,4 @@
"node_modules/*",
"target/*"
]
}
}
2 changes: 2 additions & 0 deletions public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { observabilityID, observabilityTitle } from '../../common/constants/shar
import { store } from '../framework/redux/store';
import { AppPluginStartDependencies } from '../types';
import { Home as ApplicationAnalyticsHome } from './application_analytics/home';
import { Home as PlaceholderHome } from './integrations/home';
import { MetricsListener } from './common/metrics_listener';
import { Home as CustomPanelsHome } from './custom_panels/home';
import { EventAnalytics } from './event_analytics';
Expand Down Expand Up @@ -42,6 +43,7 @@ const pages = {
traces: TraceAnalyticsHome,
notebooks: NotebooksHome,
dashboards: CustomPanelsHome,
integrations: PlaceholderHome,
};

export const App = ({
Expand Down
150 changes: 150 additions & 0 deletions public/components/common/side_nav.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {
EuiButton,
EuiFlexGroup,
EuiFlexItem,
EuiPage,
EuiPageBody,
EuiPageSideBar,
EuiSideNav,
EuiSideNavItemType,
EuiSwitch,
} from '@elastic/eui';
import React from 'react';
import { useState } from 'react';
import { toMountPoint } from '../../../../../src/plugins/opensearch_dashboards_react/public';
import { uiSettingsService } from '../../../common/utils';

export function ObservabilitySideBar(props: { children: React.ReactNode }) {
// set items.isSelected based on location.hash passed in
// tries to find an item where href is a prefix of the hash
// if none will try to find an item where the hash is a prefix of href
function setIsSelected(
items: Array<EuiSideNavItemType<React.ReactNode>>,
hash: string,
initial = true,
reverse = false
): boolean {
// Default page is Events Analytics
// But it is kept as second option in side nav
if (hash === '#/') {
items[0].items[2].isSelected = true;
return true;
}
for (let i = 0; i < items.length; i++) {
const item = items[i];
if (item.href && ((reverse && item.href.startsWith(hash)) || hash.startsWith(item.href))) {
item.isSelected = true;
return true;
}
if (item.items?.length && setIsSelected(item.items, hash, false, reverse)) return true;
}
return initial && setIsSelected(items, hash, false, !reverse);
}

const items = [
{
name: 'Observability',
id: 0,
items: [
{
name: 'Application analytics',
id: 1,
href: '#/application_analytics',
},
{
name: 'Trace analytics',
id: 2,
href: '#/trace_analytics/home',
items: [
{
name: 'Traces',
id: 2.1,
href: '#/trace_analytics/traces',
},
{
name: 'Services',
id: 2.2,
href: '#/trace_analytics/services',
},
],
},
{
name: 'Event analytics',
id: 3,
href: '#/event_analytics',
},
{
name: 'Metrics analytics',
id: 4,
href: '#/metrics_analytics/',
},
{
name: 'Operational panels',
id: 5,
href: '#/operational_panels/',
},
{
name: 'Notebooks',
id: 6,
href: '#/notebooks',
},
{
name: 'Placeholder',
id: 7,
href: '#/integrations',
},
],
},
];
setIsSelected(items, location.hash);
const [isDarkMode, setIsDarkMode] = useState(uiSettingsService.get('theme:darkMode'));

return (
<EuiPage>
<EuiPageSideBar>
<EuiFlexGroup
direction="column"
justifyContent="spaceBetween"
style={{ height: '100%' }}
gutterSize="none"
>
<EuiFlexItem>
<EuiSideNav items={items} />
</EuiFlexItem>
<EuiFlexItem grow={false} style={{ marginBottom: 20 }}>
<EuiSwitch
label="Dark mode"
checked={isDarkMode}
onChange={() => {
uiSettingsService.set('theme:darkMode', !isDarkMode).then((resp) => {
setIsDarkMode(!isDarkMode);
uiSettingsService.addToast({
title: 'Theme setting changes require you to reload the page to take effect.',
text: toMountPoint(
<>
<EuiFlexGroup justifyContent="flexEnd" gutterSize="s">
<EuiFlexItem grow={false}>
<EuiButton size="s" onClick={() => window.location.reload()}>
Reload page
</EuiButton>
</EuiFlexItem>
</EuiFlexGroup>
</>
),
color: 'success',
});
});
}}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPageSideBar>
<EuiPageBody>{props.children}</EuiPageBody>
</EuiPage>
);
}
Loading