some little refactor, deleting assets
This commit is contained in:
parent
7a116bfdf2
commit
5c4bd18cdc
21 changed files with 139 additions and 36 deletions
|
@ -4,7 +4,9 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import magpie
|
||||
import magpie.Forms as Forms
|
||||
import magpie.Components as Components
|
||||
|
||||
Item {
|
||||
StackView {
|
||||
|
@ -27,4 +29,17 @@ Item {
|
|||
onSuccess: stack.pop()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Magpie
|
||||
function onDisplayError (err) {
|
||||
modal.status = err;
|
||||
modal.open();
|
||||
}
|
||||
}
|
||||
|
||||
Components.Modal {
|
||||
id: modal
|
||||
closable: true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,21 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
|
||||
import magpie
|
||||
|
||||
Item {
|
||||
id: line
|
||||
required property string title
|
||||
required property string icon
|
||||
required property color color
|
||||
required property string balance
|
||||
required property int assetId
|
||||
|
||||
signal error (err:string)
|
||||
|
||||
Row {
|
||||
readonly property int iconSize: height
|
||||
readonly property int freespace: width - iconSize - spacing * children.length - 1
|
||||
readonly property int freespace: width - deleteButton.width - iconSize - spacing * children.length - 1
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: 5
|
||||
|
@ -49,5 +54,16 @@ Item {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
color: palette.text
|
||||
}
|
||||
|
||||
Button {
|
||||
id: deleteButton
|
||||
text: qsTr("Delete")
|
||||
flat: true
|
||||
height: parent.height
|
||||
onClicked: API.deleteAsset(line.assetId, function(err) {
|
||||
if (err)
|
||||
Magpie.displayError("Error deleting asset " + line.title + ": " + err);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ Item {
|
|||
modal.status = qsTr("Creating new asset ") + " " + title + "...";
|
||||
modal.open();
|
||||
|
||||
API.addAsset(title, icon, function (err, result) {
|
||||
API.addAsset(title, icon, "blue", function (err, result) {
|
||||
if (!modal.inProgress)
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue