mirror of
https://github.com/semaphoreui/semaphore.git
synced 2024-12-04 23:31: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"`
|
Templates []ObjectReferrer `json:"templates"`
|
||||||
Inventories []ObjectReferrer `json:"inventories"`
|
Inventories []ObjectReferrer `json:"inventories"`
|
||||||
Repositories []ObjectReferrer `json:"repositories"`
|
Repositories []ObjectReferrer `json:"repositories"`
|
||||||
|
Integrations []ObjectReferrer `json:"integrations"`
|
||||||
|
Schedules []ObjectReferrer `json:"schedules"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type IntegrationReferrers struct {
|
type IntegrationReferrers struct {
|
||||||
|
@ -4,14 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/semaphoreui/semaphore/db"
|
|
||||||
"github.com/semaphoreui/semaphore/util"
|
|
||||||
"go.etcd.io/bbolt"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/semaphoreui/semaphore/db"
|
||||||
|
"github.com/semaphoreui/semaphore/util"
|
||||||
|
"go.etcd.io/bbolt"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxID = 2147483647
|
const MaxID = 2147483647
|
||||||
@ -689,20 +690,25 @@ func (d *BoltDb) getObjectRefs(projectID int, objectProps db.ObjectProps, object
|
|||||||
return
|
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 {
|
// for _, st := range templates {
|
||||||
exists := false
|
// exists := false
|
||||||
for _, tpl := range refs.Templates {
|
// for _, tpl := range refs.Templates {
|
||||||
if tpl.ID == st.ID {
|
// if tpl.ID == st.ID {
|
||||||
exists = true
|
// exists = true
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if exists {
|
// if exists {
|
||||||
continue
|
// continue
|
||||||
}
|
// }
|
||||||
refs.Templates = append(refs.Templates, st)
|
// refs.Templates = append(refs.Templates, st)
|
||||||
|
// }
|
||||||
|
|
||||||
|
refs.Integrations, err = d.getObjectRefsFrom(projectID, objectProps, intObjectID(objectID), db.IntegrationProps)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user