mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 07:11:05 +01:00
feat(be): disable refs for schedules
This commit is contained in:
parent
8123bdad21
commit
5fc7b48d93
@ -54,6 +54,8 @@ type ObjectReferrers struct {
|
||||
Templates []ObjectReferrer `json:"templates"`
|
||||
Inventories []ObjectReferrer `json:"inventories"`
|
||||
Repositories []ObjectReferrer `json:"repositories"`
|
||||
Integrations []ObjectReferrer `json:"integrations"`
|
||||
Schedules []ObjectReferrer `json:"schedules"`
|
||||
}
|
||||
|
||||
type IntegrationReferrers struct {
|
||||
|
@ -4,14 +4,15 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/semaphoreui/semaphore/db"
|
||||
"github.com/semaphoreui/semaphore/util"
|
||||
"go.etcd.io/bbolt"
|
||||
"reflect"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/semaphoreui/semaphore/db"
|
||||
"github.com/semaphoreui/semaphore/util"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
const MaxID = 2147483647
|
||||
@ -689,20 +690,25 @@ func (d *BoltDb) getObjectRefs(projectID int, objectProps db.ObjectProps, object
|
||||
return
|
||||
}
|
||||
|
||||
templates, err := d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.ScheduleProps)
|
||||
// templates, err := d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.ScheduleProps)
|
||||
|
||||
for _, st := range templates {
|
||||
exists := false
|
||||
for _, tpl := range refs.Templates {
|
||||
if tpl.ID == st.ID {
|
||||
exists = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if exists {
|
||||
continue
|
||||
}
|
||||
refs.Templates = append(refs.Templates, st)
|
||||
// for _, st := range templates {
|
||||
// exists := false
|
||||
// for _, tpl := range refs.Templates {
|
||||
// if tpl.ID == st.ID {
|
||||
// exists = true
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
// if exists {
|
||||
// continue
|
||||
// }
|
||||
// refs.Templates = append(refs.Templates, st)
|
||||
// }
|
||||
|
||||
refs.Integrations, err = d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.IntegrationProps)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user