Skip to content

Commit b8c91bd

Browse files
committed
Fix wrong disable logic on validation page controlbar
1 parent 8316f4d commit b8c91bd

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

src/components/menus/MenuButton.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@
1212

1313
<script lang="ts">
1414
import { t } from '../../i18n';
15-
import type { MenuProperties } from '../../lib/navigation/Menus';
15+
import type { MenuProperties } from '../../lib/navigation/Menus';
1616
import Information from '../ui/information/Information.svelte';
1717
1818
export let title: string;
1919
export let helpTitle: string;
2020
export let helpDescription: string;
2121
export let onClickFunction: () => void;
2222
export let isExpanded: boolean;
23-
export let tooltipOffset: MenuProperties['tooltipOffset'] = {x: -100, y: 30};
23+
export let tooltipOffset: MenuProperties['tooltipOffset'] = { x: -100, y: 30 };
2424
</script>
2525

2626
<div>

src/lib/navigation/Menus.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ export interface MenuProperties {
2121
collapsedButtonContent: typeof SvelteComponent<any> | undefined;
2222
expandedButtonContent: typeof SvelteComponent<any>;
2323
additionalExpandPaths?: PathType[];
24-
tooltipOffset?: {x: number, y: number};
25-
};
24+
tooltipOffset?: { x: number; y: number };
25+
}
2626

2727
/**
2828
* Wrapper for the menu logic, use navigation if possible, this is for fine-grained control of menus.
@@ -64,7 +64,7 @@ class Menus {
6464
collapsedButtonContent: undefined,
6565
expandedButtonContent: ModelMenu,
6666
navigationPath: Paths.MODEL,
67-
tooltipOffset: {x: -100, y: -250}
67+
tooltipOffset: { x: -100, y: -250 },
6868
},
6969
]
7070
: [

src/pages/validation/ValidationPageControlBar.svelte

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@
1010
import { tr } from '../../i18n';
1111
import { stores } from '../../lib/stores/Stores';
1212
const validationSets = stores.getValidationSets();
13-
$: isClearDisabled = $validationSets.length === 0;
14-
const clearValidationSets = () => validationSets.clear();
13+
$: isClearDisabled =
14+
$validationSets.length === 0 ||
15+
$validationSets.map(e => e.recordings.length).reduce((pre, cur) => pre + cur, 0) ===
16+
0;
17+
const clearValidationSets = () =>
18+
confirm($tr('content.data.controlbar.button.clearData.confirm')) &&
19+
validationSets.clear();
1520
</script>
1621

1722
<ControlBar>

0 commit comments

Comments
 (0)