ui(editor): fix editor child styling

This commit is contained in:
Matthew Penner 2023-01-12 12:08:11 -07:00
parent 76b67cb889
commit bc7737840a
No known key found for this signature in database
8 changed files with 48 additions and 14 deletions

View file

@ -48,7 +48,7 @@ export default ({ className }: { className?: string }) => {
<h2 css={tw`mb-6 text-2xl text-neutral-100`}>Import Egg</h2>
<Editor
className="h-64 overflow-hidden rounded"
childClassName={tw`h-64 rounded`}
initialContent={''}
fetchContent={value => {
fetchFileContent = value;

View file

@ -33,7 +33,7 @@ const RowCheckbox = ({ id }: { id: number }) => {
<AdminCheckbox
name={id.toString()}
checked={isChecked}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
onChange={(e: ChangeEvent<HTMLInputElement>) => {
if (e.currentTarget.checked) {
appendSelectedNest(id);
} else {

View file

@ -49,7 +49,7 @@ export default ({ className }: { className?: string }) => {
<FlashMessageRender byKey={'egg:export'} css={tw`mb-6`} />
<Editor
className="h-[32rem] overflow-scroll rounded"
childClassName={tw`h-[32rem] rounded`}
initialContent={content ?? ''}
language={LanguageDescription.of({ name: 'json', support: json() })}
/>

View file

@ -64,7 +64,8 @@ export default function EggInstallContainer() {
<Form>
<Editor
className="mb-4 h-96 overflow-scroll"
className="mb-4"
childClassName={tw`h-96`}
initialContent={egg.scriptInstall || ''}
fetchContent={value => {
fetchFileContent = value;

View file

@ -19,7 +19,7 @@ const EggRouter = () => {
const { data: egg, error, isValidating, mutate } = useEggFromRoute();
useEffect(() => {
mutate();
void mutate();
}, []);
useEffect(() => {

View file

@ -135,7 +135,7 @@ export const EggProcessContainer = forwardRef<any, EggProcessContainerProps>(fun
<div css={tw`mb-5`}>
<Label>Startup Configuration</Label>
<Editor
className="h-32 overflow-scroll rounded"
childClassName={tw`h-32 rounded`}
initialContent={values.configStartup}
fetchContent={value => {
fetchStartupConfiguration = value;
@ -147,7 +147,7 @@ export const EggProcessContainer = forwardRef<any, EggProcessContainerProps>(fun
<div css={tw`mb-1`}>
<Label>Configuration Files</Label>
<Editor
className="h-48 overflow-scroll rounded"
childClassName={tw`h-48 rounded`}
initialContent={values.configFiles}
fetchContent={value => {
fetchFilesConfiguration = value;
@ -185,13 +185,23 @@ export default function EggSettingsContainer() {
const submit = async (values: Values, { setSubmitting }: FormikHelpers<Values>) => {
clearFlashes('egg');
values.configStartup = (await ref.current?.getStartupConfiguration()) || '';
values.configFiles = (await ref.current?.getFilesConfiguration()) || '';
values.configStartup = (await ref.current?.getStartupConfiguration()) ?? '';
values.configFiles = (await ref.current?.getFilesConfiguration()) ?? '';
const dockerImages: Record<string, string> = {};
for (const v of values.dockerImages.split('\n')) {
const parts = v.trim().split('|');
const image = parts[0] ?? '';
const alias = parts[1] ?? image;
dockerImages[alias] = image;
}
console.log(dockerImages);
updateEgg(egg.id, {
...values,
// TODO
dockerImages: {},
dockerImages,
})
.catch(error => {
console.error(error);
@ -207,8 +217,11 @@ export default function EggSettingsContainer() {
name: egg.name,
description: egg.description || '',
startup: egg.startup,
// TODO
dockerImages: egg.dockerImages.toString(),
dockerImages: Object.keys(egg.dockerImages)
.map(key => {
return `${egg.dockerImages[key]}|${key}`;
})
.join('\n'),
configStop: egg.configStop || '',
configStartup: JSON.stringify(egg.configStartup, null, '\t') || '',
configFiles: JSON.stringify(egg.configFiles, null, '\t') || '',