Updated types
This commit is contained in:
@@ -57,6 +57,7 @@ export class CatalogClient implements CatalogApi {
|
||||
const location = await response.json();
|
||||
if (location) return location.data;
|
||||
}
|
||||
throw new Error(`'Location not found: ${locationId}`);
|
||||
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,9 @@ const CatalogPage: FC<{}> = () => {
|
||||
};
|
||||
|
||||
if (value) {
|
||||
getLocationDataForEntities(value).then(setLocations);
|
||||
getLocationDataForEntities(value)
|
||||
.then(location => location.filter(l => !!l))
|
||||
.then(setLocations);
|
||||
}
|
||||
}, [value, catalogApi]);
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Location } from '@backstage/catalog-model';
|
||||
|
||||
export type Component = {
|
||||
name: string;
|
||||
kind: string;
|
||||
description: string;
|
||||
location?: any;
|
||||
location?: Location;
|
||||
};
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Component } from './component';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { Entity, Location } from '@backstage/catalog-model';
|
||||
|
||||
export function envelopeToComponent(
|
||||
envelope: Entity,
|
||||
location?: any,
|
||||
location?: Location,
|
||||
): Component {
|
||||
return {
|
||||
name: envelope.metadata?.name ?? '',
|
||||
|
||||
Reference in New Issue
Block a user