Skip to content

Commit

Permalink
NXDRIVE-2912: Display Drive notification for document review --21/05 -01
Browse files Browse the repository at this point in the history
  • Loading branch information
gitofanindya committed May 21, 2024
1 parent 6bca6fe commit 075e130
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 7 deletions.
1 change: 1 addition & 0 deletions nxdrive/data/i18n/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@
"RELEASE_NOTES_MSG": "Your %1 has been correctly updated to the version <b>%2</b>, please read the <a href=\"https://doc.nuxeo.com/n/Bm2\">release notes</a> for more information.",
"RECENTLY_UPDATED": "Recently updated",
"REFRESH": "Refresh",
"REFRESH_AVAILABLE": "New tasks available. Please refresh the page.",
"REMOTE_FOLDER": "Remote folder",
"REPLACE": "Replace",
"REPORT_GENERATED": "Report available:",
Expand Down
35 changes: 29 additions & 6 deletions nxdrive/data/qml/TaskManager.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,34 @@ Rectangle {
}

Rectangle {
id: buttonzone
height: 30
id: refreshButton
objectName: "refresh"

height: 0
width: parent.width
color: refreshBackground
RowLayout {
width: parent.width
height: parent.height
ScaledText {
id: refreshText
text: qsTr("REFRESH_AVAILABLE") + tl.tr
font.pointSize: point_size * 1.2
leftPadding: 25
rightPadding: 5
topPadding: 3
anchors {
centerIn: buttonBackground
}
}
NuxeoButton {
text: qsTr("REFRESH") + tl.tr
Layout.alignment: Qt.AlignHCenter
Layout.alignment: Qt.AlignRight
Layout.rightMargin: 30
primary: false
onClicked: {
tasks_model.loadList(api.get_Tasks_list(engineUid), api.get_username(engineUid))
refreshButton.height = 0
}
}
}
Expand All @@ -40,7 +56,7 @@ Rectangle {
width: parent.width
height: 50
spacing: 0
anchors.top: buttonzone.bottom
anchors.top: refreshButton.bottom
SettingsTab {
text: qsTr("PENDING_TASKS") + tl.tr
barIndex: bar.currentIndex;
Expand Down Expand Up @@ -80,9 +96,10 @@ Rectangle {

ListView {
anchors.fill: parent
anchors.top: bar.bottom
anchors.bottomMargin: 52
width: parent.width
anchors.topMargin: 90
anchors.topMargin: refreshButton.height == 0 ? 60 : 90
model: tasks_model.model
delegate: tasksDelegate
visible: !showSelfTasksList
Expand All @@ -92,6 +109,9 @@ Rectangle {
rightMargin: 10
spacing: 25
clip: true
ScrollBar.vertical: ScrollBar {
active: true
}
}

Component {
Expand All @@ -115,7 +135,7 @@ Rectangle {
anchors.fill: parent
anchors.bottomMargin: 52
width: parent.width
anchors.topMargin: 90
anchors.topMargin: refreshButton.height == 0 ? 60 : 90
model: tasks_model.self_model
delegate: selftasksDelegate
visible: showSelfTasksList
Expand All @@ -125,6 +145,9 @@ Rectangle {
rightMargin: 10
spacing: 25
clip: true
ScrollBar.vertical: ScrollBar {
active: true
}
}

}
3 changes: 3 additions & 0 deletions nxdrive/gui/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def __init__(self, application: "Application", /) -> None:
self.openAuthenticationDialog.connect(
self.application.open_authentication_dialog
)
self.last_task_list = ""

def _json_default(self, obj: Any, /) -> Any:
export = getattr(obj, "export", None)
Expand Down Expand Up @@ -525,6 +526,8 @@ def get_Tasks_list(self, engine_uid: str, /) -> list:
wf_name = f"{wf_name} {char}" if char.isupper() else f"{wf_name}{char}"
task.workflowModelName = wf_name[1:]

if self.last_task_list == "":
self.last_task_list = str(tasks_list)
return tasks_list

@pyqtSlot(str, result=str)
Expand Down
5 changes: 4 additions & 1 deletion nxdrive/gui/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def init_gui(self) -> None:
)

self.manager.featureUpdate.connect(self._update_feature_state)
self.last_engine_uid = ""

def init_workflow(self) -> Workflow:
if not self.manager.engines:
Expand Down Expand Up @@ -573,6 +574,7 @@ def _fill_qml_context(self, context: QQmlContext, /) -> None:
"warningContent": "#FF9E00",
"lightTheme": "#FFFFFF",
"darkShadow": "#333333",
"refreshBackground": "#d0d1d6",
}

for name, value in colors.items():
Expand Down Expand Up @@ -929,7 +931,7 @@ def show_settings(self, section: str, /) -> None:

@pyqtSlot()
def show_systray(self) -> None:
# self.systray_window.close()
self.systray_window.close()
icon = self.tray_icon.geometry()

if not icon or icon.isEmpty():
Expand Down Expand Up @@ -1881,6 +1883,7 @@ def fetch_pending_tasks(self, engine: Engine, /) -> list:
except Exception:
log.info("Unable to fetch tasks")
tasks = []
self.last_engine_uid = engine.uid
return tasks

def update_status(self, engine: Engine, /) -> None:
Expand Down
23 changes: 23 additions & 0 deletions nxdrive/poll_workers.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,28 @@ def _poll(self) -> bool:
self.workflow = self.app.workflow
for engine in self.manager.engines.copy().values():
self.workflow.get_pending_tasks(engine, self._first_workflow_check)
"""
if engine.uid == self.app.last_engine_uid:
print(f">>>>> engine.uid: {engine.uid!r}")
print(f">>>>> self.app.last_engine_uid: {self.app.last_engine_uid!r}")
print(">>>>> calling loadlist")
task_list = self.app.api.get_Tasks_list(engine.uid)
username = self.app.api.get_username(engine.uid)
self.app.tasks_model.loadList(task_list, username)
#self.app.tasks_model.refresh_models()
"""
if engine.uid == self.app.last_engine_uid:
task_list = str(self.app.api.get_Tasks_list(engine.uid))
if task_list != self.app.api.last_task_list:
self.app.api.last_task_list = task_list
from .qt.imports import QObject

r_button = self.app.task_manager_window.findChild(
QObject, "refresh"
)
r_button.setProperty("height", 30)
print(">>>> ")
else:
print("!!!! ")

return True

0 comments on commit 075e130

Please sign in to comment.