Remove Switch component

This commit is contained in:
Marliana Lara
2020-02-11 13:55:35 -05:00
parent ef3ab29649
commit 446021cf22
8 changed files with 8 additions and 20 deletions

View File

@@ -164,7 +164,7 @@ class NotificationList extends Component {
} }
this.setState(stateUpdateFunction); this.setState(stateUpdateFunction);
} catch (err) { } catch (err) {
this.setState({ toggleError: true }); this.setState({ toggleError: err });
} finally { } finally {
this.setState({ toggleLoading: false }); this.setState({ toggleLoading: false });
} }

View File

@@ -8,8 +8,8 @@ import {
DataListItemRow, DataListItemRow,
DataListItemCells, DataListItemCells,
DataListCell as PFDataListCell, DataListCell as PFDataListCell,
Switch,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import Switch from '@components/Switch';
import styled from 'styled-components'; import styled from 'styled-components';

View File

@@ -1,10 +0,0 @@
import { Switch } from '@patternfly/react-core';
import styled from 'styled-components';
Switch.displayName = 'PFSwitch';
export default styled(Switch)`
display: flex;
flex-wrap: no-wrap;
/* workaround PF bug; used in calculating switch width: */
--pf-c-switch__toggle-icon--Offset: 0.125rem;
`;

View File

@@ -1 +0,0 @@
export { default } from './Switch';

View File

@@ -3,7 +3,7 @@ import { Link, useHistory, useParams, useLocation } from 'react-router-dom';
import { withI18n } from '@lingui/react'; import { withI18n } from '@lingui/react';
import { t } from '@lingui/macro'; import { t } from '@lingui/macro';
import { Host } from '@types'; import { Host } from '@types';
import { Button } from '@patternfly/react-core'; import { Button, Switch } from '@patternfly/react-core';
import { CardBody, CardActionsRow } from '@components/Card'; import { CardBody, CardActionsRow } from '@components/Card';
import AlertModal from '@components/AlertModal'; import AlertModal from '@components/AlertModal';
import ErrorDetail from '@components/ErrorDetail'; import ErrorDetail from '@components/ErrorDetail';
@@ -11,7 +11,6 @@ import { DetailList, Detail, UserDateDetail } from '@components/DetailList';
import { VariablesDetail } from '@components/CodeMirrorInput'; import { VariablesDetail } from '@components/CodeMirrorInput';
import { Sparkline } from '@components/Sparkline'; import { Sparkline } from '@components/Sparkline';
import DeleteButton from '@components/DeleteButton'; import DeleteButton from '@components/DeleteButton';
import Switch from '@components/Switch';
import { HostsAPI } from '@api'; import { HostsAPI } from '@api';
function HostDetail({ host, i18n, onUpdateHost }) { function HostDetail({ host, i18n, onUpdateHost }) {

View File

@@ -34,7 +34,7 @@ class HostsList extends Component {
selected: [], selected: [],
itemCount: 0, itemCount: 0,
actions: null, actions: null,
toggleError: false, toggleError: null,
toggleLoading: null, toggleLoading: null,
}; };
@@ -83,7 +83,7 @@ class HostsList extends Component {
} }
handleHostToggleErrorClose() { handleHostToggleErrorClose() {
this.setState({ toggleError: false }); this.setState({ toggleError: null });
} }
async handleHostDelete() { async handleHostDelete() {
@@ -112,7 +112,7 @@ class HostsList extends Component {
), ),
}); });
} catch (err) { } catch (err) {
this.setState({ toggleError: true }); this.setState({ toggleError: err });
} finally { } finally {
this.setState({ toggleLoading: null }); this.setState({ toggleLoading: null });
} }

View File

@@ -6,6 +6,7 @@ import {
DataListItem, DataListItem,
DataListItemRow, DataListItemRow,
DataListItemCells, DataListItemCells,
Switch,
Tooltip, Tooltip,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
@@ -16,7 +17,6 @@ import DataListCell from '@components/DataListCell';
import DataListCheck from '@components/DataListCheck'; import DataListCheck from '@components/DataListCheck';
import ListActionButton from '@components/ListActionButton'; import ListActionButton from '@components/ListActionButton';
import { Sparkline } from '@components/Sparkline'; import { Sparkline } from '@components/Sparkline';
import Switch from '@components/Switch';
import VerticalSeparator from '@components/VerticalSeparator'; import VerticalSeparator from '@components/VerticalSeparator';
import { Host } from '@types'; import { Host } from '@types';

View File

@@ -6,6 +6,7 @@ import {
DataListItem, DataListItem,
DataListItemRow, DataListItemRow,
DataListItemCells, DataListItemCells,
Switch,
Tooltip, Tooltip,
} from '@patternfly/react-core'; } from '@patternfly/react-core';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
@@ -16,7 +17,6 @@ import DataListCell from '@components/DataListCell';
import DataListCheck from '@components/DataListCheck'; import DataListCheck from '@components/DataListCheck';
import ListActionButton from '@components/ListActionButton'; import ListActionButton from '@components/ListActionButton';
import { Sparkline } from '@components/Sparkline'; import { Sparkline } from '@components/Sparkline';
import Switch from '@components/Switch';
import VerticalSeparator from '@components/VerticalSeparator'; import VerticalSeparator from '@components/VerticalSeparator';
import { Host } from '@types'; import { Host } from '@types';