Skip to content

Commit

Permalink
console: Make request in admin-packet-broker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ryaplots committed Nov 23, 2023
1 parent c0ef919 commit 5883331
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
30 changes: 20 additions & 10 deletions pkg/webui/console/views/admin-packet-broker/admin-packet-broker.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,17 @@ import Notification from '@ttn-lw/components/notification'

import Message from '@ttn-lw/lib/components/message'
import GenericNotFound from '@ttn-lw/lib/components/full-view-error/not-found'
import RequireRequest from '@ttn-lw/lib/components/require-request'

import sharedMessages from '@ttn-lw/lib/shared-messages'

import { isNotEnabledError } from '@console/lib/packet-broker/utils'

import { registerPacketBroker, deregisterPacketBroker } from '@console/store/actions/packet-broker'
import {
registerPacketBroker,
deregisterPacketBroker,
getHomeNetworkDefaultGatewayVisibility,
} from '@console/store/actions/packet-broker'

import {
selectRegistered,
Expand Down Expand Up @@ -219,15 +224,20 @@ const PacketBroker = () => {
/>
</PortalledModal>
</Col>
<Col md={12} style={{ position: 'relative' }} className="mt-cs-xxl">
<Tabs tabs={tabs} active={activeTab} onTabChange={setActiveTab} divider />
<Routes>
<Route path="routing-configuration/*" Component={RoutingConfigurationView} />
<Route path="default-gateway-visibility" Component={DefaultGatewayVisibilityView} />
<Route path="/" element={<Navigate to="routing-configuration" />} />
<Route path="*" component={GenericNotFound} />
</Routes>
</Col>
<RequireRequest requestAction={getHomeNetworkDefaultGatewayVisibility()}>
<Col md={12} style={{ position: 'relative' }} className="mt-cs-xxl">
<Tabs tabs={tabs} active={activeTab} onTabChange={setActiveTab} divider />
<Routes>
<Route path="routing-configuration/*" Component={RoutingConfigurationView} />
<Route
path="default-gateway-visibility"
Component={DefaultGatewayVisibilityView}
/>
<Route path="/" element={<Navigate to="routing-configuration" />} />
<Route path="*" component={GenericNotFound} />
</Routes>
</Col>
</RequireRequest>
</>
)}
</Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,12 @@ import { useSelector, useDispatch } from 'react-redux'
import toast from '@ttn-lw/components/toast'

import Message from '@ttn-lw/lib/components/message'
import RequireRequest from '@ttn-lw/lib/components/require-request'

import GatewayVisibilityForm from '@console/components/gateway-visibility-form'

import attachPromise from '@ttn-lw/lib/store/actions/attach-promise'

import {
getHomeNetworkDefaultGatewayVisibility,
setHomeNetworkDefaultGatewayVisibility,
} from '@console/store/actions/packet-broker'
import { setHomeNetworkDefaultGatewayVisibility } from '@console/store/actions/packet-broker'

import { selectHomeNetworkDefaultGatewayVisibility } from '@console/store/selectors/packet-broker'

Expand Down Expand Up @@ -59,20 +55,18 @@ const DefaultGatewayVisibilityView = () => {
)

return (
<RequireRequest requestAction={getHomeNetworkDefaultGatewayVisibility()}>
<Col md={12}>
<Message
content={m.gatewayVisibilityInformation}
component="p"
className={style.routingPolicyInformation}
/>
<GatewayVisibilityForm
onSubmit={handleDefaultGatewayVisibilitySubmit}
initialValues={initialValues}
error={formError}
/>
</Col>
</RequireRequest>
<Col md={12}>
<Message
content={m.gatewayVisibilityInformation}
component="p"
className={style.routingPolicyInformation}
/>
<GatewayVisibilityForm
onSubmit={handleDefaultGatewayVisibilitySubmit}
initialValues={initialValues}
error={formError}
/>
</Col>
)
}

Expand Down

0 comments on commit 5883331

Please sign in to comment.