Skip to content

Commit 026005f

Browse files
committed
Merge branch 'main' into template-ref-crd
# Conflicts: # cyclops-ui/src/routes/index.tsx
2 parents 926b840 + 6e5b44d commit 026005f

File tree

18 files changed

+306
-220
lines changed

18 files changed

+306
-220
lines changed

cyclops-ctrl/internal/template/semver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func filterVersions(versions []string, constraint *semver.Constraints) ([]*semve
3939
for _, v := range versions {
4040
parsedVersion, err := semver.NewVersion(v)
4141
if err != nil {
42-
return nil, err
42+
continue
4343
}
4444

4545
if constraint.Check(parsedVersion) {

cyclops-ui/src/components/k8s-resources/ConfigMap.tsx

+10-5
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,28 @@ const ConfigMap = ({ name, namespace }: Props) => {
3030
setConfigMap(res.data);
3131
})
3232
.catch((error) => {
33-
console.log(error);
34-
if (error.response === undefined) {
33+
if (error?.response?.data) {
34+
setError({
35+
message: error.response.data.message || String(error),
36+
description:
37+
error.response.data.description ||
38+
"Check if Cyclops backend is available on: " +
39+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
40+
});
41+
} else {
3542
setError({
3643
message: String(error),
3744
description:
3845
"Check if Cyclops backend is available on: " +
3946
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
4047
});
41-
} else {
42-
setError(error.response.data);
4348
}
4449
});
4550
}
4651

4752
useEffect(() => {
4853
fetchConfigMap();
49-
const interval = setInterval(() => fetchConfigMap());
54+
const interval = setInterval(() => fetchConfigMap(), 15000);
5055
return () => {
5156
clearInterval(interval);
5257
};

cyclops-ui/src/components/k8s-resources/Deployment.tsx

+30-13
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,21 @@ const Deployment = ({ name, namespace }: Props) => {
5454
setDeployment(res.data);
5555
})
5656
.catch((error) => {
57-
console.log(error);
58-
if (error.response === undefined) {
57+
if (error?.response?.data) {
58+
setError({
59+
message: error.response.data.message || String(error),
60+
description:
61+
error.response.data.description ||
62+
"Check if Cyclops backend is available on: " +
63+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
64+
});
65+
} else {
5966
setError({
6067
message: String(error),
6168
description:
6269
"Check if Cyclops backend is available on: " +
6370
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
6471
});
65-
} else {
66-
setError(error.response.data);
6772
}
6873
});
6974
}
@@ -185,16 +190,21 @@ const Deployment = ({ name, namespace }: Props) => {
185190
}
186191
})
187192
.catch((error) => {
188-
console.log(error);
189-
if (error.response === undefined) {
193+
if (error?.response?.data) {
194+
setError({
195+
message: error.response.data.message || String(error),
196+
description:
197+
error.response.data.description ||
198+
"Check if Cyclops backend is available on: " +
199+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
200+
});
201+
} else {
190202
setError({
191203
message: String(error),
192204
description:
193205
"Check if Cyclops backend is available on: " +
194206
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
195207
});
196-
} else {
197-
setError(error.response.data);
198208
}
199209
});
200210
};
@@ -291,17 +301,24 @@ const Deployment = ({ name, namespace }: Props) => {
291301
}
292302
})
293303
.catch((error) => {
294-
console.log(error);
295-
if (error.response === undefined) {
304+
if (error?.response?.data) {
305+
setError({
306+
message:
307+
error.response.data.message || String(error),
308+
description:
309+
error.response.data.description ||
310+
"Check if Cyclops backend is available on: " +
311+
window.__RUNTIME_CONFIG__
312+
.REACT_APP_CYCLOPS_CTRL_HOST,
313+
});
314+
} else {
296315
setError({
297316
message: String(error),
298317
description:
299318
"Check if Cyclops backend is available on: " +
300319
window.__RUNTIME_CONFIG__
301320
.REACT_APP_CYCLOPS_CTRL_HOST,
302321
});
303-
} else {
304-
setError(error.response.data);
305322
}
306323
});
307324
setLogsModal({
@@ -327,7 +344,7 @@ const Deployment = ({ name, namespace }: Props) => {
327344
open={logsModal.on}
328345
onOk={handleCancelLogs}
329346
onCancel={handleCancelLogs}
330-
cancelButtonProps={{ style: { display: 'none' } }}
347+
cancelButtonProps={{ style: { display: "none" } }}
331348
width={"60%"}
332349
>
333350
<Tabs items={getTabItems()} onChange={onLogsTabsChange} />

cyclops-ui/src/components/k8s-resources/Pod.tsx

+28-13
Original file line numberDiff line numberDiff line change
@@ -77,16 +77,21 @@ const Pod = ({ name, namespace }: Props) => {
7777
setPod(res.data);
7878
})
7979
.catch((error) => {
80-
console.log(error);
81-
if (error.response === undefined) {
80+
if (error?.response?.data) {
81+
setError({
82+
message: error.response.data.message || String(error),
83+
description:
84+
error.response.data.description ||
85+
"Check if Cyclops backend is available on: " +
86+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
87+
});
88+
} else {
8289
setError({
8390
message: String(error),
8491
description:
8592
"Check if Cyclops backend is available on: " +
8693
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
8794
});
88-
} else {
89-
setError(error.response.data);
9095
}
9196
});
9297
}
@@ -206,16 +211,21 @@ const Pod = ({ name, namespace }: Props) => {
206211
}
207212
})
208213
.catch((error) => {
209-
console.log(error);
210-
if (error.response === undefined) {
214+
if (error?.response?.data) {
215+
setError({
216+
message: error.response.data.message || String(error),
217+
description:
218+
error.response.data.description ||
219+
"Check if Cyclops backend is available on: " +
220+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
221+
});
222+
} else {
211223
setError({
212224
message: String(error),
213225
description:
214226
"Check if Cyclops backend is available on: " +
215227
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
216228
});
217-
} else {
218-
setError(error.response.data);
219229
}
220230
});
221231
};
@@ -292,16 +302,21 @@ const Pod = ({ name, namespace }: Props) => {
292302
}
293303
})
294304
.catch((error) => {
295-
console.log(error);
296-
if (error.response === undefined) {
305+
if (error?.response?.data) {
306+
setError({
307+
message: error.response.data.message || String(error),
308+
description:
309+
error.response.data.description ||
310+
"Check if Cyclops backend is available on: " +
311+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
312+
});
313+
} else {
297314
setError({
298315
message: String(error),
299316
description:
300317
"Check if Cyclops backend is available on: " +
301318
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
302319
});
303-
} else {
304-
setError(error.response.data);
305320
}
306321
});
307322
setLogsModal({
@@ -321,7 +336,7 @@ const Pod = ({ name, namespace }: Props) => {
321336
open={logsModal.on}
322337
onOk={handleCancelLogs}
323338
onCancel={handleCancelLogs}
324-
cancelButtonProps={{ style: { display: 'none' } }}
339+
cancelButtonProps={{ style: { display: "none" } }}
325340
width={"60%"}
326341
>
327342
<Tabs items={getTabItems()} onChange={onLogsTabsChange} />

cyclops-ui/src/components/k8s-resources/Service.tsx

+9-4
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,21 @@ const Service = ({ name, namespace }: Props) => {
4242
setService(res.data);
4343
})
4444
.catch((error) => {
45-
console.log(error);
46-
if (error.response === undefined) {
45+
if (error?.response?.data) {
46+
setError({
47+
message: error.response.data.message || String(error),
48+
description:
49+
error.response.data.description ||
50+
"Check if Cyclops backend is available on: " +
51+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
52+
});
53+
} else {
4754
setError({
4855
message: String(error),
4956
description:
5057
"Check if Cyclops backend is available on: " +
5158
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
5259
});
53-
} else {
54-
setError(error.response.data);
5560
}
5661
});
5762
}

cyclops-ui/src/components/k8s-resources/StatefulSet.tsx

+30-13
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,21 @@ const StatefulSet = ({ name, namespace }: Props) => {
5454
setStatefulSet(res.data);
5555
})
5656
.catch((error) => {
57-
console.log(error);
58-
if (error.response === undefined) {
57+
if (error?.response?.data) {
58+
setError({
59+
message: error.response.data.message || String(error),
60+
description:
61+
error.response.data.description ||
62+
"Check if Cyclops backend is available on: " +
63+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
64+
});
65+
} else {
5966
setError({
6067
message: String(error),
6168
description:
6269
"Check if Cyclops backend is available on: " +
6370
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
6471
});
65-
} else {
66-
setError(error.response.data);
6772
}
6873
});
6974
}
@@ -185,16 +190,21 @@ const StatefulSet = ({ name, namespace }: Props) => {
185190
}
186191
})
187192
.catch((error) => {
188-
console.log(error);
189-
if (error.response === undefined) {
193+
if (error?.response?.data) {
194+
setError({
195+
message: error.response.data.message || String(error),
196+
description:
197+
error.response.data.description ||
198+
"Check if Cyclops backend is available on: " +
199+
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
200+
});
201+
} else {
190202
setError({
191203
message: String(error),
192204
description:
193205
"Check if Cyclops backend is available on: " +
194206
window.__RUNTIME_CONFIG__.REACT_APP_CYCLOPS_CTRL_HOST,
195207
});
196-
} else {
197-
setError(error.response.data);
198208
}
199209
});
200210
};
@@ -291,17 +301,24 @@ const StatefulSet = ({ name, namespace }: Props) => {
291301
}
292302
})
293303
.catch((error) => {
294-
console.log(error);
295-
if (error.response === undefined) {
304+
if (error?.response?.data) {
305+
setError({
306+
message:
307+
error.response.data.message || String(error),
308+
description:
309+
error.response.data.description ||
310+
"Check if Cyclops backend is available on: " +
311+
window.__RUNTIME_CONFIG__
312+
.REACT_APP_CYCLOPS_CTRL_HOST,
313+
});
314+
} else {
296315
setError({
297316
message: String(error),
298317
description:
299318
"Check if Cyclops backend is available on: " +
300319
window.__RUNTIME_CONFIG__
301320
.REACT_APP_CYCLOPS_CTRL_HOST,
302321
});
303-
} else {
304-
setError(error.response.data);
305322
}
306323
});
307324
setLogsModal({
@@ -327,7 +344,7 @@ const StatefulSet = ({ name, namespace }: Props) => {
327344
open={logsModal.on}
328345
onOk={handleCancelLogs}
329346
onCancel={handleCancelLogs}
330-
cancelButtonProps={{ style: { display: 'none' } }}
347+
cancelButtonProps={{ style: { display: "none" } }}
331348
width={"60%"}
332349
>
333350
<Tabs items={getTabItems()} onChange={onLogsTabsChange} />

cyclops-ui/src/components/layouts/Sidebar.tsx

+1-5
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,8 @@ const SideNav = () => {
3939
display: "inline-flex",
4040
}}
4141
>
42-
<h2 style={{ color: "white", marginTop: "5px" }}>
43-
<b>Cyclops</b>
44-
</h2>
4542
<img
46-
style={{ height: "120%", marginLeft: "6px" }}
47-
src={require("./KIKLOPcic.png")}
43+
src={require("./cyclops_logo.png")}
4844
alt="Cyclops"
4945
/>
5046
</div>
Loading

0 commit comments

Comments
 (0)