From 811bb237c4a82c15b82d1ac3627e70e46c63d70c Mon Sep 17 00:00:00 2001 From: Peter Grzybowski Date: Thu, 5 Sep 2024 13:56:14 +0200 Subject: [PATCH] chore: deployments: reverting release name filtering and docs ChangeLog: none Signed-off-by: Peter Grzybowski --- .../services/deployments/docs/management_api.yml | 12 ++++++------ .../deployments/docs/management_api_v2.yml | 2 +- .../deployments/store/mongo/datastore_mongo.go | 16 ++++++++-------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/backend/services/deployments/docs/management_api.yml b/backend/services/deployments/docs/management_api.yml index 1cc8a500..b57eaf2a 100644 --- a/backend/services/deployments/docs/management_api.yml +++ b/backend/services/deployments/docs/management_api.yml @@ -1073,17 +1073,17 @@ paths: parameters: - name: name in: query - description: Artifact name prefix filter. + description: Release name filter. required: false type: string - name: description in: query - description: Artifact description filter. Any artifact containing this string in the description will be returned. + description: Release description filter. required: false type: string - name: device_type in: query - description: Artifact device type filter. Any artifact containing this string in the device type will be returned. + description: Release device type filter. required: false type: string responses: @@ -1170,17 +1170,17 @@ paths: parameters: - name: name in: query - description: Artifact name prefix filter. + description: Artifact name filter. required: false type: string - name: description in: query - description: Artifact description filter. Any artifact containing this string in the description will be returned. + description: Artifact description filter. required: false type: string - name: device_type in: query - description: Artifact device type filter. Any artifact containing this string in the device type will be returned. + description: Artifact device type filter. required: false type: string - name: page diff --git a/backend/services/deployments/docs/management_api_v2.yml b/backend/services/deployments/docs/management_api_v2.yml index a58f0d3b..f214e72c 100644 --- a/backend/services/deployments/docs/management_api_v2.yml +++ b/backend/services/deployments/docs/management_api_v2.yml @@ -63,7 +63,7 @@ paths: parameters: - name: name in: query - description: Release name prefix filter. + description: Release name filter. required: false type: string - name: tag diff --git a/backend/services/deployments/store/mongo/datastore_mongo.go b/backend/services/deployments/store/mongo/datastore_mongo.go index 3dc80938..4265f8da 100644 --- a/backend/services/deployments/store/mongo/datastore_mongo.go +++ b/backend/services/deployments/store/mongo/datastore_mongo.go @@ -560,7 +560,7 @@ func (db *DataStoreMongo) getReleases_1_2_14( {Key: "$match", Value: bson.M{ StorageKeyImageName: bson.M{ "$regex": primitive.Regex{ - Pattern: "^" + regexp.QuoteMeta(filt.Name), + Pattern: ".*" + regexp.QuoteMeta(filt.Name) + ".*", Options: "i", }, }, @@ -593,7 +593,7 @@ func (db *DataStoreMongo) getReleases_1_2_14( {Key: "$match", Value: bson.M{ "artifacts." + StorageKeyImageDescription: bson.M{ "$regex": primitive.Regex{ - Pattern: regexp.QuoteMeta(filt.Description), + Pattern: ".*" + regexp.QuoteMeta(filt.Description) + ".*", Options: "i", }, }, @@ -605,7 +605,7 @@ func (db *DataStoreMongo) getReleases_1_2_14( {Key: "$match", Value: bson.M{ "artifacts." + StorageKeyImageDeviceTypes: bson.M{ "$regex": primitive.Regex{ - Pattern: regexp.QuoteMeta(filt.DeviceType), + Pattern: ".*" + regexp.QuoteMeta(filt.DeviceType) + ".*", Options: "i", }, }, @@ -713,7 +713,7 @@ func (db *DataStoreMongo) getReleases_1_2_15( if filt != nil { if filt.Name != "" { filter[StorageKeyReleaseName] = bson.M{"$regex": primitive.Regex{ - Pattern: "^" + regexp.QuoteMeta(filt.Name), + Pattern: regexp.QuoteMeta(filt.Name) + ".*", Options: "i", }} } @@ -722,7 +722,7 @@ func (db *DataStoreMongo) getReleases_1_2_15( } if filt.Description != "" { filter[StorageKeyReleaseArtifactsDescription] = bson.M{"$regex": primitive.Regex{ - Pattern: regexp.QuoteMeta(filt.Description), + Pattern: ".*" + regexp.QuoteMeta(filt.Description) + ".*", Options: "i", }} } @@ -1202,7 +1202,7 @@ func (db *DataStoreMongo) ListImages( if filt.Name != "" { filters[StorageKeyImageName] = bson.M{ "$regex": primitive.Regex{ - Pattern: "^" + regexp.QuoteMeta(filt.Name), + Pattern: ".*" + regexp.QuoteMeta(filt.Name) + ".*", Options: "i", }, } @@ -1210,7 +1210,7 @@ func (db *DataStoreMongo) ListImages( if filt.Description != "" { filters[StorageKeyImageDescription] = bson.M{ "$regex": primitive.Regex{ - Pattern: regexp.QuoteMeta(filt.Description), + Pattern: ".*" + regexp.QuoteMeta(filt.Description) + ".*", Options: "i", }, } @@ -1218,7 +1218,7 @@ func (db *DataStoreMongo) ListImages( if filt.DeviceType != "" { filters[StorageKeyImageDeviceTypes] = bson.M{ "$regex": primitive.Regex{ - Pattern: regexp.QuoteMeta(filt.DeviceType), + Pattern: ".*" + regexp.QuoteMeta(filt.DeviceType) + ".*", Options: "i", }, }