Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean old code #238

Merged
merged 4 commits into from
Dec 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions scripts/staging-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,35 +20,30 @@ spec:
spec:
containers:
- env:
- name: MONITOR_BACKEND_PATH
- name: API_SERVER_BACKEND_PATH
valueFrom:
configMapKeyRef:
key: MONITOR_BACKEND_PATH
key: API_SERVER_BACKEND_PATH
name: simulator-configmap
- name: MONITOR_BACKEND_PATH_SOCKETIO
- name: API_SERVER_BACKEND_USE_LOCATION
valueFrom:
configMapKeyRef:
key: MONITOR_BACKEND_PATH_SOCKETIO
key: API_SERVER_BACKEND_USE_LOCATION
name: simulator-configmap
- name: MONITOR_BACKEND_USE_LOCATION
- name: API_SERVER_BACKEND_HOST
valueFrom:
configMapKeyRef:
key: MONITOR_BACKEND_USE_LOCATION
key: API_SERVER_BACKEND_HOST
name: simulator-configmap
- name: MONITOR_BACKEND_HOST
- name: API_SERVER_BACKEND_PORT
valueFrom:
configMapKeyRef:
key: MONITOR_BACKEND_HOST
name: simulator-configmap
- name: MONITOR_BACKEND_PORT
valueFrom:
configMapKeyRef:
key: MONITOR_BACKEND_PORT
key: API_SERVER_BACKEND_PORT
name: simulator-configmap
- name: isSecure
valueFrom:
configMapKeyRef:
key: MONITOR_BACKEND_IS_SECURE
key: API_SERVER_BACKEND_IS_SECURE
name: simulator-configmap
- name: BOARD_PATH
valueFrom:
Expand Down
10 changes: 5 additions & 5 deletions server/setupConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ const BOARD_PORT = process.env.BOARD_PORT || '3005';
const indexHtml = path.join(__dirname, '../build', 'index.html');

const monitorBackend = {
useLocation: parseBool(process.env.MONITOR_BACKEND_USE_LOCATION),
host: process.env.MONITOR_BACKEND_HOST || 'localhost',
port: process.env.MONITOR_BACKEND_PORT || '30010',
path: process.env.MONITOR_BACKEND_PATH || '',
socketIoPath: process.env.MONITOR_BACKEND_PATH_SOCKETIO || '',
useLocation: parseBool(process.env.API_SERVER_BACKEND_USE_LOCATION),
host: process.env.API_SERVER_BACKEND_HOST || 'localhost',
port: process.env.API_SERVER_BACKEND_PORT || '30010',
path: process.env.API_SERVER_BACKEND_PATH || '',
// socketIoPath: process.env.MONITOR_BACKEND_PATH_SOCKETIO || '',
schema: process.env.isSecure ? 'https://' : 'http://',
};

Expand Down
35 changes: 0 additions & 35 deletions src/Routes/Base/Header/ConnectionStatus.react.js

This file was deleted.

23 changes: 17 additions & 6 deletions src/Routes/Base/Header/HelpBar.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import { useActions, useLeftSidebar, useSiteThemeMode } from 'hooks';
import { FlexBox, Icons } from 'components/common';
import { appInfo } from 'config';
import { ReactComponent as IconSwagger } from 'images/swagger.svg';
import { iconsThemes } from '../../../styles/themes/HelperThemes';
import {
iconsThemes,
iconsThemesTitle,
} from '../../../styles/themes/HelperThemes';
import InactiveModeTag from './InactiveMode';
import Settings from './Settings/Settings.react';
import ExperimentPicker from './ExperimentPicker.react';
Expand Down Expand Up @@ -58,6 +61,7 @@ const HelpBar = () => {
<Icons.Hover
type={
<span
title={iconsThemesTitle[themeName.toUpperCase()]}
role="img"
aria-label="menu-unfold"
className="anticon anticon-menu-unfold">
Expand All @@ -68,23 +72,30 @@ const HelpBar = () => {
/>

<Popover content={<Settings />} placement="bottomRight" trigger="click">
<Icons.Hover type={<ToolOutlined />} />
<Icons.Hover type={<ToolOutlined title="Settings" />} />
</Popover>

<Icons.Hover
type={<GlobalOutlined />}
type={<GlobalOutlined title="hkube Site" />}
onClick={openUrl(appInfo.websiteUrl)}
/>

<Icons.Hover
type={<GithubOutlined />}
type={<GithubOutlined title="Github" />}
onClick={openUrl(appInfo.githubUrl)}
/>

<Icons.Hover
type={<IconSwagger />}
type={<IconSwagger title="Swagger" />}
onClick={openUrl(appInfo.swaggerUrl)}
styleIcon={{ height: '25px' }}
/>
<Icons.Hover type={<QuestionCircleOutlined />} onClick={onGuideClick} />

<Icons.Hover
type={<QuestionCircleOutlined title="Help" />}
onClick={onGuideClick}
/>

<DarkText as="span">{hkubeSystemVersion}</DarkText>
</Container>
);
Expand Down
2 changes: 1 addition & 1 deletion src/Routes/Base/Header/ViewType.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const ViewType = () => {
}, [location, isGridView, query]);

return (
<Link to={nextPath}>
<Link to={nextPath} title="Jobs Grid View">
<Icons.Hover component={isGridView ? IconListView : IconCardView} />
</Link>
);
Expand Down
9 changes: 8 additions & 1 deletion src/Routes/Base/Header/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const FilterButton = () => {
return (
!showFilterByProp && (
<FilterOutlined
title="Filter"
style={{ fontSize: '24px', color: _color }}
onClick={() => {
filterToggeledVar(!filterToggeledVar());
Expand All @@ -81,7 +82,13 @@ const Header = () => {
<Container className={USER_GUIDE.WELCOME}>
<ButtonsContainer>
<Icons.Hover
type={isCollapsed ? <MenuFoldOutlined /> : <MenuUnfoldOutlined />}
type={
isCollapsed ? (
<MenuFoldOutlined title="open menu" />
) : (
<MenuUnfoldOutlined title="collapse menu" />
)
}
onClick={toggle}
/>

Expand Down
1 change: 1 addition & 0 deletions src/Routes/SidebarRight/Bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const SidebarRight = ({ isTop, className }) => {
</Badge>
),
key: `${name}`,
title: `${name}`,
});
}
);
Expand Down
10 changes: 2 additions & 8 deletions src/Routes/Tables/DataSources/EditDrawer/Body/QueryMode.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,7 @@ const QueryMode = ({ dataSource, onDownload }) => {
}, [dispatch, dataSource, form, setPending, goTo]);

return (
<Form
form={form}
onFinish={handleSubmit}
style={{ display: 'contents' }}
initialValues={{ comment: '' }}>
<Form form={form} onFinish={handleSubmit} initialValues={{ comment: '' }}>
<FileBrowserContainer>
<FileBrowser
isReadOnly
Expand All @@ -139,9 +135,7 @@ const QueryMode = ({ dataSource, onDownload }) => {
<Row style={{ flex: 1 }}>
<FormItem
name={['query']}
rules={[{ message: 'please enter a query', required: true }]}
style={{ display: 'contents' }}
wrapperCol={{ style: { display: 'contents' } }}>
rules={[{ message: 'please enter a query', required: true }]}>
<Input.TextArea placeholder="Query" allowClear />
</FormItem>
</Row>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { useMemo } from 'react';
import { useParams } from 'react-router-dom';
// import useSnapshots from 'hooks/dataSources/useSnapshots';
import { useSnapshots } from 'hooks/graphql';
/** @param {{ dataSourceName: string }} props */
const useActiveSnapshot = ({ dataSourceName }) => {
// const { isReady, ...snapshots } = useSnapshots({ dataSourceName });
const { isReady, snapshots } = useSnapshots({ dataSourceName });
const { snapshotName } = useParams();

Expand Down
1 change: 1 addition & 0 deletions src/Routes/Tables/Jobs/GraphTab/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ const GraphTab = ({ graph, pipeline }) => {
{isValidGraph ? (
showGraph ? (
<Fallback>
{console.log(adaptedGraph, events)}
<Graph
graph={adaptedGraph}
options={graphOptions}
Expand Down
8 changes: 3 additions & 5 deletions src/Routes/Tables/Jobs/useJobsFunctions.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useDebouncedCallback } from 'use-debounce';
import { useJobs, usePolling } from 'hooks';
import { usePolling } from 'hooks';
import { useQuery, useReactiveVar, useLazyQuery } from '@apollo/client';
import {
filterToggeledVar,
Expand All @@ -16,8 +16,7 @@ import {
} from 'graphql/queries';
import moment from 'moment';
import usePath from './usePath';

export { default as jobColumns } from './jobColumns';
import jobColumns from './jobColumns';

const topTableScroll = () => {
const el = document.querySelector('.ant-table-body');
Expand All @@ -40,7 +39,6 @@ const useJobsFunctions = () => {
const [isGraphLoad, setIsGraphLoad] = useState(true);

const { goTo } = usePath();
const { columns } = useJobs();

const mergedParams = useMemo(() => {
const iJobs = instanceFilters.jobs;
Expand Down Expand Up @@ -315,7 +313,7 @@ const useJobsFunctions = () => {
isGraphLoad,
isTableLoad,
onRow,
columns,
columns: jobColumns,
_dataSource,
};
};
Expand Down
8 changes: 3 additions & 5 deletions src/Routes/Tables/Jobs/useJobsFunctionsLimit.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useDebouncedCallback } from 'use-debounce';
import { useJobs, usePolling } from 'hooks';
import { usePolling } from 'hooks';
import { useQuery, useReactiveVar } from '@apollo/client';
import {
filterToggeledVar,
Expand All @@ -12,8 +12,7 @@ import { JOB_QUERY, JOB_QUERY_GRAPH } from 'graphql/queries';

import moment from 'moment';
import usePath from './usePath';

export { default as jobColumns } from './jobColumns';
import jobColumns from './jobColumns';

const topTableScroll = () => {
const el = document.querySelector('.ant-table-body');
Expand Down Expand Up @@ -50,7 +49,6 @@ const useJobsFunctionsLimit = () => {
const [changeDs, setChangeDs] = useState(0);
const [isGetMore, setIsGetMore] = useState(true);
const { goTo } = usePath();
const { columns } = useJobs();

const mergedParams = useMemo(() => {
const iJobs = instanceFilters.jobs;
Expand Down Expand Up @@ -262,7 +260,7 @@ const useJobsFunctionsLimit = () => {
isGraphLoad,
isTableLoad,
onRow,
columns,
columns: jobColumns,
_dataSource,
setLimitGetJobs,
};
Expand Down
36 changes: 0 additions & 36 deletions src/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,42 +79,6 @@ const cache = new InMemoryCache({
return merged;
}

if (false) {
// scroll jobs
// the cursor remove was done to avoid uncorrect equality since the cursor is a unneeded field for the query
const { cursor, ...rest } = args;

if (!_.isEqual(rest, existing?.query)) {
// if is not equal then it means that the existing value is not relevant anymore
// eslint-disable-next-line
existing = { jobs: [], cursor: '' };
}

const merged = {
cursor: incoming.cursor,
query: rest,
jobs:
incoming?.jobs &&
_.unionBy(
Object.values(existing?.jobs),
Object.values(incoming?.jobs),
'key'
).sort((a, b) =>
a.pipeline.startTime > b.pipeline.startTime ? -1 : 1
),
};
merged.jobs &&
Object.values(merged.jobs).forEach((a, i) => {
if (Object.values(incoming.jobs).find(b => b.key === a.key)) {
merged.jobs[i] = Object.values(incoming.jobs).find(
b => b.key === a.key
);
}
});

return merged;
}

return incoming.jobs;
},
},
Expand Down
8 changes: 0 additions & 8 deletions src/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,16 @@ import useDataSources from './dataSources/useDataSources';
import useDataSourceVersions from './dataSources/useVersions';

export { default as useActions } from './useActions';
export { default as useAlgorithm } from './useAlgorithm';
export { default as useBoards } from './useBoards';
export { default as useConnectionStatus } from './useConnectionStatus';
export { default as useDrawer } from './useDrawer';
export { default as useDrawerEditor } from './useDrawerEditor.react';
export { default as useErrorLogs } from './useErrorLogs';
export { default as useStorage } from './useStorage';
export { default as useExperiments } from './useExperiments';
export { default as useFilters } from './useFilters';
export { default as useJobs } from './useJobs';
export { default as useLeftSidebar } from './useLeftSidebar.react';
export { default as useLocalStorage } from './useLocalStorage';
export { default as useLogs } from './useLogs';
export { default as useNodeInfo } from './useNodeInfo';
export { default as usePipeline } from './usePipeline';
export { default as useReadme } from './useReadme';
export { default as useSettings } from './useSettings';
export { default as useStats } from './useStats';
export { default as useTraceData } from './useTraceData';
export { default as useVersions } from './useVersions';
export { default as useSiteThemeMode } from './useSiteThemeMode.react';
Expand Down
22 changes: 0 additions & 22 deletions src/hooks/useAlgorithm.js

This file was deleted.

Loading