2018-02-01 23:29:33 +01:00
|
|
|
import * as actions from 'constants/show_action_types';
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
// basic request parsing
|
2018-02-07 20:30:39 +01:00
|
|
|
export function updateRequestError (error) {
|
|
|
|
return {
|
|
|
|
type: actions.REQUEST_ERROR_UPDATE,
|
|
|
|
data: error,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-02 20:10:58 +01:00
|
|
|
export function updateRequestWithChannelRequest (name, id) {
|
2018-02-08 05:15:44 +01:00
|
|
|
const requestId = `cr#${name}#${id}`;
|
2018-02-01 23:29:33 +01:00
|
|
|
return {
|
2018-02-07 19:52:09 +01:00
|
|
|
type: actions.REQUEST_CHANNEL_UPDATE,
|
2018-02-08 05:15:44 +01:00
|
|
|
data: { requestId, name, id },
|
2018-02-01 23:29:33 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-02 20:10:58 +01:00
|
|
|
export function updateRequestWithAssetRequest (name, id, channelName, channelId, extension) {
|
2018-02-08 05:15:44 +01:00
|
|
|
const requestId = `ar#${name}#${id}#${channelName}#${channelId}`;
|
2018-02-01 23:29:33 +01:00
|
|
|
return {
|
2018-02-07 19:52:09 +01:00
|
|
|
type: actions.REQUEST_CLAIM_UPDATE,
|
2018-02-06 20:55:46 +01:00
|
|
|
data: {
|
2018-02-08 05:15:44 +01:00
|
|
|
requestId,
|
2018-02-06 20:55:46 +01:00
|
|
|
name,
|
|
|
|
modifier: {
|
|
|
|
id,
|
|
|
|
channel: {
|
|
|
|
name: channelName,
|
|
|
|
id : channelId,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
extension,
|
|
|
|
},
|
2018-02-01 23:29:33 +01:00
|
|
|
};
|
|
|
|
};
|
2018-02-03 03:16:18 +01:00
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
// request for an asset
|
|
|
|
|
|
|
|
export function newAssetRequest (id, name, modifier) {
|
2018-02-07 19:52:09 +01:00
|
|
|
return {
|
2018-02-08 08:02:57 +01:00
|
|
|
type: actions.ASSET_REQUEST_NEW,
|
2018-02-08 03:41:22 +01:00
|
|
|
data: { id, name, modifier },
|
2018-02-07 19:52:09 +01:00
|
|
|
};
|
2018-02-07 20:30:39 +01:00
|
|
|
};
|
2018-02-07 19:52:09 +01:00
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
export function addAssetRequest (id, error, name, claimId) {
|
2018-02-03 03:16:18 +01:00
|
|
|
return {
|
2018-02-08 03:41:22 +01:00
|
|
|
type: actions.ASSET_REQUEST_ADD,
|
|
|
|
data: { id, error, name, claimId },
|
2018-02-03 03:16:18 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
// show an asset
|
|
|
|
|
|
|
|
export function showNewAsset (id, name, claimId) {
|
2018-02-03 03:16:18 +01:00
|
|
|
return {
|
2018-02-08 08:02:57 +01:00
|
|
|
type: actions.SHOW_ASSET_NEW,
|
2018-02-08 03:41:22 +01:00
|
|
|
data: { id, name, claimId },
|
2018-02-03 03:16:18 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 20:22:19 +01:00
|
|
|
export function updateShowAsset (error, name, claimId, shortId, claimData) {
|
2018-02-07 04:00:52 +01:00
|
|
|
return {
|
2018-02-08 03:41:22 +01:00
|
|
|
type: actions.SHOW_ASSET_UPDATE,
|
2018-02-08 20:22:19 +01:00
|
|
|
data: { error, name, claimId, shortId, claimData },
|
2018-02-07 04:00:52 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
export function clearShowAsset () {
|
2018-02-07 04:00:52 +01:00
|
|
|
return {
|
2018-02-08 03:41:22 +01:00
|
|
|
type: actions.SHOW_ASSET_CLEAR,
|
2018-02-07 04:00:52 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 20:22:19 +01:00
|
|
|
// add asset to asset list
|
|
|
|
|
|
|
|
export function addAssetToAssetList (id, error, name, claimId, shortId, claimData) {
|
|
|
|
return {
|
|
|
|
type: actions.ASSET_LIST_ADD,
|
|
|
|
data: { id, error, name, claimId, shortId, claimData },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
// request for a channel
|
|
|
|
|
2018-02-08 06:30:32 +01:00
|
|
|
export function newChannelRequest (id, name, channelId) {
|
2018-02-07 19:52:09 +01:00
|
|
|
return {
|
2018-02-08 19:59:49 +01:00
|
|
|
type: actions.CHANNEL_REQUEST_NEW,
|
2018-02-08 06:30:32 +01:00
|
|
|
data: {id, name, channelId},
|
2018-02-07 19:52:09 +01:00
|
|
|
};
|
|
|
|
};
|
2018-02-07 22:26:07 +01:00
|
|
|
|
2018-02-08 19:02:29 +01:00
|
|
|
export function addChannelRequest (id, error, name, longId, shortId) {
|
2018-02-07 22:26:07 +01:00
|
|
|
return {
|
2018-02-08 06:30:32 +01:00
|
|
|
type: actions.CHANNEL_REQUEST_ADD,
|
2018-02-08 19:02:29 +01:00
|
|
|
data: { id, error, name, longId, shortId },
|
2018-02-07 22:26:07 +01:00
|
|
|
};
|
2018-02-08 06:30:32 +01:00
|
|
|
}
|
2018-02-07 22:26:07 +01:00
|
|
|
|
2018-02-08 06:30:32 +01:00
|
|
|
// show a channel
|
|
|
|
|
2018-02-08 20:50:30 +01:00
|
|
|
export function showNewChannel (id, channelData) {
|
2018-02-08 19:59:49 +01:00
|
|
|
return {
|
|
|
|
type: actions.SHOW_CHANNEL_NEW,
|
2018-02-08 20:50:30 +01:00
|
|
|
data: { id, channelData },
|
2018-02-08 19:59:49 +01:00
|
|
|
};
|
2018-02-08 08:02:57 +01:00
|
|
|
};
|
|
|
|
|
2018-02-08 22:22:54 +01:00
|
|
|
export function updateShowChannel (error, name, shortId, longId, claimsData) {
|
2018-02-08 19:59:49 +01:00
|
|
|
return {
|
|
|
|
type: actions.SHOW_CHANNEL_UPDATE,
|
2018-02-08 22:22:54 +01:00
|
|
|
data: { error, name, shortId, longId, claimsData },
|
2018-02-08 20:22:19 +01:00
|
|
|
};
|
2018-02-08 08:02:57 +01:00
|
|
|
};
|
|
|
|
|
2018-02-08 07:22:17 +01:00
|
|
|
export function clearShowChannel () {
|
|
|
|
return {
|
|
|
|
type: actions.SHOW_CHANNEL_CLEAR,
|
|
|
|
};
|
|
|
|
};
|
2018-02-07 22:26:07 +01:00
|
|
|
|
2018-02-08 19:59:49 +01:00
|
|
|
// add channels to channel list
|
|
|
|
|
|
|
|
export function addNewChannelToChannelList (id, error, channelData, claimsData) {
|
|
|
|
return {
|
|
|
|
type: actions.CHANNEL_LIST_ADD,
|
|
|
|
data: { id, error, channelData, claimsData },
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
// display a file
|
2018-02-08 03:01:51 +01:00
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
export function fileRequested (name, claimId) {
|
2018-02-08 03:01:51 +01:00
|
|
|
return {
|
2018-02-08 03:41:22 +01:00
|
|
|
type: actions.FILE_REQUESTED,
|
|
|
|
data: { name, claimId },
|
2018-02-08 03:01:51 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
export function updateFileAvailability (status) {
|
2018-02-08 03:01:51 +01:00
|
|
|
return {
|
2018-02-08 03:41:22 +01:00
|
|
|
type: actions.FILE_AVAILABILITY_UPDATE,
|
|
|
|
data: status,
|
2018-02-08 03:01:51 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-08 03:41:22 +01:00
|
|
|
export function updateDisplayAssetError (error) {
|
2018-02-08 03:01:51 +01:00
|
|
|
return {
|
2018-02-08 03:41:22 +01:00
|
|
|
type: actions.DISPLAY_ASSET_ERROR,
|
|
|
|
data: error,
|
2018-02-08 03:01:51 +01:00
|
|
|
};
|
|
|
|
};
|