1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-28 00:17:12 +01:00

fix: update create role links and fix ts errors (#620)

* fix: update create role links and fix ts errors

* fix: update RBAC link in create and edit page
This commit is contained in:
Youssef Khedher 2022-01-21 12:18:44 +01:00 committed by GitHub
parent c06f22bd8a
commit 130319e07c
3 changed files with 12 additions and 10 deletions

View File

@ -48,7 +48,7 @@ const CreateProjectRole = () => {
confetti: true,
type: 'success',
});
} catch (e) {
} catch (e: any) {
setToastApiError(e.toString());
}
}
@ -64,7 +64,7 @@ const CreateProjectRole = () => {
};
const handleCancel = () => {
history.push('/admin/roles');
history.goBack();
};
return (
@ -72,9 +72,9 @@ const CreateProjectRole = () => {
loading={loading}
title="Create project role"
description="A project role can be
customised to limit access
to resources within a project"
documentationLink="https://docs.getunleash.io/"
customised to limit access
to resources within a project"
documentationLink="https://docs.getunleash.io/how-to/how-to-create-and-assign-custom-project-roles"
formatApiCode={formatApiCode}
>
<ProjectRoleForm

View File

@ -16,7 +16,7 @@ const EditProjectRole = () => {
const { uiConfig } = useUiConfig();
const { setToastData, setToastApiError } = useToast();
const { id } = useParams();
const { id } = useParams<{ id: string }>();
const { role } = useProjectRole(id);
const history = useHistory();
@ -68,7 +68,7 @@ const EditProjectRole = () => {
const { refetch } = useProjectRole(id);
const { editRole, loading } = useProjectRolesApi();
const handleSubmit = async e => {
const handleSubmit = async (e: Event) => {
e.preventDefault();
const payload = getProjectRolePayload();
@ -81,18 +81,19 @@ const EditProjectRole = () => {
refetch();
history.push('/admin/roles');
setToastData({
type: 'success',
title: 'Project role updated',
text: 'Your role changes will automatically be applied to the users with this role.',
confetti: true,
});
} catch (e) {
} catch (e: any) {
setToastApiError(e.toString());
}
}
};
const handleCancel = () => {
history.push('/admin/roles');
history.goBack();
};
return (
@ -102,7 +103,7 @@ const EditProjectRole = () => {
description="A project role can be
customised to limit access
to resources within a project"
documentationLink="https://docs.getunleash.io/"
documentationLink="https://docs.getunleash.io/how-to/how-to-create-and-assign-custom-project-roles"
formatApiCode={formatApiCode}
>
<ProjectRoleForm

View File

@ -33,6 +33,7 @@ interface IProjectRoleForm {
errors: { [key: string]: string };
submitButtonText: string;
clearErrors: () => void;
validateNameUniqueness?: () => void;
getRoleKey: (permission: { id: number; environment?: string }) => string;
}