diff --git a/.github/scripts/augment-latest-json-jdbc-plugin.mjs b/.github/scripts/augment-latest-json-jdbc-plugin.mjs new file mode 100644 index 0000000000..9a95298cb6 --- /dev/null +++ b/.github/scripts/augment-latest-json-jdbc-plugin.mjs @@ -0,0 +1,31 @@ +import { readFileSync, writeFileSync } from "node:fs"; + +export function augmentLatestJsonWithJdbcPlugin({ latestJson, jdbcVersion, protocolVersion, url }) { + const data = JSON.parse(latestJson); + data.jdbc_plugin = { + version: jdbcVersion, + protocol_version: Number(protocolVersion), + url, + }; + return `${JSON.stringify(data, null, 2)}\n`; +} + +function main() { + const [latestJsonPath, jdbcVersion, protocolVersion, url] = process.argv.slice(2); + if (!latestJsonPath || !jdbcVersion || !protocolVersion || !url) { + console.error("Usage: augment-latest-json-jdbc-plugin.mjs "); + process.exit(1); + } + + const updated = augmentLatestJsonWithJdbcPlugin({ + latestJson: readFileSync(latestJsonPath, "utf8"), + jdbcVersion, + protocolVersion, + url, + }); + writeFileSync(latestJsonPath, updated); +} + +if (import.meta.url === `file://${process.argv[1]}`) { + main(); +} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 652acdec90..80627bad81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -240,6 +240,26 @@ jobs: --repo "${GITHUB_REPOSITORY}" \ --clobber + - name: Add JDBC plugin metadata to latest.json + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: | + mkdir -p "$RUNNER_TEMP/latest-json" + gh release download "${GITHUB_REF_NAME}" \ + --repo "${GITHUB_REPOSITORY}" \ + --pattern latest.json \ + --dir "$RUNNER_TEMP/latest-json" + node .github/scripts/augment-latest-json-jdbc-plugin.mjs \ + "$RUNNER_TEMP/latest-json/latest.json" \ + "${{ steps.jdbc-plugin.outputs.version }}" \ + "1" \ + "https://github.com/t8y2/dbx/releases/latest/download/dbx-jdbc-plugin-latest.zip" + gh release upload "${GITHUB_REF_NAME}" \ + "$RUNNER_TEMP/latest-json/latest.json" \ + --repo "${GITHUB_REPOSITORY}" \ + --clobber + publish: needs: [build, docker-manifest, jdbc-plugin] runs-on: ubuntu-latest diff --git a/apps/desktop/src/components/config/DriverStoreDialog.vue b/apps/desktop/src/components/config/DriverStoreDialog.vue index 56be272e25..10a7b0818a 100644 --- a/apps/desktop/src/components/config/DriverStoreDialog.vue +++ b/apps/desktop/src/components/config/DriverStoreDialog.vue @@ -11,7 +11,7 @@ import DriverInstallProgressCircle from "@/components/config/DriverInstallProgre import DatabaseIcon from "@/components/icons/DatabaseIcon.vue"; import { useToast } from "@/composables/useToast"; import { isTauriRuntime } from "@/lib/tauriRuntime"; -import { countAvailableAgentDriverUpdates } from "@/lib/agentDriverUpdateBadge"; +import { countAvailableDriverUpdates } from "@/lib/agentDriverUpdateBadge"; import type { JdbcDriverInfo, JdbcPluginStatus } from "@/types/database"; import * as api from "@/lib/api"; import type { AgentDriverInfo, JavaRuntimeConfig } from "@/lib/api"; @@ -84,7 +84,11 @@ const updatableCount = computed(() => drivers.value.filter((d) => d.update_avail function updateAgentDrivers(nextDrivers: AgentDriverInfo[]) { drivers.value = nextDrivers; - emit("update-count-change", countAvailableAgentDriverUpdates(nextDrivers)); + emitDriverUpdateCount(); +} + +function emitDriverUpdateCount() { + emit("update-count-change", countAvailableDriverUpdates(drivers.value, jdbcPluginStatus.value)); } function isDriverProgressActive(dbType: string): boolean { @@ -299,6 +303,7 @@ async function loadJdbcPluginStatus() { if (isWeb) return; try { jdbcPluginStatus.value = await api.jdbcPluginStatus(); + emitDriverUpdateCount(); } catch (e: any) { toast(String(e?.message || e), 5000); } @@ -309,6 +314,7 @@ async function installJdbcPlugin() { isInstallingJdbcPlugin.value = true; try { jdbcPluginStatus.value = await api.installJdbcPlugin(); + emitDriverUpdateCount(); toast(t("settings.jdbcPluginInstallSuccess")); await loadJdbcDrivers(); } catch (e: any) { @@ -330,6 +336,7 @@ async function installJdbcPluginLocal() { isInstallingJdbcPlugin.value = true; try { jdbcPluginStatus.value = await api.installJdbcPluginLocal(selected); + emitDriverUpdateCount(); toast(t("settings.jdbcPluginInstallSuccess")); await loadJdbcDrivers(); } catch (e: any) { @@ -344,6 +351,7 @@ async function uninstallJdbcPlugin() { isUninstallingJdbcPlugin.value = true; try { jdbcPluginStatus.value = await api.uninstallJdbcPlugin(); + emitDriverUpdateCount(); toast(t("settings.jdbcPluginUninstallSuccess")); await loadJdbcDrivers(); } catch (e: any) { @@ -702,6 +710,20 @@ onUnmounted(() => { : t("settings.jdbcPluginIncompatible") }} + → v{{ jdbcPluginStatus.latest_version }} +