Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Docker-in-Docker (DinD) capabilities of public runners deactivated.
More info
Open sidebar
tev
plugin_event
Commits
c7327a48
Commit
c7327a48
authored
Apr 20, 2017
by
LE GAC Renaud
Browse files
Add the singleton Event with the method getHistoryDataConfig.
parent
e4e15d71
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
12 deletions
+134
-12
modules/plugin_event/event.py
modules/plugin_event/event.py
+1
-1
static/app.js
static/app.js
+0
-11
static/plugin_event/src/Event.js
static/plugin_event/src/Event.js
+133
-0
No files found.
modules/plugin_event/event.py
View file @
c7327a48
...
...
@@ -43,7 +43,7 @@ class Event(object):
dbui
.
plugins_paths
[
"event"
]
=
{
"css"
:
"static/plugin_event/resources/css/"
,
"debug"
:
None
,
"debug"
:
"static/plugin_event/src/Event.js"
,
"lg"
:
"static/plugin_event/locale/event-lang-%s.js"
%
lg
,
"libmin"
:
"static/plugin_event/event-min.js"
}
...
...
static/app.js
View file @
c7327a48
...
...
@@ -24,17 +24,6 @@ Ext.require("Ext.direct.RemotingProvider");
Ext
.
require
(
"
Ext.EventManager
"
);
Ext
.
require
(
"
Ext.tip.QuickTipManager
"
);
Ext
.
require
(
"
Event.form.field.Graph
"
);
Ext
.
require
(
"
Event.form.field.UserData
"
);
Ext
.
require
(
"
Event.form.field.UserDataMultiDefault
"
);
Ext
.
require
(
"
Event.form.field.Summary
"
);
Ext
.
require
(
"
Event.form.plugin.UserDataConsistency
"
);
Ext
.
require
(
"
Event.grid.plugin.RowWidget
"
);
Ext
.
require
(
"
Event.grid.HistoryFilter
"
);
Ext
.
require
(
"
Event.grid.plugin.HistoryContextMenu
"
);
Ext
.
require
(
"
Event.grid.RowEventData
"
);
Ext
.
require
(
"
Event.grid.RowHistoryData
"
);
Ext
.
onReady
(
function
(){
"
use strict
"
;
...
...
static/plugin_event/src/Event.js
0 → 100644
View file @
c7327a48
/**
* Common utilities.
*/
Ext
.
define
(
'
Event
'
,
{
singleton
:
true
,
uses
:
[
"
Event.form.field.Graph
"
,
"
Event.form.field.UserData
"
,
"
Event.form.field.UserDataMultiDefault
"
,
"
Event.form.field.Summary
"
,
"
Event.form.plugin.UserDataConsistency
"
,
"
Event.grid.plugin.RowWidget
"
,
"
Event.grid.HistoryFilter
"
,
"
Event.grid.plugin.HistoryContextMenu
"
,
"
Event.grid.RowEventData
"
,
"
Event.grid.RowHistoryData
"
],
/**
*
* The history.data field can be manipulated by an Ext.grid.property.Grid.
* The configuration of the property grid depend on the event.
*
* This helper function return the configuration of the property grid
* using the event definition.
*
* @param {Ext.data.Store} events
* contains definitions for all events.
*
* @param {Number} idEvent
* the event identifier
*
* @return {Object}
*
*/
getHistoryDataConfig
:
function
(
events
,
idEvent
)
{
"
use strict
"
;
var
record
=
events
.
findRecord
(
"
EventsId
"
,
idEvent
),
eventData
=
record
.
get
(
"
EventsData
"
),
defaultValues
=
{},
sourceConfig
=
{};
Ext
.
Object
.
each
(
eventData
,
function
(
property
)
{
var
defaultValue
=
eventData
[
property
].
value
||
null
,
type
=
eventData
[
property
].
type
||
null
,
editor
,
li
,
map
;
sourceConfig
[
property
]
=
{
type
:
type
};
switch
(
type
)
{
case
'
boolean
'
:
defaultValue
=
Boolean
(
defaultValue
);
break
;
case
'
date
'
:
defaultValue
=
new
Date
(
defaultValue
);
editor
=
Ext
.
create
(
'
Ext.form.field.Date
'
,
{
anchor
:
"
100%
"
,
format
:
'
Y-m-dTH:i:s
'
,
useStrict
:
true
});
sourceConfig
[
property
].
editor
=
editor
;
break
;
case
'
float
'
:
defaultValue
=
Number
(
defaultValue
);
editor
=
Ext
.
create
(
'
Ext.form.field.Number
'
,
{
decimalPrecision
:
3
,
decimalSeparator
:
'
.
'
});
sourceConfig
[
property
].
editor
=
editor
;
break
;
case
'
integer
'
:
defaultValue
=
Number
(
defaultValue
);
editor
=
Ext
.
create
(
'
Ext.form.field.Number
'
,
{
allowDecimals
:
false
,
allowExponential
:
false
});
sourceConfig
[
property
].
editor
=
editor
;
break
;
case
'
reference
'
:
map
=
defaultValue
.
split
(
'
.
'
);
editor
=
Ext
.
create
(
'
Dbui.form.field.ComboBoxUserReset
'
,
{
store
:
map
[
0
]
+
'
Store
'
,
displayField
:
Dbui
.
encodeField
(
map
[
0
],
map
[
1
]),
valueField
:
Dbui
.
encodeField
(
map
[
0
],
map
[
1
])
});
defaultValue
=
null
;
sourceConfig
[
property
].
editor
=
editor
;
break
;
case
'
string
'
:
//
// the editor is a combobox when the default
// is a list of values.
//
li
=
Ext
.
JSON
.
decode
(
defaultValue
,
true
);
if
(
Ext
.
isArray
(
li
))
{
defaultValue
=
li
.
length
?
li
[
0
]
:
null
;
li
.
forEach
(
function
(
value
,
index
)
{
li
[
index
]
=
{
key
:
value
,
value
:
value
};
});
editor
=
Ext
.
create
(
'
Ext.form.field.ComboBox
'
,
{
store
:
{
fields
:
[
'
key
'
,
'
value
'
],
data
:
li
,
xtype
:
'
store
'
},
displayField
:
'
key
'
,
valueField
:
'
value
'
});
sourceConfig
[
property
].
editor
=
editor
;
}
break
;
}
defaultValues
[
property
]
=
defaultValue
;
});
return
sourceConfig
;
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment