Skip to content

Commit 32d687a

Browse files
author
Timo Stark
committed
Fix: Styling Issues
- Darkmode was not rendered correctly (reported in issue #1). - No error message if new configuration file name was empty.
1 parent fa0230f commit 32d687a

File tree

6 files changed

+23
-60
lines changed

6 files changed

+23
-60
lines changed

ui/src/configurationEditor/ConfigurationEditor.tsx

+5-6
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ export function ConfigurationEditor(props: ConfigurationEditorProps) {
131131
};
132132

133133
const content = (
134-
<Box
134+
<Grid
135135
sx={{width: "100%", height: "100vh"}}
136136
style={{
137137
position: "absolute",
@@ -143,21 +143,20 @@ export function ConfigurationEditor(props: ConfigurationEditorProps) {
143143
backgroundColor: "transparent"
144144
}}
145145
>
146-
<Box
146+
<Grid
147147
style={{
148148
display: "flex",
149149
width: "75%",
150150
height: "100vh",
151-
borderLeft: "2px solid blue",
152151
flexDirection: "column",
153-
backgroundColor: "rgba(255,255,255,1)",
154152
alignItems: "flex-start"
155153
}}
154+
sx={{backgroundColor: "background.default", borderLeft: "2px solid", borderColor: "primary.dark"}}
156155
>
157156
<Close onClick={handleNewConfigurationFileSlide} sx={{cursor: 'pointer'}} />
158157
<NewConfigurationFile nginxInstance={props.nginxInstance} instanceService={instanceService}/>
159-
</Box>
160-
</Box>
158+
</Grid>
159+
</Grid>
161160
);
162161

163162
const handleExportConfigurationFile = async () => {

ui/src/configurationEditor/NewConfigurationFile.tsx

+7-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export function NewConfigurationFile(props: NewConfigurationFileProps) {
1818

1919
const saveConfigurationToFile: any = () => {
2020
const content = Base64.encode(configurationFileContent)
21+
22+
if (!fileName) {
23+
props.instanceService.displayErrorMessage(`Filename can not be empty!`);
24+
return;
25+
}
26+
2127
props.instanceService.sendConfigurationToFile(`/etc/nginx/conf.d/${fileName}`, props.nginxInstance.id, content).then((data: any) => {
2228
props.instanceService.reloadNGINX(props.nginxInstance.id).then((data: any) => {
2329
props.instanceService.displaySuccessMessage("Configuration successfully updated!");
@@ -47,7 +53,7 @@ export function NewConfigurationFile(props: NewConfigurationFileProps) {
4753
style={{minHeight: "20rem"}}
4854
/>
4955
<Box>
50-
<Button variant={"outlined"} startIcon={<PublishIcon/>}
56+
<Button variant={"contained"} startIcon={<PublishIcon/>}
5157
onClick={saveConfigurationToFile}
5258
style={{marginLeft: "0.5rem"}}>Publish</Button>
5359
</Box>

ui/src/configurationUI/ConfigurationUi.tsx

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function ConfigurationUi(props: ConfigurationUiProps) {
4343
return (
4444
<Box paddingTop={1}>
4545
<Typography variant={"h5"} paddingBottom={1}>Mounted Volumes</Typography>
46-
<TableContainer component={Paper}>
46+
<TableContainer>
4747
<Table sx={{minWidth: 650}} aria-label="simple table">
4848
<TableHead>
4949
<TableRow>
@@ -103,7 +103,7 @@ export function ConfigurationUi(props: ConfigurationUiProps) {
103103
borderLeft: "1px solid eee",
104104
boxShadow: "-3px 0px 5px rgb(0 0 0 / 20%)",
105105
flexDirection: "column",
106-
backgroundColor: "rgba(255,255,255,1)",
106+
backgroundColor: "primary.light",
107107
alignItems: "flex-start"
108108
}}
109109
>
@@ -138,7 +138,7 @@ export function ConfigurationUi(props: ConfigurationUiProps) {
138138
height: "100vh",
139139
borderLeft: "2px solid blue",
140140
flexDirection: "column",
141-
backgroundColor: "rgba(255,255,255,1)",
141+
backgroundColor: "primary.light",
142142
alignItems: "flex-start"
143143
}}
144144
>
@@ -156,11 +156,11 @@ export function ConfigurationUi(props: ConfigurationUiProps) {
156156
<Slide direction="left" in={locationSlide} mountOnEnter unmountOnExit>
157157
{contentLocation}
158158
</Slide>
159-
<TableContainer component={Paper}>
160-
<Table sx={{minWidth: 650}} aria-label="simple table">
159+
<TableContainer>
160+
<Table>
161161
<TableHead>
162162
<TableRow>
163-
<TableCell>Server
163+
<TableCell color="text.secondary">Server
164164
{/*<Tooltip title="New Virtual Server">*/}
165165
{/* <IconButton onClick={handleChangeServer} sx={{fontSize:"0.9rem"}}>*/}
166166
{/* <Add/>*/}

ui/src/instances/NginxInstances.tsx

-44
Original file line numberDiff line numberDiff line change
@@ -96,48 +96,6 @@ export function NginxInstance() {
9696
setTabValue(newValue);
9797
};
9898

99-
const Pre = styled.pre`
100-
text-align: left;
101-
margin: 1em 0;
102-
padding: 0.5em;
103-
overflow: scroll;
104-
`;
105-
106-
const Line = styled.div`
107-
display: table-row;
108-
`;
109-
110-
const LineNo = styled.span`
111-
display: table-cell;
112-
text-align: right;
113-
padding-right: 1em;
114-
user-select: none;
115-
opacity: 0.5;
116-
`;
117-
118-
const LineContent = styled.span`
119-
display: table-cell;
120-
`;
121-
122-
const listTheme = createTheme({
123-
typography: {
124-
h3: {
125-
fontSize: 30,
126-
},
127-
subtitle2: {
128-
fontSize: 13,
129-
opacity: .6,
130-
overflow: 'hidden',
131-
},
132-
body1: {
133-
fontWeight: 400,
134-
},
135-
body2: {
136-
fontWeight: 600,
137-
},
138-
},
139-
});
140-
14199
const containerNetwork: any = (port: any, key: number) => {
142100
if (port.PrivatePort && port.PublicPort) {
143101
return (
@@ -167,7 +125,6 @@ export function NginxInstance() {
167125

168126
return (
169127
<Box sx={{m: 1}}>
170-
<ThemeProvider theme={listTheme}>
171128
{!loading ? (
172129
!nginxInstance.id ? (
173130
<Box>
@@ -252,7 +209,6 @@ export function NginxInstance() {
252209
</Box>
253210
)
254211
) : (<Typography variant='h3'>Loading...</Typography>)}
255-
</ThemeProvider>
256212
</Box>
257213
);
258214
}

ui/src/main.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import CssBaseline from "@mui/material/CssBaseline";
44
import {DockerMuiThemeProvider} from "@docker/docker-mui-theme";
55

66
import {App} from './App';
7-
import {createTheme, ThemeProvider, useTheme} from "@mui/material";
7+
import {ThemeProvider, useTheme} from "@mui/material";
88

99
const CustomThemeProvider = ({ children }: any) => {
1010
const theme = useTheme();

ui/src/prism/Editor.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,15 @@ export function Editor(props: EditorProps) {
1919
props.setConfigurationFileContent(value)
2020
}
2121

22+
const placeholderText = "# ********************************************\n# NGINX Configuration Editor \n# Please write your configuration here\n# Feel free to remove this comment\n# ********************************************"
23+
2224
return (
2325
<ReactEditor
24-
value={props.fileContent}
26+
value={props.fileContent ? props.fileContent : placeholderText}
2527
className={"nginx-config-editor"}
2628
onValueChange={handleChange}
2729
highlight={
28-
configurationFileContent => highlight(props.fileContent, languages.nginx, "bash")
30+
configurationFileContent => highlight(props.fileContent ? props.fileContent : placeholderText, languages.nginx, "bash")
2931
.split("\n")
3032
.map((line, i) => `<span class='editorLineNumber' key=${i}>${i + 1}</span>${line}`)
3133
.join('\n')

0 commit comments

Comments
 (0)