Skip to content

Commit

Permalink
NXDRIVE-2890: List all pending documents for review 27/03 --working list
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofanindya committed Mar 27, 2024
1 parent b6cde64 commit 9aa07dc
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 168 deletions.
1 change: 1 addition & 0 deletions nxdrive/data/qml/SystrayMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ ShadowRectangle {
text: qsTr("Tasks")
onClicked: {
api.show_tasks()
tasks_model.loadList();
control.visible = false
}
}
Expand Down
191 changes: 31 additions & 160 deletions nxdrive/data/qml/TaskManager.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,187 +4,58 @@ import QtQuick.Layouts 1.15
import QtQuick.Window 2.15
import "icon-font/Icon.js" as MdiFont

/*
Rectangle {
id: taskManager
anchors.fill: parent

property string engineUid: ""
//property list pendingDocumentsList: []
property bool pendingDocumentsPresent: true
signal setEngine(string uid)
onSetEngine: {
engineUid = uid
updateList()
pendingDocumentsPresent = true
}
function updateList() {
// pendingDocumentsList = api.get_Tasks_list()
pendingDocumentsPresent = api.get_Tasks_count()
//pendingDocumentsPresent = True
}
Connections {
target: TasksModel
}
TabBar {
id: bar
width: parent.width
height: 50
spacing: 0
anchors.top: buttonzone.bottom
SettingsTab {
text: qsTr("Tasks") + tl.tr
text: qsTr("Pending Tasks")
barIndex: bar.currentIndex;
index: 0
anchors.top: parent.top
}
}
Text {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
height: 100
//textFormat: Text.RichText
text: "No Tasks Available"
visible: !pendingDocumentsPresent
font.pointSize: point_size * 1.2
color: primaryText
}
StackLayout {
currentIndex: bar.currentIndex
width: parent.width
height: parent.height - bar.height - buttonzone.height
anchors.bottom: parent.bottom
// The "Pending Tasks" list
ListView {
id: activeTasksList
flickableDirection: Flickable.VerticalFlick
boundsBehavior: Flickable.StopAtBounds
clip: true
spacing: 25
model: TasksModel
delegate: SessionItem {}
Label {
anchors.fill: parent
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
// visible: !ActiveSessionModel.count_no_shadow
visible: true
text: qsTr("NO_ACTIVE_SESSION") + tl.tr
font.pointSize: point_size * 1.2
color: primaryText
}
Layout.fillWidth: true
Layout.fillHeight: true
topMargin: 20
bottomMargin: 20
ScrollBar.vertical: ScrollBar {}
}
}
}
*/

Rectangle {
id: taskManager
anchors.fill: parent

property string engineUid: ""
signal setEngine(string uid)

onSetEngine: {
engineUid = uid
}

TabBar {
id: bar
Component {
id: tasksDelegate
Row {
spacing: 50
width: parent.width
height: 50
spacing: 0
anchors.top: buttonzone.bottom
SettingsTab {
text: qsTr("Pending Tasks")
barIndex: bar.currentIndex;
index: 0
anchors.top: parent.top
anchors.bottomMargin: 40
Link {
Layout.fillWidth: true
elide: Text.ElideMiddle
text: qsTr("Review")
onClicked: api.on_clicked_open_task(task["task_id"])
}
}
Component {
id: tasksDelegate
//width: parent.width
Row {
id: rw
spacing: 50
width: parent.width
//border.color: "black"
ScaledText {
text: task
padding: 5
//height: parent.height
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
IconLabel {
icon: MdiFont.Icon.folder
iconColor: secondaryIcon
onClicked: api.on_clicked_open_task(task_id)
}

/*
Link {
//id: csvFileLink
Layout.fillWidth: true
elide: Text.ElideMiddle
text: qsTr("Review")
//visible: task_id != ''
onClicked: api.on_clicked_open_task(task_id)
}*/

/*MouseArea {
anchors.fill: parent
hoverEnabled: true
onEntered: {
var x = parent.x
var y = parent.y
var index = listv.indexAt(x, y)
listv.currentIndex = index
}
}*/
ScaledText {
text: task["task_details"]
//padding: 5
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
}
}
ListView {
anchors.fill: parent
anchors.bottomMargin: 52
width: parent.width
y: 80
anchors.topMargin: 80
model: tasks_model.model
delegate: tasksDelegate
//highlight: Rectangle{color: lightGray}
focus: true
}
Button {
id: btnShowList
width: parent.width
height: 30
y: 50
text: qsTr("show list")
onClicked: {
tasks_model.loadList();
IconLabel {
icon: MdiFont.Icon.folder
iconColor: secondaryIcon
onClicked: api.on_clicked_open_task(task["task_id"])
}
}
}

ListView {
anchors.fill: parent
anchors.bottomMargin: 52
width: parent.width
anchors.topMargin: 50
model: tasks_model.model
delegate: tasksDelegate
focus: true
}

}
27 changes: 19 additions & 8 deletions nxdrive/gui/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,19 +870,30 @@ def loadList(self):
tasks_list = tasks["entries"]
for task in tasks_list:
doc_info = get_document_info(task["targetDocumentIds"][0]["id"])

Check warning on line 872 in nxdrive/gui/view.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/gui/view.py#L869-L872

Added lines #L869 - L872 were not covered by tests
data = (
task["workflowModelName"]
+ " requested for: "
"""
data = {
"task_id": task["id"],
"workflow_type": task["workflowModelName"],
"doc_name": doc_info["title"],
"intiated_by": task["workflowInitiator"],
"due_date": task["dueDate"],
}
"""
data = {

Check warning on line 882 in nxdrive/gui/view.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/gui/view.py#L882

Added line #L882 was not covered by tests
"task_details": task["workflowModelName"]
+ "\n"
+ doc_info["title"]
+ "\n"
+ "By: "
+ "Initiator: "
+ task["workflowInitiator"]
+ "\n"
+ "Please review by:"
+ task["dueDate"]
)
+ "Due:"
+ task["dueDate"],
"task_id": task["id"],
}

self.add_row(data, self.TASK_ROLE) # (task, self.TASK_ROLE)

Check warning on line 895 in nxdrive/gui/view.py

View check run for this annotation

Codecov / codecov/patch

nxdrive/gui/view.py#L895

Added line #L895 was not covered by tests
self.add_row(task["id"], self.TASK_ID)
# self.add_row(task["id"], self.TASK_ID)

def add_row(self, task, role):
item = QStandardItem()
Expand Down

0 comments on commit 9aa07dc

Please sign in to comment.