From 08e2a48878d82e8c3dde4dd2e516eb7d7f672ae2 Mon Sep 17 00:00:00 2001 From: abbyhu2000 Date: Mon, 12 Jun 2023 21:07:51 +0000 Subject: [PATCH] changes --- package.json | 5 +++-- .../application/components/dashboard_top_nav.tsx | 4 ++-- .../utils/use/use_dashboard_container.tsx | 10 ++++++---- .../application/utils/use/use_editor_updates.ts | 12 ++++++++---- yarn.lock | 12 ++++++++++++ 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index be91136e831f..a01c568d3999 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,6 @@ "dns-sync": "^0.2.1", "elastic-apm-node": "^3.43.0", "elasticsearch": "^16.7.0", - "http-aws-es": "npm:@zhongnansu/http-aws-es@6.0.1", "execa": "^4.0.2", "expiry-js": "0.1.7", "fast-deep-equal": "^3.1.1", @@ -181,6 +180,7 @@ "globby": "^11.1.0", "handlebars": "4.7.7", "hjson": "3.2.1", + "http-aws-es": "npm:@zhongnansu/http-aws-es@6.0.1", "http-proxy-agent": "^2.1.0", "https-proxy-agent": "^5.0.0", "inline-style": "^2.0.0", @@ -254,6 +254,7 @@ "@osd/utility-types": "1.0.0", "@percy/cli": "^1.0.0", "@percy/sdk-utils": "^1.0.0", + "@rxjs-insights/devtools": "^0.5.0", "@testing-library/dom": "^8.11.3", "@testing-library/jest-dom": "^5.16.2", "@testing-library/react": "^12.1.2", @@ -287,6 +288,7 @@ "@types/has-ansi": "^3.0.0", "@types/history": "^4.7.3", "@types/hjson": "^2.4.2", + "@types/http-aws-es": "6.0.2", "@types/jest": "^27.4.0", "@types/joi": "^13.4.2", "@types/jquery": "^3.3.31", @@ -339,7 +341,6 @@ "@types/zen-observable": "^0.8.0", "@typescript-eslint/eslint-plugin": "^3.10.0", "@typescript-eslint/parser": "^3.10.0", - "@types/http-aws-es": "6.0.2", "angular-aria": "^1.8.0", "angular-mocks": "^1.8.2", "angular-recursion": "^1.0.5", diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx index 2cfb289f7f74..4d3f1f6431e7 100644 --- a/src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx +++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx @@ -130,7 +130,8 @@ const TopNav = ({ } asyncSetIndexPattern() - }, [currentAppState, services.data.indexPatterns]) + console.log("index pattern", indexPatterns) + }, [dashboardContainer, stateContainer, currentAppState, services.data.indexPatterns]) const shouldShowFilterBar = (forceHide: boolean): boolean => !forceHide && (filters!.length > 0 || !currentAppState?.fullScreenMode); @@ -146,7 +147,6 @@ const TopNav = ({ const showFilterBar = shouldShowFilterBar(forceHideFilterBar); const showSearchBar = showQueryBar || showFilterBar; - console.log("index pattern", indexPatterns) return isChromeVisible ? ( { const incomingEmbeddable = services.embeddable @@ -95,7 +95,7 @@ export const useDashboardContainer = ( return { dashboardContainer }; }; -const createDashboardEmbeddable = async ( +const createDashboardEmbeddable = ( savedDash: any, dashboardServices: DashboardServices, appState: DashboardAppStateContainer @@ -103,7 +103,7 @@ const createDashboardEmbeddable = async ( let dashboardContainer: DashboardContainer; let inputSubscription: Subscription | undefined; let outputSubscription: Subscription | undefined; - + console.log('createing container!'); const { embeddable, data, @@ -284,7 +284,9 @@ const createDashboardEmbeddable = async ( mapTo(dashboardContainer), startWith(dashboardContainer) // to trigger initial index pattern update ) - .subscribe(); + .subscribe(() => { + handleDashboardContainerChanges(container, appState, dashboardServices); + }); inputSubscription = dashboardContainer.getInput$().subscribe(() => { // This has to be first because handleDashboardContainerChanges causes diff --git a/src/plugins/dashboard/public/application/utils/use/use_editor_updates.ts b/src/plugins/dashboard/public/application/utils/use/use_editor_updates.ts index 7eba0217995b..53551255a183 100644 --- a/src/plugins/dashboard/public/application/utils/use/use_editor_updates.ts +++ b/src/plugins/dashboard/public/application/utils/use/use_editor_updates.ts @@ -33,10 +33,14 @@ export const useEditorUpdates = ( const unsubscribeStateUpdates = appState.subscribe((state) => { setCurrentAppState(state); - if(dashboardContainer.getChangesFromAppStateForContainerState){ - const changes = dashboardContainer.getChangesFromAppStateForContainerState(dashboardContainer); - if(changes){ - dashboardContainer.updateInput(changes) + console.log('before invoked'); + if (dashboardContainer.getChangesFromAppStateForContainerState) { + console.log('invoked'); + const changes = dashboardContainer.getChangesFromAppStateForContainerState( + dashboardContainer + ); + if (changes) { + dashboardContainer.updateInput(changes); } } }); diff --git a/yarn.lock b/yarn.lock index e1985b3cd645..52991a0d3a7a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2691,6 +2691,18 @@ colors "~1.2.1" string-argv "~0.3.1" +"@rxjs-insights/core@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@rxjs-insights/core/-/core-0.5.0.tgz#567190414ab5b89d93e6e9ec31c289415ba37054" + integrity sha512-xvWcD9s9SWU9HX3GGI50EMLk5epstuCsln358Zno0+DT6jvN2FWwDxaIe6ohRKB4893H1dm0WWbIawXSBSTpNw== + +"@rxjs-insights/devtools@^0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@rxjs-insights/devtools/-/devtools-0.5.0.tgz#30ce80ef1d682ef222eca4b909a7fcc3f843f0fd" + integrity sha512-C59VFJqLf7SFYq5Vm3n2+NE8IDvzQHyH954cmxRzmUOWfkAZoM+9ZcYkIWM9BunjBdZgq8tych0fezQvUWawTQ== + dependencies: + "@rxjs-insights/core" "^0.5.0" + "@samverschueren/stream-to-observable@^0.3.0": version "0.3.1" resolved "https://registry.yarnpkg.com/@samverschueren/stream-to-observable/-/stream-to-observable-0.3.1.tgz#a21117b19ee9be70c379ec1877537ef2e1c63301"