2018-02-01 14:29:33 -08:00
|
|
|
import * as actions from 'constants/show_action_types';
|
|
|
|
|
2018-02-14 11:39:24 -08:00
|
|
|
import { CHANNEL, ASSET_LITE, ASSET_DETAILS } from 'constants/show_request_types';
|
|
|
|
|
2018-02-07 18:41:22 -08:00
|
|
|
// basic request parsing
|
2018-02-22 15:43:26 -08:00
|
|
|
export function onHandleShowPageUri (params) {
|
2018-02-14 17:26:11 -08:00
|
|
|
return {
|
|
|
|
type: actions.HANDLE_SHOW_URI,
|
|
|
|
data: params,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-14 09:19:22 -08:00
|
|
|
export function onRequestError (error) {
|
2018-02-07 11:30:39 -08:00
|
|
|
return {
|
2018-02-22 15:43:26 -08:00
|
|
|
type: actions.REQUEST_ERROR,
|
2018-02-07 11:30:39 -08:00
|
|
|
data: error,
|
|
|
|
};
|
2018-02-14 17:26:11 -08:00
|
|
|
};
|
2018-02-07 11:30:39 -08:00
|
|
|
|
2018-02-14 11:39:24 -08:00
|
|
|
export function onNewChannelRequest (channelName, channelId) {
|
|
|
|
const requestType = CHANNEL;
|
|
|
|
const requestId = `cr#${channelName}#${channelId}`;
|
2018-02-01 14:29:33 -08:00
|
|
|
return {
|
2018-02-14 11:39:24 -08:00
|
|
|
type: actions.CHANNEL_REQUEST_NEW,
|
|
|
|
data: { requestType, requestId, channelName, channelId },
|
2018-02-01 14:29:33 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-14 11:39:24 -08:00
|
|
|
export function onNewAssetRequest (name, id, channelName, channelId, extension) {
|
|
|
|
const requestType = extension ? ASSET_LITE : ASSET_DETAILS;
|
2018-02-07 20:15:44 -08:00
|
|
|
const requestId = `ar#${name}#${id}#${channelName}#${channelId}`;
|
2018-02-01 14:29:33 -08:00
|
|
|
return {
|
2018-02-14 11:39:24 -08:00
|
|
|
type: actions.ASSET_REQUEST_NEW,
|
2018-02-06 11:55:46 -08:00
|
|
|
data: {
|
2018-02-14 11:39:24 -08:00
|
|
|
requestType,
|
2018-02-07 20:15:44 -08:00
|
|
|
requestId,
|
2018-02-06 11:55:46 -08:00
|
|
|
name,
|
|
|
|
modifier: {
|
|
|
|
id,
|
|
|
|
channel: {
|
|
|
|
name: channelName,
|
|
|
|
id : channelId,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2018-02-01 14:29:33 -08:00
|
|
|
};
|
|
|
|
};
|
2018-02-02 18:16:18 -08:00
|
|
|
|
2018-02-22 15:43:26 -08:00
|
|
|
export function onRequestUpdate (requestType, requestId) {
|
|
|
|
return {
|
|
|
|
type: actions.REQUEST_UPDATE,
|
|
|
|
data: {
|
|
|
|
requestType,
|
|
|
|
requestId,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-14 12:19:43 -08:00
|
|
|
export function addRequestToRequestList (id, error, key) {
|
2018-02-02 18:16:18 -08:00
|
|
|
return {
|
2018-02-14 17:26:11 -08:00
|
|
|
type: actions.REQUEST_LIST_ADD,
|
2018-02-14 12:09:57 -08:00
|
|
|
data: { id, error, key },
|
2018-02-02 18:16:18 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-14 12:09:57 -08:00
|
|
|
// asset actions
|
|
|
|
|
2018-02-12 18:18:56 -08:00
|
|
|
export function addAssetToAssetList (id, error, name, claimId, shortId, claimData) {
|
2018-02-08 11:22:19 -08:00
|
|
|
return {
|
2018-02-13 17:16:50 -08:00
|
|
|
type: actions.ASSET_ADD,
|
2018-02-08 11:22:19 -08:00
|
|
|
data: { id, error, name, claimId, shortId, claimData },
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2018-02-13 17:16:50 -08:00
|
|
|
// channel actions
|
2018-02-07 18:41:22 -08:00
|
|
|
|
2018-02-12 18:18:56 -08:00
|
|
|
export function addNewChannelToChannelList (id, name, shortId, longId, claimsData) {
|
2018-02-07 22:22:17 -08:00
|
|
|
return {
|
2018-02-13 17:16:50 -08:00
|
|
|
type: actions.CHANNEL_ADD,
|
2018-02-12 18:18:56 -08:00
|
|
|
data: { id, name, shortId, longId, claimsData },
|
2018-02-07 22:22:17 -08:00
|
|
|
};
|
|
|
|
};
|
2018-02-07 13:26:07 -08:00
|
|
|
|
2018-02-14 09:19:22 -08:00
|
|
|
export function onUpdateChannelClaims (channelKey, name, longId, page) {
|
2018-02-09 10:02:13 -08:00
|
|
|
return {
|
2018-02-12 20:01:02 -08:00
|
|
|
type: actions.CHANNEL_CLAIMS_UPDATE_ASYNC,
|
2018-02-12 18:18:56 -08:00
|
|
|
data: {channelKey, name, longId, page},
|
2018-02-09 10:02:13 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export function updateChannelClaims (channelListId, claimsData) {
|
|
|
|
return {
|
2018-02-12 20:01:02 -08:00
|
|
|
type: actions.CHANNEL_CLAIMS_UPDATE_SUCCESS,
|
2018-02-09 10:02:13 -08:00
|
|
|
data: {channelListId, claimsData},
|
|
|
|
};
|
|
|
|
};
|
2018-02-08 15:47:10 -08:00
|
|
|
|
2018-02-07 18:41:22 -08:00
|
|
|
// display a file
|
2018-02-07 18:01:51 -08:00
|
|
|
|
2018-02-07 18:41:22 -08:00
|
|
|
export function fileRequested (name, claimId) {
|
2018-02-07 18:01:51 -08:00
|
|
|
return {
|
2018-02-07 18:41:22 -08:00
|
|
|
type: actions.FILE_REQUESTED,
|
|
|
|
data: { name, claimId },
|
2018-02-07 18:01:51 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-07 18:41:22 -08:00
|
|
|
export function updateFileAvailability (status) {
|
2018-02-07 18:01:51 -08:00
|
|
|
return {
|
2018-02-07 18:41:22 -08:00
|
|
|
type: actions.FILE_AVAILABILITY_UPDATE,
|
|
|
|
data: status,
|
2018-02-07 18:01:51 -08:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2018-02-07 18:41:22 -08:00
|
|
|
export function updateDisplayAssetError (error) {
|
2018-02-07 18:01:51 -08:00
|
|
|
return {
|
2018-02-07 18:41:22 -08:00
|
|
|
type: actions.DISPLAY_ASSET_ERROR,
|
|
|
|
data: error,
|
2018-02-07 18:01:51 -08:00
|
|
|
};
|
|
|
|
};
|