mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
fix adding Visualize visualization to dashboard from modal directs user to dashboard listing page (#90090)
This commit is contained in:
parent
c67e291189
commit
84a67a44d1
7 changed files with 57 additions and 2 deletions
|
@ -0,0 +1,13 @@
|
|||
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
||||
|
||||
[Home](./index.md) > [kibana-plugin-plugins-kibana\_utils-public-state\_sync](./kibana-plugin-plugins-kibana_utils-public-state_sync.md) > [IKbnUrlStateStorage](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.md) > [cancel](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md)
|
||||
|
||||
## IKbnUrlStateStorage.cancel property
|
||||
|
||||
Cancels any pending url updates
|
||||
|
||||
<b>Signature:</b>
|
||||
|
||||
```typescript
|
||||
cancel: () => void;
|
||||
```
|
|
@ -20,6 +20,7 @@ export interface IKbnUrlStateStorage extends IStateStorage
|
|||
|
||||
| Property | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| [cancel](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.cancel.md) | <code>() => void</code> | Cancels any pending url updates |
|
||||
| [change$](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.change_.md) | <code><State = unknown>(key: string) => Observable<State | null></code> | |
|
||||
| [get](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.get.md) | <code><State = unknown>(key: string) => State | null</code> | |
|
||||
| [kbnUrlControls](./kibana-plugin-plugins-kibana_utils-public-state_sync.ikbnurlstatestorage.kbnurlcontrols.md) | <code>IKbnUrlControls</code> | Lower level wrapper around history library that handles batching multiple URL updates into one history change |
|
||||
|
|
|
@ -4,6 +4,7 @@ exports[`after fetch When given a title that matches multiple dashboards, filter
|
|||
<DashboardListing
|
||||
kbnUrlStateStorage={
|
||||
Object {
|
||||
"cancel": [Function],
|
||||
"change$": [Function],
|
||||
"get": [Function],
|
||||
"kbnUrlControls": Object {
|
||||
|
@ -150,6 +151,7 @@ exports[`after fetch hideWriteControls 1`] = `
|
|||
<DashboardListing
|
||||
kbnUrlStateStorage={
|
||||
Object {
|
||||
"cancel": [Function],
|
||||
"change$": [Function],
|
||||
"get": [Function],
|
||||
"kbnUrlControls": Object {
|
||||
|
@ -249,6 +251,7 @@ exports[`after fetch initialFilter 1`] = `
|
|||
initialFilter="testFilter"
|
||||
kbnUrlStateStorage={
|
||||
Object {
|
||||
"cancel": [Function],
|
||||
"change$": [Function],
|
||||
"get": [Function],
|
||||
"kbnUrlControls": Object {
|
||||
|
@ -394,6 +397,7 @@ exports[`after fetch renders all table rows 1`] = `
|
|||
<DashboardListing
|
||||
kbnUrlStateStorage={
|
||||
Object {
|
||||
"cancel": [Function],
|
||||
"change$": [Function],
|
||||
"get": [Function],
|
||||
"kbnUrlControls": Object {
|
||||
|
@ -539,6 +543,7 @@ exports[`after fetch renders call to action when no dashboards exist 1`] = `
|
|||
<DashboardListing
|
||||
kbnUrlStateStorage={
|
||||
Object {
|
||||
"cancel": [Function],
|
||||
"change$": [Function],
|
||||
"get": [Function],
|
||||
"kbnUrlControls": Object {
|
||||
|
@ -684,6 +689,7 @@ exports[`after fetch renders warning when listingLimit is exceeded 1`] = `
|
|||
<DashboardListing
|
||||
kbnUrlStateStorage={
|
||||
Object {
|
||||
"cancel": [Function],
|
||||
"change$": [Function],
|
||||
"get": [Function],
|
||||
"kbnUrlControls": Object {
|
||||
|
|
|
@ -22,6 +22,7 @@ export const createSessionStorageStateStorage: (storage?: Storage) => ISessionSt
|
|||
|
||||
// @public
|
||||
export interface IKbnUrlStateStorage extends IStateStorage {
|
||||
cancel: () => void;
|
||||
// (undocumented)
|
||||
change$: <State = unknown>(key: string) => Observable<State | null>;
|
||||
// (undocumented)
|
||||
|
|
|
@ -290,7 +290,7 @@ describe('state_sync', () => {
|
|||
expect(history.length).toBe(startHistoryLength);
|
||||
expect(getCurrentUrl()).toMatchInlineSnapshot(`"/"`);
|
||||
|
||||
urlSyncStrategy.kbnUrlControls.cancel();
|
||||
urlSyncStrategy.cancel();
|
||||
|
||||
expect(history.length).toBe(startHistoryLength);
|
||||
expect(getCurrentUrl()).toMatchInlineSnapshot(`"/"`);
|
||||
|
@ -303,6 +303,32 @@ describe('state_sync', () => {
|
|||
stop();
|
||||
});
|
||||
|
||||
it('cancels pending URL updates when sync stops', async () => {
|
||||
const { stop, start } = syncStates([
|
||||
{
|
||||
stateContainer: withDefaultState(container, defaultState),
|
||||
storageKey: key,
|
||||
stateStorage: urlSyncStrategy,
|
||||
},
|
||||
]);
|
||||
start();
|
||||
|
||||
const startHistoryLength = history.length;
|
||||
container.transitions.add({ id: 2, text: '2', completed: false });
|
||||
container.transitions.add({ id: 3, text: '3', completed: false });
|
||||
container.transitions.completeAll();
|
||||
|
||||
expect(history.length).toBe(startHistoryLength);
|
||||
expect(getCurrentUrl()).toMatchInlineSnapshot(`"/"`);
|
||||
|
||||
stop();
|
||||
|
||||
await tick();
|
||||
|
||||
expect(history.length).toBe(startHistoryLength);
|
||||
expect(getCurrentUrl()).toMatchInlineSnapshot(`"/"`);
|
||||
});
|
||||
|
||||
it("should preserve reference to unchanged state slices if them didn't change", async () => {
|
||||
const otherUnchangedSlice = { a: 'test' };
|
||||
const oldState = {
|
||||
|
|
|
@ -51,7 +51,7 @@ describe('KbnUrlStateStorage', () => {
|
|||
const key = '_s';
|
||||
const pr = urlStateStorage.set(key, state);
|
||||
expect(getCurrentUrl()).toMatchInlineSnapshot(`"/"`);
|
||||
urlStateStorage.kbnUrlControls.cancel();
|
||||
urlStateStorage.cancel();
|
||||
await pr;
|
||||
expect(getCurrentUrl()).toMatchInlineSnapshot(`"/"`);
|
||||
expect(urlStateStorage.get(key)).toEqual(null);
|
||||
|
|
|
@ -39,6 +39,11 @@ export interface IKbnUrlStateStorage extends IStateStorage {
|
|||
get: <State = unknown>(key: string) => State | null;
|
||||
change$: <State = unknown>(key: string) => Observable<State | null>;
|
||||
|
||||
/**
|
||||
* Cancels any pending url updates
|
||||
*/
|
||||
cancel: () => void;
|
||||
|
||||
/**
|
||||
* Lower level wrapper around history library that handles batching multiple URL updates into one history change
|
||||
*/
|
||||
|
@ -108,6 +113,9 @@ export const createKbnUrlStateStorage = (
|
|||
}),
|
||||
share()
|
||||
),
|
||||
cancel() {
|
||||
url.cancel();
|
||||
},
|
||||
kbnUrlControls: url,
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue