-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tomsun28 <tomsun28@outlook.com> Co-authored-by: Logic <zqr10159@dromara.org>
- Loading branch information
Showing
49 changed files
with
2,407 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
.../src/main/java/org/dromara/hertzbeat/common/entity/manager/JsonTagAttributeConverter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.dromara.hertzbeat.common.entity.manager; | ||
|
||
import com.fasterxml.jackson.core.type.TypeReference; | ||
import org.dromara.hertzbeat.common.util.JsonUtil; | ||
|
||
import javax.persistence.AttributeConverter; | ||
|
||
/** | ||
* json str to tag item | ||
* @author tom | ||
* | ||
*/ | ||
public class JsonTagAttributeConverter implements AttributeConverter<TagItem, String> { | ||
|
||
@Override | ||
public String convertToDatabaseColumn(TagItem attribute) { | ||
return JsonUtil.toJson(attribute); | ||
} | ||
|
||
@Override | ||
public TagItem convertToEntityAttribute(String dbData) { | ||
TypeReference<TagItem> typeReference = new TypeReference<>() {}; | ||
return JsonUtil.fromJson(dbData, typeReference); | ||
} | ||
} |
75 changes: 75 additions & 0 deletions
75
common/src/main/java/org/dromara/hertzbeat/common/entity/manager/StatusPageComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package org.dromara.hertzbeat.common.entity.manager; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotBlank; | ||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* status page component entity | ||
* @author tom | ||
*/ | ||
@Entity | ||
@Table(name = "hzb_status_page_component") | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "status page component entity") | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class StatusPageComponent { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Schema(title = "ID", example = "87584674384") | ||
private Long id; | ||
|
||
@Schema(title = "org id", example = "1234") | ||
private Long orgId; | ||
|
||
@Schema(title = "component name", example = "Gateway") | ||
@NotBlank | ||
private String name; | ||
|
||
@Schema(title = "component desc", example = "TanCloud Gateway") | ||
private String description; | ||
|
||
@Schema(title = "component match single tag", example = "{labelName:labelValue}") | ||
@Convert(converter = JsonTagAttributeConverter.class) | ||
private TagItem tag; | ||
|
||
@Schema(title = "calculate status method: 0-auto 1-manual", example = "0") | ||
private byte method; | ||
|
||
@Schema(title = "config state when use manual method: 0-Normal 1-Abnormal 2-unknown", example = "0") | ||
private byte configState; | ||
|
||
@Schema(title = "component current state: 0-Normal 1-Abnormal 2-unknown", example = "0") | ||
private byte state; | ||
|
||
@Schema(title = "The creator of this record", example = "tom") | ||
@CreatedBy | ||
private String creator; | ||
|
||
@Schema(title = "The modifier of this record", example = "tom") | ||
@LastModifiedBy | ||
private String modifier; | ||
|
||
@Schema(title = "Record create time", example = "1612198922000") | ||
@CreatedDate | ||
private LocalDateTime gmtCreate; | ||
|
||
@Schema(title = "Record modify time", example = "1612198444000") | ||
@LastModifiedDate | ||
private LocalDateTime gmtUpdate; | ||
} |
72 changes: 72 additions & 0 deletions
72
common/src/main/java/org/dromara/hertzbeat/common/entity/manager/StatusPageHistory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.dromara.hertzbeat.common.entity.manager; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.*; | ||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* status page history entity | ||
* @author tom | ||
*/ | ||
@Entity | ||
@Table(name = "hzb_status_page_history") | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "status page component history entity") | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class StatusPageHistory { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Schema(title = "ID", example = "87584674384") | ||
private Long id; | ||
|
||
@Schema(title = "component id", example = "1234") | ||
private Long componentId; | ||
|
||
@Schema(title = "component state: 0-Normal 1-Abnormal 2-unknown", example = "0") | ||
private byte state; | ||
|
||
@Schema(title = "state calculate timestamp", example = "4248574985744") | ||
private Long timestamp; | ||
|
||
@Schema(title = "state uptime percentage", example = "99.99") | ||
private Double uptime; | ||
|
||
@Schema(title = "state abnormal time(s)", example = "1000") | ||
private Integer abnormal; | ||
|
||
@Schema(title = "state unknown time(s)", example = "1000") | ||
@Column(name = "`unknown`") | ||
private Integer unknown; | ||
|
||
@Schema(title = "state normal tim(s)", example = "1000") | ||
private Integer normal; | ||
|
||
@Schema(title = "The creator of this record", example = "tom") | ||
@CreatedBy | ||
private String creator; | ||
|
||
@Schema(title = "The modifier of this record", example = "tom") | ||
@LastModifiedBy | ||
private String modifier; | ||
|
||
@Schema(title = "Record create time", example = "1612198922000") | ||
@CreatedDate | ||
private LocalDateTime gmtCreate; | ||
|
||
@Schema(title = "Record modify time", example = "1612198444000") | ||
@LastModifiedDate | ||
private LocalDateTime gmtUpdate; | ||
} |
78 changes: 78 additions & 0 deletions
78
common/src/main/java/org/dromara/hertzbeat/common/entity/manager/StatusPageOrg.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package org.dromara.hertzbeat.common.entity.manager; | ||
|
||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import org.springframework.data.annotation.CreatedBy; | ||
import org.springframework.data.annotation.CreatedDate; | ||
import org.springframework.data.annotation.LastModifiedBy; | ||
import org.springframework.data.annotation.LastModifiedDate; | ||
import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
||
import javax.persistence.*; | ||
import javax.validation.constraints.NotBlank; | ||
|
||
import java.time.LocalDateTime; | ||
|
||
/** | ||
* status page org entity | ||
* @author tom | ||
*/ | ||
@Entity | ||
@Table(name = "hzb_status_page_org") | ||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Schema(description = "status page org entity") | ||
@EntityListeners(AuditingEntityListener.class) | ||
public class StatusPageOrg { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Schema(title = "ID", example = "87584674384") | ||
private Long id; | ||
|
||
@Schema(title = "org name", example = "TanCloud") | ||
@NotBlank | ||
private String name; | ||
|
||
@Schema(title = "org desc", example = "TanCloud inc") | ||
@NotBlank | ||
private String description; | ||
|
||
@Schema(title = "org home url", example = "https://tancloud.com") | ||
@NotBlank | ||
private String home; | ||
|
||
@Schema(title = "org logo url", example = "logo.svg url") | ||
@NotBlank | ||
private String logo; | ||
|
||
@Schema(title = "org feedback issue url", example = "contact@email.com") | ||
private String feedback; | ||
|
||
@Schema(title = "org theme background color", example = "#ffffff") | ||
private String color; | ||
|
||
@Schema(title = "org current state: 0-All Systems Operational 1-Some Systems Abnormal 2-All Systems Abnormal ", example = "0") | ||
private byte state; | ||
|
||
@Schema(title = "The creator of this record", example = "tom") | ||
@CreatedBy | ||
private String creator; | ||
|
||
@Schema(title = "The modifier of this record", example = "tom") | ||
@LastModifiedBy | ||
private String modifier; | ||
|
||
@Schema(title = "Record create time", example = "1612198922000") | ||
@CreatedDate | ||
private LocalDateTime gmtCreate; | ||
|
||
@Schema(title = "Record modify time", example = "1612198444000") | ||
@LastModifiedDate | ||
private LocalDateTime gmtUpdate; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.