Updated types

This commit is contained in:
Sebastian Qvarfordt
2020-06-02 15:45:38 +02:00
parent 254d9089be
commit d620646890
4 changed files with 10 additions and 5 deletions
+2 -1
View File
@@ -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]);
+3 -1
View File
@@ -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;
};
+2 -2
View File
@@ -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 ?? '',