-
Notifications
You must be signed in to change notification settings - Fork 2
/
cuba-entity.html
41 lines (35 loc) · 1.18 KB
/
cuba-entity.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../cuba-app/cuba-app-aware-behavior.html">
<link rel="import" href="cuba-data-loading-behavior.html">
<!--
The `cuba-entity` element provides an ability to load specific entity by Id.
-->
<dom-module id="cuba-entity">
<script>
Polymer({
is: 'cuba-entity',
behaviors: [CubaAppAwareBehavior, CubaDataLoadingBehavior],
properties: {
/**
* Entity name as specified in domain model class via `@Entity` annotation e.g. sec$User
*/
entityName: String,
entityId: String,
/**
* Name of the [view](See https://doc.cuba-platform.com/manual-latest/views.html) which is used for loading entities.
*/
view: {
type: String,
value: null
}
},
observers: ['_optionsChanged(app, entityName, entityId, view, auto)'],
_load: function(fetchOptions) {
if (this.app == null || this.entityName == null || this.entityId == null) {
return;
}
return this.app.loadEntity(this.entityName, this.entityId, {view: this.view}, fetchOptions);
}
});
</script>
</dom-module>