Skip to content

Commit 9ab65aa

Browse files
committed
fix: Formatting
1 parent d4dee27 commit 9ab65aa

File tree

3 files changed

+38
-32
lines changed

3 files changed

+38
-32
lines changed

frontend/src/components/messages.svelte

+14-10
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ THE SOFTWARE.
2626
2727
export let selectedTopic: Treebranch | null; // Can't be null.
2828
29-
let selectedMessage = selectedTopic?.messages[0]!;
29+
let selectedMessage = selectedTopic?.messages[0];
3030
function selectMessage(message: CustomEvent) {
31-
selectedMessage = selectedTopic?.messages
32-
.find(msg => msg.timestamp == message.detail)!;
31+
const foundMessage = selectedTopic?.messages.find((msg) => msg.timestamp == message.detail);
32+
if (foundMessage) {
33+
selectedMessage = foundMessage;
34+
}
3335
}
3436
</script>
3537

@@ -41,12 +43,14 @@ THE SOFTWARE.
4143

4244
{#if selectedTopic?.messages.length}
4345
<Tile light>
44-
<h5>
45-
Selected message: {new Date(selectedMessage.timestamp).toLocaleString()}
46-
</h5>
47-
<div style="height: 30em;">
48-
<Monaco readonly bind:code={selectedMessage.text} />
49-
</div>
46+
{#if selectedMessage}
47+
<h5>
48+
Selected message: {new Date(selectedMessage.timestamp).toLocaleString()}
49+
</h5>
50+
<div style="height: 30em;">
51+
<Monaco readonly bind:code={selectedMessage.text} />
52+
</div>
53+
{/if}
5054
</Tile>
5155
{/if}
5256

@@ -57,7 +61,7 @@ THE SOFTWARE.
5761
{#each selectedTopic?.messages as message}
5862
<RadioTile value={message.timestamp} style="height: 1em">
5963
{new Date(message.timestamp).toLocaleString() +
60-
(message.delta_t ? ' (' + message.delta_t + ' ms)' : '')}
64+
(message.delta_t ? ' (' + message.delta_t + ' ms)' : '')}
6165
</RadioTile>
6266
{/each}
6367
</TileGroup>

frontend/src/components/publish_message.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ THE SOFTWARE.
2020
-->
2121

2222
<script lang="ts">
23-
import { Button, ComboBox, Row, TextInput, Tile } from 'carbon-components-svelte';
23+
import { Button, ComboBox, TextInput, Tile } from 'carbon-components-svelte';
2424
import { requestCommandAddition, requestPublishMqttMessage } from '$lib/socket';
2525
import { Add, TrashCan } from 'carbon-icons-svelte';
2626
import type { BrokerRepositoryEntry, Command } from '$lib/state';
@@ -93,7 +93,7 @@ THE SOFTWARE.
9393
function clicked() {
9494
setTimeout(() => {
9595
if (open) {
96-
scrollBy({top: 1000, behavior: 'smooth'});
96+
scrollBy({ top: 1000, behavior: 'smooth' });
9797
}
9898
}, 0);
9999
}

frontend/src/routes/+page.svelte

+22-20
Original file line numberDiff line numberDiff line change
@@ -254,27 +254,29 @@ THE SOFTWARE.
254254
<Tab label="Treeview" />
255255
<Tab label="Pipeline" />
256256
<svelte:fragment slot="content">
257-
<TabContent>
258-
<TopicTree bind:broker={app.brokerRepository[app.selectedBroker]} />
259-
</TabContent>
260-
<TabContent>
261-
<Pipeline
262-
bind:pipelines={app.pipelines}
263-
bind:broker={app.brokerRepository[app.selectedBroker]}
264-
bind:socket
265-
/>
266-
</TabContent>
267-
</svelte:fragment>
268-
</Tabs>
257+
<TabContent>
258+
<TopicTree bind:broker={app.brokerRepository[app.selectedBroker]} />
259+
</TabContent>
260+
<TabContent>
261+
<Pipeline
262+
bind:pipelines={app.pipelines}
263+
bind:broker={app.brokerRepository[app.selectedBroker]}
264+
bind:socket
265+
/>
266+
</TabContent>
267+
</svelte:fragment>
268+
</Tabs>
269+
</div>
270+
<div style="flex: 1">
271+
{#if app.brokerRepository[app.selectedBroker].selectedTopic?.messages.length}
272+
<Messages
273+
bind:selectedTopic={app.brokerRepository[app.selectedBroker].selectedTopic}
274+
/>
275+
{/if}
276+
</div>
269277
</div>
270-
<div style="flex: 1">
271-
{#if app.brokerRepository[app.selectedBroker].selectedTopic?.messages.length}
272-
<Messages
273-
bind:selectedTopic={app.brokerRepository[app.selectedBroker].selectedTopic} />
274-
{/if}
275-
</div>
276-
</div>
277-
</Grid>
278+
</div></Grid
279+
>
278280
<PublishMessage
279281
bind:savedCommands={app.commands}
280282
bind:selectedBroker={app.selectedBroker}

0 commit comments

Comments
 (0)