@skyhook-io/k8s-ui 1.18.1 → 1.18.2
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/README.md +8 -0
- package/package.json +1 -1
- package/src/components/applications/ApplicationsView.tsx +8 -7
- package/src/components/cluster-switcher/ClusterSwitcher.tsx +4 -0
- package/src/components/compare/ResourceCompareView.tsx +6 -2
- package/src/components/gitops/GitOpsTableView.tsx +13 -8
- package/src/components/issues/IssuesView.tsx +2 -2
- package/src/components/issues/diagnostic.ts +2 -0
- package/src/components/issues/severity.ts +1 -0
- package/src/components/logs/LogCore.tsx +13 -11
- package/src/components/logs/WorkloadLogsViewer.tsx +1 -1
- package/src/components/namespace-switcher/NamespacePicker.tsx +2 -0
- package/src/components/resources/ResourcesSidebar.keyboard.test.tsx +28 -0
- package/src/components/resources/ResourcesSidebar.tsx +26 -5
- package/src/components/resources/ResourcesView.crossplane-pause.test.tsx +133 -0
- package/src/components/resources/ResourcesView.flagger.test.tsx +31 -0
- package/src/components/resources/ResourcesView.kind-view.test.tsx +96 -1
- package/src/components/resources/ResourcesView.opentelemetry.test.tsx +29 -0
- package/src/components/resources/ResourcesView.tsx +238 -66
- package/src/components/resources/curated-column-ownership.test.ts +3 -3
- package/src/components/resources/generic-status.ts +15 -0
- package/src/components/resources/printer-columns.test.ts +36 -0
- package/src/components/resources/printer-columns.ts +12 -1
- package/src/components/resources/readiness-gates.test.ts +95 -0
- package/src/components/resources/renderers/CompositeRenderer.tsx +8 -12
- package/src/components/resources/renderers/CrossplanePauseContext.test.tsx +153 -0
- package/src/components/resources/renderers/CrossplanePauseContext.tsx +39 -0
- package/src/components/resources/renderers/FlaggerRenderers.tsx +96 -0
- package/src/components/resources/renderers/GenericRenderer.tsx +19 -11
- package/src/components/resources/renderers/ManagedResourceRenderer.tsx +5 -12
- package/src/components/resources/renderers/OpenTelemetryRenderers.tsx +73 -0
- package/src/components/resources/renderers/crossplane-cells.tsx +5 -5
- package/src/components/resources/renderers/index.ts +3 -0
- package/src/components/resources/resource-utils-crossplane.test.ts +45 -0
- package/src/components/resources/resource-utils-crossplane.ts +44 -8
- package/src/components/resources/resource-utils-flagger.test.tsx +82 -0
- package/src/components/resources/resource-utils-flagger.ts +76 -0
- package/src/components/resources/resource-utils-opentelemetry.test.tsx +74 -0
- package/src/components/resources/resource-utils-opentelemetry.ts +97 -0
- package/src/components/resources/resource-utils.ts +80 -2
- package/src/components/shared/CreateResourceDialog.test.tsx +14 -0
- package/src/components/shared/CreateResourceDialog.tsx +5 -0
- package/src/components/shared/DetailShell.phone.test.tsx +54 -0
- package/src/components/shared/DetailShell.tsx +14 -3
- package/src/components/shared/EditableYamlView.phone.test.tsx +44 -0
- package/src/components/shared/EditableYamlView.test.tsx +58 -0
- package/src/components/shared/EditableYamlView.tsx +18 -3
- package/src/components/shared/FilterRailPanel.test.tsx +39 -0
- package/src/components/shared/FilterRailPanel.tsx +62 -0
- package/src/components/shared/GitOpsWriteWarning.managers.test.tsx +85 -0
- package/src/components/shared/GitOpsWriteWarning.tsx +87 -5
- package/src/components/shared/ManagedByChip.manager.test.tsx +115 -0
- package/src/components/shared/ManagedByChip.menu.test.tsx +103 -0
- package/src/components/shared/ManagedByChip.tsx +135 -2
- package/src/components/shared/ResourceActionsBar.tsx +22 -6
- package/src/components/shared/ResourceRendererDispatch.tsx +23 -0
- package/src/components/shared/SetImageDialog.tsx +3 -0
- package/src/components/topology/TopologyControls.tsx +1 -1
- package/src/components/ui/CrossplaneOperationNotice.test.tsx +153 -0
- package/src/components/ui/CrossplaneOperationNotice.tsx +139 -0
- package/src/components/ui/ForceDeleteConfirmDialog.test.tsx +55 -6
- package/src/components/ui/ForceDeleteConfirmDialog.tsx +127 -22
- package/src/components/ui/PageHeader.tsx +3 -2
- package/src/components/ui/SummaryTile.tsx +13 -3
- package/src/components/ui/Tooltip.touch.test.tsx +55 -0
- package/src/components/ui/Tooltip.tsx +11 -2
- package/src/components/ui/YamlReview.test.tsx +52 -0
- package/src/components/ui/YamlReview.tsx +7 -0
- package/src/components/ui/drawer-components.test.tsx +27 -0
- package/src/components/ui/drawer-components.tsx +22 -42
- package/src/components/workload/WorkloadView.relationships.test.tsx +40 -0
- package/src/components/workload/WorkloadView.tsx +57 -34
- package/src/hooks/useKeepInViewport.mounted.test.tsx +72 -0
- package/src/hooks/useKeepInViewport.test.ts +27 -0
- package/src/hooks/useKeepInViewport.ts +87 -0
- package/src/types/core.ts +53 -1
- package/src/utils/api-resources.ts +1 -0
- package/src/utils/gitops-owner.ts +136 -8
- package/src/utils/gitops-write-guard.test.ts +332 -0
- package/src/utils/gitops-write-guard.ts +175 -11
- package/src/utils/index.ts +1 -0
- package/src/utils/read-actions.ts +34 -0
- package/src/utils/touch-intent.test.ts +39 -0
- package/src/utils/touch-intent.ts +35 -0
- package/vitest.config.ts +26 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
import { beforeEach, describe, expect, it } from 'vitest'
|
|
3
|
+
import { isTouchIntent } from './touch-intent'
|
|
4
|
+
|
|
5
|
+
function press(pointerType: string) {
|
|
6
|
+
const e = new Event('pointerdown', { bubbles: true }) as Event & { pointerType: string }
|
|
7
|
+
Object.defineProperty(e, 'pointerType', { value: pointerType })
|
|
8
|
+
document.body.dispatchEvent(e)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function pressKey() {
|
|
12
|
+
document.body.dispatchEvent(new KeyboardEvent('keydown', { key: 'Tab', bubbles: true }))
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// The module keeps the last touch time across tests and files; a key press clears it.
|
|
16
|
+
beforeEach(pressKey)
|
|
17
|
+
|
|
18
|
+
describe('isTouchIntent', () => {
|
|
19
|
+
it('ignores mouse presses', () => {
|
|
20
|
+
press('mouse')
|
|
21
|
+
expect(isTouchIntent()).toBe(false)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('is set right after a touch press and expires', () => {
|
|
25
|
+
press('touch')
|
|
26
|
+
const now = performance.now()
|
|
27
|
+
expect(isTouchIntent(now)).toBe(true)
|
|
28
|
+
expect(isTouchIntent(now + 2000)).toBe(false)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe('isTouchIntent and the keyboard', () => {
|
|
33
|
+
it('ends the tap window on a key press', () => {
|
|
34
|
+
press('touch')
|
|
35
|
+
expect(isTouchIntent()).toBe(true)
|
|
36
|
+
pressKey()
|
|
37
|
+
expect(isTouchIntent()).toBe(false)
|
|
38
|
+
})
|
|
39
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// A tap fires a burst of mouse-compatibility events (mouseover, mouseenter)
|
|
2
|
+
// and focuses the tapped control, and when the tap changes the layout the
|
|
3
|
+
// browser can report a hover on whatever now sits under the finger. Hover and
|
|
4
|
+
// focus affordances (tooltips, hover cards) that react to that burst pop open
|
|
5
|
+
// over whatever the tap just opened. This records the last touch or pen
|
|
6
|
+
// pointer-down so they can tell a tap's side effects from a real hover or a
|
|
7
|
+
// keyboard focus.
|
|
8
|
+
const TOUCH_INTENT_MS = 800
|
|
9
|
+
|
|
10
|
+
let lastTouchAt = Number.NEGATIVE_INFINITY
|
|
11
|
+
|
|
12
|
+
if (typeof document !== 'undefined') {
|
|
13
|
+
document.addEventListener(
|
|
14
|
+
'pointerdown',
|
|
15
|
+
(e) => {
|
|
16
|
+
if (e.pointerType !== 'mouse') lastTouchAt = performance.now()
|
|
17
|
+
},
|
|
18
|
+
{ capture: true, passive: true },
|
|
19
|
+
)
|
|
20
|
+
// Keyboard use ends the tap's window: a Tab right after a tap (a touchscreen
|
|
21
|
+
// laptop) is real keyboard focus.
|
|
22
|
+
document.addEventListener(
|
|
23
|
+
'keydown',
|
|
24
|
+
() => {
|
|
25
|
+
lastTouchAt = Number.NEGATIVE_INFINITY
|
|
26
|
+
},
|
|
27
|
+
{ capture: true, passive: true },
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** True right after a touch or pen press: a mouseenter or focus now is the
|
|
32
|
+
* tap's side effect, not a hover or keyboard navigation. */
|
|
33
|
+
export function isTouchIntent(now = performance.now()): boolean {
|
|
34
|
+
return now - lastTouchAt < TOUCH_INTENT_MS
|
|
35
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { configDefaults, defineConfig } from 'vitest/config'
|
|
3
|
+
import { isolatedTestFiles } from '../../scripts/vitest-isolated-tests'
|
|
4
|
+
|
|
5
|
+
const isolated = isolatedTestFiles(__dirname)
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
test: {
|
|
9
|
+
fsModuleCache: true,
|
|
10
|
+
// Worktrees symlink node_modules to one checkout, so the default cache
|
|
11
|
+
// location would be shared by every worktree.
|
|
12
|
+
fsModuleCachePath: path.resolve(__dirname, '.vitest-cache'),
|
|
13
|
+
projects: [
|
|
14
|
+
{
|
|
15
|
+
extends: true,
|
|
16
|
+
test: {
|
|
17
|
+
name: 'shared',
|
|
18
|
+
isolate: false,
|
|
19
|
+
setupFiles: [path.resolve(__dirname, '../../scripts/vitest-shared-setup.ts')],
|
|
20
|
+
exclude: [...configDefaults.exclude, ...isolated],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
{ extends: true, test: { name: 'isolated', include: isolated } },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
})
|