|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
import { useCurrentStateAndParams } from '@uirouter/react';
|
|
|
|
|
|
|
|
|
|
import { parseAccessControlFormData } from '@/react/portainer/access-control/utils';
|
|
|
|
|
import { useCurrentUser, useIsEdgeAdmin } from '@/react/hooks/useUser';
|
|
|
|
|
import { useCurrentUser } from '@/react/hooks/useUser';
|
|
|
|
|
import { StackType } from '@/react/common/stacks/types';
|
|
|
|
|
|
|
|
|
|
import { Platform } from '../../types';
|
|
|
|
@ -19,13 +19,12 @@ export function useInitialValues({
|
|
|
|
|
isEdge?: boolean;
|
|
|
|
|
buildMethods: Array<Method>;
|
|
|
|
|
}): FormValues | undefined {
|
|
|
|
|
const { user } = useCurrentUser();
|
|
|
|
|
const isAdminQuery = useIsEdgeAdmin();
|
|
|
|
|
const { user, isPureAdmin } = useCurrentUser();
|
|
|
|
|
|
|
|
|
|
const { appTemplateId, type = defaultType } = useAppTemplateParams();
|
|
|
|
|
|
|
|
|
|
const fileContentQuery = useFetchTemplateFile(appTemplateId);
|
|
|
|
|
if (fileContentQuery.isLoading || isAdminQuery.isLoading) {
|
|
|
|
|
if (fileContentQuery.isLoading) {
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -53,7 +52,7 @@ export function useInitialValues({
|
|
|
|
|
},
|
|
|
|
|
AccessControl: isEdge
|
|
|
|
|
? undefined
|
|
|
|
|
: parseAccessControlFormData(isAdminQuery.isAdmin, user.Id),
|
|
|
|
|
: parseAccessControlFormData(isPureAdmin, user.Id),
|
|
|
|
|
EdgeSettings: isEdge ? getDefaultEdgeTemplateSettings() : undefined,
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|