mirror of
https://gitee.com/devlive-community/datacap.git
synced 2024-12-05 05:27:52 +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 String type;
|
||||
private String name;
|
||||
private String version;
|
||||
private IConfigure configure;
|
||||
}
|
||||
|
@ -12,10 +12,14 @@ import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
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.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.EntityListeners;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
@ -38,6 +42,7 @@ import java.util.Map;
|
||||
@Entity
|
||||
@Table(name = "source")
|
||||
@JsonIgnoreProperties(value = {"configure", "pluginAudits"})
|
||||
@EntityListeners(AuditingEntityListener.class)
|
||||
@org.hibernate.annotations.Table(appliesTo = "source", comment = "The storage is used to query the data connection source")
|
||||
@SuppressFBWarnings(value = {"EI_EXPOSE_REP"},
|
||||
justification = "I prefer to suppress these FindBugs warnings")
|
||||
@ -82,9 +87,6 @@ public class SourceEntity
|
||||
@Column(name = "_database")
|
||||
private String database;
|
||||
|
||||
@Column(name = "create_time", columnDefinition = "datetime default CURRENT_TIMESTAMP()")
|
||||
private Timestamp createTime;
|
||||
|
||||
// Add from 1.1.0.20221115
|
||||
@Column(name = "_ssl", columnDefinition = "boolean default false")
|
||||
private Boolean ssl;
|
||||
@ -102,15 +104,32 @@ public class SourceEntity
|
||||
@JsonProperty(value = "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
|
||||
private Map<String, Object> configures;
|
||||
|
||||
@Transient
|
||||
private IConfigure schema;
|
||||
|
||||
@Column(name = "used_config")
|
||||
private boolean usedConfig;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
@JsonIncludeProperties(value = {"id", "username"})
|
||||
|
@ -249,7 +249,13 @@ public class SourceServiceImpl
|
||||
if (ObjectUtils.isNotEmpty(configure.getId()) && configure.getId() > 0) {
|
||||
source.setId(configure.getId());
|
||||
}
|
||||
|
||||
if (StringUtils.isNotEmpty(configure.getVersion())) {
|
||||
source.setVersion(configure.getVersion());
|
||||
source.setAvailable(true);
|
||||
}
|
||||
else {
|
||||
source.setAvailable(false);
|
||||
}
|
||||
this.sourceRepository.save(source);
|
||||
// Copy file to local data
|
||||
if (source.isUsedConfig()) {
|
||||
|
@ -125,4 +125,6 @@ export default {
|
||||
seconds: 'Seconds',
|
||||
avatar: 'Avatar',
|
||||
text: 'Text',
|
||||
version: 'Version',
|
||||
available: 'Available',
|
||||
}
|
||||
|
@ -124,5 +124,7 @@ export default {
|
||||
timeout: '超时时间',
|
||||
seconds: '秒',
|
||||
avatar: '头像',
|
||||
text: '文本'
|
||||
text: '文本',
|
||||
version: '版本',
|
||||
available: '可用',
|
||||
}
|
||||
|
@ -14,5 +14,6 @@ export interface SourceModel
|
||||
createTime?: number;
|
||||
ssl?: boolean;
|
||||
configures: {};
|
||||
file?: []
|
||||
file?: [];
|
||||
version?: string;
|
||||
}
|
||||
|
@ -19,8 +19,24 @@
|
||||
<template #host="{ row }">
|
||||
<Ellipsis :text="row.host" :length="8" tooltip transfer/>
|
||||
</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 }">
|
||||
<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 #action="{ row }">
|
||||
<Space>
|
||||
|
@ -15,8 +15,10 @@
|
||||
<Col :span="6">
|
||||
<Card :bordered="false" dis-hover>
|
||||
<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>
|
||||
{{ formState.version }}
|
||||
</div>
|
||||
</Card>
|
||||
</Col>
|
||||
@ -241,7 +243,8 @@ export default defineComponent({
|
||||
id: this.id,
|
||||
type: type,
|
||||
name: name,
|
||||
configure: this.applyPlugin
|
||||
configure: this.applyPlugin,
|
||||
version: this.formState.version
|
||||
};
|
||||
SourceV2Service.saveAndUpdate(configure, this.isUpdate)
|
||||
.then((response) => {
|
||||
@ -277,6 +280,7 @@ export default defineComponent({
|
||||
this.$Message.success("Test successful");
|
||||
this.testInfo.connected = true;
|
||||
this.testInfo.successful = true;
|
||||
this.formState.version = response.data?.columns[0]?.version;
|
||||
}
|
||||
else {
|
||||
this.$Message.error(response.message);
|
||||
|
@ -52,12 +52,30 @@ const createHeaders = (i18n: any) => {
|
||||
slot: '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'),
|
||||
key: 'createTime',
|
||||
ellipsis: true,
|
||||
tooltip: true
|
||||
},
|
||||
{
|
||||
title: i18n.t('common.updateTime'),
|
||||
key: 'updateTime',
|
||||
ellipsis: true,
|
||||
tooltip: true
|
||||
},
|
||||
{
|
||||
title: i18n.t('common.action'),
|
||||
slot: 'action',
|
||||
|
Loading…
Reference in New Issue
Block a user