mirror of
https://github.com/portainer/portainer.git
synced 2025-07-20 05:49:40 +02:00
fix(namespace): create ns qa feedback [EE-2226] (#10474)
This commit is contained in:
parent
bcb3f918d1
commit
07ec2ffe5e
11 changed files with 34 additions and 43 deletions
|
@ -5,6 +5,7 @@ import { useEnvironmentId } from '@/react/hooks/useEnvironmentId';
|
|||
import { notifySuccess } from '@/portainer/services/notifications';
|
||||
import { useCurrentEnvironment } from '@/react/hooks/useCurrentEnvironment';
|
||||
import { useEnvironmentRegistries } from '@/react/portainer/environments/queries/useEnvironmentRegistries';
|
||||
import { useCurrentUser } from '@/react/hooks/useUser';
|
||||
|
||||
import { Widget, WidgetBody } from '@@/Widget';
|
||||
|
||||
|
@ -30,6 +31,7 @@ export function CreateNamespaceForm() {
|
|||
const { data: registries } = useEnvironmentRegistries(environmentId, {
|
||||
hideDefault: true,
|
||||
});
|
||||
const { user } = useCurrentUser();
|
||||
// for namespace create, show ingress classes that are allowed in the current environment.
|
||||
// the ingressClasses show the none option, so we don't need to add it here.
|
||||
const { data: ingressClasses } = useIngressControllerClassMapQuery({
|
||||
|
@ -65,7 +67,7 @@ export function CreateNamespaceForm() {
|
|||
<Formik
|
||||
enableReinitialize
|
||||
initialValues={initialValues}
|
||||
onSubmit={handleSubmit}
|
||||
onSubmit={(values) => handleSubmit(values, user.Username)}
|
||||
validateOnMount
|
||||
validationSchema={getNamespaceValidationSchema(
|
||||
memoryLimit,
|
||||
|
@ -78,9 +80,9 @@ export function CreateNamespaceForm() {
|
|||
</Widget>
|
||||
);
|
||||
|
||||
function handleSubmit(values: CreateNamespaceFormValues) {
|
||||
function handleSubmit(values: CreateNamespaceFormValues, userName: string) {
|
||||
const createNamespacePayload: CreateNamespacePayload =
|
||||
transformFormValuesToNamespacePayload(values);
|
||||
transformFormValuesToNamespacePayload(values, userName);
|
||||
const updateRegistriesPayload: UpdateRegistryPayload[] =
|
||||
values.registries.flatMap((registryFormValues) => {
|
||||
// find the matching registry from the cluster registries
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue