|
12 | 12 | selectedDataType |
13 | 13 | } from "./data-type-decorator-section-store"; |
14 | 14 | import {prepareData} from "./data-type-decorator-view-grid-utils"; |
| 15 | + import {onDestroy, onMount} from "svelte"; |
| 16 | + import localWritable from "../../../common/svelte/local-writable"; |
15 | 17 |
|
16 | 18 | const Modes = { |
17 | 19 | TREE: "TREE", |
|
20 | 22 |
|
21 | 23 | export let primaryEntityRef; |
22 | 24 |
|
23 | | - let activeMode = Modes.TREE; |
| 25 | + let activeMode = localWritable('waltz.DataTypeDecoratorSection.activeMode', Modes.TREE); |
24 | 26 | let viewCall; |
25 | 27 |
|
26 | 28 | function toggleView() { |
27 | | - if (activeMode === Modes.TREE) { |
28 | | - activeMode = Modes.TABLE; |
| 29 | + if ($activeMode === Modes.TREE) { |
| 30 | + $activeMode = Modes.TABLE; |
29 | 31 | } else { |
30 | | - activeMode = Modes.TREE; |
| 32 | + $activeMode = Modes.TREE; |
31 | 33 | } |
32 | 34 | } |
33 | 35 |
|
| 36 | + function clearSelections() { |
| 37 | + $selectedDataType = null; |
| 38 | + $selectedDecorator = null; |
| 39 | + } |
| 40 | +
|
| 41 | + onMount(() => { |
| 42 | + clearSelections(); |
| 43 | + }); |
| 44 | +
|
| 45 | + onDestroy(() => { |
| 46 | + clearSelections(); |
| 47 | + }); |
| 48 | +
|
34 | 49 | $: { |
35 | 50 | if (primaryEntityRef) { |
36 | 51 | viewCall = dataTypeDecoratorStore.getViewForParentRef(primaryEntityRef); |
|
49 | 64 |
|
50 | 65 | <div class="decorator-section"> |
51 | 66 | <div class="decorator-table"> |
52 | | - <div class="pull-right" style="display: block"> |
| 67 | + <div> |
| 68 | + These are the data types currently aligned to this logical flow. You can toggle between a tabular and tree view of this information. Select a data type to see more information. |
| 69 | + <br> |
53 | 70 | <Toggle labelOn="Tree View" |
54 | 71 | labelOff="Table View" |
55 | | - state={activeMode === Modes.TREE} |
| 72 | + state={$activeMode === Modes.TREE} |
56 | 73 | onToggle={toggleView}/> |
57 | 74 | </div> |
58 | | - <div> |
59 | | - These are the data types currently aligned to this logical flow. You can toggle between a tabular and tree view of this information. Select a data type to see more information. |
60 | | - </div> |
61 | 75 | <br> |
62 | 76 | <div> |
63 | | - {#if activeMode === Modes.TREE} |
| 77 | + {#if $activeMode === Modes.TREE} |
64 | 78 | <DataTypeOverviewPanel primaryEntityReference={primaryEntityRef}/> |
65 | | - {:else if activeMode === Modes.TABLE} |
| 79 | + {:else if $activeMode === Modes.TABLE} |
66 | 80 | <DataTypeDecoratorViewGrid/> |
67 | 81 | {/if} |
68 | 82 | </div> |
|
0 commit comments