mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 09:23:13 +01:00
Small cosmetic changes
This commit is contained in:
parent
a2320b892d
commit
78cf40ba64
@ -17,7 +17,7 @@ class EditionListActions {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchEditionList({pieceId, page, pageSize, orderBy, orderAsc, filterBy, maxEdition}) {
|
fetchEditionList({ pieceId, page, pageSize, orderBy, orderAsc, filterBy, maxEdition }) {
|
||||||
if ((!orderBy && typeof orderAsc === 'undefined') || !orderAsc) {
|
if ((!orderBy && typeof orderAsc === 'undefined') || !orderAsc) {
|
||||||
orderBy = 'edition_number';
|
orderBy = 'edition_number';
|
||||||
orderAsc = true;
|
orderAsc = true;
|
||||||
@ -39,7 +39,7 @@ class EditionListActions {
|
|||||||
|
|
||||||
return Q.Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
EditionListFetcher
|
EditionListFetcher
|
||||||
.fetch({pieceId, page, itemsToFetch, orderBy, orderAsc, filterBy})
|
.fetch({ pieceId, page, itemsToFetch, orderBy, orderAsc, filterBy })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res && !res.editions) {
|
if (res && !res.editions) {
|
||||||
throw new Error('Piece has no editions to fetch.');
|
throw new Error('Piece has no editions to fetch.');
|
||||||
|
@ -15,7 +15,7 @@ class PieceListActions {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy}) {
|
fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy }) {
|
||||||
// To prevent flickering on a pagination request,
|
// To prevent flickering on a pagination request,
|
||||||
// we overwrite the piecelist with an empty list before
|
// we overwrite the piecelist with an empty list before
|
||||||
// pieceListCount === -1 defines the loading state
|
// pieceListCount === -1 defines the loading state
|
||||||
@ -34,7 +34,7 @@ class PieceListActions {
|
|||||||
// afterwards, we can load the list
|
// afterwards, we can load the list
|
||||||
return Q.Promise((resolve, reject) => {
|
return Q.Promise((resolve, reject) => {
|
||||||
PieceListFetcher
|
PieceListFetcher
|
||||||
.fetch({page, pageSize, search, orderBy, orderAsc, filterBy})
|
.fetch({ page, pageSize, search, orderBy, orderAsc, filterBy })
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
this.actions.updatePieceList({
|
this.actions.updatePieceList({
|
||||||
page,
|
page,
|
||||||
|
@ -19,9 +19,10 @@ import { getLangText } from '../../utils/lang_utils';
|
|||||||
|
|
||||||
let AccordionListItemEditionWidget = React.createClass({
|
let AccordionListItemEditionWidget = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
className: React.PropTypes.string,
|
|
||||||
piece: React.PropTypes.object.isRequired,
|
piece: React.PropTypes.object.isRequired,
|
||||||
toggleCreateEditionsDialog: React.PropTypes.func.isRequired,
|
toggleCreateEditionsDialog: React.PropTypes.func.isRequired,
|
||||||
|
|
||||||
|
className: React.PropTypes.string,
|
||||||
onPollingSuccess: React.PropTypes.func
|
onPollingSuccess: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -54,11 +55,11 @@ let AccordionListItemEditionWidget = React.createClass({
|
|||||||
const { filterBy, isEditionListOpenForPieceId } = this.state;
|
const { filterBy, isEditionListOpenForPieceId } = this.state;
|
||||||
const isEditionListOpen = isEditionListOpenForPieceId[pieceId] ? isEditionListOpenForPieceId[pieceId].show : false;
|
const isEditionListOpen = isEditionListOpenForPieceId[pieceId] ? isEditionListOpenForPieceId[pieceId].show : false;
|
||||||
|
|
||||||
if(isEditionListOpen) {
|
if (isEditionListOpen) {
|
||||||
EditionListActions.toggleEditionList(pieceId);
|
EditionListActions.toggleEditionList(pieceId);
|
||||||
} else {
|
} else {
|
||||||
EditionListActions.toggleEditionList(pieceId);
|
EditionListActions.toggleEditionList(pieceId);
|
||||||
EditionListActions.fetchEditionList({pieceId, filterBy});
|
EditionListActions.fetchEditionList({ pieceId, filterBy });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -82,11 +82,11 @@ let AccordionListItemTableEditions = React.createClass({
|
|||||||
|
|
||||||
EditionListActions.fetchEditionList({
|
EditionListActions.fetchEditionList({
|
||||||
pieceId,
|
pieceId,
|
||||||
page: page + 1,
|
|
||||||
pageSize,
|
pageSize,
|
||||||
orderBy,
|
orderBy,
|
||||||
orderAsc,
|
orderAsc,
|
||||||
filterBy
|
filterBy,
|
||||||
|
page: page + 1
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
@ -90,10 +90,10 @@ let AccordionListItemWallet = React.createClass({
|
|||||||
onPollingSuccess(pieceId) {
|
onPollingSuccess(pieceId) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
EditionListActions.toggleEditionList(pieceId);
|
EditionListActions.toggleEditionList(pieceId);
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
const notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -81,8 +81,8 @@ let EditionActionPanel = React.createClass({
|
|||||||
refreshCollection() {
|
refreshCollection() {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
EditionListActions.refreshEditionList({pieceId: this.props.edition.parent});
|
EditionListActions.refreshEditionList({ pieceId: this.props.edition.parent });
|
||||||
},
|
},
|
||||||
|
|
||||||
handleSuccess(response) {
|
handleSuccess(response) {
|
||||||
|
@ -144,14 +144,14 @@ let PieceContainer = React.createClass({
|
|||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceActions.updateProperty({key: 'num_editions', value: 0});
|
PieceActions.updateProperty({key: 'num_editions', value: 0});
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
this.toggleCreateEditionsDialog();
|
this.toggleCreateEditionsDialog();
|
||||||
},
|
},
|
||||||
|
|
||||||
handleDeleteSuccess(response) {
|
handleDeleteSuccess(response) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
// since we're deleting a piece, we just need to close
|
// since we're deleting a piece, we just need to close
|
||||||
// all editions dialogs and not reload them
|
// all editions dialogs and not reload them
|
||||||
@ -192,7 +192,7 @@ let PieceContainer = React.createClass({
|
|||||||
// btw.: It's not sufficient to just set num_editions to numEditions, since a single accordion
|
// btw.: It's not sufficient to just set num_editions to numEditions, since a single accordion
|
||||||
// list item also uses the firstEdition property which we can only get from the server in that case.
|
// list item also uses the firstEdition property which we can only get from the server in that case.
|
||||||
// Therefore we need to at least refetch the changed piece from the server or on our case simply all
|
// Therefore we need to at least refetch the changed piece from the server or on our case simply all
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
@ -214,14 +214,14 @@ let PieceList = React.createClass({
|
|||||||
|
|
||||||
applyOrderBy(orderBy) {
|
applyOrderBy(orderBy) {
|
||||||
const { filterBy, orderAsc, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, page, pageSize, search } = this.state;
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
loadPieceList({ page, filterBy = this.state.filterBy, search = this.state.search }) {
|
loadPieceList({ page, filterBy = this.state.filterBy, search = this.state.search }) {
|
||||||
const { orderAsc, pageSize } = this.state;
|
const { orderAsc, pageSize } = this.state;
|
||||||
const orderBy = this.state.orderBy || this.props.orderBy;
|
const orderBy = this.state.orderBy || this.props.orderBy;
|
||||||
|
|
||||||
return PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
return PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
fetchSelectedPieceEditionList() {
|
fetchSelectedPieceEditionList() {
|
||||||
@ -249,7 +249,7 @@ let PieceList = React.createClass({
|
|||||||
handleAclSuccess() {
|
handleAclSuccess() {
|
||||||
const { filterBy, orderBy, orderAsc, page, pageSize, search } = this.state;
|
const { filterBy, orderBy, orderAsc, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
this.fetchSelectedPieceEditionList()
|
this.fetchSelectedPieceEditionList()
|
||||||
.forEach((pieceId) => {
|
.forEach((pieceId) => {
|
||||||
|
@ -73,13 +73,13 @@ let RegisterPiece = React.createClass( {
|
|||||||
|
|
||||||
// once the user was able to register a piece successfully, we need to make sure to keep
|
// once the user was able to register a piece successfully, we need to make sure to keep
|
||||||
// the piece list up to date
|
// the piece list up to date
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
this.history.push(`/pieces/${response.piece.id}`);
|
this.history.push(`/pieces/${response.piece.id}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
getSpecifyEditions() {
|
getSpecifyEditions() {
|
||||||
if(this.state.whitelabel && this.state.whitelabel.acl_create_editions || Object.keys(this.state.whitelabel).length === 0) {
|
if (this.state.whitelabel && this.state.whitelabel.acl_create_editions || Object.keys(this.state.whitelabel).length === 0) {
|
||||||
return (
|
return (
|
||||||
<Property
|
<Property
|
||||||
name="num_editions"
|
name="num_editions"
|
||||||
|
@ -60,7 +60,7 @@ let AccordionListItemPrize = React.createClass({
|
|||||||
handleSubmitPrizeSuccess(response) {
|
handleSubmitPrizeSuccess(response) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
@ -141,7 +141,7 @@ let AccordionListItemPrize = React.createClass({
|
|||||||
refreshPieceData() {
|
refreshPieceData() {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectChange(){
|
onSelectChange(){
|
||||||
|
@ -306,7 +306,7 @@ let PrizePieceRatings = React.createClass({
|
|||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
this.props.loadPiece();
|
this.props.loadPiece();
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
onSelectChange() {
|
onSelectChange() {
|
||||||
|
@ -54,7 +54,7 @@ let CylandAccordionListItem = React.createClass({
|
|||||||
handleSubmitSuccess(response) {
|
handleSubmitSuccess(response) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
@ -76,7 +76,7 @@ let CylandPieceContainer = React.createClass({
|
|||||||
handleDeleteSuccess(response) {
|
handleDeleteSuccess(response) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
// since we're deleting a piece, we just need to close
|
// since we're deleting a piece, we just need to close
|
||||||
// all editions dialogs and not reload them
|
// all editions dialogs and not reload them
|
||||||
|
@ -144,7 +144,7 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
refreshPieceList() {
|
refreshPieceList() {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -55,7 +55,7 @@ let IkonotvAccordionListItem = React.createClass({
|
|||||||
handleSubmitSuccess(response) {
|
handleSubmitSuccess(response) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
@ -85,7 +85,7 @@ let IkonotvPieceContainer = React.createClass({
|
|||||||
handleDeleteSuccess(response) {
|
handleDeleteSuccess(response) {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
|
|
||||||
// since we're deleting a piece, we just need to close
|
// since we're deleting a piece, we just need to close
|
||||||
// all editions dialogs and not reload them
|
// all editions dialogs and not reload them
|
||||||
|
@ -149,7 +149,7 @@ let IkonotvRegisterPiece = React.createClass({
|
|||||||
refreshPieceList() {
|
refreshPieceList() {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
canSubmit() {
|
canSubmit() {
|
||||||
|
@ -105,7 +105,7 @@ let MarketRegisterPiece = React.createClass({
|
|||||||
refreshPieceList() {
|
refreshPieceList() {
|
||||||
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
const { filterBy, orderAsc, orderBy, page, pageSize, search } = this.state;
|
||||||
|
|
||||||
PieceListActions.fetchPieceList({page, pageSize, search, orderBy, orderAsc, filterBy});
|
PieceListActions.fetchPieceList({ page, pageSize, search, orderBy, orderAsc, filterBy });
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -9,10 +9,10 @@ let EditionListFetcher = {
|
|||||||
/**
|
/**
|
||||||
* Fetches a list of editions from the API.
|
* Fetches a list of editions from the API.
|
||||||
*/
|
*/
|
||||||
fetch({pieceId, page, pageSize, orderBy, orderAsc, filterBy}) {
|
fetch({ pieceId, page, pageSize, orderBy, orderAsc, filterBy }) {
|
||||||
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
const ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
||||||
|
|
||||||
let queryParams = mergeOptions(
|
const queryParams = mergeOptions(
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
pageSize,
|
pageSize,
|
||||||
|
@ -10,12 +10,12 @@ let PieceListFetcher = {
|
|||||||
* Fetches a list of pieces from the API.
|
* Fetches a list of pieces from the API.
|
||||||
* Can be called with all supplied queryparams the API.
|
* Can be called with all supplied queryparams the API.
|
||||||
*/
|
*/
|
||||||
fetch({page, pageSize, search, orderBy, orderAsc, filterBy}) {
|
fetch({ page, pageSize, search, orderBy, orderAsc, filterBy }) {
|
||||||
let ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
const ordering = generateOrderingQueryParams(orderBy, orderAsc);
|
||||||
|
|
||||||
// filterBy is an object of acl key-value pairs.
|
// filterBy is an object of acl key-value pairs.
|
||||||
// The values are booleans
|
// The values are booleans
|
||||||
let queryParams = mergeOptions(
|
const queryParams = mergeOptions(
|
||||||
{
|
{
|
||||||
page,
|
page,
|
||||||
pageSize,
|
pageSize,
|
||||||
|
@ -109,12 +109,12 @@ class EditionListStore {
|
|||||||
|
|
||||||
EditionsListActions
|
EditionsListActions
|
||||||
.fetchEditionList({
|
.fetchEditionList({
|
||||||
filterBy,
|
|
||||||
maxSeen,
|
|
||||||
orderAsc,
|
|
||||||
orderBy,
|
|
||||||
pieceId,
|
pieceId,
|
||||||
pageSize,
|
pageSize,
|
||||||
|
orderBy,
|
||||||
|
orderAsc,
|
||||||
|
filterBy,
|
||||||
|
maxSeen,
|
||||||
page: 1
|
page: 1
|
||||||
})
|
})
|
||||||
.catch(console.logGlobal);
|
.catch(console.logGlobal);
|
||||||
|
Loading…
Reference in New Issue
Block a user