Remove admin pricing stack and prepare v1.0.4 release
This commit is contained in:
@@ -600,26 +600,6 @@ func (s *LocalConfigurationService) ListAll(page, perPage int) ([]models.Configu
|
||||
|
||||
// ListAllWithStatus returns configurations filtered by status: active|archived|all.
|
||||
func (s *LocalConfigurationService) ListAllWithStatus(page, perPage int, status string, search string) ([]models.Configuration, int64, error) {
|
||||
localConfigs, err := s.localDB.GetConfigurations()
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
|
||||
search = strings.ToLower(strings.TrimSpace(search))
|
||||
configs := make([]models.Configuration, len(localConfigs))
|
||||
configs = configs[:0]
|
||||
for _, lc := range localConfigs {
|
||||
if !matchesConfigStatus(lc.IsActive, status) {
|
||||
continue
|
||||
}
|
||||
if search != "" && !strings.Contains(strings.ToLower(lc.Name), search) {
|
||||
continue
|
||||
}
|
||||
configs = append(configs, *localdb.LocalToConfiguration(&lc))
|
||||
}
|
||||
|
||||
total := int64(len(configs))
|
||||
|
||||
// Apply pagination
|
||||
if page < 1 {
|
||||
page = 1
|
||||
@@ -628,17 +608,15 @@ func (s *LocalConfigurationService) ListAllWithStatus(page, perPage int, status
|
||||
perPage = 20
|
||||
}
|
||||
offset := (page - 1) * perPage
|
||||
|
||||
start := offset
|
||||
if start > len(configs) {
|
||||
start = len(configs)
|
||||
localConfigs, total, err := s.localDB.ListConfigurationsWithFilters(status, search, offset, perPage)
|
||||
if err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
end := start + perPage
|
||||
if end > len(configs) {
|
||||
end = len(configs)
|
||||
configs := make([]models.Configuration, 0, len(localConfigs))
|
||||
for _, lc := range localConfigs {
|
||||
configs = append(configs, *localdb.LocalToConfiguration(&lc))
|
||||
}
|
||||
|
||||
return configs[start:end], total, nil
|
||||
return configs, total, nil
|
||||
}
|
||||
|
||||
// ListTemplates returns all template configurations
|
||||
|
||||
Reference in New Issue
Block a user