Skip to content

Commit

Permalink
refactor: extracted dashboard to separate package
Browse files Browse the repository at this point in the history
  • Loading branch information
manusa committed May 7, 2024
1 parent 2165ce5 commit 85ad625
Show file tree
Hide file tree
Showing 89 changed files with 182 additions and 136 deletions.
3 changes: 2 additions & 1 deletion src/main/frontend/src/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {DeploymentsCard} from './deployments';
import {EventsList} from './events';
import {NodesCard} from './nodes';
import pods from './pods';
import {DashboardPage, FilterBar} from './components';
import {FilterBar} from './components';
import {DashboardPage} from './dashboard';
import {useUiNamespace} from './redux';

const cardResponsiveClass = 'w-full sm:w-1/2 md:w-1/3';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {connect} from 'react-redux';
import {api, selectors} from './';
import {withParams} from '../router';
import {Details, byUidOrName} from '../metadata';
import {Form, Link, ResourceDetailPage} from '../components';
import {Form, Link} from '../components';
import {ResourceDetailPage} from '../dashboard';

const mapStateToProps = ({clusterRoleBindings}) => ({
clusterRoleBindings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import React from 'react';
import {withParams} from '../router';
import {name} from '../metadata';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';
import {Link, ResourceEditPage} from '../components';

export const ClusterRoleBindingsEditPage = withParams(({params: {uid}}) => (
<ResourceEditPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/
import React from 'react';
import {DashboardPage} from '../components';
import {DashboardPage} from '../dashboard';
import {List} from './';

export const ClusterRoleBindingsPage = () => (
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/clusterroles/ClusterRolesDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {withParams} from '../router';
import {Details, byUidOrName, name} from '../metadata';
import {api, selectors, RuleList} from './';
import {List as CrbList} from '../clusterrolebindings';
import {Card, Form, ResourceDetailPage} from '../components';
import {Card, Form} from '../components';
import {ResourceDetailPage} from '../dashboard';

const mapStateToProps = ({clusterRoles}) => ({
clusterRoles
Expand Down
5 changes: 3 additions & 2 deletions src/main/frontend/src/clusterroles/ClusterRolesEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
*/
import React from 'react';
import {withParams} from '../router';
import {api} from './';
import {name} from '../metadata';
import {Link, ResourceEditPage} from '../components';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';

export const ClusterRolesEditPage = withParams(({params: {uid}}) => (
<ResourceEditPage
Expand Down
2 changes: 1 addition & 1 deletion src/main/frontend/src/clusterroles/ClusterRolesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/
import React from 'react';
import {DashboardPage} from '../components';
import {DashboardPage} from '../dashboard';
import {ClusterRolesList} from './';

export const ClusterRolesPage = () => (
Expand Down
3 changes: 0 additions & 3 deletions src/main/frontend/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*
*/

export * from './editor';
export * from './popup';
export {Age} from './Age';
export {Alert} from './Alert';
Expand All @@ -28,12 +27,10 @@ export {Icon} from './Icon';
export {Link} from './Link';
export {Modal} from './Modal';
export {PopupMenu} from './PopupMenu';
export {ResourceDetailPage} from './ResourceDetailPage';
export {Spinner} from './Spinner';
export {StatusCard} from './StatusCard';
export {Switch} from './Switch';
export {Table} from './Table';
export {Tag} from './Tag';
export {Textfield} from './Textfield';
export {Tooltip} from './Tooltip';
export {DashboardPage} from './dashboard';
3 changes: 2 additions & 1 deletion src/main/frontend/src/configmaps/ConfigMapsDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ import {connect} from 'react-redux';
import {withParams} from '../router';
import {api, selectors} from './';
import {Details} from '../metadata';
import {Form, ResourceDetailPage} from '../components';
import {Form} from '../components';
import {ResourceDetailPage} from '../dashboard';

const DataField = ({label, value}) => (
<Form.Field width={Form.widths.full} label={label}>
Expand Down
5 changes: 3 additions & 2 deletions src/main/frontend/src/configmaps/ConfigMapsEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
*/
import React from 'react';
import {withParams} from '../router';
import {api} from './';
import {name} from '../metadata';
import {Link, ResourceEditPage} from '../components';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';

export const ConfigMapsEditPage = withParams(({params: {uid}}) => {
const cardTitle = resource => (
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/configmaps/ConfigMapsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*
*/
import React from 'react';
import {DashboardPage, FilterBar} from '../components';
import {FilterBar} from '../components';
import {DashboardPage} from '../dashboard';
import {useUiNamespace} from '../redux';
import {ConfigMapsList} from './';

Expand Down
10 changes: 2 additions & 8 deletions src/main/frontend/src/cronjobs/CronJobsDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,8 @@
*/
import React from 'react';
import {connect} from 'react-redux';
import {
Card,
DashboardPage,
Form,
Icon,
Link,
ResourceDetailPage
} from '../components';
import {Card, Form, Icon, Link} from '../components';
import {DashboardPage, ResourceDetailPage} from '../dashboard';
import {withParams} from '../router';
import {Details, namespace, uid} from '../metadata';
import {api, selectors} from './';
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/cronjobs/CronJobsEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import React from 'react';
import {withParams} from '../router';
import {name} from '../metadata';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';
import {Link, ResourceEditPage} from '../components';

export const CronJobsEditPage = withParams(({params: {uid}}) => (
<ResourceEditPage
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/cronjobs/CronJobsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*
*/
import React from 'react';
import {DashboardPage, FilterBar} from '../components';
import {FilterBar} from '../components';
import {DashboardPage} from '../dashboard';
import {CronJobsList} from './';
import {useUiNamespace} from '../redux';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ import {withParams} from '../router';
import {Details} from '../metadata';
import {api as crApi, CustomResourceList} from '../customresources';
import {api, selectors, DashboardPageTitle, GroupLink} from './';
import {Card, Form, Link, ResourceDetailPage} from '../components';
import {Card, Form, Link} from '../components';
import {ResourceDetailPage} from '../dashboard';

const useCustomResourceList = customResourceDefinition => {
const [customResourceList, setCustomResourceList] = useState([]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import React from 'react';
import {withParams} from '../router';
import {name} from '../metadata';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api, DashboardPageTitle} from './';
import {Link, ResourceEditPage} from '../components';

export const CustomResourceDefinitionsEditPage = withParams(
({params: {uid}}) => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
import React from 'react';
import {useLocation} from 'react-router-dom';
import {DashboardPage, Link} from '../components';
import {Link} from '../components';
import {DashboardPage} from '../dashboard';
import {CustomResourceDefinitionsList} from './';

export const CustomResourceDefinitionsPage = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
*/
import React from 'react';
import {DashboardPage} from '../components';
import {DashboardPage} from '../dashboard';
import {name} from '../metadata';
import {GroupLink} from './';

Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/customresources/List.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {crudDelete} from '../redux';
import {name, namespace, sortByCreationTimeStamp, uid} from '../metadata';
import {api, selectors} from './';
import {selectors as crdSelectors} from '../customresourcedefinitions';
import {Icon, Link, ResourceEditModal, Table} from '../components';
import {Icon, Link, Table} from '../components';
import {ResourceEditModal} from '../editor';
import ResourceList from '../components/ResourceList';

const headers = customResourceDefinition => {
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/daemonsets/DaemonSetsDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ import {Details, uid} from '../metadata';
import {ContainerList} from '../containers';
import {api, selectors} from './';
import pods from '../pods';
import {Card, Form, Icon, Link, ResourceDetailPage} from '../components';
import {Card, Form, Icon, Link} from '../components';
import {ResourceDetailPage} from '../dashboard';

const mapStateToProps = ({daemonSets}) => ({
daemonSets
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/daemonsets/DaemonSetsEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import React from 'react';
import {withParams} from '../router';
import {name} from '../metadata';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';
import {Link, ResourceEditPage} from '../components';

export const DaemonSetsEditPage = withParams(({params: {uid}}) => (
<ResourceEditPage
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/daemonsets/DaemonSetsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
import React from 'react';
import {DaemonSetsList} from './';
import {DashboardPage, FilterBar} from '../components';
import {FilterBar} from '../components';
import {DashboardPage} from '../dashboard';
import {useUiNamespace} from '../redux';

export const DaemonSetsPage = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@
*/
import React, {useState} from 'react';
import {shallowEqual, useDispatch, useSelector} from 'react-redux';
import {clearError} from '../../redux';
import * as apis from '../../apis';
import i from '../icons';
import {name as metadataName} from '../../metadata';
import {selectors as nodeSelectors} from '../../nodes';
import {Alert, Icon, Link, Tooltip} from '../';
import {NewResource, NewResourceButton, SideBar} from './';
import {clearError} from '../redux';
import * as apis from '../apis';
import i from '../components/icons';
import {name as metadataName} from '../metadata';
import {selectors as nodeSelectors} from '../nodes';
import {Alert, Icon, Link, Tooltip} from '../components';
import {NewResource} from './NewResource';
import {NewResourceButton} from './NewResourceButton';
import {SideBar} from './SideBar';

const OfflineIcon = () => (
<div className='fa-stack text-red-700' title='Watchers stopped (No network)'>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import React, {useState, useEffect} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {uiSetCreatingNewResource} from '../../redux';
import {createResource} from '../../fetch';
import {ResourceEditModal} from '../';
import {uiSetCreatingNewResource} from '../redux';
import {createResource} from '../fetch';
import {ResourceEditModal} from '../editor';

const mapStateToProps = ({ui: {creatingNewResource}}) => ({
creatingNewResource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import React from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {uiSetCreatingNewResource} from '../../redux';
import {Icon, Link} from '../';
import {uiSetCreatingNewResource} from '../redux';
import {Icon, Link} from '../components';

export const NewResourceButton = connect(undefined, dispatch =>
bindActionCreators(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import React from 'react';
import {useNavigate} from 'react-router-dom';
import YAML from 'yaml';
import {name, namespace} from '../metadata';
import {Card, DashboardPage, Icon, Link, PopupMenu} from './';
import {Card, Icon, Link, PopupMenu} from '../components';
import {DashboardPage} from './';

const downloadResource = resource => {
const mimeType = 'text/yaml';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
import React, {useRef, useLayoutEffect} from 'react';
import {connect} from 'react-redux';
import {useMatch} from 'react-router-dom';
import * as apis from '../../apis';
import i from '../../components/icons';
import {useUiSidebar} from '../../redux';
import * as crd from '../../customresourcedefinitions';
import {Icon, Link} from '../../components';
import * as apis from '../apis';
import i from '../components/icons';
import {useUiSidebar} from '../redux';
import * as crd from '../customresourcedefinitions';
import {Icon, Link} from '../components';

import './SideBar.css';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@
*
*/
export {DashboardPage} from './DashboardPage';
export {NewResource} from './NewResource';
export {NewResourceButton} from './NewResourceButton';
export {SideBar} from './SideBar';
export {ResourceDetailPage} from './ResourceDetailPage';
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ import {api, selectors} from './';
import pods from '../pods';
import {ReplicasField} from '../replicasets';
import {ReplicationControllersList} from '../replicationcontrollers';
import {Card, Form, Icon, Link, ResourceDetailPage} from '../components';
import {Card, Form, Icon, Link} from '../components';
import {ResourceDetailPage} from '../dashboard';

const mapStateToProps = ({deploymentConfigs, replicationControllers}) => ({
deploymentConfigs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import React from 'react';
import {withParams} from '../router';
import {name} from '../metadata';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';
import {Link, ResourceEditPage} from '../components';

export const DeploymentConfigsEditPage = withParams(({params: {uid}}) => (
<ResourceEditPage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/
import React from 'react';
import {DeploymentConfigsList} from './';
import {DashboardPage, FilterBar} from '../components';
import {FilterBar} from '../components';
import {DashboardPage} from '../dashboard';
import {useUiNamespace} from '../redux';

export const DeploymentConfigsPage = () => {
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/deployments/DeploymentsDetailPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {ContainerList} from '../containers';
import {api, selectors} from './';
import pods from '../pods';
import {ReplicasField, ReplicaSetsList} from '../replicasets';
import {Card, Form, Icon, Link, ResourceDetailPage} from '../components';
import {Card, Form, Icon, Link} from '../components';
import {ResourceDetailPage} from '../dashboard';

const mapStateToProps = ({deployments, replicaSets}) => ({
deployments,
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/deployments/DeploymentsEditPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
import React from 'react';
import {withParams} from '../router';
import {name} from '../metadata';
import {Link} from '../components';
import {ResourceEditPage} from '../editor';
import {api} from './';
import {Link, ResourceEditPage} from '../components';

export const DeploymentsEditPage = withParams(({params: {uid}}) => (
<ResourceEditPage
Expand Down
3 changes: 2 additions & 1 deletion src/main/frontend/src/deployments/DeploymentsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
*
*/
import React from 'react';
import {DashboardPage, FilterBar} from '../components';
import {FilterBar} from '../components';
import {DashboardPage} from '../dashboard';
import {DeploymentsCard, DeploymentsList} from './';
import {useUiNamespace} from '../redux';

Expand Down
Loading

0 comments on commit 85ad625

Please sign in to comment.