Mercurial > lada > lada-client
annotate app/model/Messung.js @ 958:5d57c6c53e20
Made the grids more robust against erroneous data
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 10 Nov 2015 09:50:06 +0100 |
parents | 023e622f9551 |
children | a2c2039bb5d9 |
rev | line source |
---|---|
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 /** |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 * Model class for Messungen |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 Ext.define('Lada.model.Messung', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.data.Model', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 fields: [{ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 name: 'id' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 }, { |
691 | 18 name: 'owner', |
19 type: 'boolean' | |
20 }, { | |
693 | 21 name: 'readonly', |
702
0c8e689f3bcb
Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents:
698
diff
changeset
|
22 type: 'boolean', |
0c8e689f3bcb
Added readonly to models, Probenzusatzwertgrid does now check wheter a record is readonly and disables the roweditor in such a case
Dustin Demuth <dustin@intevation.de>
parents:
698
diff
changeset
|
23 persist: false |
693 | 24 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 name: 'probeId' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 name: 'mmtId' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 name: 'nebenprobenNr' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
30 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
31 name: 'messdauer' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 name: 'messzeitpunkt', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
34 convert: function(v) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 if (!v) { |
584
8ed6c3fb8bda
Fixed indention and constructor call.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
563
diff
changeset
|
36 return new Date(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 } |
563
c3169d4847dd
Datumsumwandlung Timestamp -> Datum korrigiert
Dustin Demuth <dustin@intevation.de>
parents:
548
diff
changeset
|
38 return new Date(v); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 defaultValue: new Date() |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 }, { |
945
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
711
diff
changeset
|
42 name: 'status', |
023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents:
711
diff
changeset
|
43 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 name: 'fertig', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 type: 'boolean' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 name: 'letzteAenderung', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 type: 'date', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 convert: function(v) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 if (!v) { |
584
8ed6c3fb8bda
Fixed indention and constructor call.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
563
diff
changeset
|
51 return new Date(); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
52 } |
563
c3169d4847dd
Datumsumwandlung Timestamp -> Datum korrigiert
Dustin Demuth <dustin@intevation.de>
parents:
548
diff
changeset
|
53 return new Date(v); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
54 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
55 defaultValue: new Date() |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
56 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
57 name: 'geplant', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
58 type: 'boolean' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
59 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 name: 'messungsIdAlt' |
689
c07419f07a0c
Added field treeModified to models.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
584
diff
changeset
|
61 }, { |
711
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
62 name: 'treeModified', |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
63 serialize: function(value) { |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
64 if (value === '') { |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
65 return null; |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
66 } |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
67 return value; |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
68 } |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
69 }, { |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
70 name: 'parentModified', |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
71 serialize: function(value) { |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
72 if (value === '') { |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
73 return null; |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
74 } |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
75 return value; |
af16a257d5f6
Updated the model to have correct tree_modified value and parent_modified
Raimund Renkert <raimund.renkert@intevation.de>
parents:
702
diff
changeset
|
76 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 }], |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 idProperty: 'id', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
80 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
81 proxy: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
82 type: 'rest', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 url: 'lada-server/messung', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 reader: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 type: 'json', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 root: 'data' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 }); |