From a39f57bac157fabb9681e2eb9b8de4f213cb8b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Thu, 7 Sep 2023 17:39:33 +0200 Subject: [PATCH] feat: apply setting changes and add commit feature --- .github/workflows/build.yml | 7 ++-- README.md | 8 +++++ package.json | 2 +- src-tauri/Cargo.lock | 2 +- src-tauri/Cargo.toml | 2 +- src-tauri/tauri.conf.json | 2 +- src/i18n/de/index.ts | 1 + src/i18n/en/index.ts | 1 + src/lib/serial/connection.ts | 2 +- src/lib/setting.ts | 29 +++++++++++++++-- src/routes/Navigation.svelte | 63 ++++++++++++++++++++++++++++-------- 11 files changed, 93 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a23ec3a7..b6736225 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,9 +2,9 @@ name: Build on: push: - branches: ["master"] - pull_request: - branches: ["master"] + tags: + - 'v*' + workflow_dispatch: jobs: build: @@ -41,7 +41,6 @@ jobs: path: build deploy: name: 🚀 Deploy - if: github.event_name == 'push' && contains(github.event.head_commit.message, '[deploy]') runs-on: ubuntu-latest needs: build environment: diff --git a/README.md b/README.md index ce1b29aa..c24effb3 100644 --- a/README.md +++ b/README.md @@ -57,3 +57,11 @@ To double-check, make sure your private key starts with After that, add the `SSH_SERVER`, `SSH_PORT`, `SSH_PRIVATE_KEY` and `SSH_USER` environment secrets to your environment in GitHub. + +## Releases + +Change the version in + +- [package.json](package.json) +- [tauri.conf.json](src-tauri/tauri.conf.json) +- [Cargo.toml](src-tauri/Cargo.toml) diff --git a/package.json b/package.json index d09ea72b..2a48e111 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "amacc1ng", - "version": "0.4.2", + "version": "0.5.0", "license": "AGPL-3.0-or-later", "private": true, "scripts": { diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 05a002f3..1cd3d88a 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -85,7 +85,7 @@ checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "app" -version = "0.4.1" +version = "0.4.2" dependencies = [ "serde", "serde_json", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index aa02d635..884c8834 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "app" -version = "0.4.2" +version = "0.5.0" description = "A Tauri App" authors = ["Thea Schöbl "] license = "AGPL-3" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 102afc05..94ebcecb 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -8,7 +8,7 @@ }, "package": { "productName": "amacc1ng", - "version": "0.4.2" + "version": "0.5.0" }, "tauri": { "allowlist": { diff --git a/src/i18n/de/index.ts b/src/i18n/de/index.ts index ce7db8e5..618251e9 100644 --- a/src/i18n/de/index.ts +++ b/src/i18n/de/index.ts @@ -25,6 +25,7 @@ const de = { CONNECT: "Verbinden", DISCONNECT: "Entfernen", TERMINAL: "Konsole", + APPLY_SETTINGS: "Änderungen auf das Gerät brennen", bootMenu: { TITLE: "Bootmenü", REBOOT: "Neustarten", diff --git a/src/i18n/en/index.ts b/src/i18n/en/index.ts index c2c16889..2a57147a 100644 --- a/src/i18n/en/index.ts +++ b/src/i18n/en/index.ts @@ -24,6 +24,7 @@ const en = { CONNECT: "Connect", DISCONNECT: "Disconnect", TERMINAL: "Terminal", + APPLY_SETTINGS: "Flash changes to device", bootMenu: { TITLE: "Boot Menu", REBOOT: "Reboot", diff --git a/src/lib/serial/connection.ts b/src/lib/serial/connection.ts index 87bb33b3..b657c1ba 100644 --- a/src/lib/serial/connection.ts +++ b/src/lib/serial/connection.ts @@ -25,7 +25,7 @@ export const layout = persistentWritable( export const settings = writable({}) -export const unsavedChanges = writable(0) +export const unsavedChanges = writable(new Map()) export const highlightActions: Writable = writable([]) diff --git a/src/lib/setting.ts b/src/lib/setting.ts index 42b9eb2a..b3288bea 100644 --- a/src/lib/setting.ts +++ b/src/lib/setting.ts @@ -1,15 +1,16 @@ import type {Action} from "svelte/action" -import {serialPort} from "$lib/serial/connection" +import {serialPort, unsavedChanges} from "$lib/serial/connection" +import {get} from "svelte/store" export const setting: Action = function ( node: HTMLInputElement, {id, inverse, scale}, ) { node.setAttribute("disabled", "") + const type = node.getAttribute("type") as "number" | "checkbox" const unsubscribe = serialPort.subscribe(async port => { if (port) { - const type = node.getAttribute("type") as "number" | "checkbox" if (type === "number") { const value = Number(await port.getSetting(id).then(it => it.toString())) node.value = ( @@ -23,7 +24,29 @@ export const setting: Action { + if (originalValue === value) { + it.delete(id) + } else if (!it.has(id)) { + it.set(id, currentValue) + } + return it + }) + } node.addEventListener("input", listener) return { diff --git a/src/routes/Navigation.svelte b/src/routes/Navigation.svelte index 39a9b035..3a3d0a86 100644 --- a/src/routes/Navigation.svelte +++ b/src/routes/Navigation.svelte @@ -1,5 +1,5 @@