Skip to content

Commit 78366b0

Browse files
committed
cleaned up code
1 parent 1173e9a commit 78366b0

File tree

9 files changed

+6
-175
lines changed

9 files changed

+6
-175
lines changed

src/components/Images/Images.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ import globalStyles from '../global.module.scss';
1212
* @description | Provides ability to pull images from DockerHub image repository, run images, and remove images
1313
**/
1414

15+
// eslint-disable-next-line react/prop-types
1516
const Images = ({ imagesList: initialImagesList }): JSX.Element => {
16-
// const imagesList = useAppSelector((state) => state.images.imagesList);
17+
// imagesList for testing purposes only
1718
const reduxImagesList = useAppSelector((state) => state.images.imagesList);
1819
const imagesList = initialImagesList ? [initialImagesList] : reduxImagesList;
1920
const [repo, setRepo] = useState('');

src/components/Metrics/Metrics.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import useHelper from '../../helpers/commands';
44

55
const Metrics = (): JSX.Element => {
66
const { getKey, getUid } = useHelper();
7-
const [kubernetesOrNah, setFrame] = useState(1);
7+
const [toggleKubernetes, setToggleKubernetes] = useState(1);
88
const [apiKey, setApiKey] = useState('');
99
const [uidKey, setUidKey] = useState('');
1010
const [currentPage, setCurrentPage] = useState('Node Exporter / Nodes');
11-
const button = kubernetesOrNah === 1 ? 'Containers' : 'Kubernetes Cluster';
11+
const button = toggleKubernetes === 1 ? 'Containers' : 'Kubernetes Cluster';
1212

1313
useEffect(() => {
1414
/**
@@ -31,7 +31,7 @@ const Metrics = (): JSX.Element => {
3131
}, []);
3232

3333
const handleToggle = () => {
34-
setFrame((prevFrame) => (prevFrame === 1 ? 2 : 1));
34+
setToggleKubernetes((prevFrame) => (prevFrame === 1 ? 2 : 1));
3535
};
3636

3737
/**
@@ -57,7 +57,7 @@ const Metrics = (): JSX.Element => {
5757
<>{button}</>
5858
<label className={styles.toggle} htmlFor="switch" />
5959

60-
{kubernetesOrNah === 1 ? (
60+
{toggleKubernetes === 1 ? (
6161
<div>
6262
<iframe
6363
className={styles.metrics}

src/helpers/dispatch.tsx

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ import {
1515
refreshStoppedContainer,
1616
} from '../reducers/containerReducer';
1717

18-
import {
19-
buildAxis,
20-
buildMemory,
21-
buildCpu,
22-
buildWrittenIO,
23-
buildReadIO,
24-
buildReceivedIO,
25-
buildTransmittedIO,
26-
} from '../reducers/graphReducer';
27-
2818
import { refreshImages } from '../reducers/imageReducer';
2919

3020
import { getLogs } from '../reducers/logReducer';
@@ -108,28 +98,6 @@ const useSurvey = () => {
10898
composeDown(data: any) {
10999
dispatch(composeDown(data));
110100
},
111-
// Dispatch functions used in LineChartDisplay.tsx
112-
buildAxis(data: any) {
113-
dispatch(buildAxis(data));
114-
},
115-
buildMemory(data: any) {
116-
dispatch(buildMemory(data));
117-
},
118-
buildCpu(data: any) {
119-
dispatch(buildCpu(data));
120-
},
121-
buildWrittenIO(data: any) {
122-
dispatch(buildWrittenIO(data));
123-
},
124-
buildReadIO(data: any) {
125-
dispatch(buildReadIO(data));
126-
},
127-
buildReceivedIO(data: any) {
128-
dispatch(buildReceivedIO(data));
129-
},
130-
buildTransmittedIO(data: any) {
131-
dispatch(buildTransmittedIO(data));
132-
},
133101
// Dispatch functions used in ProcessLogsTable.tsx
134102
getContainerLogsDispatcher(data: ContainerLogsType) {
135103
dispatch(getLogs(data));

src/reducers/alertReducer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const alertSlice = createSlice({
4242

4343
export const { setAlert, setPrompt } = alertSlice.actions;
4444

45-
// let timeoutId = null;
4645
let timeoutId: ReturnType<typeof setTimeout> | null = null;
4746

4847
export const createAlert = (

src/reducers/composeReducer.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { PayloadAction, createSlice } from '@reduxjs/toolkit';
22
import { ContainerStateType } from '../../types';
33

44
const initialState: ContainerStateType = {
5-
// ? why is runningList & stoppedList here
65
runningList: [],
76
stoppedList: [],
87
networkList: [],
@@ -20,10 +19,8 @@ export const composeSlice = createSlice({
2019
const currentState: any = state.composeStack;
2120

2221
const composeStackUpdater = (
23-
// ? are the two forEaches redundant?
2422
// current state is first array
2523
firstArray: [],
26-
// action payload is second array (new stack?)
2724
secondArray: [],
2825
outputArray = []
2926
) => {

src/reducers/graphReducer.ts

Lines changed: 0 additions & 123 deletions
This file was deleted.

src/reducers/sessionReducer.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,11 @@ const initialState: SessionStateType = {
1010
_id: '',
1111
username: '',
1212
password: '',
13-
email: '',
14-
phone: '',
15-
role: '',
16-
contact_pref: '',
1713
mem_threshold: '',
1814
cpu_threshold: '',
1915
container_stops: '',
2016
token: '',
2117
isLoggedIn: false,
22-
// userList: [],
2318
};
2419

2520
export const sessionSlice = createSlice({

src/store.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { configureStore } from '@reduxjs/toolkit';
22
import alertReducer from './reducers/alertReducer';
33
import composeReducer from './reducers/composeReducer';
44
import containerReducer from './reducers/containerReducer';
5-
import graphReducer from './reducers/graphReducer';
65
import imageReducer from './reducers/imageReducer';
76
import logReducer from './reducers/logReducer';
87
import userReducer from './reducers/userReducer';
@@ -13,7 +12,6 @@ const store = configureStore({
1312
reducer: {
1413
containers: containerReducer,
1514
images: imageReducer,
16-
graphs: graphReducer,
1715
composes: composeReducer,
1816
sessions: sessionReducer,
1917
volumes: volumeReducer,

types.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ export interface UserInfo extends User {
2424
// removed password property on userInfo as it's not being used.
2525
// changed id from number type to string type so see if that breaks anything
2626
_id: string;
27-
email: string;
28-
phone: string;
29-
role: string;
30-
contact_pref: string;
3127
// changed memthreshold from string to string to align with sessionState in sessions reducer. see if it broke something
3228
mem_threshold: string;
3329
// changed cpu threshold from string to string let's see what happens

0 commit comments

Comments
 (0)