Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(appbuilder): Issue related to App-builder placeholder wrong message #6010

Merged
merged 3 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { getSamCliContext } from '../../../../shared/sam/cli/samCliContext'
import { SamCliListResourcesParameters } from '../../../../shared/sam/cli/samCliListResources'
import { getDeployedResources, StackResource } from '../../../../lambda/commands/listSamResources'
import * as path from 'path'
import fs from '../../../../shared/fs/fs'
import { generateStackNode } from './deployedStack'

export class AppNode implements TreeNode {
Expand Down Expand Up @@ -61,19 +60,9 @@ export class AppNode implements TreeNode {

// indicate that App exists, but it is empty
if (resources.length === 0) {
if (await fs.exists(this.location.samTemplateUri)) {
return [
createPlaceholderItem(
localize(
'AWS.appBuilder.explorerNode.app.noResource',
'[No resource found in IaC template]'
)
),
]
}
return [
createPlaceholderItem(
localize('AWS.appBuilder.explorerNode.app.noTemplate', '[No IaC templates found in Workspaces]')
localize('AWS.appBuilder.explorerNode.app.noResource', '[No resource found in SAM template]')
),
]
}
Expand All @@ -84,7 +73,7 @@ export class AppNode implements TreeNode {
createPlaceholderItem(
localize(
'AWS.appBuilder.explorerNode.app.noResourceTree',
'[Unable to load Resource tree for this App. Update IaC template]'
'[Unable to load Resource tree for this App. Update SAM template]'
)
),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export async function getAppNodes(): Promise<TreeNode[]> {
if (appsFound.length === 0) {
return [
createPlaceholderItem(
localize('AWS.appBuilder.explorerNode.noApps', '[No IaC templates found in Workspaces]')
localize('AWS.appBuilder.explorerNode.noApps', '[No SAM templates found in Workspaces]')
),
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ describe('AppNode', () => {

const resourceNode = resources[0] as TreeNode
assert.strictEqual(resourceNode.id, 'placeholder')
assert.strictEqual(resourceNode.resource, '[No IaC templates found in Workspaces]')
assert.strictEqual(resourceNode.resource, '[No resource found in SAM template]')
assert(getAppStub.calledOnce)
assert(getStackNameStub.calledOnce)
assert(generateStackNodeStub.notCalled)
Expand Down Expand Up @@ -157,7 +157,7 @@ describe('AppNode', () => {
assert.strictEqual(resourceNode.id, 'placeholder')
assert.strictEqual(
resourceNode.resource,
'[Unable to load Resource tree for this App. Update IaC template]'
'[Unable to load Resource tree for this App. Update SAM template]'
)
assert(getAppStub.calledOnce)
assert(getStackNameStub.notCalled)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('getAppNodes', async () => {
const appNodes = await getAppNodes()
assert.strictEqual(appNodes.length, 1)
assert.strictEqual(appNodes[0].id, 'placeholder')
assert.strictEqual(appNodes[0].resource, '[No IaC templates found in Workspaces]')
assert.strictEqual(appNodes[0].resource, '[No SAM templates found in Workspaces]')
})

it('should return all SAM projects as AppNode', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "SAM debugging: misleading 'IaC' message/placeholder"
}
Loading