renamed existing request
This commit is contained in:
parent
0912cd45d9
commit
b1fb65b1ec
8 changed files with 64 additions and 57 deletions
|
@ -8,8 +8,8 @@ const mapStateToProps = ({ show }) => {
|
||||||
status: show.displayAsset.status,
|
status: show.displayAsset.status,
|
||||||
};
|
};
|
||||||
// select asset info
|
// select asset info
|
||||||
const existingRequest = show.assetRequests[show.request.id];
|
const previousRequest = show.assetRequests[show.request.id];
|
||||||
const assetKey = `a#${existingRequest.name}#${existingRequest.claimId}`;
|
const assetKey = `a#${previousRequest.name}#${previousRequest.claimId}`;
|
||||||
const asset = show.assetList[assetKey];
|
const asset = show.assetList[assetKey];
|
||||||
if (asset) {
|
if (asset) {
|
||||||
props['asset'] = asset;
|
props['asset'] = asset;
|
||||||
|
|
|
@ -4,8 +4,8 @@ import View from './view';
|
||||||
const mapStateToProps = ({ show }) => {
|
const mapStateToProps = ({ show }) => {
|
||||||
let props = {};
|
let props = {};
|
||||||
// select title
|
// select title
|
||||||
const existingRequest = show.assetRequests[show.request.id];
|
const previousRequest = show.assetRequests[show.request.id];
|
||||||
const assetKey = `a#${existingRequest.name}#${existingRequest.claimId}`;
|
const assetKey = `a#${previousRequest.name}#${previousRequest.claimId}`;
|
||||||
const asset = show.assetList[assetKey];
|
const asset = show.assetList[assetKey];
|
||||||
if (asset) {
|
if (asset) {
|
||||||
props['title'] = asset.claimData.title;
|
props['title'] = asset.claimData.title;
|
||||||
|
|
|
@ -4,8 +4,8 @@ import View from './view';
|
||||||
const mapStateToProps = ({ show }) => {
|
const mapStateToProps = ({ show }) => {
|
||||||
let props = {};
|
let props = {};
|
||||||
// select name and claim id
|
// select name and claim id
|
||||||
const existingRequest = show.assetRequests[show.request.id];
|
const previousRequest = show.assetRequests[show.request.id];
|
||||||
const assetKey = `a#${existingRequest.name}#${existingRequest.claimId}`;
|
const assetKey = `a#${previousRequest.name}#${previousRequest.claimId}`;
|
||||||
const asset = show.assetList[assetKey];
|
const asset = show.assetList[assetKey];
|
||||||
if (asset) {
|
if (asset) {
|
||||||
props['name'] = asset.name;
|
props['name'] = asset.name;
|
||||||
|
|
|
@ -3,17 +3,16 @@ import { updateChannelClaimsAsync } from 'actions/show';
|
||||||
import View from './view';
|
import View from './view';
|
||||||
|
|
||||||
const mapStateToProps = ({ show }) => {
|
const mapStateToProps = ({ show }) => {
|
||||||
let props = {};
|
|
||||||
// select channel key
|
// select channel key
|
||||||
const request = show.channelRequests[show.request.id];
|
const request = show.channelRequests[show.request.id];
|
||||||
const channelKey = `c#${request.name}#${request.longId}`;
|
const channelKey = `c#${request.name}#${request.longId}`;
|
||||||
props['channelKey'] = channelKey;
|
|
||||||
// select channel claims
|
// select channel claims
|
||||||
const channel = show.channelList[channelKey];
|
const channel = show.channelList[channelKey] || null;
|
||||||
if (channel) {
|
// return props
|
||||||
props['channel'] = channel;
|
return {
|
||||||
|
channelKey,
|
||||||
|
channel,
|
||||||
};
|
};
|
||||||
return props;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
|
|
|
@ -3,25 +3,30 @@ import View from './view';
|
||||||
import { newAssetRequest, showNewAsset } from 'actions/show';
|
import { newAssetRequest, showNewAsset } from 'actions/show';
|
||||||
|
|
||||||
const mapStateToProps = ({ show }) => {
|
const mapStateToProps = ({ show }) => {
|
||||||
let props = {};
|
// select request info
|
||||||
props['requestType'] = show.request.type;
|
const requestType = show.request.type;
|
||||||
props['requestId'] = show.request.id;
|
const requestId = show.request.id;
|
||||||
props['requestName'] = show.request.data.name;
|
const requestName = show.request.data.name;
|
||||||
props['requestModifier'] = show.request.data.modifier;
|
const requestModifier = show.request.data.modifier;
|
||||||
props['requestExtension'] = show.request.data.extension;
|
const requestExtension = show.request.data.extension;
|
||||||
// select request
|
// select request
|
||||||
const existingRequest = show.assetRequests[show.request.id];
|
const previousRequest = show.assetRequests[show.request.id] || null;
|
||||||
if (existingRequest) {
|
// select asset infogit
|
||||||
props['existingRequest'] = existingRequest;
|
let asset;
|
||||||
// select asset info
|
if (previousRequest) {
|
||||||
const assetKey = `a#${existingRequest.name}#${existingRequest.claimId}`; // note: just store this in the request
|
const assetKey = `a#${previousRequest.name}#${previousRequest.claimId}`; // note: just store this in the request
|
||||||
const asset = show.assetList[assetKey];
|
asset = show.assetList[assetKey] || null;
|
||||||
if (asset) {
|
};
|
||||||
console.log('existing asset found', asset);
|
// return props
|
||||||
props['asset'] = asset;
|
return {
|
||||||
};
|
requestType,
|
||||||
|
requestId,
|
||||||
|
requestName,
|
||||||
|
requestModifier,
|
||||||
|
requestExtension,
|
||||||
|
previousRequest,
|
||||||
|
asset,
|
||||||
};
|
};
|
||||||
return props;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
|
|
|
@ -11,23 +11,23 @@ function requestIsAnAssetRequest ({ requestType }) {
|
||||||
|
|
||||||
class ShowAsset extends React.Component {
|
class ShowAsset extends React.Component {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { asset, existingRequest, requestId, requestName, requestModifier } = this.props;
|
const { asset, previousRequest, requestId, requestName, requestModifier } = this.props;
|
||||||
if (!existingRequest) { // case: the asset request does not exist
|
if (!previousRequest) { // case: the asset request does not exist
|
||||||
return this.props.onNewRequest(requestId, requestName, requestModifier);
|
return this.props.onNewRequest(requestId, requestName, requestModifier);
|
||||||
};
|
};
|
||||||
if (!asset) { // case: the asset request does not exist
|
if (!asset) { // case: the asset request does not exist
|
||||||
const { name, claimId } = existingRequest;
|
const { name, claimId } = previousRequest;
|
||||||
return this.props.onShowNewAsset(name, claimId);
|
return this.props.onShowNewAsset(name, claimId);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
if (requestIsAnAssetRequest(nextProps)) {
|
if (requestIsAnAssetRequest(nextProps)) {
|
||||||
const { asset, existingRequest, requestId, requestName, requestModifier } = nextProps;
|
const { asset, previousRequest, requestId, requestName, requestModifier } = nextProps;
|
||||||
if (!existingRequest) {
|
if (!previousRequest) {
|
||||||
return this.props.onNewRequest(requestId, requestName, requestModifier);
|
return this.props.onNewRequest(requestId, requestName, requestModifier);
|
||||||
};
|
};
|
||||||
if (!asset) {
|
if (!asset) {
|
||||||
const { name, claimId } = existingRequest;
|
const { name, claimId } = previousRequest;
|
||||||
return this.props.onShowNewAsset(name, claimId);
|
return this.props.onShowNewAsset(name, claimId);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,24 +4,27 @@ import { newChannelRequest, showNewChannel } from 'actions/show';
|
||||||
import View from './view';
|
import View from './view';
|
||||||
|
|
||||||
const mapStateToProps = ({ show }) => {
|
const mapStateToProps = ({ show }) => {
|
||||||
let props = {};
|
// select request info
|
||||||
props['requestId'] = show.request.id;
|
const requestId = show.request.id;
|
||||||
props['requestType'] = show.request.type;
|
const requestType = show.request.type;
|
||||||
props['requestChannelName'] = show.request.data.name;
|
const requestChannelName = show.request.data.name;
|
||||||
props['requestChannelId'] = show.request.data.id;
|
const requestChannelId = show.request.data.id;
|
||||||
// select request
|
// select request
|
||||||
const existingRequest = show.channelRequests[show.request.id];
|
const previousRequest = show.channelRequests[show.request.id] || null;
|
||||||
if (existingRequest) {
|
// select channel info
|
||||||
props['existingRequest'] = existingRequest;
|
let channel;
|
||||||
console.log('existing channel request found', existingRequest);
|
if (previousRequest) {
|
||||||
// select channel info
|
const channelKey = `c#${previousRequest.name}#${previousRequest.longId}`;
|
||||||
const channelKey = `c#${existingRequest.name}#${existingRequest.longId}`;
|
channel = show.channelList[channelKey] || null;
|
||||||
const channel = show.channelList[channelKey];
|
|
||||||
if (channel) {
|
|
||||||
props['channel'] = channel;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
return props;
|
return {
|
||||||
|
requestId,
|
||||||
|
requestType,
|
||||||
|
requestChannelName,
|
||||||
|
requestChannelId,
|
||||||
|
previousRequest,
|
||||||
|
channel,
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
|
|
|
@ -11,23 +11,23 @@ function requestIsAChannelRequest ({ requestType }) {
|
||||||
|
|
||||||
class ShowChannel extends React.Component {
|
class ShowChannel extends React.Component {
|
||||||
componentDidMount () {
|
componentDidMount () {
|
||||||
const { existingRequest, channel, requestId, requestChannelName, requestChannelId } = this.props;
|
const { previousRequest, channel, requestId, requestChannelName, requestChannelId } = this.props;
|
||||||
if (!existingRequest) {
|
if (!previousRequest) {
|
||||||
return this.props.onNewChannelRequest(requestId, requestChannelName, requestChannelId);
|
return this.props.onNewChannelRequest(requestId, requestChannelName, requestChannelId);
|
||||||
}
|
}
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
const { name, shortId, longId } = existingRequest;
|
const { name, shortId, longId } = previousRequest;
|
||||||
return this.props.onShowNewChannel(name, shortId, longId);
|
return this.props.onShowNewChannel(name, shortId, longId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
componentWillReceiveProps (nextProps) {
|
componentWillReceiveProps (nextProps) {
|
||||||
if (requestIsAChannelRequest(nextProps)) {
|
if (requestIsAChannelRequest(nextProps)) {
|
||||||
const { existingRequest, channel, requestId, requestChannelName, requestChannelId } = nextProps;
|
const { previousRequest, channel, requestId, requestChannelName, requestChannelId } = nextProps;
|
||||||
if (!existingRequest) {
|
if (!previousRequest) {
|
||||||
return this.props.onNewChannelRequest(requestId, requestChannelName, requestChannelId);
|
return this.props.onNewChannelRequest(requestId, requestChannelName, requestChannelId);
|
||||||
}
|
}
|
||||||
if (!channel) {
|
if (!channel) {
|
||||||
const { name, shortId, longId } = existingRequest;
|
const { name, shortId, longId } = previousRequest;
|
||||||
return this.props.onShowNewChannel(name, shortId, longId);
|
return this.props.onShowNewChannel(name, shortId, longId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue