From 9a10aba67ef18407c97b681abb817ab3b1d98e93 Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Fri, 23 Feb 2024 22:38:35 +0800 Subject: [PATCH 1/4] fix: can not build Windows installer #163 --- .github/workflows/release-windows.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index 1713230..512cd21 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -39,7 +39,7 @@ jobs: - name: Install chocolatey uses: crazy-max/ghaction-chocolatey@v2 with: - args: install nsis jq upx + args: install nsis jq - name: Install wails shell: bash @@ -70,11 +70,7 @@ jobs: - name: Compress portable binary working-directory: ./build/bin - run: Compress-Archive "Tiny RDM.exe" tiny-rdm.zip - - - name: Rename zip package - working-directory: ./build/bin - run: Rename-Item -Path "tiny-rdm.zip" -NewName "TinyRDM_Portable_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip" + run: Compress-Archive "Tiny RDM.exe" "TinyRDM_Portable_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip" - name: Upload release asset (Portable) uses: softprops/action-gh-release@v1 @@ -84,7 +80,10 @@ jobs: - name: Build Windows NSIS installer shell: bash - run: CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} -nsis -webview2 embed -ldflags "-X main.version=${{ github.event.release.tag_name }}" + run: | + CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} \ + -nsis -webview2 embed \ + -ldflags "-X main.version=${{ github.event.release.tag_name }}" - name: Codesign Windows NSIS installer working-directory: ./build/bin @@ -94,11 +93,11 @@ jobs: Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}' certutil -decode certificate\certificate.txt certificate\certificate.pfx echo "Signing TinyRDM installer" - & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' 'Tiny RDM.exe' + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' TinyRDM-${{ matrix.platform }}-installer.exe - name: Rename installer working-directory: ./build/bin - run: Rename-Item -Path "Tiny RDM.exe" -NewName "TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.exe" + run: Rename-Item -Path "TinyRDM-${{ matrix.platform }}-installer.exe" -NewName "TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.exe" - name: Upload release asset (Installer) uses: softprops/action-gh-release@v1 From 23b68d9e192c08462cb1fd35dc7a280baf4f6a0d Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Fri, 23 Feb 2024 23:59:37 +0800 Subject: [PATCH 2/4] fix: can not build Windows installer #163 --- .github/workflows/release-windows.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index 512cd21..b62e852 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -24,6 +24,11 @@ jobs: tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g' -e 's/amd64/x64/g') echo "tag=$tag" >> "$GITHUB_OUTPUT" + - name: Normalise platform name + id: platform_name + shell: bash + run: tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g') + - name: Normalise version tag id: normalise_version shell: bash @@ -97,7 +102,7 @@ jobs: - name: Rename installer working-directory: ./build/bin - run: Rename-Item -Path "TinyRDM-${{ matrix.platform }}-installer.exe" -NewName "TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.exe" + run: Rename-Item -Path "TinyRDM-${{ matrix.platform }}-installer.exe" -NewName "TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.platform_name.outputs.tag }}.exe" - name: Upload release asset (Installer) uses: softprops/action-gh-release@v1 From 53563acac0821fd8b76c1285b25a6316b3b9005d Mon Sep 17 00:00:00 2001 From: Lykin <137850705+tiny-craft@users.noreply.github.com> Date: Mon, 26 Feb 2024 10:28:26 +0800 Subject: [PATCH 3/4] chore: add manual trigger to github action --- .github/workflows/release-linux.yaml | 18 +++++++++++++--- .github/workflows/release-macos.yaml | 16 ++++++++++++-- .github/workflows/release-windows.yaml | 29 +++++++++++++++++++------- 3 files changed, 51 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-linux.yaml b/.github/workflows/release-linux.yaml index df7e535..a45f957 100644 --- a/.github/workflows/release-linux.yaml +++ b/.github/workflows/release-linux.yaml @@ -3,6 +3,12 @@ name: Release Linux App on: release: types: [ published ] + workflow_dispatch: + inputs: + tag: + description: 'Version tag' + required: true + default: '1.0.0' jobs: release: @@ -27,8 +33,13 @@ jobs: id: normalise_version shell: bash run: | - version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') - echo "version=$version" >> "$GITHUB_OUTPUT" + if [ "${{ github.event.release.tag_name }}" == "" ]; then + version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g') + echo "version=$version" >> "$GITHUB_OUTPUT" + else + version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') + echo "version=$version" >> "$GITHUB_OUTPUT" + fi - name: Setup Go uses: actions/setup-go@v4 @@ -65,7 +76,7 @@ jobs: shell: bash run: | CGO_ENABLED=1 wails build -platform ${{ matrix.platform }} \ - -ldflags "-X main.version=${{ github.event.release.tag_name }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.LINUX_GA_SECRET }}" \ + -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.LINUX_GA_SECRET }}" \ -o tiny-rdm - name: Setup control template @@ -105,5 +116,6 @@ jobs: - name: Upload release asset uses: softprops/action-gh-release@v1 with: + tag_name: v${{ steps.normalise_version.outputs.version }} files: ./build/linux/tiny-rdm_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.deb token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-macos.yaml b/.github/workflows/release-macos.yaml index 9e61275..a5238bd 100644 --- a/.github/workflows/release-macos.yaml +++ b/.github/workflows/release-macos.yaml @@ -3,6 +3,12 @@ name: Release macOS App on: release: types: [ published ] + workflow_dispatch: + inputs: + tag: + description: 'Version tag' + required: true + default: '1.0.0' jobs: release: @@ -29,8 +35,13 @@ jobs: id: normalise_version shell: bash run: | - version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') - echo "version=$version" >> "$GITHUB_OUTPUT" + if [ "${{ github.event.release.tag_name }}" == "" ]; then + version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g') + echo "version=$version" >> "$GITHUB_OUTPUT" + else + version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') + echo "version=$version" >> "$GITHUB_OUTPUT" + fi - name: Setup Go uses: actions/setup-go@v4 @@ -116,5 +127,6 @@ jobs: - name: Upload release asset (DMG Package) uses: softprops/action-gh-release@v1 with: + tag_name: v${{ steps.normalise_version.outputs.version }} files: ./build/bin/TinyRDM_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.dmg token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-windows.yaml b/.github/workflows/release-windows.yaml index b62e852..6709e33 100644 --- a/.github/workflows/release-windows.yaml +++ b/.github/workflows/release-windows.yaml @@ -3,6 +3,12 @@ name: Release Windows App on: release: types: [ published ] + workflow_dispatch: + inputs: + tag: + description: 'Version tag' + required: true + default: '1.0.0' jobs: release: @@ -25,16 +31,23 @@ jobs: echo "tag=$tag" >> "$GITHUB_OUTPUT" - name: Normalise platform name - id: platform_name + id: normalise_platform_name shell: bash - run: tag=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g') + run: | + pname=$(echo ${{ matrix.platform }} | sed -e 's/\//_/g') + echo "pname=$pname" >> "$GITHUB_OUTPUT" - name: Normalise version tag id: normalise_version shell: bash run: | - version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') - echo "version=$version" >> "$GITHUB_OUTPUT" + if [ "${{ github.event.release.tag_name }}" == "" ]; then + version=$(echo ${{ github.event.inputs.tag }} | sed -e 's/v//g') + echo "version=$version" >> "$GITHUB_OUTPUT" + else + version=$(echo ${{ github.event.release.tag_name }} | sed -e 's/v//g') + echo "version=$version" >> "$GITHUB_OUTPUT" + fi - name: Setup Go uses: actions/setup-go@v4 @@ -71,7 +84,7 @@ jobs: run: | CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} \ -webview2 embed \ - -ldflags "-X main.version=${{ github.event.release.tag_name }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.WINDOWS_GA_SECRET }}" + -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }} -X main.gaMeasurementID=${{ secrets.GA_MEASUREMENT_ID }} -X main.gaSecretKey=${{ secrets.WINDOWS_GA_SECRET }}" - name: Compress portable binary working-directory: ./build/bin @@ -80,6 +93,7 @@ jobs: - name: Upload release asset (Portable) uses: softprops/action-gh-release@v1 with: + tag_name: v${{ steps.normalise_version.outputs.version }} files: ./build/bin/TinyRDM_Portable_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.zip token: ${{ secrets.GITHUB_TOKEN }} @@ -88,7 +102,7 @@ jobs: run: | CGO_ENABLED=1 wails build -clean -platform ${{ matrix.platform }} \ -nsis -webview2 embed \ - -ldflags "-X main.version=${{ github.event.release.tag_name }}" + -ldflags "-X main.version=v${{ steps.normalise_version.outputs.version }}" - name: Codesign Windows NSIS installer working-directory: ./build/bin @@ -98,7 +112,7 @@ jobs: Set-Content -Path certificate\certificate.txt -Value '${{ secrets.WIN_SIGNING_CERT }}' certutil -decode certificate\certificate.txt certificate\certificate.pfx echo "Signing TinyRDM installer" - & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' TinyRDM-${{ matrix.platform }}-installer.exe + & 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe' sign /fd sha256 /tr http://ts.ssl.com /f certificate\certificate.pfx /p '${{ secrets.WIN_SIGNING_CERT_PASSWORD }}' TinyRDM-${{ steps.normalise_platform_name.outputs.pname }}-installer.exe - name: Rename installer working-directory: ./build/bin @@ -107,5 +121,6 @@ jobs: - name: Upload release asset (Installer) uses: softprops/action-gh-release@v1 with: + tag_name: v${{ steps.normalise_version.outputs.version }} files: ./build/bin/TinyRDM_Setup_${{ steps.normalise_version.outputs.version }}_${{ steps.normalise_platform.outputs.tag }}.exe token: ${{ secrets.GITHUB_TOKEN }} From c4d41b12dc3295161a9efc1595d957a74a7c4bad Mon Sep 17 00:00:00 2001 From: raojinlin Date: Mon, 26 Feb 2024 10:34:21 +0800 Subject: [PATCH 4/4] feat: value editor maintains scroll offset after refresh #162 * feat: refresh string value keep scrolltop * fix code styles * delete unused code * feat: Configurable and compatible with keyPath changes * Fix props name format, use kebab-case * Unify coding style --------- Co-authored-by: raojinlin --- .../content_value/ContentEditor.vue | 40 ++++++++++++++++++- .../content_value/ContentEntryEditor.vue | 1 + .../content_value/ContentValueJson.vue | 1 + .../content_value/ContentValueString.vue | 1 + 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/content_value/ContentEditor.vue b/frontend/src/components/content_value/ContentEditor.vue index b4508dc..e2c22cf 100644 --- a/frontend/src/components/content_value/ContentEditor.vue +++ b/frontend/src/components/content_value/ContentEditor.vue @@ -22,10 +22,20 @@ const props = defineProps({ type: Boolean, default: false, }, + keyPath: { + type: String, + default: "", + }, + rememberScroll: { + type: Boolean, + default: true, + } }) const emit = defineEmits(['reset', 'input', 'save']) +const scrollTop = ref(0) + const themeVars = useThemeVars() /** @type {HTMLElement|null} */ const editorRef = ref(null) @@ -88,6 +98,15 @@ onMounted(async () => { emit('save') }) + if (props.rememberScroll) { + editorNode.onDidScrollChange((event) => { + // Update scrolltop when scroll height changes, ie. content changes + if (!event.scrollHeightChanged) { + scrollTop.value = event.scrollTop + } + }) + } + // editorNode.onDidChangeModelLanguageConfiguration(() => { // editorNode?.getAction('editor.action.formatDocument')?.run() // }) @@ -102,14 +121,33 @@ onMounted(async () => { watch( () => props.content, - async (content) => { + async (content, oldContent, onCleanup) => { if (editorNode != null) { editorNode.setValue(content) + + const disposable = editorNode.onDidLayoutChange(() => { + if (props.rememberScroll && scrollTop.value > 0) { + editorNode.setScrollTop(scrollTop.value) + } + }); + + onCleanup(() => disposable.dispose()) + await nextTick(() => emit('reset', content)) } }, ) +watch( + () => props.keyPath, + () => { + if (editorNode != null) { + scrollTop.value = 0 + editorNode.setScrollTop(0) + } + } +) + watch( () => readonlyValue.value, (readOnly) => { diff --git a/frontend/src/components/content_value/ContentEntryEditor.vue b/frontend/src/components/content_value/ContentEntryEditor.vue index 452df28..ce56563 100644 --- a/frontend/src/components/content_value/ContentEntryEditor.vue +++ b/frontend/src/components/content_value/ContentEntryEditor.vue @@ -175,6 +175,7 @@ const onSave = () => { :border="true" :content="displayValue" :language="viewLanguage" + :key-path="viewAs.field" class="flex-item-expand" @input="onInput" @reset="onInput" diff --git a/frontend/src/components/content_value/ContentValueJson.vue b/frontend/src/components/content_value/ContentValueJson.vue index 978f5d7..4f07954 100644 --- a/frontend/src/components/content_value/ContentValueJson.vue +++ b/frontend/src/components/content_value/ContentValueJson.vue @@ -149,6 +149,7 @@ defineExpose({ v-show="!props.loading" :content="displayValue" :loading="props.loading" + :key-path="props.keyPath" class="flex-item-expand" language="json" style="height: 100%" diff --git a/frontend/src/components/content_value/ContentValueString.vue b/frontend/src/components/content_value/ContentValueString.vue index c023b87..2742d75 100644 --- a/frontend/src/components/content_value/ContentValueString.vue +++ b/frontend/src/components/content_value/ContentValueString.vue @@ -204,6 +204,7 @@ defineExpose({ :content="displayValue" :language="viewLanguage" :loading="props.loading" + :key-path="props.keyPath" class="flex-item-expand" style="height: 100%" @input="onInput"