mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 18:16:08 +02:00
checkpoint
This commit is contained in:
parent
b0d3729d4d
commit
e8e12eef8f
5 changed files with 29 additions and 25 deletions
|
@ -399,8 +399,9 @@ Item {
|
|||
listModelName: root.listModelName;
|
||||
endpoint: "/api/v1/users?filter=connections";
|
||||
itemsPerPage: 8;
|
||||
listView: connectionsList;
|
||||
processPage: function (data) {
|
||||
console.log("HRS FIXME processPage", JSON.stringify(data));
|
||||
console.log("processPage", connectionsModel.listModelName, JSON.stringify(data));
|
||||
return data.users;
|
||||
};
|
||||
searchFilter: filterBar.text;
|
||||
|
@ -523,7 +524,7 @@ Item {
|
|||
visible: !connectionsLoading.visible;
|
||||
clip: true;
|
||||
model: connectionsModel.model;
|
||||
onAtYEndChanged: if (connectionsList.atYEnd) { connectionsModel.getNextPage(); }
|
||||
onAtYEndChanged: if (connectionsList.atYEnd /*&& !connectionsList.atYBeginning*/) { connectionsModel.getNextPage(); }
|
||||
snapMode: ListView.SnapToItem;
|
||||
// Anchors
|
||||
anchors.fill: parent;
|
||||
|
|
|
@ -780,6 +780,9 @@ Rectangle {
|
|||
case 'http.response':
|
||||
http.handleHttpResponse(message);
|
||||
break;
|
||||
case 'palIsStale':
|
||||
case 'avatarDisconnected': // HRS FIXME. What are these about?
|
||||
break;
|
||||
default:
|
||||
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
|
||||
}
|
||||
|
|
|
@ -214,11 +214,11 @@ Item {
|
|||
listModelName: "transaction history"; // For debugging. Alternatively, we could specify endpoint for that purpose, even though it's not used directly.
|
||||
itemsPerPage: 6;
|
||||
getPage: function () {
|
||||
console.debug('WalletHome getPage', transactionHistoryModel.currentPageToRetrieve);
|
||||
console.debug('getPage', transactionHistoryModel.listModelName, transactionHistoryModel.currentPageToRetrieve);
|
||||
Commerce.history(transactionHistoryModel.currentPageToRetrieve, transactionHistoryModel.itemsPerPage);
|
||||
}
|
||||
processPage: function (data) {
|
||||
console.debug('WalletHome processPage', JSON.stringify(data));
|
||||
console.debug('processPage', transactionHistoryModel.listModelName, JSON.stringify(data));
|
||||
var result, pending; // Set up or get the accumulator for pending.
|
||||
if (transactionHistoryModel.currentPageToRetrieve == 1) {
|
||||
pending = {transaction_type: "pendingCount", count: 0};
|
||||
|
@ -441,25 +441,6 @@ Item {
|
|||
return year + '-' + month + '-' + day + '<br>' + drawnHour + ':' + min + amOrPm;
|
||||
}
|
||||
|
||||
//
|
||||
// Function Name: fromScript()
|
||||
//
|
||||
// Relevant Variables:
|
||||
// None
|
||||
//
|
||||
// Arguments:
|
||||
// message: The message sent from the JavaScript.
|
||||
// Messages are in format "{method, params}", like json-rpc.
|
||||
//
|
||||
// Description:
|
||||
// Called when a message is received from a script.
|
||||
//
|
||||
function fromScript(message) {
|
||||
switch (message.method) {
|
||||
default:
|
||||
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
|
||||
}
|
||||
}
|
||||
signal sendSignalToWallet(var msg);
|
||||
|
||||
//
|
||||
|
|
|
@ -40,6 +40,7 @@ Item {
|
|||
var filteredCopy = applySearchItemTest(copyOfItems);
|
||||
finalModel.clear();
|
||||
finalModel.append(filteredCopy);
|
||||
debugView('after searchFilterChanged');
|
||||
} else { // TODO: fancy timer against fast typing.
|
||||
getFirstPage();
|
||||
}
|
||||
|
@ -69,6 +70,7 @@ Item {
|
|||
// Override to return one property of data, and/or to transform the elements. Must return an array of model elements.
|
||||
property var processPage: function (data) { return data; }
|
||||
|
||||
property var listView; // Optional. For debugging.
|
||||
// Check consistency and call processPage.
|
||||
function handlePage(error, response) {
|
||||
var processed;
|
||||
|
@ -100,14 +102,28 @@ Item {
|
|||
finalModel.clear();
|
||||
delayedClear = false;
|
||||
}
|
||||
finalModel.append(processed); // FIXME keep index steady, and apply any post sort/filter
|
||||
finalModel.append(processed); // FIXME keep index steady, and apply any post sort
|
||||
retrievedAtLeastOnePage = true;
|
||||
if (response.total_pages && (response.total_pages === currentPageToRetrieve)) {
|
||||
currentPageToRetrieve = -1;
|
||||
}
|
||||
debugView('after handlePage');
|
||||
if (searchItemTest && searchFilter && listView && listView.atYEnd && (currentPageToRetrieve >= 0)) {
|
||||
getNextPage(); // too fancy??
|
||||
}
|
||||
}
|
||||
function applySearchItemTest(items) {
|
||||
return items.filter(function (item) {
|
||||
return searchItemTest(searchFilter, item);
|
||||
});
|
||||
}
|
||||
function debugView(label) {
|
||||
if (!listView) { return; }
|
||||
console.debug(label, listModelName, 'perPage:', itemsPerPage, 'count:', listView.count,
|
||||
'index:', listView.currentIndex, 'section:', listView.currentSection,
|
||||
'atYBeginning:', listView.atYBeginning, 'atYEnd:', listView.atYEnd,
|
||||
'y:', listView.y, 'contentY:', listView.contentY);
|
||||
}
|
||||
|
||||
// Override either http or getPage.
|
||||
property var http; // An Item that has a request function.
|
||||
|
@ -121,7 +137,7 @@ Item {
|
|||
];
|
||||
var parametersSeparator = /\?/.test(url) ? '&' : '?';
|
||||
url = url + parametersSeparator + parameters.join('&');
|
||||
console.debug('getPage', listModelName);
|
||||
console.debug('getPage', listModelName, currentPageToRetrieve);
|
||||
http.request({uri: url}, handlePage);
|
||||
}
|
||||
|
||||
|
@ -131,6 +147,7 @@ Item {
|
|||
delayedClear = !!delayClear;
|
||||
resetModel();
|
||||
requestPending = true;
|
||||
console.debug("getFirstPage", listModelName, currentPageToRetrieve);
|
||||
getPage();
|
||||
}
|
||||
|
||||
|
|
|
@ -991,6 +991,8 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
|||
case 'http.request':
|
||||
// Handled elsewhere, don't log.
|
||||
break;
|
||||
case 'goToPurchases_fromWalletHome': // HRS FIXME What's this about?
|
||||
break;
|
||||
default:
|
||||
print('Unrecognized message from Checkout.qml or Purchases.qml: ' + JSON.stringify(message));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue