@@ -21,6 +21,7 @@
|
||||
"clean": "backstage-cli clean"
|
||||
},
|
||||
"dependencies": {
|
||||
"@backstage/catalog-client": "^0.5.3",
|
||||
"@backstage/catalog-model": "^0.9.7",
|
||||
"@backstage/cli": "^0.10.5",
|
||||
"@backstage/core-components": "^0.8.3",
|
||||
|
||||
@@ -57,7 +57,10 @@ export const AddProjectDialog = ({
|
||||
setSelectedEntity(entity);
|
||||
};
|
||||
|
||||
const handleSubmit: any = async (
|
||||
const handleSubmit: (
|
||||
getValues: UseFormGetValues<FormValues>,
|
||||
reset: UseFormReset<FormValues>,
|
||||
) => Promise<void> = async (
|
||||
getValues: UseFormGetValues<FormValues>,
|
||||
reset: UseFormReset<FormValues>,
|
||||
) => {
|
||||
|
||||
@@ -76,9 +76,9 @@ export const EditProjectDialog = ({
|
||||
});
|
||||
}, [bazaarProject]);
|
||||
|
||||
const handleEditSubmit: any = async (
|
||||
const handleEditSubmit: (
|
||||
getValues: UseFormGetValues<FormValues>,
|
||||
) => {
|
||||
) => Promise<void> = async (getValues: UseFormGetValues<FormValues>) => {
|
||||
const formValues = getValues();
|
||||
|
||||
const updateResponse = await bazaarApi.updateProject({
|
||||
@@ -88,7 +88,7 @@ export const EditProjectDialog = ({
|
||||
membersCount: bazaarProject.membersCount,
|
||||
startDate: formValues?.startDate ?? null,
|
||||
endDate: formValues?.endDate ?? null,
|
||||
});
|
||||
} as BazaarProject);
|
||||
|
||||
if (updateResponse.status === 'ok') fetchBazaarProject();
|
||||
handleEditClose();
|
||||
|
||||
@@ -43,7 +43,7 @@ import {
|
||||
import { Member, BazaarProject } from '../../types';
|
||||
import { bazaarApiRef } from '../../api';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import useAsyncFn from 'react-use/lib/useAsyncFn';
|
||||
import { useAsyncFn } from 'react-use';
|
||||
import {
|
||||
catalogApiRef,
|
||||
catalogRouteRef,
|
||||
|
||||
@@ -15,13 +15,18 @@
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Controller, Control, FieldError } from 'react-hook-form';
|
||||
import {
|
||||
Controller,
|
||||
Control,
|
||||
FieldError,
|
||||
ValidationRule,
|
||||
} from 'react-hook-form';
|
||||
import { TextField } from '@material-ui/core';
|
||||
import { FormValues } from '../../types';
|
||||
|
||||
type Rules = {
|
||||
required: boolean;
|
||||
pattern?: any;
|
||||
pattern?: ValidationRule<RegExp> | undefined;
|
||||
};
|
||||
|
||||
type Props = {
|
||||
|
||||
@@ -16,12 +16,7 @@
|
||||
|
||||
import React from 'react';
|
||||
import { Button, Dialog } from '@material-ui/core';
|
||||
import {
|
||||
useForm,
|
||||
SubmitHandler,
|
||||
UseFormReset,
|
||||
UseFormGetValues,
|
||||
} from 'react-hook-form';
|
||||
import { useForm, UseFormReset, UseFormGetValues } from 'react-hook-form';
|
||||
import { InputField } from '../InputField/InputField';
|
||||
import { InputSelector } from '../InputSelector/InputSelector';
|
||||
import { FormValues } from '../../types';
|
||||
@@ -36,7 +31,7 @@ type Props = {
|
||||
handleSave: (
|
||||
getValues: UseFormGetValues<FormValues>,
|
||||
reset: UseFormReset<FormValues>,
|
||||
) => SubmitHandler<FormValues>;
|
||||
) => Promise<void>;
|
||||
isAddForm: boolean;
|
||||
title: string;
|
||||
defaultValues: FormValues;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import React, { ChangeEvent, ReactNode } from 'react';
|
||||
import { FormControl, MenuItem, Select, makeStyles } from '@material-ui/core';
|
||||
|
||||
const useStyles = makeStyles({
|
||||
@@ -27,7 +27,12 @@ const useStyles = makeStyles({
|
||||
|
||||
type Props = {
|
||||
sortMethodNbr: number;
|
||||
handleSortMethodChange: any;
|
||||
handleSortMethodChange:
|
||||
| ((
|
||||
event: ChangeEvent<{ name?: string | undefined; value: unknown }>,
|
||||
child: ReactNode,
|
||||
) => void)
|
||||
| undefined;
|
||||
};
|
||||
|
||||
export const SortMethodSelector = ({
|
||||
|
||||
@@ -141,7 +141,9 @@ export const SortView = () => {
|
||||
}
|
||||
}, [bazaarProjects, catalogEntities]);
|
||||
|
||||
const handleSortMethodChange = (event: ChangeEvent<HTMLInputElement>) => {
|
||||
const handleSortMethodChange = (
|
||||
event: ChangeEvent<{ name?: string | undefined; value: unknown }>,
|
||||
) => {
|
||||
setSortMethodNbr(
|
||||
typeof event.target.value === 'number' ? event.target.value : 0,
|
||||
);
|
||||
|
||||
@@ -19,6 +19,7 @@ import { parseMember } from './parseMethods';
|
||||
import { BazaarProject, Member } from '../types';
|
||||
import { BazaarApi } from '../api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { CatalogApi } from '@backstage/plugin-catalog-react';
|
||||
|
||||
export const fetchProjectMembers = async (
|
||||
bazaarApi: BazaarApi,
|
||||
@@ -37,7 +38,9 @@ export const fetchProjectMembers = async (
|
||||
return [];
|
||||
};
|
||||
|
||||
export const fetchCatalogItems = async (catalogApi: any): Promise<Entity[]> => {
|
||||
export const fetchCatalogItems = async (
|
||||
catalogApi: CatalogApi,
|
||||
): Promise<Entity[]> => {
|
||||
const entities = await catalogApi.getEntities({
|
||||
filter: {
|
||||
kind: ['Component', 'Resource'],
|
||||
|
||||
Reference in New Issue
Block a user