mirror of
https://github.com/overte-org/overte.git
synced 2025-04-26 06:36: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;
|
listModelName: root.listModelName;
|
||||||
endpoint: "/api/v1/users?filter=connections";
|
endpoint: "/api/v1/users?filter=connections";
|
||||||
itemsPerPage: 8;
|
itemsPerPage: 8;
|
||||||
|
listView: connectionsList;
|
||||||
processPage: function (data) {
|
processPage: function (data) {
|
||||||
console.log("HRS FIXME processPage", JSON.stringify(data));
|
console.log("processPage", connectionsModel.listModelName, JSON.stringify(data));
|
||||||
return data.users;
|
return data.users;
|
||||||
};
|
};
|
||||||
searchFilter: filterBar.text;
|
searchFilter: filterBar.text;
|
||||||
|
@ -523,7 +524,7 @@ Item {
|
||||||
visible: !connectionsLoading.visible;
|
visible: !connectionsLoading.visible;
|
||||||
clip: true;
|
clip: true;
|
||||||
model: connectionsModel.model;
|
model: connectionsModel.model;
|
||||||
onAtYEndChanged: if (connectionsList.atYEnd) { connectionsModel.getNextPage(); }
|
onAtYEndChanged: if (connectionsList.atYEnd /*&& !connectionsList.atYBeginning*/) { connectionsModel.getNextPage(); }
|
||||||
snapMode: ListView.SnapToItem;
|
snapMode: ListView.SnapToItem;
|
||||||
// Anchors
|
// Anchors
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
|
|
|
@ -780,6 +780,9 @@ Rectangle {
|
||||||
case 'http.response':
|
case 'http.response':
|
||||||
http.handleHttpResponse(message);
|
http.handleHttpResponse(message);
|
||||||
break;
|
break;
|
||||||
|
case 'palIsStale':
|
||||||
|
case 'avatarDisconnected': // HRS FIXME. What are these about?
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
|
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.
|
listModelName: "transaction history"; // For debugging. Alternatively, we could specify endpoint for that purpose, even though it's not used directly.
|
||||||
itemsPerPage: 6;
|
itemsPerPage: 6;
|
||||||
getPage: function () {
|
getPage: function () {
|
||||||
console.debug('WalletHome getPage', transactionHistoryModel.currentPageToRetrieve);
|
console.debug('getPage', transactionHistoryModel.listModelName, transactionHistoryModel.currentPageToRetrieve);
|
||||||
Commerce.history(transactionHistoryModel.currentPageToRetrieve, transactionHistoryModel.itemsPerPage);
|
Commerce.history(transactionHistoryModel.currentPageToRetrieve, transactionHistoryModel.itemsPerPage);
|
||||||
}
|
}
|
||||||
processPage: function (data) {
|
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.
|
var result, pending; // Set up or get the accumulator for pending.
|
||||||
if (transactionHistoryModel.currentPageToRetrieve == 1) {
|
if (transactionHistoryModel.currentPageToRetrieve == 1) {
|
||||||
pending = {transaction_type: "pendingCount", count: 0};
|
pending = {transaction_type: "pendingCount", count: 0};
|
||||||
|
@ -441,25 +441,6 @@ Item {
|
||||||
return year + '-' + month + '-' + day + '<br>' + drawnHour + ':' + min + amOrPm;
|
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);
|
signal sendSignalToWallet(var msg);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -40,6 +40,7 @@ Item {
|
||||||
var filteredCopy = applySearchItemTest(copyOfItems);
|
var filteredCopy = applySearchItemTest(copyOfItems);
|
||||||
finalModel.clear();
|
finalModel.clear();
|
||||||
finalModel.append(filteredCopy);
|
finalModel.append(filteredCopy);
|
||||||
|
debugView('after searchFilterChanged');
|
||||||
} else { // TODO: fancy timer against fast typing.
|
} else { // TODO: fancy timer against fast typing.
|
||||||
getFirstPage();
|
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.
|
// 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 processPage: function (data) { return data; }
|
||||||
|
|
||||||
|
property var listView; // Optional. For debugging.
|
||||||
// Check consistency and call processPage.
|
// Check consistency and call processPage.
|
||||||
function handlePage(error, response) {
|
function handlePage(error, response) {
|
||||||
var processed;
|
var processed;
|
||||||
|
@ -100,14 +102,28 @@ Item {
|
||||||
finalModel.clear();
|
finalModel.clear();
|
||||||
delayedClear = false;
|
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;
|
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) {
|
function applySearchItemTest(items) {
|
||||||
return items.filter(function (item) {
|
return items.filter(function (item) {
|
||||||
return searchItemTest(searchFilter, 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.
|
// Override either http or getPage.
|
||||||
property var http; // An Item that has a request function.
|
property var http; // An Item that has a request function.
|
||||||
|
@ -121,7 +137,7 @@ Item {
|
||||||
];
|
];
|
||||||
var parametersSeparator = /\?/.test(url) ? '&' : '?';
|
var parametersSeparator = /\?/.test(url) ? '&' : '?';
|
||||||
url = url + parametersSeparator + parameters.join('&');
|
url = url + parametersSeparator + parameters.join('&');
|
||||||
console.debug('getPage', listModelName);
|
console.debug('getPage', listModelName, currentPageToRetrieve);
|
||||||
http.request({uri: url}, handlePage);
|
http.request({uri: url}, handlePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,6 +147,7 @@ Item {
|
||||||
delayedClear = !!delayClear;
|
delayedClear = !!delayClear;
|
||||||
resetModel();
|
resetModel();
|
||||||
requestPending = true;
|
requestPending = true;
|
||||||
|
console.debug("getFirstPage", listModelName, currentPageToRetrieve);
|
||||||
getPage();
|
getPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -991,6 +991,8 @@ var selectionDisplay = null; // for gridTool.js to ignore
|
||||||
case 'http.request':
|
case 'http.request':
|
||||||
// Handled elsewhere, don't log.
|
// Handled elsewhere, don't log.
|
||||||
break;
|
break;
|
||||||
|
case 'goToPurchases_fromWalletHome': // HRS FIXME What's this about?
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('Unrecognized message from Checkout.qml or Purchases.qml: ' + JSON.stringify(message));
|
print('Unrecognized message from Checkout.qml or Purchases.qml: ' + JSON.stringify(message));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue