Page MenuHomePhorge

ManiphestPage.qml
No OneTemporary

ManiphestPage.qml

import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
id: page
// The effective value will be restricted by ApplicationWindow.allowedOrientations
allowedOrientations: Orientation.All
SilicaListView {
id: taskList
model: ListModel { id: model}
anchors.fill: parent
header: PageHeader { title: "Maniphest Tasks"}
delegate: ListItem {
id: myDelegate
menu: contextMenu
Label {
id: label
text: "T" + taskID + " | " + status + " | " + priorityName
color: priorityColor
}
Label {
anchors.top: label.bottom
text: title
font.pixelSize: Theme.fontSizeSmall
wrapMode: Text.WordWrap
}
Component {
id: contextMenu
ContextMenu {
MenuItem {
text: "Open"
onClicked: Qt.openUrlExternally("https://phabricator.keithzg.ca" + "/T" + taskID)
}
}
}
}
Component.onCompleted: {
var xhr = new XMLHttpRequest;
xhr.open("POST", "https://phabricator.keithzg.ca/api/maniphest.search");
xhr.onreadystatechange = function() {
if (xhr.readyState === XMLHttpRequest.DONE) {
var data = JSON.parse(xhr.responseText);
model.clear();
//console.log(JSON.stringify(data))
// var list = data["result"]; // For maniphest.query
var list = data["result"]["data"]; // For maniphest.search
for (var i in list) {
//console.log(i)
model.append({
taskID: list[i]["id"],
title: list[i]["fields"]["name"],
priorityColor: list[i]["fields"]["priority"]["color"],
priorityName: list[i]["fields"]["priority"]["name"],
status: list[i]["fields"]["status"]["name"],
});
}
}
}
// xhr.send("api.token="+settings.api_token+"&order=order-priority&status=status-open"); // For maniphest.query
xhr.send("api.token="+"api-72nyev5tli26lrjvmksvbbfuvyqr"+"&order=order-priority&queryKey=open"); // For maniphest.search
console.log("So, you should see something by now?")
}
VerticalScrollDecorator {}
}
}

File Metadata

Mime Type
text/plain
Expires
Mon, Aug 18, 12:55 PM (23 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
184752
Default Alt Text
ManiphestPage.qml (1 KB)

Event Timeline