feat(plugin): support fix metadata versions

This commit is contained in:
qianmoQ 2024-11-21 23:12:13 +08:00
parent bdfad72a91
commit b9bca70175
5 changed files with 43 additions and 23 deletions

View File

@ -430,6 +430,7 @@ common.releasedTime=Released Time
common.install=Install
common.uninstall=Uninstall
common.installTime=Install Time
common.installVersion=Install Version
common.plugin.version=Plugin Version
common.plugin.systemVersion=Current system version:
common.plugin.list.name=Plugin List

View File

@ -430,6 +430,7 @@ common.releasedTime=发布时间
common.install=安装
common.uninstall=卸载
common.installTime=安装时间
common.installVersion=安装版本
common.plugin.version=插件版本
common.plugin.systemVersion=当前系统版本:
common.plugin.list.name=插件列表

View File

@ -10,14 +10,15 @@
"description": "Integrate MySQL data sources",
"i18nFormat": true,
"type": "JDBC",
"version": "2024.4.0",
"version": "2024.4.0-SNAPSHOT",
"author": "datacap-community",
"logo": "https://www.vectorlogo.zone/logos/mysql/mysql-icon.svg",
"released": "2024-01-01",
"released": "2024-11-21 23:11:15",
"supportVersion": [
"8.0",
"5.7"
]
],
"url": "https://cdn.north.devlive.org/applications/datacap/plugins/2024.4.0-SNAPSHOT/plugin/datacap-plugin-mysql-bin.tar.gz"
}
]
}

View File

@ -1,6 +1,7 @@
#!/bin/sh
VERSION=$1
HOME=$(pwd)
CURRENT_DATE=$(date '+%Y-%m-%d %H:%M:%S')
job_before_echo_basic() {
printf "\n\tJob before echo basic \n"
@ -39,6 +40,12 @@ job_runner_apply() {
echo "Apply new version for plugin ..."
perl -pi -e 's/VERSION=.*/VERSION='"$VERSION"'/g' configure/etc/bin/install-plugin.sh
echo "Apply new version for metadata ..."
# Update version and URL in metadata.json using perl
perl -i -pe 's/"version": "[^"]*"/"version": "'"$VERSION"'"/' "$HOME/configure/metadata.json"
perl -i -pe 's|/plugins/[^/]+/|/plugins/'"$VERSION"'/|g' "$HOME/configure/metadata.json"
perl -i -pe 's/"released": "[^"]*"/"released": "'"$CURRENT_DATE"'"/' "$HOME/configure/metadata.json"
printf "Apply new version for web ...\n"
# shellcheck disable=SC2164
cd "$HOME"/core/datacap-ui
@ -55,4 +62,4 @@ job_runner_apply() {
job_before_echo_basic
job_before_checked
job_runner_apply
job_runner_apply

View File

@ -30,7 +30,7 @@
<ShadcnSpace class="pl-8" wrap :size="[20, 40]">
<!-- Description -->
<div class="flex flex-col space-y-2">
<div class="flex flex-col space-y-4">
<ShadcnText class="text-sm text-gray-500" type="small">
{{ child.i18nFormat ? $t(child.description) : child.description }}
</ShadcnText>
@ -48,11 +48,32 @@
<!-- Version -->
<div class="flex space-x-2 text-sm text-gray-500">
<div class="flex items-center space-x-2">
<div class="space-x-1">
{{ $t('common.plugin.version') }} :
<ShadcnTag>{{ child.version }}</ShadcnTag>
</div>
<ShadcnTag>{{ child.version }}</ShadcnTag>
<ShadcnDivider v-if="child.installed" type="vertical"/>
<div v-if="child.installed" class="space-x-1">
{{ $t('common.installVersion') }}:
<ShadcnTag color="#00BFFF">{{ child.installVersion }}</ShadcnTag>
</div>
</div>
<!-- Time -->
<div class="flex space-x-2 text-sm text-gray-500">
<div class="space-x-1">
{{ $t('common.releasedTime') }}
<ShadcnTag type="warning">{{ child.released }}</ShadcnTag>
</div>
<ShadcnDivider v-if="child.installed" type="vertical"/>
<div v-if="child.installed" class="space-x-1">
{{ $t('common.installTime') }}
<ShadcnTag color="#00BFFF">{{ child.installTime }}</ShadcnTag>
</div>
</div>
<!-- Other -->
@ -67,20 +88,6 @@
{{ $t('common.type') }}
<ShadcnTag>{{ child.type }}</ShadcnTag>
</div>
<ShadcnDivider type="vertical"/>
<div class="space-x-1">
{{ $t('common.releasedTime') }}
<ShadcnTag type="warning">{{ child.released }}</ShadcnTag>
</div>
<ShadcnDivider v-if="child.installed" type="vertical"/>
<div v-if="child.installed" class="space-x-1">
{{ $t('common.installTime') }}
<ShadcnTag color="#00BFFF">{{ child.installTime }}</ShadcnTag>
</div>
</div>
</div>
</ShadcnSpace>
@ -88,7 +95,7 @@
<!-- Action -->
<div class="flex items-center space-x-2">
<ShadcnButton :type="child.installed ? 'danger' : 'success'">
<ShadcnButton :type="child.installed ? 'danger' : 'primary'">
<template #icon>
<ShadcnIcon :icon="child.installed ? 'Trash' : 'Plus'" size="15"/>
</template>
@ -125,6 +132,8 @@ interface MetadataItem
author: string
installed: boolean
installTime: string
installVersion: string
url: string
}
interface Metadata
@ -173,10 +182,11 @@ const loadMetadata = async () => {
//
// Bind installation information
metadata.value.children.map(item => {
installResponse.data.some((installedPlugin: { name: string, loadTime: string }) => {
installResponse.data.some((installedPlugin: { name: string, loadTime: string, version: string }) => {
if (installedPlugin.name === item.label) {
item.installed = true
item.installTime = installedPlugin.loadTime
item.installVersion = installedPlugin.version
}
})
})