Redirect to segments listing after segment editing
[MAILPOET-3490]
This commit is contained in:
@@ -354,6 +354,7 @@ class SegmentList extends React.Component {
|
|||||||
messages={messages}
|
messages={messages}
|
||||||
search={false}
|
search={false}
|
||||||
endpoint="segments"
|
endpoint="segments"
|
||||||
|
base_url="lists"
|
||||||
onRenderItem={this.renderItem}
|
onRenderItem={this.renderItem}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
bulk_actions={bulkActions}
|
bulk_actions={bulkActions}
|
||||||
|
@@ -1,6 +1,8 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
import { HashRouter, Switch, Route } from 'react-router-dom';
|
import {
|
||||||
|
HashRouter, Switch, Route, Redirect,
|
||||||
|
} from 'react-router-dom';
|
||||||
|
|
||||||
import MailPoet from 'mailpoet';
|
import MailPoet from 'mailpoet';
|
||||||
import RoutedTabs from 'common/tabs/routed_tabs';
|
import RoutedTabs from 'common/tabs/routed_tabs';
|
||||||
@@ -18,8 +20,12 @@ const container = document.getElementById('segments_container');
|
|||||||
const Tabs = () => (
|
const Tabs = () => (
|
||||||
<>
|
<>
|
||||||
<ListHeading />
|
<ListHeading />
|
||||||
<RoutedTabs activeKey="" routerType="switch-only">
|
<RoutedTabs activeKey="lists" routerType="switch-only">
|
||||||
<Tab key="" route="*" title={MailPoet.I18n.t('pageTitle')}>
|
<Tab
|
||||||
|
key="lists"
|
||||||
|
route="lists/(.*)?"
|
||||||
|
title={MailPoet.I18n.t('pageTitle')}
|
||||||
|
>
|
||||||
<SegmentList />
|
<SegmentList />
|
||||||
</Tab>
|
</Tab>
|
||||||
<Tab
|
<Tab
|
||||||
@@ -39,12 +45,13 @@ const App = () => (
|
|||||||
<HashRouter>
|
<HashRouter>
|
||||||
<Notices />
|
<Notices />
|
||||||
<Switch>
|
<Switch>
|
||||||
|
<Route exact path="/" render={() => <Redirect to="/lists" />} />
|
||||||
<Route path="/new" component={SegmentForm} />
|
<Route path="/new" component={SegmentForm} />
|
||||||
<Route path="/edit/:id" component={SegmentForm} />
|
<Route path="/edit/:id" component={SegmentForm} />
|
||||||
<Route path="/new-segment" component={DynamicSegmentForm} />
|
<Route path="/new-segment" component={DynamicSegmentForm} />
|
||||||
<Route path="/edit-segment/:id" component={DynamicSegmentForm} />
|
<Route path="/edit-segment/:id" component={DynamicSegmentForm} />
|
||||||
<Route path="/segments/(.*)?" component={Tabs} />
|
<Route path="/segments/(.*)?" component={Tabs} />
|
||||||
<Route path="*" component={Tabs} />
|
<Route path="/lists/(.*)?" component={Tabs} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</HashRouter>
|
</HashRouter>
|
||||||
</GlobalContext.Provider>
|
</GlobalContext.Provider>
|
||||||
|
@@ -195,6 +195,7 @@ class DynamicSegments extends APIEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function listing($data = []) {
|
public function listing($data = []) {
|
||||||
|
$data['params'] = $data['params'] ?? ['segments']; // Dummy param to apply constraints properly
|
||||||
$definition = $this->listingHandler->getListingDefinition($data);
|
$definition = $this->listingHandler->getListingDefinition($data);
|
||||||
$items = $this->dynamicSegmentsListingRepository->getData($definition);
|
$items = $this->dynamicSegmentsListingRepository->getData($definition);
|
||||||
$count = $this->dynamicSegmentsListingRepository->getCount($definition);
|
$count = $this->dynamicSegmentsListingRepository->getCount($definition);
|
||||||
|
@@ -84,6 +84,7 @@ class Segments extends APIEndpoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function listing($data = []) {
|
public function listing($data = []) {
|
||||||
|
$data['params'] = $data['params'] ?? ['lists']; // Dummy param to apply constraints properly
|
||||||
$definition = $this->listingHandler->getListingDefinition($data);
|
$definition = $this->listingHandler->getListingDefinition($data);
|
||||||
$items = $this->segmentListingRepository->getData($definition);
|
$items = $this->segmentListingRepository->getData($definition);
|
||||||
$count = $this->segmentListingRepository->getCount($definition);
|
$count = $this->segmentListingRepository->getCount($definition);
|
||||||
|
Reference in New Issue
Block a user