Commit 03a424a6 authored by NICLAUSSE Nicolas's avatar NICLAUSSE Nicolas

add qrc file for dashboard + update qml

parent 4c024f18
......@@ -13,12 +13,17 @@ project(dtkDistributedDashboard)
set(${PROJECT_NAME}_SOURCES
main.cpp)
set(${PROJECT_NAME}_RESOURCES
dtkDashboard.qrc)
## #################################################################
## Build rules
## #################################################################
qt5_add_RESOURCES(${PROJECT_NAME}_SOURCES_QRC ${${PROJECT_NAME}_RESOURCES})
add_executable(${PROJECT_NAME}
${${PROJECT_NAME}_SOURCES_QRC}
${${PROJECT_NAME}_SOURCES})
target_link_libraries(${PROJECT_NAME}
......
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import dtkDistributed 1.0
import "status.js" as Status
import "qrc:/Charts" 1.0
Item {
anchors.fill: parent
ListModel {
id: servers
ListElement { text: "localhost" }
ListElement { text: "nef-devel.inria.fr" }
ListElement { text: "fsophia.sophia.grid5000.fr" }
}
ListModel {
id: types
ListElement { text: "local" }
ListElement { text: "torque" }
ListElement { text: "oar" }
}
RowLayout {
id: contentRow
anchors.fill:parent
anchors.margins: 8
spacing: 16
ColumnLayout {
id: firstColumn
Layout.minimumWidth: 400
Layout.fillWidth: false
RowLayout {
id: serverrow
Label {
id: serverLabel
text: "resources:"
}
ComboBox {
id: combo
editable: true
model: servers
currentIndex: 0
Layout.fillWidth: true
onCurrentIndexChanged: {
if (combotypes) {
/* console.log("index changed " + currentText +" " + combotypes.find(Status.guess_type(currentText))) */
combotypes.currentIndex = combotypes.find(Status.guess_type(currentText))
}
}
}
Label {
id: typeLabel
text: "type:"
}
ComboBox {
id: combotypes
editable: true
model: types
Layout.minimumWidth: 80
currentIndex: 0
}
}
RowLayout {
id: pathrow
Label {
id: pathLabel
text: "path:"
}
TextEdit {
id: serverPath
Layout.fillWidth: true
text: "/home/nniclaus/git/dtk-github/build/bin/dtkDistributedServer"
}
}
RowLayout {
id: apppathrow
Label {
id: apppathLabel
text: "application path:"
}
TextEdit {
id: slavePath
Layout.fillWidth: true
text: "dtkDistributedSlave"
}
}
RowLayout {
id: actionrow
CheckBox {
id: tunnel
text: "SSH Tunnel"
checked: false
}
Button {
id: connectBotton
text: "Connect"
tooltip: "Deploy resource manager daemon on remote host"
onClicked: {
controller.deploy( Status.url(false),combotypes.currentText, tunnel.checked, serverPath.text);
controller.connect( Status.url(false), tunnel.checked, true);
Status.show()
}
}
Button {
id: statusBotton
text: "Refresh"
tooltip:"Refresh status"
onClicked: {
Status.show()
}
}
Button {
id: quitBotton
text: "Stop"
tooltip:"Deconnect and stop server"
onClicked: {
controller.stop( Status.url(false) );
}
}
}
RowLayout {
id: submitrow
Label {
id: nodesLabel
text: "nodes:"
}
SpinBox {
id: nodes
minimumValue: 1
value: 1
}
Label {
id: coresLabel
/* Layout.fillWidth: true */
text: "cores:"
}
SpinBox {
id: cores
minimumValue: 1
value: 1
}
Label {
id: walltimeLabel
text: "walltime:"
}
SpinBox {
id: wallHours
minimumValue: 0
value: 0
}
SpinBox {
id: wallMin
minimumValue: 0
value: 10
maximumValue: 59
}
SpinBox {
id: wallSec
minimumValue: 0
value: 0
maximumValue: 59
}
}
RowLayout {
id: submitrow2
Label {
id: policyLabel
text: "Distributed policy:"
}
ComboBox {
id: comboPolicies
editable: false
/* model: policies */
model: policy.types()
currentIndex: 0
Layout.fillWidth: true
}
Button {
id: submitButton
text: "Submit"
Layout.fillWidth: true
tooltip: "Submit a job on a resource manager"
onClicked: {
console.debug("submit");
Status.submit(nodes.value, cores.value, Status.setWalltime(wallHours.value,wallMin.value,wallSec.value))
}
}
}
RowLayout {
id: jobs
Item {
id: root
anchors.fill: parent
/* anchors.margins: Qt.platform.os === "osx" ? 12 : 6 */
ListModel {
id: jobModel
}
TableView{
model: jobModel
anchors.fill: parent
TableViewColumn {
role: "id"
title: "jobid"
width: 72
resizable: false
movable: false
}
TableViewColumn {
role: "nodes"
title: "Nodes"
width: 52
}
TableViewColumn {
role: "cores"
title: "Cores"
width: 52
visible: true
}
TableViewColumn {
role: "queue"
title: "Queue"
width: 100
visible: true
}
TableViewColumn {
role: "user"
title: "User"
width: 100
}
}
}
}
RowLayout {
id: myjobs
Item {
id: jobsitem
anchors.fill: parent
/* anchors.margins: Qt.platform.os === "osx" ? 12 : 6 */
ListModel {
id: myjobModel
}
TableView{
model: myjobModel
anchors.fill: parent
TableViewColumn {
role: "id"
title: "jobid"
width: 72
resizable: false
movable: false
}
TableViewColumn {
role: "nodes"
title: "Nodes"
width: 52
}
TableViewColumn {
role: "cores"
title: "Cores"
width: 52
visible: true
}
TableViewColumn {
role: "state"
title: "State"
width: 72
visible: true
}
}
}
}
}
RowLayout {
id: chartrow
ColumnLayout {
id: coresColumn
Layout.minimumWidth: 400
TextBox {
id: coresTotal
color: "#000000"
text: "Number of cores: unknown"
}
TextBox {
id: coresFree
color: "#008800"
text: "Free cores: "
}
TextBox {
id: coresBusy
color: "orange"
text: "Busy cores: "
}
Chart {
id: cores_pie;
width: 200;
height: 200;
chartAnimated: true;
chartAnimationEasing: Easing.InOutElastic;
chartAnimationDuration: 2000;
chartType: Charts.ChartType.PIE;
chartData: [];
}
}
ColumnLayout {
id: nodesColumn
Layout.minimumWidth: 400
TextBox {
id: nodesTotal
/* anchors.fill: parent */
color: "#000000"
text: "Number of nodes: unknown"
}
TextBox {
id: nodesFree
color: "#008800"
text: "Free nodes: "
}
TextBox {
id: nodesBusy
color: "orange"
text: "Busy nodes: "
}
TextBox {
id: nodesDead
color: "#880000"
text: "Dead nodes: "
}
Chart {
id: nodes_pie;
width: 200;
height: 200;
chartAnimated: true;
chartAnimationEasing: Easing.InOutElastic;
chartAnimationDuration: 2000;
chartType: Charts.ChartType.DOUGHNUT;
chartData: [];
}
}
}
}
DistributedController {
id: controller
property var jobs: { }
onJobQueued: {
console.debug("a job is queued");
myjobModel.append({"id": jobid,"nodes" : NaN, "cores" : NaN, "state": "Queued"})
}
onJobStarted: {
console.debug("a job is started");
myjobModel.setProperty(Status.getJobIndex(jobid), "state", "Running")
}
onJobEnded: {
console.debug("a job has ended");
myjobModel.remove(Status.getJobIndex(jobid))
}
onDataPosted: {
console.debug("a job has send us some data!")
console.debug("recevied:" +data),
messageDialog.text=data
messageDialog.visible=true
}
}
MessageDialog {
id: messageDialog
title: "Data received from slave"
onAccepted: {
console.log("And of course you could only agree.")
}
Component.onCompleted: visible = false
}
DistributedPolicy {
id: policy
}
}
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.0
FocusScope {
id: root
width: 200
height: 30
property Item nextInFocus;
property string text;
property string color;
Rectangle {
anchors.margins: 2
anchors.fill: parent
radius: 8
gradient: Gradient {
GradientStop { position: 0; color: "lightgray" }
GradientStop { position: 1; color: "white" }
}
border.color: "white"
border.width: 2
antialiasing: true
TextInput {
anchors.fill: parent
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
focus: true
text: root.text;
color: root.color;
KeyNavigation.tab: root.nextInFocus;
}
}
}
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
import dtkDistributed 1.0
import "status.js" as Status
import jbQuick.Charts 1.0
Item {
anchors.fill: parent
ListModel {
id: servers
ListElement { text: "localhost" }
ListElement { text: "nef-devel.inria.fr" }
ListElement { text: "fsophia.sophia.grid5000.fr" }
}
ListModel {
id: types
ListElement { text: "local" }
ListElement { text: "torque" }
ListElement { text: "oar" }
}
RowLayout {
id: contentRow
anchors.fill:parent
anchors.margins: 8
spacing: 16
ColumnLayout {
id: firstColumn
Layout.minimumWidth: 400
Layout.fillWidth: false
RowLayout {
id: serverrow
Label {
id: serverLabel
text: "resources:"
}
ComboBox {
id: combo
editable: true
model: servers
currentIndex: 0
Layout.fillWidth: true
onCurrentIndexChanged: {
if (combotypes) {
/* console.log("index changed " + currentText +" " + combotypes.find(Status.guess_type(currentText))) */
combotypes.currentIndex = combotypes.find(Status.guess_type(currentText))
}
}
}
Label {
id: typeLabel
text: "type:"
}
ComboBox {
id: combotypes
editable: true
model: types
Layout.minimumWidth: 80
currentIndex: 0
}
}
RowLayout {
id: pathrow
Label {
id: pathLabel
text: "path:"
}
TextEdit {
id: serverPath
Layout.fillWidth: true
text: "/home/nniclaus/git/dtk-github/build/bin/dtkDistributedServer"
}
}
RowLayout {
id: apppathrow
Label {
id: apppathLabel
text: "application path:"
}
TextEdit {
id: slavePath
Layout.fillWidth: true
text: "dtkDistributedSlave"
}
}
RowLayout {
id: actionrow
CheckBox {
id: tunnel
text: "SSH Tunnel"
checked: false
}
Button {
id: connectBotton
text: "Connect"
tooltip: "Deploy resource manager daemon on remote host"
onClicked: {
controller.deploy( Status.url(false),combotypes.currentText, tunnel.checked, serverPath.text);
controller.connect( Status.url(false), tunnel.checked, true);
Status.show()
}
}
Button {
id: statusBotton
text: "Refresh"
tooltip:"Refresh status"
onClicked: {
Status.show()
}
}
Button {
id: quitBotton
text: "Stop"
tooltip:"Deconnect and stop server"
onClicked: {
controller.stop( Status.url(false) );
}
}
}
RowLayout {
id: submitrow
Label {
id: nodesLabel
text: "nodes:"
}
SpinBox {
id: nodes
minimumValue: 1
value: 1
}
Label {
id: coresLabel
/* Layout.fillWidth: true */
text: "cores:"
}
SpinBox {
id: cores
minimumValue: 1
value: 1
}
Label {
id: walltimeLabel
text: "walltime:"
}
SpinBox {
id: wallHours
minimumValue: 0
value: 0
}
SpinBox {
id: wallMin
minimumValue: 0
value: 10
maximumValue: 59
}
SpinBox {
id: wallSec
minimumValue: 0
value: 0
maximumValue: 59
}
}
RowLayout {
id: submitrow2
Label {
id: policyLabel
text: "Distributed policy:"
}
ComboBox {
id: comboPolicies
editable: false
/* model: policies */
model: policy.types()
currentIndex: 0
Layout.fillWidth: true
}
Button {
id: submitButton
text: "Submit"