@gravitee/gamma-lib-observability 2.2.3-fix-obs-60-keep-dirty-draft-on-failed-refetch.e1de2f4 → 2.2.3-fix-obs-60-keep-dirty-draft-on-failed-refetch.0cef7ba
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dashboards/editor/DashboardEditorPage.d.ts.map +1 -1
- package/dist/dashboards/editor/InlineEditableText.d.ts +11 -1
- package/dist/dashboards/editor/InlineEditableText.d.ts.map +1 -1
- package/dist/dashboards/editor/testing/vanishing-dashboard-harness.d.ts +173 -0
- package/dist/dashboards/editor/testing/vanishing-dashboard-harness.d.ts.map +1 -0
- package/dist/dashboards/editor/use-dashboard-save.d.ts +58 -0
- package/dist/dashboards/editor/use-dashboard-save.d.ts.map +1 -0
- package/dist/dashboards/editor/use-leave-guard.d.ts +34 -0
- package/dist/dashboards/editor/use-leave-guard.d.ts.map +1 -0
- package/dist/index.js +474 -407
- package/dist/styles/observability.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DashboardEditorPage.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/DashboardEditorPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DashboardEditorPage.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/DashboardEditorPage.tsx"],"names":[],"mappings":"AAwEA;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;OAIG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACpC;AAED,wBAAgB,mBAAmB,CAAC,EAAE,gBAAgB,EAAE,EAAE,wBAAwB,2CAYjF"}
|
|
@@ -9,7 +9,17 @@ export interface InlineEditableTextProps {
|
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
11
|
* Click-to-edit text used for the dashboard title and description in the
|
|
12
|
-
* editor. Enter or blur
|
|
12
|
+
* editor. Enter or blur closes the input (trimming on the way out); Escape
|
|
13
|
+
* restores the value the edit started from.
|
|
14
|
+
*
|
|
15
|
+
* Every keystroke is reported through `onChange` rather than buffered until
|
|
16
|
+
* commit. Deliberate, and load-bearing for the editor's guards: a component
|
|
17
|
+
* that holds typed text the parent cannot see is a place unsaved work can
|
|
18
|
+
* hide, and this editor closes itself, arms a refresh prompt, and asks before
|
|
19
|
+
* navigating based on whether such work exists. With the text always in the
|
|
20
|
+
* draft, a half-typed title is counted by construction. What Escape needs is
|
|
21
|
+
* kept instead: a snapshot of where the edit started, which is a revert
|
|
22
|
+
* reference, not unreported work.
|
|
13
23
|
*/
|
|
14
24
|
export declare function InlineEditableText({ value, onChange, placeholder, ariaLabel, textClassName, inputClassName, }: InlineEditableTextProps): import("react/jsx-runtime").JSX.Element;
|
|
15
25
|
//# sourceMappingURL=InlineEditableText.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineEditableText.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/InlineEditableText.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED
|
|
1
|
+
{"version":3,"file":"InlineEditableText.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/InlineEditableText.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,6CAA6C;IAC7C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,KAAK,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,aAAa,EACb,cAAc,GACf,EAAE,uBAAuB,2CA0DzB"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { UserEvent } from '@testing-library/user-event';
|
|
2
|
+
import { DashboardPersistence } from '../../../data-sources/dashboard-persistence';
|
|
3
|
+
import { Dashboard, DashboardCapabilities } from '../../../types/domain';
|
|
4
|
+
/**
|
|
5
|
+
* One rig for every test about an editor whose dashboard disappears, or whose
|
|
6
|
+
* author walks away holding work: a persistence whose reads can be made to
|
|
7
|
+
* fail after the first success, an editor mounted on it, and one helper per
|
|
8
|
+
* place the editor can hold unsaved work.
|
|
9
|
+
*
|
|
10
|
+
* Shared between the reload suite and the guards suite so the two cannot
|
|
11
|
+
* drift: the buffers the deletion path must respect are exactly the buffers
|
|
12
|
+
* the leave paths must respect, and both suites drive them through the same
|
|
13
|
+
* hands.
|
|
14
|
+
*/
|
|
15
|
+
export declare const WRITE: DashboardCapabilities;
|
|
16
|
+
export declare const MINE: Dashboard;
|
|
17
|
+
export declare const MY_EDIT = "Latency board with my edit";
|
|
18
|
+
export declare const DELETED_DIALOG: RegExp;
|
|
19
|
+
export declare const KEEP_THE_WORK = "Save as a new dashboard";
|
|
20
|
+
/** The panel that replaces the editor, worded for a dashboard known to be gone. */
|
|
21
|
+
export declare const DELETED_PANEL: RegExp;
|
|
22
|
+
/** Its hedging form, for a dashboard that never loaded in the first place. */
|
|
23
|
+
export declare const NOT_FOUND_PANEL: RegExp;
|
|
24
|
+
/** What stays behind in the editor once the dialog has been answered. */
|
|
25
|
+
export declare const GONE_BANNER: RegExp;
|
|
26
|
+
/**
|
|
27
|
+
* A persistence whose reads can be made to fail after the editor has already
|
|
28
|
+
* loaded from it, which is the whole situation: the first read succeeded, so
|
|
29
|
+
* the dashboard the draft was built from is in hand, and every read after it
|
|
30
|
+
* comes back empty-handed.
|
|
31
|
+
*/
|
|
32
|
+
export declare function createVanishingPersistence(): {
|
|
33
|
+
persistence: DashboardPersistence;
|
|
34
|
+
created: Dashboard[];
|
|
35
|
+
reads: () => number;
|
|
36
|
+
/** Another author removes it, so every read from now on answers 404. */
|
|
37
|
+
deleteRemotely: () => void;
|
|
38
|
+
/** The server is merely unreachable, which says nothing about the dashboard. */
|
|
39
|
+
breakReads: () => void;
|
|
40
|
+
};
|
|
41
|
+
export type VanishingServer = ReturnType<typeof createVanishingPersistence>;
|
|
42
|
+
export declare function renderEditor(persistence: DashboardPersistence): void;
|
|
43
|
+
export type User = UserEvent;
|
|
44
|
+
/** The widget editor panel, which renders outside the editor's own subtree. */
|
|
45
|
+
export declare function panel(): {
|
|
46
|
+
getByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByText<T>>;
|
|
47
|
+
getAllByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByText<T>>;
|
|
48
|
+
queryByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByText<T>>;
|
|
49
|
+
queryAllByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByText<T>>;
|
|
50
|
+
findByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByText<T>>;
|
|
51
|
+
findAllByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByText<T>>;
|
|
52
|
+
getByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByBoundAttribute<T>>;
|
|
53
|
+
getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
54
|
+
queryByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByBoundAttribute<T>>;
|
|
55
|
+
queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
56
|
+
findByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByBoundAttribute<T>>;
|
|
57
|
+
findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByBoundAttribute<T>>;
|
|
58
|
+
getByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByText<T>>;
|
|
59
|
+
getAllByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByText<T>>;
|
|
60
|
+
queryByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByText<T>>;
|
|
61
|
+
queryAllByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByText<T>>;
|
|
62
|
+
findByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByText<T>>;
|
|
63
|
+
findAllByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByText<T>>;
|
|
64
|
+
getByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByBoundAttribute<T>>;
|
|
65
|
+
getAllByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
66
|
+
queryByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByBoundAttribute<T>>;
|
|
67
|
+
queryAllByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
68
|
+
findByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByBoundAttribute<T>>;
|
|
69
|
+
findAllByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByBoundAttribute<T>>;
|
|
70
|
+
getByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByBoundAttribute<T>>;
|
|
71
|
+
getAllByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
72
|
+
queryByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByBoundAttribute<T>>;
|
|
73
|
+
queryAllByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
74
|
+
findByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByBoundAttribute<T>>;
|
|
75
|
+
findAllByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByBoundAttribute<T>>;
|
|
76
|
+
getByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByBoundAttribute<T>>;
|
|
77
|
+
getAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
78
|
+
queryByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByBoundAttribute<T>>;
|
|
79
|
+
queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
80
|
+
findByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByBoundAttribute<T>>;
|
|
81
|
+
findAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByBoundAttribute<T>>;
|
|
82
|
+
getByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined): ReturnType<import('@testing-library/dom').GetByRole<T>>;
|
|
83
|
+
getAllByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined): ReturnType<import('@testing-library/dom').AllByRole<T>>;
|
|
84
|
+
queryByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined): ReturnType<import('@testing-library/dom').QueryByRole<T>>;
|
|
85
|
+
queryAllByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined): ReturnType<import('@testing-library/dom').AllByRole<T>>;
|
|
86
|
+
findByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByRole<T>>;
|
|
87
|
+
findAllByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByRole<T>>;
|
|
88
|
+
getByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').GetByBoundAttribute<T>>;
|
|
89
|
+
getAllByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
90
|
+
queryByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').QueryByBoundAttribute<T>>;
|
|
91
|
+
queryAllByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined): ReturnType<import('@testing-library/dom').AllByBoundAttribute<T>>;
|
|
92
|
+
findByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindByBoundAttribute<T>>;
|
|
93
|
+
findAllByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined): ReturnType<import('@testing-library/dom').FindAllByBoundAttribute<T>>;
|
|
94
|
+
} & {
|
|
95
|
+
getByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement;
|
|
96
|
+
getAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
97
|
+
queryByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
98
|
+
queryAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
99
|
+
findByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
100
|
+
findAllByLabelText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
101
|
+
getByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
|
|
102
|
+
getAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
103
|
+
queryByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
|
|
104
|
+
queryAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
105
|
+
findByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
106
|
+
findAllByPlaceholderText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
107
|
+
getByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement;
|
|
108
|
+
getAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
109
|
+
queryByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
110
|
+
queryAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
111
|
+
findByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
112
|
+
findAllByText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
113
|
+
getByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
|
|
114
|
+
getAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
115
|
+
queryByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
|
|
116
|
+
queryAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
117
|
+
findByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
118
|
+
findAllByAltText: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
119
|
+
getByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
|
|
120
|
+
getAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
121
|
+
queryByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
|
|
122
|
+
queryAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
123
|
+
findByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
124
|
+
findAllByTitle: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
125
|
+
getByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
|
|
126
|
+
getAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
127
|
+
queryByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
|
|
128
|
+
queryAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
129
|
+
findByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
130
|
+
findAllByDisplayValue: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
131
|
+
getByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement;
|
|
132
|
+
getAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement[];
|
|
133
|
+
queryByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement | null;
|
|
134
|
+
queryAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined) => HTMLElement[];
|
|
135
|
+
findByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
136
|
+
findAllByRole: (role: import('@testing-library/dom').ByRoleMatcher, options?: import('@testing-library/dom').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
137
|
+
getByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement;
|
|
138
|
+
getAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
139
|
+
queryByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement | null;
|
|
140
|
+
queryAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined) => HTMLElement[];
|
|
141
|
+
findByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
142
|
+
findAllByTestId: (id: import('@testing-library/dom').Matcher, options?: import('@testing-library/dom').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/dom').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The editor toolbar's Cancel, as opposed to the widget panel's own Cancel:
|
|
146
|
+
* with the panel open both are on screen under the same accessible name.
|
|
147
|
+
*/
|
|
148
|
+
export declare function toolbarCancel(): HTMLElement;
|
|
149
|
+
/** Work the draft can see: an edited, committed dashboard title. */
|
|
150
|
+
export declare function editTitle(user: User, title?: string): Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* A title being typed, with no Enter and no blur. The input reports every
|
|
153
|
+
* keystroke into the draft, so this is indistinguishable from a committed edit
|
|
154
|
+
* to every guard; the row exists to prove that stays true.
|
|
155
|
+
*/
|
|
156
|
+
export declare function typeTitleWithoutCommitting(user: User): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Work in progress that the dashboard draft cannot see: the panel holds its own
|
|
159
|
+
* copy of the widget until "Save widget", so the reducer never moves.
|
|
160
|
+
*/
|
|
161
|
+
export declare function editAWidgetWithoutSaving(user: User): Promise<void>;
|
|
162
|
+
/** The same, for the JSON tab: text is held until it is applied. */
|
|
163
|
+
export declare function typeJsonWithoutApplying(user: User): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Away to another tab and back, which is what fires the background re-read.
|
|
166
|
+
* Driven through the focus manager rather than a direct refetch so the test
|
|
167
|
+
* enters by the same door the bug did. Callers must reset the manager in an
|
|
168
|
+
* `afterEach` (`focusManager.setFocused(undefined)`): it is a module-level
|
|
169
|
+
* singleton, and an override left behind would decide whether the next test
|
|
170
|
+
* file refetches at all.
|
|
171
|
+
*/
|
|
172
|
+
export declare function returnToTheTab(server: VanishingServer): Promise<void>;
|
|
173
|
+
//# sourceMappingURL=vanishing-dashboard-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vanishing-dashboard-harness.d.ts","sourceRoot":"","sources":["../../../../src/dashboards/editor/testing/vanishing-dashboard-harness.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAIxF,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAI9E;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,KAAK,EAAE,qBAInB,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,SAQlB,CAAC;AAEF,eAAO,MAAM,OAAO,+BAA+B,CAAC;AAEpD,eAAO,MAAM,cAAc,QAAoC,CAAC;AAChE,eAAO,MAAM,aAAa,4BAA4B,CAAC;AACvD,mFAAmF;AACnF,eAAO,MAAM,aAAa,QAAsC,CAAC;AACjE,8EAA8E;AAC9E,eAAO,MAAM,eAAe,QAA6C,CAAC;AAC1E,yEAAyE;AACzE,eAAO,MAAM,WAAW,QAA6C,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,0BAA0B;;;;IA6BtC,wEAAwE;;IAExE,gFAAgF;;EAKnF;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAQ5E,wBAAgB,YAAY,CAAC,WAAW,EAAE,oBAAoB,QAgB7D;AAED,MAAM,MAAM,IAAI,GAAG,SAAS,CAAC;AAE7B,+EAA+E;AAC/E,wBAAgB,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIpB;AAED;;;GAGG;AACH,wBAAgB,aAAa,gBAK5B;AAED,oEAAoE;AACpE,wBAAsB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,SAAU,iBAK1D;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,IAAI,iBAG1D;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,iBAGxD;AAED,oEAAoE;AACpE,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,IAAI,iBAIvD;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,eAAe,iBAO3D"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Dashboard } from '../../types/domain';
|
|
2
|
+
/**
|
|
3
|
+
* What a write to the dashboards persistence came back as, said in the
|
|
4
|
+
* screen's vocabulary rather than as an error to sniff.
|
|
5
|
+
*
|
|
6
|
+
* A closed union on purpose: the editor answers every one of these in a single
|
|
7
|
+
* exhaustive switch, so the day a write can come back another way (OBS-62's
|
|
8
|
+
* `forbidden` is next), the compiler walks the author to the one place that
|
|
9
|
+
* decides what the screen does about it. Three hand-written `onError` handlers
|
|
10
|
+
* is how the last rule ended up applied to one of them.
|
|
11
|
+
*/
|
|
12
|
+
export type DashboardSaveOutcome = {
|
|
13
|
+
readonly kind: 'saved';
|
|
14
|
+
readonly dashboard: Dashboard;
|
|
15
|
+
}
|
|
16
|
+
/** Someone else saved first. Their version rode along on the refusal. */
|
|
17
|
+
| {
|
|
18
|
+
readonly kind: 'conflict';
|
|
19
|
+
readonly theirs: Dashboard;
|
|
20
|
+
}
|
|
21
|
+
/** The dashboard this write aimed at no longer exists. */
|
|
22
|
+
| {
|
|
23
|
+
readonly kind: 'gone';
|
|
24
|
+
} | {
|
|
25
|
+
readonly kind: 'failed';
|
|
26
|
+
readonly error: Error;
|
|
27
|
+
};
|
|
28
|
+
export interface DashboardSaver {
|
|
29
|
+
readonly isSaving: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Which conflict resolution is waiting on the server, so a slow one cannot
|
|
32
|
+
* be fired twice. Taking their version is not one: it needs no request.
|
|
33
|
+
*/
|
|
34
|
+
readonly resolutionInFlight: 'overwrite' | 'save-as-copy' | null;
|
|
35
|
+
/** Create or update, whichever the route this editor was mounted on means. */
|
|
36
|
+
readonly save: (draft: Dashboard, then: (outcome: DashboardSaveOutcome) => void) => void;
|
|
37
|
+
/** Update that applies over whatever revision is current: the deliberate act. */
|
|
38
|
+
readonly overwrite: (draft: Dashboard, then: (outcome: DashboardSaveOutcome) => void) => void;
|
|
39
|
+
/** Create, from a dashboard that already carries its new identity and title. */
|
|
40
|
+
readonly createCopy: (dashboard: Dashboard, then: (outcome: DashboardSaveOutcome) => void) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The editor's writes, each reporting a {@link DashboardSaveOutcome}.
|
|
44
|
+
*
|
|
45
|
+
* `gone` is only ever said about a dashboard that existed: an update's 404
|
|
46
|
+
* means it was deleted under the author, while a creation's 404 means the
|
|
47
|
+
* dashboards endpoint itself is absent, which is a deployment problem with
|
|
48
|
+
* nothing for a "keep your work" flow to keep it from. That rule used to live
|
|
49
|
+
* as an `&&` inside one of three inline error handlers; here it is the shape
|
|
50
|
+
* of the mapping.
|
|
51
|
+
*
|
|
52
|
+
* Continuation-passing rather than promises, deliberately: React Query skips
|
|
53
|
+
* per-call `mutate` callbacks once the component is unmounted, and `await`
|
|
54
|
+
* would not, so the promise form would resurrect state updates on dead
|
|
55
|
+
* screens.
|
|
56
|
+
*/
|
|
57
|
+
export declare function useDashboardSave(mode: 'create' | 'edit'): DashboardSaver;
|
|
58
|
+
//# sourceMappingURL=use-dashboard-save.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dashboard-save.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/use-dashboard-save.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;CAAE;AAC3D,yEAAyE;GACvE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAA;CAAE;AAC3D,0DAA0D;GACxD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,kBAAkB,EAAE,WAAW,GAAG,cAAc,GAAG,IAAI,CAAC;IACjE,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,KAAK,IAAI,CAAC;IACzF,iFAAiF;IACjF,QAAQ,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,KAAK,IAAI,CAAC;IAC9F,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,KAAK,IAAI,CAAC;CACpG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,cAAc,CAyCxE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface LeaveGuardOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Whether anything on screen would be lost by leaving. The whole answer,
|
|
4
|
+
* not the draft alone: the widget panel's working copy and the JSON tab's
|
|
5
|
+
* unapplied text are exactly as gone after a navigation as an edited title.
|
|
6
|
+
*/
|
|
7
|
+
readonly hasUnsavedWork: boolean;
|
|
8
|
+
/** Performs the exit once it is allowed: confirmed, or nothing to lose. */
|
|
9
|
+
readonly onLeave: () => void;
|
|
10
|
+
}
|
|
11
|
+
export interface LeaveGuard {
|
|
12
|
+
/** Leave now, or put the question on screen if that would lose work. */
|
|
13
|
+
readonly requestLeave: () => void;
|
|
14
|
+
/** Whether the confirmation dialog is up. */
|
|
15
|
+
readonly confirmOpen: boolean;
|
|
16
|
+
/** The author chose to lose the work. */
|
|
17
|
+
readonly confirmLeave: () => void;
|
|
18
|
+
/** The author chose to stay; nothing is touched. */
|
|
19
|
+
readonly stay: () => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The one owner of "may this editor be left?": the in-app exits ask through
|
|
23
|
+
* {@link LeaveGuard.requestLeave}, and the browser's own exits (refresh, tab
|
|
24
|
+
* close) are armed against the same predicate.
|
|
25
|
+
*
|
|
26
|
+
* A hook rather than a few lines in the page, for scope: the class of bug this
|
|
27
|
+
* editor shipped was consumers of "is there unsaved work" each asking a
|
|
28
|
+
* slightly different question, and a leave path was the likeliest place for
|
|
29
|
+
* the next one. With the question answered in here, a new exit either calls
|
|
30
|
+
* `requestLeave` and inherits the right answer, or it has to reimplement a
|
|
31
|
+
* dialog and a beforeunload listener to get a wrong one.
|
|
32
|
+
*/
|
|
33
|
+
export declare function useLeaveGuard({ hasUnsavedWork, onLeave }: LeaveGuardOptions): LeaveGuard;
|
|
34
|
+
//# sourceMappingURL=use-leave-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-leave-guard.d.ts","sourceRoot":"","sources":["../../../src/dashboards/editor/use-leave-guard.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU;IACzB,wEAAwE;IACxE,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;IAClC,6CAA6C;IAC7C,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,yCAAyC;IACzC,QAAQ,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC;IAClC,oDAAoD;IACpD,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAAE,cAAc,EAAE,OAAO,EAAE,EAAE,iBAAiB,GAAG,UAAU,CA+BxF"}
|