Skip to content

Commit

Permalink
fix repository corner cases (#558)
Browse files Browse the repository at this point in the history
Signed-off-by: SamiulSourav <[email protected]>
  • Loading branch information
SamiulSourav authored Aug 20, 2024
1 parent f550efb commit e5d82cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ steps:
$ref: schema#/properties/spec/properties/dataSource/properties/snapshot
type: select
- elements:
- computed: setNamespace
disableUnselect: true
- disableUnselect: true
fetch: getNamespaces
label:
text: labels.namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,19 @@ async function getSnapshots({ watchDependency, model, storeGet, getValue, axios
if (namespace) {
const resp = await axios.get(url)
let snapshots = resp?.data?.items
snapshots.map((item, idx) => {
snapshots.map((item) => {
const name = item?.metadata?.name
item.value = name
item.text = idx === 0 ? name + ' (Latest)' : name
item.text = name
return true
})

const filteredSnapshots = snapshots.filter((item) => {
const owners = item?.metadata?.ownerReferences
return owners[0]?.name === repository && owners[0]?.kind === 'Repository'
if (owners.length) return owners[0].name === repository && owners[0].kind === 'Repository'
})
if (filteredSnapshots.length)
filteredSnapshots[0].text = filteredSnapshots[0].text + ' (Latest)'
return filteredSnapshots
}
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
snapshot: latest
encryptionSecret:
name: ""
namespace: ""
namespace: "stash"

addon:
name: ""
Expand Down

0 comments on commit e5d82cc

Please sign in to comment.