remove some circular imports
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -15,29 +15,15 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { useEntity } from '@backstage/plugin-catalog-react';
|
||||
import { MissingAnnotationEmptyState } from '@backstage/core-components';
|
||||
import { Route, Routes } from 'react-router-dom';
|
||||
import { EntityNomadAllocationListTable } from './components/EntityNomadAllocationListTable/EntityNomadAllocationListTable';
|
||||
|
||||
/** @public */
|
||||
export const NOMAD_NAMESPACE_ANNOTATION = 'nomad.io/namespace';
|
||||
|
||||
/** @public */
|
||||
export const NOMAD_JOB_ID_ANNOTATION = 'nomad.io/job-id';
|
||||
|
||||
/** @public */
|
||||
export const NOMAD_GROUP_ANNOTATION = 'nomad.io/group';
|
||||
|
||||
/** @public */
|
||||
export const isNomadJobIDAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[NOMAD_JOB_ID_ANNOTATION]);
|
||||
|
||||
/** @public */
|
||||
export const isNomadAllocationsAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[NOMAD_JOB_ID_ANNOTATION]) ||
|
||||
Boolean(entity.metadata.annotations?.[NOMAD_GROUP_ANNOTATION]);
|
||||
import {
|
||||
NOMAD_GROUP_ANNOTATION,
|
||||
NOMAD_JOB_ID_ANNOTATION,
|
||||
isNomadAllocationsAvailable,
|
||||
} from './annotations';
|
||||
|
||||
export const EmbeddedRouter = () => {
|
||||
const { entity } = useEntity();
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2023 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';
|
||||
|
||||
/** @public */
|
||||
export const NOMAD_NAMESPACE_ANNOTATION = 'nomad.io/namespace';
|
||||
|
||||
/** @public */
|
||||
export const NOMAD_JOB_ID_ANNOTATION = 'nomad.io/job-id';
|
||||
|
||||
/** @public */
|
||||
export const NOMAD_GROUP_ANNOTATION = 'nomad.io/group';
|
||||
|
||||
/** @public */
|
||||
export const isNomadJobIDAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[NOMAD_JOB_ID_ANNOTATION]);
|
||||
|
||||
/** @public */
|
||||
export const isNomadAllocationsAvailable = (entity: Entity) =>
|
||||
Boolean(entity.metadata.annotations?.[NOMAD_JOB_ID_ANNOTATION]) ||
|
||||
Boolean(entity.metadata.annotations?.[NOMAD_GROUP_ANNOTATION]);
|
||||
+1
-1
@@ -35,7 +35,7 @@ import {
|
||||
NOMAD_JOB_ID_ANNOTATION,
|
||||
NOMAD_NAMESPACE_ANNOTATION,
|
||||
isNomadAllocationsAvailable,
|
||||
} from '../../Router';
|
||||
} from '../../annotations';
|
||||
import useAsync from 'react-use/lib/useAsync';
|
||||
|
||||
type rowType = Allocation & { nomadAddr: string };
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ import {
|
||||
NOMAD_JOB_ID_ANNOTATION,
|
||||
NOMAD_NAMESPACE_ANNOTATION,
|
||||
isNomadJobIDAvailable,
|
||||
} from '../../Router';
|
||||
} from '../../annotations';
|
||||
import OpenInNewIcon from '@material-ui/icons/OpenInNew';
|
||||
import { Chip } from '@material-ui/core';
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { EntityNomadJobVersionListCard } from './EntityNomadJobVersionListCard/EntityNomadJobVersionListCard';
|
||||
import { EntityNomadAllocationListTable } from './EntityNomadAllocationListTable/EntityNomadAllocationListTable';
|
||||
|
||||
export { EntityNomadJobVersionListCard, EntityNomadAllocationListTable };
|
||||
export { EntityNomadJobVersionListCard } from './EntityNomadJobVersionListCard/EntityNomadJobVersionListCard';
|
||||
export { EntityNomadAllocationListTable } from './EntityNomadAllocationListTable/EntityNomadAllocationListTable';
|
||||
|
||||
@@ -18,4 +18,7 @@ export {
|
||||
EntityNomadJobVersionListCard,
|
||||
EntityNomadAllocationListTable,
|
||||
} from './plugin';
|
||||
export { isNomadAllocationsAvailable, isNomadJobIDAvailable } from './Router';
|
||||
export {
|
||||
isNomadAllocationsAvailable,
|
||||
isNomadJobIDAvailable,
|
||||
} from './annotations';
|
||||
|
||||
Reference in New Issue
Block a user