Skip to content

Commit

Permalink
Propagate _sourceinfo for shared templates
Browse files Browse the repository at this point in the history
  • Loading branch information
AjBreidenbach committed Mar 19, 2024
1 parent ce613cf commit a504525
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,17 @@ const actions = {
resource = rootGetters.getPrimaryCard
}

const type = rootGetters.resolveResourceTypeFromAny(resource.type)
const newObject = {
name: `__${environmentName}__${deploymentName}__${resourceName}`,
metadata: {
extends: rootGetters.resolveResourceTypeFromAny(resource.type)?.extends || [],
extends: type?.extends || [],
},
title: resource.title,
directives: ['select'],
imported: `${deploymentName}:${resource.name}`,
type: resource.type,
_sourceinfo: type?._sourceinfo,
__typename: 'ResourceTemplate'
}

Expand All @@ -326,15 +328,17 @@ const actions = {
const resource = rootGetters.getCardsStacked.find(card => card.name == resourceName)

const name = `__${environmentName}__${deploymentName}__${resourceName}`
const type = rootGetters.resolveResourceTypeFromAny(resource.type)
const newObject = {
name,
metadata: {
extends: rootGetters.resolveResourceTypeFromAny(resource.type)?.extends || [],
extends: type?.extends || [],
},
title: resource.title,
directives: ['select'],
imported: `${deploymentName}:${resource.name}`,
type: resource.type,
_sourceinfo: type?._sourceinfo,
__typename: 'ResourceTemplate'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,15 @@ const actions = {
await dispatch('fetchDeploymentIfNeeded', resourceTemplate)
}

let _sourceinfo

if(!resourceTemplate._sourceinfo) {
const type = getters.resolveResourceTypeFromAny(resourceTemplate.type)
_sourceinfo = type?._sourceinfo
}

resourceTemplateNode = {
_sourceinfo,
...resourceTemplate,
name,
dependentName,
Expand Down

0 comments on commit a504525

Please sign in to comment.