mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make notifications unit testable in behaviours
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
7623dc7bad
commit
1b46ccd18b
@ -1,11 +1,20 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`extension special characters in page registrations renders 1`] = `<div />`;
|
exports[`extension special characters in page registrations renders 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`extension special characters in page registrations when navigating to route with ID having special characters renders 1`] = `
|
exports[`extension special characters in page registrations when navigating to route with ID having special characters renders 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
Some page
|
Some page
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1,12 +1,21 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`navigate to extension page renders 1`] = `<div />`;
|
exports[`navigate to extension page renders 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`navigate to extension page when extension navigates to child route renders 1`] = `
|
exports[`navigate to extension page when extension navigates to child route renders 1`] = `
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
Child page
|
Child page
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -31,6 +40,9 @@ exports[`navigate to extension page when extension navigates to route with param
|
|||||||
Some button
|
Some button
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -55,6 +67,9 @@ exports[`navigate to extension page when extension navigates to route without pa
|
|||||||
Some button
|
Some button
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -79,5 +94,8 @@ exports[`navigate to extension page when extension navigates to route without pa
|
|||||||
Some button
|
Some button
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -8,6 +8,9 @@ exports[`navigating between routes given route with optional path parameters whe
|
|||||||
"someOtherParameter": "some-other-value"
|
"someOtherParameter": "some-other-value"
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -16,5 +19,8 @@ exports[`navigating between routes given route without path parameters when navi
|
|||||||
<div>
|
<div>
|
||||||
Some component
|
Some component
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`add-cluster - navigation using application menu renders 1`] = `<div />`;
|
exports[`add-cluster - navigation using application menu renders 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`add-cluster - navigation using application menu when navigating to add cluster using application menu renders 1`] = `
|
exports[`add-cluster - navigation using application menu when navigating to add cluster using application menu renders 1`] = `
|
||||||
<div>
|
<div>
|
||||||
@ -85,5 +91,8 @@ exports[`add-cluster - navigation using application menu when navigating to add
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -328,6 +328,9 @@ exports[`cluster - order of sidebar items when rendered renders 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -723,5 +726,8 @@ exports[`cluster - order of sidebar items when rendered when parent is expanded
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -293,6 +293,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -589,6 +592,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -909,6 +915,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1234,6 +1243,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
<div
|
<div
|
||||||
data-testid="some-child-page"
|
data-testid="some-child-page"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1534,6 +1546,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
<div
|
<div
|
||||||
data-testid="some-child-page"
|
data-testid="some-child-page"
|
||||||
/>
|
/>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1854,6 +1869,9 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -2150,5 +2168,8 @@ exports[`cluster - sidebar and tab navigation for core given core registrations
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -293,6 +293,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -589,6 +592,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -929,6 +935,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1313,6 +1322,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1697,6 +1709,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -2036,6 +2051,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -2376,6 +2394,9 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -2672,5 +2693,8 @@ exports[`cluster - sidebar and tab navigation for extensions given extension wit
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -261,6 +261,9 @@ exports[`cluster - visibility of sidebar items given kube resource for route is
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -573,5 +576,8 @@ exports[`cluster - visibility of sidebar items given kube resource for route is
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`extensions - navigation using application menu renders 1`] = `<div />`;
|
exports[`extensions - navigation using application menu renders 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`extensions - navigation using application menu when navigating to extensions using application menu renders 1`] = `
|
exports[`extensions - navigation using application menu when navigating to extensions using application menu renders 1`] = `
|
||||||
<div>
|
<div>
|
||||||
@ -118,5 +124,8 @@ exports[`extensions - navigation using application menu when navigating to exten
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -454,5 +454,8 @@ exports[`helm-charts - navigation to Helm charts when navigating to Helm charts
|
|||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -537,6 +537,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -679,6 +682,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -687,6 +693,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
|||||||
<div>
|
<div>
|
||||||
Some front page
|
Some front page
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -695,6 +704,9 @@ exports[`preferences - closing-preferences given accessing preferences directly
|
|||||||
<div>
|
<div>
|
||||||
Some front page
|
Some front page
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1235,6 +1247,9 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1377,6 +1392,9 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1519,6 +1537,9 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1661,5 +1682,8 @@ exports[`preferences - closing-preferences given already in a page and then navi
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -199,6 +199,9 @@ exports[`preferences - navigation to application preferences given in some child
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -727,5 +730,8 @@ exports[`preferences - navigation to application preferences given in some child
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -525,6 +525,9 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -935,5 +938,8 @@ exports[`preferences - navigation to editor preferences given in preferences, wh
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -525,6 +525,9 @@ exports[`preferences - navigation to extension specific preferences given in pre
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1065,6 +1068,9 @@ exports[`preferences - navigation to extension specific preferences given in pre
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1239,5 +1245,8 @@ exports[`preferences - navigation to extension specific preferences given in pre
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -525,6 +525,9 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -836,7 +839,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
class="flex gaps"
|
class="flex gaps"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="Select theme-lens box grow css-b62m3t-container"
|
class="Select theme-lens box grow Select--is-disabled css-3iigni-container"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="css-1f43avz-a11yText-A11yText"
|
class="css-1f43avz-a11yText-A11yText"
|
||||||
@ -849,7 +852,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
class="css-1f43avz-a11yText-A11yText"
|
class="css-1f43avz-a11yText-A11yText"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="Select__control css-1s2u09g-control"
|
class="Select__control Select__control--is-disabled css-1insrsq-control"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="Select__value-container css-319lph-ValueContainer"
|
class="Select__value-container css-319lph-ValueContainer"
|
||||||
@ -861,7 +864,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
Repositories
|
Repositories
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="Select__input-container css-6j8wv5-Input"
|
class="Select__input-container css-jzldcf-Input"
|
||||||
data-value=""
|
data-value=""
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
@ -873,6 +876,7 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
autocorrect="off"
|
autocorrect="off"
|
||||||
class="Select__input"
|
class="Select__input"
|
||||||
|
disabled=""
|
||||||
id="HelmRepoSelect"
|
id="HelmRepoSelect"
|
||||||
role="combobox"
|
role="combobox"
|
||||||
spellcheck="false"
|
spellcheck="false"
|
||||||
@ -885,9 +889,23 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
class="Select__indicators css-1hb7zxy-IndicatorsContainer"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
aria-hidden="true"
|
||||||
|
class="Select__indicator Select__loading-indicator css-at12u2-loadingIndicator"
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
class="Select__indicator-separator css-1okebmr-indicatorSeparator"
|
class="css-1xtdfmb-LoadingDot"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="css-zoievk-LoadingDot"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="css-x748d8-LoadingDot"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<span
|
||||||
|
class="Select__indicator-separator css-109onse-indicatorSeparator"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
@ -920,13 +938,11 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
class="repos"
|
class="repos"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="notice"
|
class="pt-5 relative"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="flex-grow text-center"
|
class="Spinner singleColor center"
|
||||||
>
|
/>
|
||||||
The repositories have not been added yet
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -969,5 +985,8 @@ exports[`preferences - navigation to kubernetes preferences given in preferences
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -525,6 +525,9 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -727,5 +730,8 @@ exports[`preferences - navigation to proxy preferences given in preferences, whe
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -185,6 +185,9 @@ exports[`preferences - navigation to telemetry preferences given URL for Sentry
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -713,6 +716,9 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1253,6 +1259,9 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1429,6 +1438,9 @@ exports[`preferences - navigation to telemetry preferences given in preferences,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -1568,5 +1580,8 @@ exports[`preferences - navigation to telemetry preferences given no URL for Sent
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -525,6 +525,9 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -845,5 +848,8 @@ exports[`preferences - navigation to terminal preferences given in preferences,
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`preferences - navigation using application menu renders 1`] = `<div />`;
|
exports[`preferences - navigation using application menu renders 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`preferences - navigation using application menu when navigating to preferences using application menu renders 1`] = `
|
exports[`preferences - navigation using application menu when navigating to preferences using application menu renders 1`] = `
|
||||||
<div>
|
<div>
|
||||||
@ -527,5 +533,8 @@ exports[`preferences - navigation using application menu when navigating to pref
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
exports[`show-about-using-tray renders 1`] = `
|
exports[`show-about-using-tray renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@ -532,6 +536,9 @@ exports[`show-about-using-tray when navigating using tray renders 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -2,54 +2,90 @@
|
|||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download fails renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download fails renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds when user answers not to install the update renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds when user answers not to install the update renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds when user answers to install the update renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds when user answers to install the update renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds when user disregards the question and installs the update using tray renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when new update is discovered when download succeeds when user disregards the question and installs the update using tray renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when no new update is discovered renders 1`] = `
|
exports[`installing update using tray given no update is already downloaded, and "latest" update channel is selected, when started when user checks for updates using tray when no new update is discovered renders 1`] = `
|
||||||
<body>
|
<body>
|
||||||
<div />
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -1,6 +1,12 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`welcome - navigation using application menu renders 1`] = `<div />`;
|
exports[`welcome - navigation using application menu renders 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`welcome - navigation using application menu when navigating to welcome using application menu renders 1`] = `
|
exports[`welcome - navigation using application menu when navigating to welcome using application menu renders 1`] = `
|
||||||
<div>
|
<div>
|
||||||
@ -87,5 +93,8 @@ exports[`welcome - navigation using application menu when navigating to welcome
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="Notifications flex column align-flex-end"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@ -0,0 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||||
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
|
*/
|
||||||
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
|
import { NotificationsStore } from "./notifications.store";
|
||||||
|
|
||||||
|
const notificationsStoreInjectable = getInjectable({
|
||||||
|
id: "notifications-store",
|
||||||
|
instantiate: () => new NotificationsStore(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default notificationsStoreInjectable;
|
||||||
@ -91,5 +91,3 @@ export class NotificationsStore {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const notificationsStore = new NotificationsStore();
|
|
||||||
|
|||||||
@ -10,61 +10,25 @@ import { reaction } from "mobx";
|
|||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { JsonApiErrorParsed } from "../../../common/k8s-api/json-api";
|
import { JsonApiErrorParsed } from "../../../common/k8s-api/json-api";
|
||||||
import { cssNames, prevDefault } from "../../utils";
|
import { cssNames, prevDefault } from "../../utils";
|
||||||
import type { Notification, NotificationMessage } from "./notifications.store";
|
import type { Notification, NotificationMessage, NotificationsStore } from "./notifications.store";
|
||||||
import { notificationsStore, NotificationStatus } from "./notifications.store";
|
import { NotificationStatus } from "./notifications.store";
|
||||||
import { Animate } from "../animate";
|
import { Animate } from "../animate";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
|
import { asLegacyGlobalForExtensionApi } from "../../../extensions/as-legacy-globals-for-extension-api/as-legacy-global-object-for-extension-api";
|
||||||
|
import notificationsStoreInjectable from "./notifications-store.injectable";
|
||||||
|
|
||||||
|
interface Dependencies {
|
||||||
|
store: NotificationsStore;
|
||||||
|
}
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
export class Notifications extends React.Component {
|
class NonInjectedNotifications extends React.Component<Dependencies> {
|
||||||
public elem: HTMLDivElement | null = null;
|
public elem: HTMLDivElement | null = null;
|
||||||
|
|
||||||
static ok(message: NotificationMessage) {
|
|
||||||
return notificationsStore.add({
|
|
||||||
message,
|
|
||||||
timeout: 2_500,
|
|
||||||
status: NotificationStatus.OK,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static checkedError(message: unknown, fallback: string, customOpts?: Partial<Omit<Notification, "message">>) {
|
|
||||||
if (typeof message === "string" || message instanceof Error || message instanceof JsonApiErrorParsed) {
|
|
||||||
return Notifications.error(message, customOpts);
|
|
||||||
}
|
|
||||||
|
|
||||||
console.warn("Unknown notification error message, falling back to default", message);
|
|
||||||
|
|
||||||
return Notifications.error(fallback, customOpts);
|
|
||||||
}
|
|
||||||
|
|
||||||
static error(message: NotificationMessage, customOpts: Partial<Omit<Notification, "message">> = {}) {
|
|
||||||
return notificationsStore.add({
|
|
||||||
message,
|
|
||||||
timeout: 10_000,
|
|
||||||
status: NotificationStatus.ERROR,
|
|
||||||
...customOpts,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static shortInfo(message: NotificationMessage, customOpts: Partial<Omit<Notification, "message">> = {}) {
|
|
||||||
return this.info(message, {
|
|
||||||
timeout: 5_000,
|
|
||||||
...customOpts,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
static info(message: NotificationMessage, customOpts: Partial<Omit<Notification, "message">> = {}) {
|
|
||||||
return notificationsStore.add({
|
|
||||||
status: NotificationStatus.INFO,
|
|
||||||
timeout: 0,
|
|
||||||
message,
|
|
||||||
...customOpts,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
disposeOnUnmount(this, [
|
disposeOnUnmount(this, [
|
||||||
reaction(() => notificationsStore.notifications.length, () => {
|
reaction(() => this.props.store.notifications.length, () => {
|
||||||
this.scrollToLastNotification();
|
this.scrollToLastNotification();
|
||||||
}, { delay: 250 }),
|
}, { delay: 250 }),
|
||||||
]);
|
]);
|
||||||
@ -74,7 +38,7 @@ export class Notifications extends React.Component {
|
|||||||
if (!this.elem) {
|
if (!this.elem) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.elem.scrollTo({
|
this.elem.scrollTo?.({
|
||||||
top: this.elem.scrollHeight,
|
top: this.elem.scrollHeight,
|
||||||
behavior: "smooth",
|
behavior: "smooth",
|
||||||
});
|
});
|
||||||
@ -91,7 +55,7 @@ export class Notifications extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { notifications, remove, addAutoHideTimer, removeAutoHideTimer } = notificationsStore;
|
const { notifications, remove, addAutoHideTimer, removeAutoHideTimer } = this.props.store;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="Notifications flex column align-flex-end" ref={e => this.elem = e}>
|
<div className="Notifications flex column align-flex-end" ref={e => this.elem = e}>
|
||||||
@ -114,6 +78,7 @@ export class Notifications extends React.Component {
|
|||||||
<Icon
|
<Icon
|
||||||
material="close"
|
material="close"
|
||||||
className="close"
|
className="close"
|
||||||
|
data-testid={`close-notification-for-${id}`}
|
||||||
onClick={prevDefault(() => {
|
onClick={prevDefault(() => {
|
||||||
remove(id);
|
remove(id);
|
||||||
onClose?.();
|
onClose?.();
|
||||||
@ -128,3 +93,68 @@ export class Notifications extends React.Component {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const Notifications = withInjectables<Dependencies>(
|
||||||
|
NonInjectedNotifications,
|
||||||
|
|
||||||
|
{
|
||||||
|
getProps: (di) => ({
|
||||||
|
store: di.inject(notificationsStoreInjectable),
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
) as React.FC & {
|
||||||
|
ok: (message: NotificationMessage) => () => void;
|
||||||
|
checkedError: (message: unknown, fallback: string, customOpts?: Partial<Omit<Notification, "message">>) => () => void;
|
||||||
|
error: (message: NotificationMessage, customOpts?: Partial<Omit<Notification, "message">>) => () => void;
|
||||||
|
shortInfo: (message: NotificationMessage, customOpts?: Partial<Omit<Notification, "message">>) => () => void;
|
||||||
|
info: (message: NotificationMessage, customOpts?: Partial<Omit<Notification, "message">>) => () => void;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
const _notificationStore = asLegacyGlobalForExtensionApi(notificationsStoreInjectable);
|
||||||
|
|
||||||
|
Notifications.ok = (message: NotificationMessage) => {
|
||||||
|
return _notificationStore.add({
|
||||||
|
message,
|
||||||
|
timeout: 2_500,
|
||||||
|
status: NotificationStatus.OK,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Notifications.checkedError = (message, fallback, customOpts = {}) => {
|
||||||
|
if (typeof message === "string" || message instanceof Error || message instanceof JsonApiErrorParsed) {
|
||||||
|
return Notifications.error(message, customOpts);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn("Unknown notification error message, falling back to default", message);
|
||||||
|
|
||||||
|
return Notifications.error(fallback, customOpts);
|
||||||
|
};
|
||||||
|
|
||||||
|
Notifications.error = (message, customOpts= {}) => {
|
||||||
|
return _notificationStore.add({
|
||||||
|
message,
|
||||||
|
timeout: 10_000,
|
||||||
|
status: NotificationStatus.ERROR,
|
||||||
|
...customOpts,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Notifications.shortInfo = (message, customOpts = {}) => {
|
||||||
|
return Notifications.info(message, {
|
||||||
|
timeout: 5_000,
|
||||||
|
...customOpts,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
Notifications.info = (message, customOpts = {}) => {
|
||||||
|
return _notificationStore.add({
|
||||||
|
status: NotificationStatus.INFO,
|
||||||
|
timeout: 0,
|
||||||
|
message,
|
||||||
|
...customOpts,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@ -44,10 +44,10 @@ import { flushPromises } from "../../../common/test-utils/flush-promises";
|
|||||||
import type { NamespaceStore } from "../+namespaces/store";
|
import type { NamespaceStore } from "../+namespaces/store";
|
||||||
import namespaceStoreInjectable from "../+namespaces/store.injectable";
|
import namespaceStoreInjectable from "../+namespaces/store.injectable";
|
||||||
import historyInjectable from "../../navigation/history.injectable";
|
import historyInjectable from "../../navigation/history.injectable";
|
||||||
import trayMenuItemsInjectable from "../../../main/tray/tray-menu-item/tray-menu-items.injectable";
|
|
||||||
import type { TrayMenuItem } from "../../../main/tray/tray-menu-item/tray-menu-item-injection-token";
|
import type { TrayMenuItem } from "../../../main/tray/tray-menu-item/tray-menu-item-injection-token";
|
||||||
import electronTrayInjectable from "../../../main/tray/electron-tray/electron-tray.injectable";
|
import electronTrayInjectable from "../../../main/tray/electron-tray/electron-tray.injectable";
|
||||||
import applicationWindowInjectable from "../../../main/start-main-application/lens-window/application-window/application-window.injectable";
|
import applicationWindowInjectable from "../../../main/start-main-application/lens-window/application-window/application-window.injectable";
|
||||||
|
import { Notifications } from "../notifications/notifications";
|
||||||
|
|
||||||
type Callback = (dis: DiContainers) => void | Promise<void>;
|
type Callback = (dis: DiContainers) => void | Promise<void>;
|
||||||
|
|
||||||
@ -395,6 +395,8 @@ export const getApplicationBuilder = () => {
|
|||||||
return <Component />;
|
return <Component />;
|
||||||
}}
|
}}
|
||||||
</Observer>
|
</Observer>
|
||||||
|
|
||||||
|
<Notifications />
|
||||||
</Router>,
|
</Router>,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -5,17 +5,19 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import navigateToEntitySettingsInjectable from "../../common/front-end-routing/routes/entity-settings/navigate-to-entity-settings.injectable";
|
import navigateToEntitySettingsInjectable from "../../common/front-end-routing/routes/entity-settings/navigate-to-entity-settings.injectable";
|
||||||
import type { ListNamespaceForbiddenArgs } from "../../common/ipc/cluster";
|
import type { ListNamespaceForbiddenArgs } from "../../common/ipc/cluster";
|
||||||
import { Notifications, notificationsStore } from "../components/notifications";
|
import { Notifications } from "../components/notifications";
|
||||||
import { ClusterStore } from "../../common/cluster-store/cluster-store";
|
import { ClusterStore } from "../../common/cluster-store/cluster-store";
|
||||||
import { Button } from "../components/button";
|
import { Button } from "../components/button";
|
||||||
import type { IpcRendererEvent } from "electron";
|
import type { IpcRendererEvent } from "electron";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
import notificationsStoreInjectable from "../components/notifications/notifications-store.injectable";
|
||||||
|
|
||||||
const listNamespacesForbiddenHandlerInjectable = getInjectable({
|
const listNamespacesForbiddenHandlerInjectable = getInjectable({
|
||||||
id: "list-namespaces-forbidden-handler",
|
id: "list-namespaces-forbidden-handler",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const navigateToEntitySettings = di.inject(navigateToEntitySettingsInjectable);
|
const navigateToEntitySettings = di.inject(navigateToEntitySettingsInjectable);
|
||||||
|
const notificationsStore = di.inject(notificationsStoreInjectable);
|
||||||
|
|
||||||
const notificationLastDisplayedAt = new Map<string, number>();
|
const notificationLastDisplayedAt = new Map<string, number>();
|
||||||
const intervalBetweenNotifications = 1000 * 60; // 60s
|
const intervalBetweenNotifications = 1000 * 60; // 60s
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import type { IpcRendererEvent } from "electron";
|
|||||||
import { ipcRenderer } from "electron";
|
import { ipcRenderer } from "electron";
|
||||||
import type { UpdateAvailableFromMain, BackchannelArg } from "../../common/ipc";
|
import type { UpdateAvailableFromMain, BackchannelArg } from "../../common/ipc";
|
||||||
import { areArgsUpdateAvailableFromMain, UpdateAvailableChannel, onCorrect, ipcRendererOn, AutoUpdateChecking, AutoUpdateNoUpdateAvailable } from "../../common/ipc";
|
import { areArgsUpdateAvailableFromMain, UpdateAvailableChannel, onCorrect, ipcRendererOn, AutoUpdateChecking, AutoUpdateNoUpdateAvailable } from "../../common/ipc";
|
||||||
import { Notifications, notificationsStore } from "../components/notifications";
|
import { Notifications } from "../components/notifications";
|
||||||
import { Button } from "../components/button";
|
import { Button } from "../components/button";
|
||||||
import { isMac } from "../../common/vars";
|
import { isMac } from "../../common/vars";
|
||||||
import { defaultHotbarCells } from "../../common/hotbars/types";
|
import { defaultHotbarCells } from "../../common/hotbars/types";
|
||||||
@ -16,7 +16,6 @@ import { type ListNamespaceForbiddenArgs, clusterListNamespaceForbiddenChannel,
|
|||||||
import { hotbarTooManyItemsChannel } from "../../common/ipc/hotbar";
|
import { hotbarTooManyItemsChannel } from "../../common/ipc/hotbar";
|
||||||
|
|
||||||
function sendToBackchannel(backchannel: string, notificationId: string, data: BackchannelArg): void {
|
function sendToBackchannel(backchannel: string, notificationId: string, data: BackchannelArg): void {
|
||||||
notificationsStore.remove(notificationId);
|
|
||||||
ipcRenderer.send(backchannel, data);
|
ipcRenderer.send(backchannel, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,18 +7,22 @@ import { aboutPortForwarding } from "./port-forward-notify";
|
|||||||
import navigateToPortForwardsInjectable from "../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
import navigateToPortForwardsInjectable from "../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
||||||
import hostedClusterIdInjectable from "../../common/cluster-store/hosted-cluster-id.injectable";
|
import hostedClusterIdInjectable from "../../common/cluster-store/hosted-cluster-id.injectable";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
import notificationsStoreInjectable from "../components/notifications/notifications-store.injectable";
|
||||||
|
|
||||||
const aboutPortForwardingInjectable = getInjectable({
|
const aboutPortForwardingInjectable = getInjectable({
|
||||||
id: "about-port-forwarding",
|
id: "about-port-forwarding",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const hostedClusterId = di.inject(hostedClusterIdInjectable);
|
const hostedClusterId = di.inject(hostedClusterIdInjectable);
|
||||||
|
const notificationsStore = di.inject(notificationsStoreInjectable);
|
||||||
|
const navigateToPortForwards = di.inject(navigateToPortForwardsInjectable);
|
||||||
|
|
||||||
assert(hostedClusterId, "Only allowed to notify about port forward errors within a cluster frame");
|
assert(hostedClusterId, "Only allowed to notify about port forward errors within a cluster frame");
|
||||||
|
|
||||||
return aboutPortForwarding({
|
return aboutPortForwarding({
|
||||||
navigateToPortForwards: di.inject(navigateToPortForwardsInjectable),
|
navigateToPortForwards,
|
||||||
hostedClusterId,
|
hostedClusterId,
|
||||||
|
notificationsStore,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -7,18 +7,22 @@ import { notifyErrorPortForwarding } from "./port-forward-notify";
|
|||||||
import navigateToPortForwardsInjectable from "../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
import navigateToPortForwardsInjectable from "../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
||||||
import hostedClusterIdInjectable from "../../common/cluster-store/hosted-cluster-id.injectable";
|
import hostedClusterIdInjectable from "../../common/cluster-store/hosted-cluster-id.injectable";
|
||||||
import assert from "assert";
|
import assert from "assert";
|
||||||
|
import notificationsStoreInjectable from "../components/notifications/notifications-store.injectable";
|
||||||
|
|
||||||
const notifyErrorPortForwardingInjectable = getInjectable({
|
const notifyErrorPortForwardingInjectable = getInjectable({
|
||||||
id: "notify-error-port-forwarding",
|
id: "notify-error-port-forwarding",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const hostedClusterId = di.inject(hostedClusterIdInjectable);
|
const hostedClusterId = di.inject(hostedClusterIdInjectable);
|
||||||
|
const notificationsStore = di.inject(notificationsStoreInjectable);
|
||||||
|
const navigateToPortForwards = di.inject(navigateToPortForwardsInjectable);
|
||||||
|
|
||||||
assert(hostedClusterId, "Only allowed to notify about port forward errors within a cluster frame");
|
assert(hostedClusterId, "Only allowed to notify about port forward errors within a cluster frame");
|
||||||
|
|
||||||
return notifyErrorPortForwarding({
|
return notifyErrorPortForwarding({
|
||||||
navigateToPortForwards: di.inject(navigateToPortForwardsInjectable),
|
navigateToPortForwards,
|
||||||
hostedClusterId,
|
hostedClusterId,
|
||||||
|
notificationsStore,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@ -5,17 +5,20 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Button } from "../components/button";
|
import { Button } from "../components/button";
|
||||||
import { Notifications, notificationsStore } from "../components/notifications";
|
import type { NotificationsStore } from "../components/notifications";
|
||||||
|
import { Notifications } from "../components/notifications";
|
||||||
import type { NavigateToPortForwards } from "../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
import type { NavigateToPortForwards } from "../../common/front-end-routing/routes/cluster/network/port-forwards/navigate-to-port-forwards.injectable";
|
||||||
|
|
||||||
interface AboutPortForwardingDependencies {
|
interface AboutPortForwardingDependencies {
|
||||||
navigateToPortForwards: NavigateToPortForwards;
|
navigateToPortForwards: NavigateToPortForwards;
|
||||||
hostedClusterId: string;
|
hostedClusterId: string;
|
||||||
|
notificationsStore: NotificationsStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const aboutPortForwarding = ({
|
export const aboutPortForwarding = ({
|
||||||
navigateToPortForwards,
|
navigateToPortForwards,
|
||||||
hostedClusterId,
|
hostedClusterId,
|
||||||
|
notificationsStore,
|
||||||
}: AboutPortForwardingDependencies) => () => {
|
}: AboutPortForwardingDependencies) => () => {
|
||||||
const notificationId = `port-forward-notification-${hostedClusterId}`;
|
const notificationId = `port-forward-notification-${hostedClusterId}`;
|
||||||
|
|
||||||
@ -49,12 +52,14 @@ export const aboutPortForwarding = ({
|
|||||||
interface NotifyErrorPortForwardingDependencies {
|
interface NotifyErrorPortForwardingDependencies {
|
||||||
navigateToPortForwards: NavigateToPortForwards;
|
navigateToPortForwards: NavigateToPortForwards;
|
||||||
hostedClusterId: string;
|
hostedClusterId: string;
|
||||||
|
notificationsStore: NotificationsStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export const notifyErrorPortForwarding = ({
|
export const notifyErrorPortForwarding = ({
|
||||||
navigateToPortForwards,
|
navigateToPortForwards,
|
||||||
hostedClusterId,
|
hostedClusterId,
|
||||||
|
notificationsStore,
|
||||||
}: NotifyErrorPortForwardingDependencies) => (msg: string) => {
|
}: NotifyErrorPortForwardingDependencies) => (msg: string) => {
|
||||||
const notificationId = `port-forward-error-notification-${hostedClusterId}`;
|
const notificationId = `port-forward-error-notification-${hostedClusterId}`;
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user