-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hasHumanitecAnnotations function
- Loading branch information
1 parent
c32bdb9
commit 22a6c79
Showing
8 changed files
with
113 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@humanitec/backstage-plugin': minor | ||
--- | ||
|
||
Add hasHumanitecAnnotations function for conditional rendering |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,5 +59,6 @@ | |
}, | ||
"dependencies": { | ||
"@changesets/cli": "^2.27.1" | ||
} | ||
}, | ||
"packageManager": "[email protected]+sha512.ca75da26c00327d26267ce33536e5790f18ebd53266796fbb664d2a4a5116308042dd8ee7003b276a20eace7d3c5561c3577bdd71bcb67071187af124779620a" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
plugins/humanitec/src/components/HumanitecCardComponent.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Entity } from '@backstage/catalog-model'; | ||
import { hasHumanitecAnnotations } from './HumanitecCardComponent'; | ||
|
||
describe('<HumanitecCardComponent />', () => { | ||
it('returns hasHumanitecAnnotations truthy if the entity has humanitec annotations', async () => { | ||
const entity: Entity = { | ||
apiVersion: 'v1', | ||
kind: 'Component', | ||
metadata: { | ||
name: 'software', | ||
annotations: { | ||
'humanitec.com/orgId': 'orgId', | ||
'humanitec.com/appId': 'appId', | ||
}, | ||
}, | ||
}; | ||
|
||
const hasAnnotations = await hasHumanitecAnnotations(entity); | ||
|
||
expect(hasAnnotations).toBeTruthy(); | ||
}); | ||
|
||
it('returns hasHumanitecAnnotations falsy if the entity has no humanitec annotations', async () => { | ||
const entity: Entity = { | ||
apiVersion: 'v1', | ||
kind: 'Component', | ||
metadata: { | ||
name: 'software', | ||
}, | ||
}; | ||
|
||
const hasAnnotations = await hasHumanitecAnnotations(entity); | ||
|
||
expect(hasAnnotations).toBeFalsy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { humanitecPlugin } from './plugin'; | ||
export { HumanitecCardComponent } from './components/HumanitecCardComponent'; | ||
export { HumanitecCardComponent, hasHumanitecAnnotations } from './components/HumanitecCardComponent'; | ||
export { ValidateHumanitecAppIDFieldExtension } from './scaffolder/ValidateHumanitecAppID'; |