Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set dashboard container functions and fix license headers #4540

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 1 addition & 7 deletions src/plugins/dashboard/public/application/app.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* 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.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import './app.scss';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ export const DashboardListing = () => {
[history, application]
);

// TODO: Currently, dashboard listing is using a href to view items.
// Dashboard listing should utilize a callback to take us away from using a href in favor
// of using onClick.
//
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3365
//
// const viewItem = useCallback(
// ({ appId, viewUrl }: any) => {
// if (appId === 'dashboard') {
Expand Down
8 changes: 1 addition & 7 deletions src/plugins/dashboard/public/application/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* 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.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import React from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* 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.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import { i18n } from '@osd/i18n';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,18 @@ export const createDashboardGlobalAndAppState = ({
...state,
});
} else {
// TODO: This logic was ported over this but can be handled more gracefully and intentionally
// Sync from state url should be refactored within this application. The app is syncing from
// the query state and the dashboard in different locations which can be handled better.
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3365
//
// Do nothing in case when state from url is empty,
// this fixes: https://github.com/elastic/kibana/issues/57789
// There are not much cases when state in url could become empty:
// 1. User manually removed `_a` from the url
// 2. Browser is navigating away from the page and most likely there is no `_a` in the url.
// In this case we don't want to do any state updates
// and just allow $scope.$on('destroy') fire later and clean up everything
// and just unmount later and clean up everything
}
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* 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.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import { Dashboard, DashboardParams } from '../../dashboard';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* 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.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

import { useState, useEffect } from 'react';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ export const useDashboardAppAndGlobalState = ({
savedDashboard: savedDashboardInstance,
appState: stateContainer,
});
setCurrentContainer(dashboardContainer);

if (!dashboardContainer) {
return;
}

// Ensure empty state is attached to current container being dispatched
dashboardContainer.renderEmpty = () =>
renderEmpty(dashboardContainer, stateContainer, services);

// Ensure update app state in url is attached to current container being dispatched
dashboardContainer.updateAppStateUrl = ({
replace,
pathname,
Expand All @@ -147,6 +147,8 @@ export const useDashboardAppAndGlobalState = ({
}
};

setCurrentContainer(dashboardContainer);

const stopSyncingDashboardContainerOutputs = handleDashboardContainerOutputs(
services,
dashboardContainer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ export const useSavedDashboardInstance = ({
history.replace(DashboardConstants.LANDING_PAGE_PATH);
};

// TODO: handle try/catch as expected workflows instead of catching as an error
// https://github.com/opensearch-project/OpenSearch-Dashboards/issues/3365
const getSavedDashboardInstance = async () => {
try {
let dashboardInstance: {
Expand Down
8 changes: 1 addition & 7 deletions src/plugins/dashboard/public/dashboard.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
/*
* Copyright OpenSearch Contributors
* 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.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/**
Expand Down