192 lines
4.2 KiB
JavaScript
192 lines
4.2 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.onHandleShowPageUri = onHandleShowPageUri;
|
||
|
exports.onRequestError = onRequestError;
|
||
|
exports.onNewChannelRequest = onNewChannelRequest;
|
||
|
exports.onNewAssetRequest = onNewAssetRequest;
|
||
|
exports.onRequestUpdate = onRequestUpdate;
|
||
|
exports.addRequestToRequestList = addRequestToRequestList;
|
||
|
exports.addAssetToAssetList = addAssetToAssetList;
|
||
|
exports.addNewChannelToChannelList = addNewChannelToChannelList;
|
||
|
exports.onUpdateChannelClaims = onUpdateChannelClaims;
|
||
|
exports.updateChannelClaims = updateChannelClaims;
|
||
|
exports.fileRequested = fileRequested;
|
||
|
exports.updateFileAvailability = updateFileAvailability;
|
||
|
exports.updateDisplayAssetError = updateDisplayAssetError;
|
||
|
|
||
|
var actions = _interopRequireWildcard(require("../constants/show_action_types"));
|
||
|
|
||
|
var _show_request_types = require("../constants/show_request_types");
|
||
|
|
||
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||
|
|
||
|
// basic request parsing
|
||
|
function onHandleShowPageUri(params) {
|
||
|
return {
|
||
|
type: actions.HANDLE_SHOW_URI,
|
||
|
data: params
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function onRequestError(error) {
|
||
|
return {
|
||
|
type: actions.REQUEST_ERROR,
|
||
|
data: error
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function onNewChannelRequest(channelName, channelId) {
|
||
|
var requestType = _show_request_types.CHANNEL;
|
||
|
var requestId = "cr#".concat(channelName, "#").concat(channelId);
|
||
|
return {
|
||
|
type: actions.CHANNEL_REQUEST_NEW,
|
||
|
data: {
|
||
|
requestType: requestType,
|
||
|
requestId: requestId,
|
||
|
channelName: channelName,
|
||
|
channelId: channelId
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function onNewAssetRequest(name, id, channelName, channelId, extension) {
|
||
|
var requestType = extension ? _show_request_types.ASSET_LITE : _show_request_types.ASSET_DETAILS;
|
||
|
var requestId = "ar#".concat(name, "#").concat(id, "#").concat(channelName, "#").concat(channelId);
|
||
|
return {
|
||
|
type: actions.ASSET_REQUEST_NEW,
|
||
|
data: {
|
||
|
requestType: requestType,
|
||
|
requestId: requestId,
|
||
|
name: name,
|
||
|
modifier: {
|
||
|
id: id,
|
||
|
channel: {
|
||
|
name: channelName,
|
||
|
id: channelId
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function onRequestUpdate(requestType, requestId) {
|
||
|
return {
|
||
|
type: actions.REQUEST_UPDATE,
|
||
|
data: {
|
||
|
requestType: requestType,
|
||
|
requestId: requestId
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function addRequestToRequestList(id, error, key) {
|
||
|
return {
|
||
|
type: actions.REQUEST_LIST_ADD,
|
||
|
data: {
|
||
|
id: id,
|
||
|
error: error,
|
||
|
key: key
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
; // asset actions
|
||
|
|
||
|
function addAssetToAssetList(id, error, name, claimId, shortId, claimData) {
|
||
|
return {
|
||
|
type: actions.ASSET_ADD,
|
||
|
data: {
|
||
|
id: id,
|
||
|
error: error,
|
||
|
name: name,
|
||
|
claimId: claimId,
|
||
|
shortId: shortId,
|
||
|
claimData: claimData
|
||
|
}
|
||
|
};
|
||
|
} // channel actions
|
||
|
|
||
|
|
||
|
function addNewChannelToChannelList(id, name, shortId, longId, claimsData) {
|
||
|
return {
|
||
|
type: actions.CHANNEL_ADD,
|
||
|
data: {
|
||
|
id: id,
|
||
|
name: name,
|
||
|
shortId: shortId,
|
||
|
longId: longId,
|
||
|
claimsData: claimsData
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function onUpdateChannelClaims(channelKey, name, longId, page) {
|
||
|
return {
|
||
|
type: actions.CHANNEL_CLAIMS_UPDATE_ASYNC,
|
||
|
data: {
|
||
|
channelKey: channelKey,
|
||
|
name: name,
|
||
|
longId: longId,
|
||
|
page: page
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function updateChannelClaims(channelListId, claimsData) {
|
||
|
return {
|
||
|
type: actions.CHANNEL_CLAIMS_UPDATE_SUCCESS,
|
||
|
data: {
|
||
|
channelListId: channelListId,
|
||
|
claimsData: claimsData
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
; // display a file
|
||
|
|
||
|
function fileRequested(name, claimId) {
|
||
|
return {
|
||
|
type: actions.FILE_REQUESTED,
|
||
|
data: {
|
||
|
name: name,
|
||
|
claimId: claimId
|
||
|
}
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function updateFileAvailability(status) {
|
||
|
return {
|
||
|
type: actions.FILE_AVAILABILITY_UPDATE,
|
||
|
data: status
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|
||
|
|
||
|
function updateDisplayAssetError(error) {
|
||
|
return {
|
||
|
type: actions.DISPLAY_ASSET_ERROR,
|
||
|
data: error
|
||
|
};
|
||
|
}
|
||
|
|
||
|
;
|