diff --git a/src/app/settings/components/project-role-edit-panel/project-role-edit-panel.tsx b/src/app/settings/components/project-role-edit-panel/project-role-edit-panel.tsx index b786ff8dbbae7..b3d8e2548246b 100644 --- a/src/app/settings/components/project-role-edit-panel/project-role-edit-panel.tsx +++ b/src/app/settings/components/project-role-edit-panel/project-role-edit-panel.tsx @@ -34,12 +34,11 @@ export const ProjectRoleEditPanel = (props: ProjectRoleEditPanelProps) => { getApi={props.getApi} defaultValues={{ projName: props.defaultParams.projName, - roleName: (props.defaultParams.role !== undefined ? props.defaultParams.role.name : ''), - description: (props.defaultParams.role !== undefined ? props.defaultParams.role.description : ''), - policies: (props.defaultParams.role !== undefined && props.defaultParams.role.policies !== null - ? props.defaultParams.role.policies : []), - jwtTokens: (props.defaultParams.role !== undefined ? props.defaultParams.role.jwtTokens : []), - groups: (props.defaultParams.role !== undefined ? props.defaultParams.role.groups : []), + roleName: (props.defaultParams.role && props.defaultParams.role.name || ''), + description: (props.defaultParams.role && props.defaultParams.role.description || ''), + policies: (props.defaultParams.role && props.defaultParams.role.policies || []), + jwtTokens: (props.defaultParams.role && props.defaultParams.role.jwtTokens || []), + groups: (props.defaultParams.role && props.defaultParams.role.groups || []), }} validateError={(params: ProjectRoleParams) => ({ projName: !params.projName && 'Project name is required', diff --git a/src/app/settings/components/project-role-policies-edit/project-role-policies-edit.tsx b/src/app/settings/components/project-role-policies-edit/project-role-policies-edit.tsx index 57dbf33e976d4..d648a2a2a5a8a 100644 --- a/src/app/settings/components/project-role-policies-edit/project-role-policies-edit.tsx +++ b/src/app/settings/components/project-role-policies-edit/project-role-policies-edit.tsx @@ -20,7 +20,7 @@ function generatePolicy(project: string, role: string, action?: string, object?: const actions = ['get', 'create', 'update', 'delete', 'sync']; export const ProjectRolePoliciesEdit = (props: ProjectRolePoliciesProps) => ( - services.applications.list([props.projName])}> + services.applications.list([props.projName], { fields: ['items.metadata.name'] })}> {(applications) => (

Policy Rules

diff --git a/src/app/shared/services/applications-service.ts b/src/app/shared/services/applications-service.ts index c56ff0ddb24a4..423050fcf5af0 100644 --- a/src/app/shared/services/applications-service.ts +++ b/src/app/shared/services/applications-service.ts @@ -168,11 +168,15 @@ export class ApplicationsService { private parseAppFields(data: any): models.Application { const app = data as models.Application; - app.spec.project = app.spec.project || 'default'; - delete app.spec.source.componentParameterOverrides; app.kind = app.kind || 'Application'; - app.status.resources = app.status.resources || []; - app.status.summary = app.status.summary || {}; + if (app.spec) { + app.spec.project = app.spec.project || 'default'; + delete app.spec.source.componentParameterOverrides; + } + if (app.status) { + app.status.resources = app.status.resources || []; + app.status.summary = app.status.summary || {}; + } return app; } }