Add SecurityTab

Signed-off-by: Paul Cowan <paul.cowan@cutting.scot>
This commit is contained in:
Paul Cowan
2022-12-08 12:41:26 +00:00
parent e5cd3c8e62
commit 2ca355e491
6 changed files with 88 additions and 12 deletions
@@ -0,0 +1,25 @@
/* eslint-disable no-console */
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import React from 'react';
import { useEntity } from '@backstage/plugin-catalog-react';
export function SecurityTab(): JSX.Element | null {
const entity = useEntity();
console.log(entity);
return <h1>Security</h1>;
}
@@ -0,0 +1,17 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { SecurityTab } from './SecurityTab';
export { showSecurityTab } from './showSecurityTab';
@@ -0,0 +1,22 @@
/*
* Copyright 2022 The Backstage Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Entity } from '@backstage/catalog-model';
export const SECURITY_ANNOTATION = 'myorg.org/security';
/** @public */
export const showSecurityTab = (entity: Entity) =>
Boolean(entity.metadata.annotations?.[SECURITY_ANNOTATION]);
@@ -154,6 +154,8 @@ import {
ReportIssue,
} from '@backstage/plugin-techdocs-module-addons-contrib';
import { EntityCostInsightsContent } from '@backstage/plugin-cost-insights';
import { SecurityTab } from '../SecurityTab/SecurityTab';
import { showSecurityTab } from '../SecurityTab';
const customEntityFilterKind = ['Component', 'API', 'System'];
@@ -400,6 +402,12 @@ const overviewContent = (
</Grid>
);
const securityContent = (
<EntityLayout.Route path="/security" title="Security" if={showSecurityTab}>
<SecurityTab />
</EntityLayout.Route>
);
const serviceEntityPage = (
<EntityLayoutWrapper>
<EntityLayout.Route path="/" title="Overview">
@@ -440,6 +448,8 @@ const serviceEntityPage = (
{techdocsContent}
</EntityLayout.Route>
{securityContent}
<EntityLayout.Route
if={isNewRelicDashboardAvailable}
path="/newrelic-dashboard"
@@ -5,16 +5,16 @@ metadata:
description: A collection of all Backstage example components
spec:
targets:
- ./components/artist-lookup-component.yaml
- ./components/petstore-component.yaml
- ./components/playback-order-component.yaml
- ./components/podcast-api-component.yaml
- ./components/queue-proxy-component.yaml
- ./components/searcher-component.yaml
- ./components/playback-lib-component.yaml
- ./components/www-artist-component.yaml
- ./components/shuffle-api-component.yaml
- ./components/wayback-archive-component.yaml
- ./components/wayback-archive-ingestion-component.yaml
- ./components/wayback-archive-storage-component.yaml
# - ./components/artist-lookup-component.yaml
# - ./components/petstore-component.yaml
# - ./components/playback-order-component.yaml
# - ./components/podcast-api-component.yaml
# - ./components/queue-proxy-component.yaml
# - ./components/searcher-component.yaml
# - ./components/playback-lib-component.yaml
# - ./components/www-artist-component.yaml
# - ./components/shuffle-api-component.yaml
# - ./components/wayback-archive-component.yaml
# - ./components/wayback-archive-ingestion-component.yaml
# - ./components/wayback-archive-storage-component.yaml
- ./components/wayback-search-component.yaml
@@ -3,6 +3,8 @@ kind: Component
metadata:
name: wayback-search
description: Search of the wayback machine
annotations:
myorg.org/security: 'true'
spec:
type: service
lifecycle: production