Merge branch 'main' into beta-fixes

This commit is contained in:
Digimer 2023-08-17 18:56:49 -04:00 committed by GitHub
commit 4f2e766bab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 74 additions and 36 deletions

File diff suppressed because one or more lines are too long

View File

@ -51,7 +51,7 @@ export const buildManifest = async (
const manifestUuid = sanitize(rawManifestUuid, 'string'); const manifestUuid = sanitize(rawManifestUuid, 'string');
assert( assert(
REP_UUID.test(manifestUuid), manifestUuid === 'new' || REP_UUID.test(manifestUuid),
`Manifest UUID must be a UUIDv4; got [${manifestUuid}]`, `Manifest UUID must be a UUIDv4; got [${manifestUuid}]`,
); );

View File

@ -1,5 +1,7 @@
import { RequestHandler } from 'express'; import { RequestHandler } from 'express';
import { DELETED } from '../../consts';
import { getLocalHostName, query } from '../../accessModule'; import { getLocalHostName, query } from '../../accessModule';
import { import {
getHostNameDomain, getHostNameDomain,
@ -52,6 +54,7 @@ export const getManifestTemplate: RequestHandler = async (
fence_uuid, fence_uuid,
fence_name fence_name
FROM fences FROM fences
WHERE fence_arguments != '${DELETED}'
ORDER BY fence_name ORDER BY fence_name
) AS a ) AS a
FULL JOIN ( FULL JOIN (
@ -60,6 +63,7 @@ export const getManifestTemplate: RequestHandler = async (
ups_uuid, ups_uuid,
ups_name ups_name
FROM upses FROM upses
WHERE ups_ip_address != '${DELETED}'
ORDER BY ups_name ORDER BY ups_name
) AS b ON a.row_number = b.row_number ) AS b ON a.row_number = b.row_number
FULL JOIN ( FULL JOIN (
@ -69,6 +73,7 @@ export const getManifestTemplate: RequestHandler = async (
SUBSTRING(manifest_name, '([\\d]*)$') AS INTEGER SUBSTRING(manifest_name, '([\\d]*)$') AS INTEGER
) AS last_sequence ) AS last_sequence
FROM manifests FROM manifests
WHERE manifest_note != '${DELETED}'
ORDER BY manifest_name DESC ORDER BY manifest_name DESC
LIMIT 1 LIMIT 1
) AS c ON a.row_number = c.row_number;`, ) AS c ON a.row_number = c.row_number;`,

View File

@ -1,18 +1,46 @@
import { forwardRef, useMemo } from 'react'; import { forwardRef, useMemo } from 'react';
import ConfirmDialog from './ConfirmDialog'; import ConfirmDialog from './ConfirmDialog';
import IconButton from './IconButton';
import { HeaderText } from './Text';
const FormDialog = forwardRef< const FormDialog = forwardRef<
ConfirmDialogForwardedRefContent, ConfirmDialogForwardedRefContent,
ConfirmDialogProps ConfirmDialogProps & { showClose?: boolean }
>((props, ref) => { >((props, ref) => {
const { scrollContent: isScrollContent } = props; const { scrollContent, showClose, titleText, ...restProps } = props;
const scrollBoxPaddingRight = useMemo( const scrollBoxPaddingRight = useMemo(
() => (isScrollContent ? '.5em' : undefined), () => (scrollContent ? '.5em' : undefined),
[isScrollContent], [scrollContent],
); );
const titleElement = useMemo(() => {
const title =
typeof titleText === 'string' ? (
<HeaderText>{titleText}</HeaderText>
) : (
titleText
);
return showClose ? (
<>
{title}
<IconButton
mapPreset="close"
onClick={() => {
if (ref && 'current' in ref) {
ref.current?.setOpen?.call(null, false);
}
}}
variant="redcontained"
/>
</>
) : (
title
);
}, [ref, showClose, titleText]);
return ( return (
<ConfirmDialog <ConfirmDialog
dialogProps={{ dialogProps={{
@ -23,12 +51,18 @@ const FormDialog = forwardRef<
paddingRight: scrollBoxPaddingRight, paddingRight: scrollBoxPaddingRight,
paddingTop: '.3em', paddingTop: '.3em',
}} }}
{...props} scrollContent={scrollContent}
titleText={titleElement}
{...restProps}
ref={ref} ref={ref}
/> />
); );
}); });
FormDialog.defaultProps = {
showClose: false,
};
FormDialog.displayName = 'FormDialog'; FormDialog.displayName = 'FormDialog';
export default FormDialog; export default FormDialog;

View File

@ -421,6 +421,7 @@ const ManageFencePanel: FC = () => {
preActionArea={messageArea} preActionArea={messageArea}
ref={formDialogRef} ref={formDialogRef}
scrollContent scrollContent
showClose
/> />
<ConfirmDialog <ConfirmDialog
closeOnProceed closeOnProceed

View File

@ -26,6 +26,7 @@ import ConfirmDialog from '../ConfirmDialog';
import EditManifestInputGroup from './EditManifestInputGroup'; import EditManifestInputGroup from './EditManifestInputGroup';
import FlexBox from '../FlexBox'; import FlexBox from '../FlexBox';
import FormDialog from '../FormDialog'; import FormDialog from '../FormDialog';
import FormSummary from '../FormSummary';
import handleAPIError from '../../lib/handleAPIError'; import handleAPIError from '../../lib/handleAPIError';
import IconButton from '../IconButton'; import IconButton from '../IconButton';
import List from '../List'; import List from '../List';
@ -282,7 +283,7 @@ const ManageManifestPanel: FC = () => {
setConfirmDialogProps({ setConfirmDialogProps({
actionProceedText: 'Add', actionProceedText: 'Add',
content: <></>, content: <FormSummary entries={body} />,
onProceedAppend: () => { onProceedAppend: () => {
submitForm({ submitForm({
body, body,
@ -329,7 +330,7 @@ const ManageManifestPanel: FC = () => {
setConfirmDialogProps({ setConfirmDialogProps({
actionProceedText: 'Edit', actionProceedText: 'Edit',
content: <></>, content: <FormSummary entries={body} />,
onProceedAppend: () => { onProceedAppend: () => {
submitForm({ submitForm({
body, body,
@ -380,7 +381,7 @@ const ManageManifestPanel: FC = () => {
setConfirmDialogProps({ setConfirmDialogProps({
actionProceedText: 'Run', actionProceedText: 'Run',
content: <></>, content: <FormSummary entries={body} hasPassword />,
onProceedAppend: () => { onProceedAppend: () => {
submitForm({ submitForm({
body, body,
@ -590,6 +591,7 @@ const ManageManifestPanel: FC = () => {
preActionArea={messageArea} preActionArea={messageArea}
ref={addManifestFormDialogRef} ref={addManifestFormDialogRef}
scrollContent scrollContent
showClose
/> />
<FormDialog <FormDialog
{...editManifestFormDialogProps} {...editManifestFormDialogProps}
@ -598,6 +600,7 @@ const ManageManifestPanel: FC = () => {
preActionArea={messageArea} preActionArea={messageArea}
ref={editManifestFormDialogRef} ref={editManifestFormDialogRef}
scrollContent scrollContent
showClose
/> />
<FormDialog <FormDialog
{...runManifestFormDialogProps} {...runManifestFormDialogProps}
@ -606,11 +609,13 @@ const ManageManifestPanel: FC = () => {
preActionArea={messageArea} preActionArea={messageArea}
ref={runManifestFormDialogRef} ref={runManifestFormDialogRef}
scrollContent scrollContent
showClose
/> />
<ConfirmDialog <ConfirmDialog
closeOnProceed closeOnProceed
{...confirmDialogProps} {...confirmDialogProps}
ref={confirmDialogRef} ref={confirmDialogRef}
scrollContent
/> />
</> </>
); );

View File

@ -365,6 +365,7 @@ const ManageUpsPanel: FC = () => {
loadingAction={isFormSubmitting} loadingAction={isFormSubmitting}
preActionArea={messageArea} preActionArea={messageArea}
ref={formDialogRef} ref={formDialogRef}
showClose
/> />
<ConfirmDialog <ConfirmDialog
closeOnProceed closeOnProceed

View File

@ -52,7 +52,6 @@ import { InnerPanel, InnerPanelHeader } from './Panels';
import periodicFetch from '../lib/fetchers/periodicFetch'; import periodicFetch from '../lib/fetchers/periodicFetch';
import SelectWithLabel from './SelectWithLabel'; import SelectWithLabel from './SelectWithLabel';
import Spinner from './Spinner'; import Spinner from './Spinner';
import sumstring from '../lib/sumstring';
import { createTestInputFunction, testNotBlank } from '../lib/test_input'; import { createTestInputFunction, testNotBlank } from '../lib/test_input';
import { BodyText, MonoText, SmallText } from './Text'; import { BodyText, MonoText, SmallText } from './Text';
@ -238,7 +237,6 @@ const createNetworkInterfaceTableColumns = (
<SmallText text={value} /> <SmallText text={value} />
</MUIBox> </MUIBox>
), ),
sortComparator: (v1, v2) => sumstring(v1) - sumstring(v2),
}, },
{ {
field: 'networkInterfaceMACAddress', field: 'networkInterfaceMACAddress',
@ -1514,6 +1512,11 @@ const NetworkInitForm = forwardRef<
}} }}
getRowId={({ networkInterfaceUUID }) => networkInterfaceUUID} getRowId={({ networkInterfaceUUID }) => networkInterfaceUUID}
hideFooter hideFooter
initialState={{
sorting: {
sortModel: [{ field: 'networkInterfaceName', sort: 'asc' }],
},
}}
rows={networkInterfaces} rows={networkInterfaces}
sx={{ sx={{
color: GREY, color: GREY,

View File

@ -1,11 +0,0 @@
const sumstring = (value: string): number => {
let sum = 0;
for (let index = 0; index < value.length; index += 1) {
sum += value.codePointAt(index) || 0;
}
return sum;
};
export default sumstring;

View File

@ -1 +0,0 @@
self.__BUILD_MANIFEST=function(s,c,a,e,t,n,i,d,f,b,u,k,h,j,r,g){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,a,e,i,d,k,"static/chunks/717-8bd60b96d67fd464.js",c,t,n,f,h,j,"static/chunks/pages/index-7c2cb48473145987.js"],"/_error":["static/chunks/pages/_error-2280fa386d040b66.js"],"/anvil":[s,a,e,i,d,k,c,t,n,f,h,"static/chunks/pages/anvil-c0917177269e4c45.js"],"/config":[s,a,e,b,c,t,n,u,"static/chunks/pages/config-af002475ca739544.js"],"/file-manager":[s,a,e,i,"static/chunks/768-9ee3dcb62beecb53.js",c,t,"static/chunks/pages/file-manager-1a707639a4834587.js"],"/init":[s,a,i,d,b,r,c,t,n,f,g,"static/chunks/pages/init-7428606d331bc1dd.js"],"/login":[s,a,e,c,t,n,u,"static/chunks/pages/login-b5de0cd2f49998d6.js"],"/manage-element":[s,a,e,i,d,b,r,"static/chunks/195-d5fd184cc249f755.js",c,t,n,f,u,g,"static/chunks/pages/manage-element-3b79eff498885bcb.js"],"/server":[s,e,"static/chunks/227-a3756585a7ef09ae.js",c,j,"static/chunks/pages/server-db52258419acacf3.js"],sortedPages:["/","/_app","/_error","/anvil","/config","/file-manager","/init","/login","/manage-element","/server"]}}("static/chunks/382-f51344f6f9208507.js","static/chunks/62-532ed713980da8db.js","static/chunks/483-f8013e38dca1620d.js","static/chunks/894-e57948de523bcf96.js","static/chunks/780-e8b3396d257460a4.js","static/chunks/899-ec535b0f0a173e21.js","static/chunks/182-08683bbe95fbb010.js","static/chunks/614-0ce04fd295045ffe.js","static/chunks/140-ec935fb15330b98a.js","static/chunks/644-c7c6e21c71345aed.js","static/chunks/903-dc2a40be612a10c3.js","static/chunks/485-77798bccc4308d0e.js","static/chunks/825-f20d177b43a24683.js","static/chunks/94-e103c3735f0e061b.js","static/chunks/676-6159ce853338cc1f.js","static/chunks/692-e32ff331a198ffb5.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

View File

@ -0,0 +1 @@
self.__BUILD_MANIFEST=function(s,a,c,e,t,n,i,f,d,u,b,k,h,j,r,g){return{__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/":[s,c,e,i,f,k,"static/chunks/717-8bd60b96d67fd464.js",a,t,n,d,h,j,"static/chunks/pages/index-7c2cb48473145987.js"],"/_error":["static/chunks/pages/_error-2280fa386d040b66.js"],"/anvil":[s,c,e,i,f,k,a,t,n,d,h,"static/chunks/pages/anvil-c0917177269e4c45.js"],"/config":[s,c,e,u,a,t,n,b,"static/chunks/pages/config-cb5dcd774a7f13bc.js"],"/file-manager":[s,c,e,i,"static/chunks/768-9ee3dcb62beecb53.js",a,t,"static/chunks/pages/file-manager-1a707639a4834587.js"],"/init":[s,c,i,f,u,r,a,t,n,d,g,"static/chunks/pages/init-124696b2707615f8.js"],"/login":[s,c,e,a,t,n,b,"static/chunks/pages/login-b5de0cd2f49998d6.js"],"/manage-element":[s,c,e,i,f,u,r,"static/chunks/195-d5fd184cc249f755.js",a,t,n,d,b,g,"static/chunks/pages/manage-element-2cd039af77a29c90.js"],"/server":[s,e,"static/chunks/227-a3756585a7ef09ae.js",a,j,"static/chunks/pages/server-db52258419acacf3.js"],sortedPages:["/","/_app","/_error","/anvil","/config","/file-manager","/init","/login","/manage-element","/server"]}}("static/chunks/382-f51344f6f9208507.js","static/chunks/62-532ed713980da8db.js","static/chunks/483-f8013e38dca1620d.js","static/chunks/894-e57948de523bcf96.js","static/chunks/780-e8b3396d257460a4.js","static/chunks/899-ec535b0f0a173e21.js","static/chunks/182-08683bbe95fbb010.js","static/chunks/614-0ce04fd295045ffe.js","static/chunks/140-ec935fb15330b98a.js","static/chunks/644-c7c6e21c71345aed.js","static/chunks/903-dc2a40be612a10c3.js","static/chunks/485-77798bccc4308d0e.js","static/chunks/825-f20d177b43a24683.js","static/chunks/94-e103c3735f0e061b.js","static/chunks/676-6159ce853338cc1f.js","static/chunks/86-a6f7430ac8a027ff.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long