Browse Source

feat: embedded product api (#2671)

main
Yening Qin GitHub 1 year ago
parent
commit
eb330f00b2
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
3 changed files with 57 additions and 1 deletions
  1. +49
    -0
      center/cconf/ops.go
  2. +8
    -0
      models/embedded_product.go
  3. +0
    -1
      models/migrate/migrate.go

+ 49
- 0
center/cconf/ops.go View File

@@ -288,5 +288,54 @@ ops:
cname: View Alerting Engines
- name: /system/version
cname: View Product Version
- name: message-templates
cname: Message Templates
ops:
- name: "/notification-templates"
cname: View Message Templates
- name: "/notification-templates/add"
cname: Add Message Templates
- name: "/notification-templates/put"
cname: Modify Message Templates
- name: "/notification-templates/del"
cname: Delete Message Templates

- name: notify-rules
cname: Notify Rules
ops:
- name: "/notification-rules"
cname: View Notify Rules
- name: "/notification-rules/add"
cname: Add Notify Rules
- name: "/notification-rules/put"
cname: Modify Notify Rules
- name: "/notification-rules/del"
cname: Delete Notify Rules

- name: notify-channels
cname: Notify Channels
ops:
- name: "/notification-channels"
cname: View Notify Channels
- name: "/notification-channels/add"
cname: Add Notify Channels
- name: "/notification-channels/put"
cname: Modify Notify Channels
- name: "/notification-channels/del"
cname: Delete Notify Channels

- name: embedded-product
cname: Integrated Instrument Dashboard
ops:
- name: "/embedded-product"
cname: View Embedded Product
- name: "/embedded-product/add"
cname: Add Embedded Product
- name: "/embedded-product/delete"
cname: Delete Embedded Product
- name: "/embedded-product/put"
cname: Edit Embedded Product

`
)

+ 8
- 0
models/embedded_product.go View File

@@ -9,6 +9,7 @@ import (
"github.com/pkg/errors"
"github.com/toolkits/pkg/logger"
"github.com/toolkits/pkg/str"
"gorm.io/gorm"
"gorm.io/gorm/clause"
)

@@ -28,6 +29,13 @@ func (e *EmbeddedProduct) TableName() string {
return "embedded_product"
}

func (e *EmbeddedProduct) AfterFind(tx *gorm.DB) (err error) {
if e.TeamIDs == nil {
e.TeamIDs = []int64{}
}
return nil
}

func (e *EmbeddedProduct) Verify() error {
if e.Name == "" {
return errors.New("Name is blank")


+ 0
- 1
models/migrate/migrate.go View File

@@ -70,7 +70,6 @@ func MigrateTables(db *gorm.DB) error {
&models.UserToken{}, &models.DashAnnotation{}, MessageTemplate{}, NotifyRule{}, NotifyChannelConfig{}, &EsIndexPatternMigrate{},
&AlertAggrView{}, &models.EventPipeline{}, &models.EmbeddedProduct{}}


if isPostgres(db) {
dts = append(dts, &models.PostgresBuiltinComponent{})
} else {


Loading…
Cancel
Save