[Lada-commits] [PATCH 13 of 13] Added Status into Messungen listing

Wald Commits scm-commit at wald.intevation.org
Wed Jul 3 16:09:29 CEST 2013


# HG changeset patch
# User Torsten Irländer <torsten.irlaender at intevation.de>
# Date 1372860502 -7200
# Node ID 738d657d8b6b4e6c8a6beb9b4365513725e7259f
# Parent  52d105d4e93fe9303e12eb451bf20710bb54de4d
Added Status into Messungen listing.

diff -r 52d105d4e93f -r 738d657d8b6b app/model/Status.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/model/Status.js	Wed Jul 03 16:08:22 2013 +0200
@@ -0,0 +1,33 @@
+Ext.define('Lada.model.Status', {
+    extend: 'Ext.data.Model',
+    fields: [
+        {name: "sId"},
+        {name: "messungsId"},
+        {name: "probeId"},
+        {name: "erzeuger"},
+        {name: "status"},
+        {name: "sdatum", type: 'date', convert: ts2date, defaultValue: new Date()},
+        {name: "stext"}
+    ],
+    idProperty: "sId",
+    proxy: {
+        type: 'rest',
+        appendId: true, //default
+        url: 'server/rest/status',
+        reader: {
+            type: 'json',
+            root: 'data'
+        }
+    },
+    getEidi: function() {
+        var sid =  this.get('sId');
+        var messId = this.get('messungsId');
+        var probeId = this.get('probeId');
+        return "/" + sid + "/" + messId + "/" + probeId;
+    }
+});
+
+function ts2date(v, record){
+    // Converts a timestamp into a date object.
+    return new Date(v);
+}
diff -r 52d105d4e93f -r 738d657d8b6b app/store/Status.js
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/store/Status.js	Wed Jul 03 16:08:22 2013 +0200
@@ -0,0 +1,5 @@
+Ext.define('Lada.store.Status', {
+    extend: 'Ext.data.Store',
+    model: 'Lada.model.Status'
+});
+
diff -r 52d105d4e93f -r 738d657d8b6b app/view/messungen/List.js
--- a/app/view/messungen/List.js	Wed Jul 03 16:06:51 2013 +0200
+++ b/app/view/messungen/List.js	Wed Jul 03 16:08:22 2013 +0200
@@ -34,7 +34,24 @@
             {header: 'NPR-Nr.', dataIndex: "nebenprobenNr", width: 50},
             {header: 'MMT', dataIndex: "mmtId", width: 50},
             {header: 'Messzeit', dataIndex: "messdauer"},
-            {header: 'Status'},
+            {
+                header: 'Status',
+                dataIndex: 'id',
+                renderer: function(value) {
+                    var sstore = Ext.getStore('Status');
+                    sstore.load({
+                        params: {
+                            probeId: value.probeId,
+                            messungsId: value.messungsId
+                        }
+                    });
+                    if (sstore.getTotalCount() === 0) {
+                        return "unbekannt";
+                    } else {
+                        return sstore.last().get('status');
+                    }
+                }
+            },
             {header: 'OK-Flag', dataIndex: "fertig"},
             {
                 header: 'Anzahl Nuklide',


More information about the Lada-commits mailing list