HL7-1: rename userId to stationId

This commit is contained in:
Markus Thielker 2025-07-30 12:49:02 +02:00
parent 3e00cf88e7
commit bb3a6a5d8e
3 changed files with 32 additions and 34 deletions

View file

@ -19,7 +19,7 @@
// connection state
let ws = $state<WebSocket | undefined>(undefined);
let userId = $state<string | undefined>(undefined);
let stationId = $state<string | undefined>(undefined); // stationId assigned by server
let connectionState = $state<ConnectionState>(ConnectionState.disconnected);
// client state
@ -80,7 +80,7 @@
// initial message from server assigning ID
case MessageType.assign_id:
userId = message.payload.userId;
stationId = message.payload.stationId;
composedMessage = segmentTemplates.MSH.template();
connectionState = ConnectionState.connected;
break;
@ -128,7 +128,7 @@
function handleSendMessage(message: string) {
if (!ws || ws.readyState !== WebSocket.OPEN || isSending || !userId) {
if (!ws || ws.readyState !== WebSocket.OPEN || isSending || !stationId) {
console.log('Socket not ready');
return;
}
@ -150,9 +150,9 @@
isSending = false;
}
function copyUserId() {
if (userId) {
navigator.clipboard.writeText(userId).then(() => {
function copyStationId() {
if (stationId) {
navigator.clipboard.writeText(stationId).then(() => {
copySuccess = true;
setTimeout(() => copySuccess = false, 2000);
});
@ -174,7 +174,7 @@
<div class="max-w-7xl mx-auto">
<main class="grid grid-cols-1 lg:grid-cols-3 gap-6">
<!-- Left Column: User Info & Logs -->
<!-- Left Column: Station Info & Logs -->
<div class="space-y-6">
<Card>
<CardHeader class="flex flex-row items-center">
@ -182,11 +182,11 @@
Your Info
</CardHeader>
<CardContent>
{#if connectionState === ConnectionState.connected && userId}
{#if connectionState === ConnectionState.connected && stationId}
<Label class="">Station ID</Label>
<div class="flex items-center space-x-2">
<Input disabled bind:value={userId}/>
<Button variant="outline" size="icon" onclick={copyUserId}>
<Input disabled bind:value={stationId}/>
<Button variant="outline" size="icon" onclick={copyStationId}>
{#if copySuccess}
<CheckIcon class={'text-green-400'}/>
{:else}
@ -232,7 +232,7 @@
<span>HL7v2 Message Editor</span>
</CardHeader>
<CardContent>
{#if connectionState === ConnectionState.connected && userId}
{#if connectionState === ConnectionState.connected && stationId}
<div>
<div class="flex flex-wrap gap-2 mb-4">
{#each segmentTypes as type (type)}