mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-05 21:48:58 +08:00
[Core] Add version for source (#407)
This commit is contained in:
commit
aa84547f03
7
core/datacap-server/src/main/schema/1.13.0/schema.sql
Normal file
7
core/datacap-server/src/main/schema/1.13.0/schema.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
USE `datacap`;
|
||||||
|
|
||||||
|
ALTER TABLE `source`
|
||||||
|
ADD COLUMN `version` VARCHAR(255) DEFAULT NULL,
|
||||||
|
ADD COLUMN `available` BOOLEAN DEFAULT TRUE,
|
||||||
|
ADD COLUMN `message` TEXT DEFAULT NULL,
|
||||||
|
ADD COLUMN `update_time` DATETIME DEFAULT NULL;
|
@ -15,5 +15,6 @@ public class SourceBody
|
|||||||
private Long id;
|
private Long id;
|
||||||
private String type;
|
private String type;
|
||||||
private String name;
|
private String name;
|
||||||
|
private String version;
|
||||||
private IConfigure configure;
|
private IConfigure configure;
|
||||||
}
|
}
|
||||||
|
@ -12,10 +12,14 @@ import lombok.Getter;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.data.annotation.CreatedDate;
|
||||||
|
import org.springframework.data.annotation.LastModifiedDate;
|
||||||
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.EntityListeners;
|
||||||
import javax.persistence.FetchType;
|
import javax.persistence.FetchType;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
@ -38,6 +42,7 @@ import java.util.Map;
|
|||||||
@Entity
|
@Entity
|
||||||
@Table(name = "source")
|
@Table(name = "source")
|
||||||
@JsonIgnoreProperties(value = {"configure", "pluginAudits"})
|
@JsonIgnoreProperties(value = {"configure", "pluginAudits"})
|
||||||
|
@EntityListeners(AuditingEntityListener.class)
|
||||||
@org.hibernate.annotations.Table(appliesTo = "source", comment = "The storage is used to query the data connection source")
|
@org.hibernate.annotations.Table(appliesTo = "source", comment = "The storage is used to query the data connection source")
|
||||||
@SuppressFBWarnings(value = {"EI_EXPOSE_REP"},
|
@SuppressFBWarnings(value = {"EI_EXPOSE_REP"},
|
||||||
justification = "I prefer to suppress these FindBugs warnings")
|
justification = "I prefer to suppress these FindBugs warnings")
|
||||||
@ -82,9 +87,6 @@ public class SourceEntity
|
|||||||
@Column(name = "_database")
|
@Column(name = "_database")
|
||||||
private String database;
|
private String database;
|
||||||
|
|
||||||
@Column(name = "create_time", columnDefinition = "datetime default CURRENT_TIMESTAMP()")
|
|
||||||
private Timestamp createTime;
|
|
||||||
|
|
||||||
// Add from 1.1.0.20221115
|
// Add from 1.1.0.20221115
|
||||||
@Column(name = "_ssl", columnDefinition = "boolean default false")
|
@Column(name = "_ssl", columnDefinition = "boolean default false")
|
||||||
private Boolean ssl;
|
private Boolean ssl;
|
||||||
@ -102,15 +104,32 @@ public class SourceEntity
|
|||||||
@JsonProperty(value = "configure")
|
@JsonProperty(value = "configure")
|
||||||
private String configure;
|
private String configure;
|
||||||
|
|
||||||
|
@Column(name = "used_config")
|
||||||
|
private boolean usedConfig;
|
||||||
|
|
||||||
|
@Column(name = "version")
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
@Column(name = "available")
|
||||||
|
private Boolean available;
|
||||||
|
|
||||||
|
@Column(name = "message")
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
@Column(name = "create_time")
|
||||||
|
@CreatedDate
|
||||||
|
private Timestamp createTime;
|
||||||
|
|
||||||
|
@Column(name = "update_time")
|
||||||
|
@LastModifiedDate
|
||||||
|
private Timestamp updateTime;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private Map<String, Object> configures;
|
private Map<String, Object> configures;
|
||||||
|
|
||||||
@Transient
|
@Transient
|
||||||
private IConfigure schema;
|
private IConfigure schema;
|
||||||
|
|
||||||
@Column(name = "used_config")
|
|
||||||
private boolean usedConfig;
|
|
||||||
|
|
||||||
@ManyToOne
|
@ManyToOne
|
||||||
@JoinColumn(name = "user_id")
|
@JoinColumn(name = "user_id")
|
||||||
@JsonIncludeProperties(value = {"id", "username"})
|
@JsonIncludeProperties(value = {"id", "username"})
|
||||||
|
@ -249,7 +249,13 @@ public class SourceServiceImpl
|
|||||||
if (ObjectUtils.isNotEmpty(configure.getId()) && configure.getId() > 0) {
|
if (ObjectUtils.isNotEmpty(configure.getId()) && configure.getId() > 0) {
|
||||||
source.setId(configure.getId());
|
source.setId(configure.getId());
|
||||||
}
|
}
|
||||||
|
if (StringUtils.isNotEmpty(configure.getVersion())) {
|
||||||
|
source.setVersion(configure.getVersion());
|
||||||
|
source.setAvailable(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
source.setAvailable(false);
|
||||||
|
}
|
||||||
this.sourceRepository.save(source);
|
this.sourceRepository.save(source);
|
||||||
// Copy file to local data
|
// Copy file to local data
|
||||||
if (source.isUsedConfig()) {
|
if (source.isUsedConfig()) {
|
||||||
|
@ -125,4 +125,6 @@ export default {
|
|||||||
seconds: 'Seconds',
|
seconds: 'Seconds',
|
||||||
avatar: 'Avatar',
|
avatar: 'Avatar',
|
||||||
text: 'Text',
|
text: 'Text',
|
||||||
|
version: 'Version',
|
||||||
|
available: 'Available',
|
||||||
}
|
}
|
||||||
|
@ -124,5 +124,7 @@ export default {
|
|||||||
timeout: '超时时间',
|
timeout: '超时时间',
|
||||||
seconds: '秒',
|
seconds: '秒',
|
||||||
avatar: '头像',
|
avatar: '头像',
|
||||||
text: '文本'
|
text: '文本',
|
||||||
|
version: '版本',
|
||||||
|
available: '可用',
|
||||||
}
|
}
|
||||||
|
@ -14,5 +14,6 @@ export interface SourceModel
|
|||||||
createTime?: number;
|
createTime?: number;
|
||||||
ssl?: boolean;
|
ssl?: boolean;
|
||||||
configures: {};
|
configures: {};
|
||||||
file?: []
|
file?: [];
|
||||||
|
version?: string;
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,24 @@
|
|||||||
<template #host="{ row }">
|
<template #host="{ row }">
|
||||||
<Ellipsis :text="row.host" :length="8" tooltip transfer/>
|
<Ellipsis :text="row.host" :length="8" tooltip transfer/>
|
||||||
</template>
|
</template>
|
||||||
|
<template #version="{ row }">
|
||||||
|
<Tag v-if="row.version"
|
||||||
|
color="primary">
|
||||||
|
{{ row.version }}
|
||||||
|
</Tag>
|
||||||
|
</template>
|
||||||
|
<template #available="{ row }">
|
||||||
|
<Button :type="row.available ? 'success' : 'error'"
|
||||||
|
:icon="row.available ? 'md-checkmark-circle' : 'md-close-circle'"
|
||||||
|
shape="circle"
|
||||||
|
size="small">
|
||||||
|
</Button>
|
||||||
|
</template>
|
||||||
<template #public="{ row }">
|
<template #public="{ row }">
|
||||||
<Switch v-model="row.public" :disabled="currentUserId !== row.user.id" @on-change="handlerShared(row.public, row.id)"/>
|
<Switch v-model="row.public"
|
||||||
|
:disabled="currentUserId !== row.user.id"
|
||||||
|
@on-change="handlerShared(row.public, row.id)">
|
||||||
|
</Switch>
|
||||||
</template>
|
</template>
|
||||||
<template #action="{ row }">
|
<template #action="{ row }">
|
||||||
<Space>
|
<Space>
|
||||||
|
@ -15,8 +15,10 @@
|
|||||||
<Col :span="6">
|
<Col :span="6">
|
||||||
<Card :bordered="false" dis-hover>
|
<Card :bordered="false" dis-hover>
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<Progress :percent="testInfo.percent" :status="(testInfo.connected && testInfo.successful) ? 'success' : 'wrong'">
|
<Progress :percent="testInfo.percent"
|
||||||
|
:status="(testInfo.connected && testInfo.successful) ? 'success' : 'wrong'">
|
||||||
</Progress>
|
</Progress>
|
||||||
|
{{ formState.version }}
|
||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
</Col>
|
</Col>
|
||||||
@ -241,7 +243,8 @@ export default defineComponent({
|
|||||||
id: this.id,
|
id: this.id,
|
||||||
type: type,
|
type: type,
|
||||||
name: name,
|
name: name,
|
||||||
configure: this.applyPlugin
|
configure: this.applyPlugin,
|
||||||
|
version: this.formState.version
|
||||||
};
|
};
|
||||||
SourceV2Service.saveAndUpdate(configure, this.isUpdate)
|
SourceV2Service.saveAndUpdate(configure, this.isUpdate)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -277,6 +280,7 @@ export default defineComponent({
|
|||||||
this.$Message.success("Test successful");
|
this.$Message.success("Test successful");
|
||||||
this.testInfo.connected = true;
|
this.testInfo.connected = true;
|
||||||
this.testInfo.successful = true;
|
this.testInfo.successful = true;
|
||||||
|
this.formState.version = response.data?.columns[0]?.version;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.$Message.error(response.message);
|
this.$Message.error(response.message);
|
||||||
|
@ -52,12 +52,30 @@ const createHeaders = (i18n: any) => {
|
|||||||
slot: 'public',
|
slot: 'public',
|
||||||
key: 'public'
|
key: 'public'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18n.t('common.version'),
|
||||||
|
slot: 'version',
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: i18n.t('common.available'),
|
||||||
|
key: 'available',
|
||||||
|
slot: 'available',
|
||||||
|
ellipsis: true,
|
||||||
|
align: 'center'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t('common.createTime'),
|
title: i18n.t('common.createTime'),
|
||||||
key: 'createTime',
|
key: 'createTime',
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
tooltip: true
|
tooltip: true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: i18n.t('common.updateTime'),
|
||||||
|
key: 'updateTime',
|
||||||
|
ellipsis: true,
|
||||||
|
tooltip: true
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: i18n.t('common.action'),
|
title: i18n.t('common.action'),
|
||||||
slot: 'action',
|
slot: 'action',
|
||||||
|
Loading…
Reference in New Issue
Block a user