diff --git a/deploy/run.sh b/deploy/run.sh index 5a6211c..1b80530 100644 --- a/deploy/run.sh +++ b/deploy/run.sh @@ -3,6 +3,7 @@ set -euo pipefail cd "$(dirname "$0")" host="root@hub.hordelab.com" +remote_path="/var/horde/hub/" run_nginx() { echo "Uploading nginx config file" @@ -43,6 +44,12 @@ run_update() { " } +run_dist() { + echo "Uploading frontend/dist to $host:/var/frontend/dist" + ssh "$host" "rm -rf $remote_path/frontend/dist && mkdir $remote_path/frontend/dist" + scp -r ../frontend/dist "$host:$remote_path/frontend/" +} + restart_service() { echo "Restarting horde-hub.service" ssh "$host" -t "systemctl restart horde-hub.service" @@ -50,6 +57,7 @@ restart_service() { # Determine which stages to run stages=() +do_restart=0 if [[ $# -eq 0 ]]; then # Interactive prompts when no arguments are given read -p "Run nginx deployment? [Y/n] " choice @@ -70,8 +78,12 @@ else # Parse arguments for arg in "$@"; do case "$arg" in - nginx|service|update) + nginx|service|update|dist) stages+=("$arg") + do_restart=1 + ;; + --dist) + stages+=("dist") ;; *) echo "Unknown argument: $arg" >&2 @@ -87,8 +99,9 @@ for stage in "${stages[@]}"; do nginx) run_nginx ;; service) run_service ;; update) run_update ;; + dist) run_dist ;; esac done # Final stage: always restart the systemd service at the end -restart_service \ No newline at end of file +if [[ $do_restart -eq 1 ]]; then restart_service; fi diff --git a/frontend/src/components/Message.vue b/frontend/src/components/Message.vue index a76bf22..a14df50 100644 --- a/frontend/src/components/Message.vue +++ b/frontend/src/components/Message.vue @@ -1,5 +1,5 @@ - + {{message.sender}} @@ -93,7 +114,8 @@ watch(() => [props.message.format, props.message.content], ([newFormat, newConte {{message.sender}} [{{message.subkind}}] - {{content}} + {{logContent}} + {{logExpanded ? '(collapse)' : '(expand)'}} @@ -169,6 +191,12 @@ watch(() => [props.message.format, props.message.content], ([newFormat, newConte font-weight: bold; font-size: 80%; } +.message.log .log-toggle { + font-family: monospace; + font-size: 80%; + cursor: pointer; + user-select: none; +} .resource { align-self: center; @@ -246,4 +274,4 @@ watch(() => [props.message.format, props.message.content], ([newFormat, newConte .thread-header:hover { border-style: solid; } - \ No newline at end of file + diff --git a/frontend/src/views/Chat.vue b/frontend/src/views/Chat.vue index 50ac630..ee35898 100644 --- a/frontend/src/views/Chat.vue +++ b/frontend/src/views/Chat.vue @@ -35,6 +35,7 @@ const editingMessageId = ref(null); const noteMode = ref(false); const messageRunMap = ref({}); + const expandedLogs = ref({}); // Message ids of logs currently expanded const editInfo = computed(() => { const parts = [isNewThread.value ? 'New Thread' : `Thread ${currentThreadId.value}`] @@ -468,13 +469,25 @@ // === UI Helper Functions === // - async function chatEntryContextMenu (message) { - let selected = await ui.contextMenu([ + function toggleLogExpand (message) { + expandedLogs.value[message.id] = !expandedLogs.value[message.id]; + } + + async function chatEntryContextMenu (message, logMeta) { + let entries = [ {value: 'pin', title: "Pin message"}, {value: 'edit', title: "Edit message"}, {value: 'start-thread', title: "Start thread from here"}, - {value: 'delete', icon: 'fa-trash', title: "Delete message"}, - ]); + ]; + + // Long logs can be expanded/collapsed + if (logMeta) { + entries.push({value: 'toggle-log', title: logMeta.expanded ? "Collapse log" : "Expand log"}); + } + + entries.push({value: 'delete', icon: 'fa-trash', title: "Delete message"}); + + let selected = await ui.contextMenu(entries); switch (selected) { case 'pin': { @@ -489,6 +502,10 @@ alert("Start Thread (TODO)"); break; } + case 'toggle-log': { + toggleLogExpand(message); + break; + } case 'delete': { if (confirm("Are you sure you want to delete this message?")) { alert("Delete Message (TODO)"); @@ -548,6 +565,9 @@ @open-menu="chatEntryContextMenu" @open-thread="activateThread" + :log-expanded="expandedLogs[msg.id]" + @toggle-log="toggleLogExpand(msg)" + :cancellable="messageRunMap[msg.id]" @cancel="runs.cancelRun(messageRunMap[msg.id])" /> @@ -640,4 +660,4 @@ /* align-self: end; /* for flex rows */ float: right; /* for flow rows */ } - + \ No newline at end of file diff --git a/run.sh b/run.sh index 6f238fe..53f8e6b 100644 --- a/run.sh +++ b/run.sh @@ -56,6 +56,10 @@ case "$1" in tortoise -c database.TORTOISE_ORM makemigrations ;; + "deploy") + bash deploy/run.sh $@ + ;; + # Execute with custom home directory if it exists *) if [ -d "$1" ]; then @@ -65,4 +69,4 @@ case "$1" in echo "Error: unknown command or directory '$1'" fi ;; -esac \ No newline at end of file +esac