Created
June 18, 2013 22:28
-
-
Save majimenezp/5810061 to your computer and use it in GitHub Desktop.
Modelo de entidad aplicacion para emberjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
S.RESTAdapter.map('App.Aplicacion', { | |
nombre: { key: 'Nombre' }, | |
instancias: { key: 'Instancias', embedded: 'always' }, | |
uid: { key: 'UId' } | |
}); | |
DS.RESTAdapter.map('App.Instancia', { | |
primaryKey:"id", | |
id_ubicacion: { key: 'IdUbicacion' }, | |
base_de_datos: { key: 'BasesDeDatos', embedded: 'always' } | |
}); | |
DS.RESTAdapter.map('App.Base_de_datos', { | |
servidor: { key: 'Servidor' }, | |
usuario: { key: 'Usuario' }, | |
password: { key: 'Password' }, | |
nombre_base_de_datos: { key: 'NombreBaseDeDatos' }, | |
uid: { key: 'UId' }, | |
cronexp: { key: 'CronExp' }, | |
tipodb: { key: 'TipoDB' } | |
}); | |
App.Aplicacion = DS.Model.extend({ | |
nombre: DS.attr('string'), | |
uid:DS.attr('string'), | |
instancias: DS.hasMany('App.Instancia', { embedded: true }) | |
,numero_instancias: function () { | |
return this.get('instancias.length'); | |
}.property("instancias") | |
}); | |
App.Instancia = DS.Model.extend({ | |
aplicacion: DS.belongsTo('App.Aplicacion'), | |
id_ubicacion: DS.attr("number"), | |
base_de_datos: DS.hasMany('App.Base_de_datos', { embedded: true }), | |
ubicacioninfo: function () { | |
return App.Ubicacion.find(this.get("id_ubicacion")); | |
}.property("id_ubicacion") | |
}); | |
App.Base_de_datos = DS.Model.extend({ | |
instalacion: DS.belongsTo('App.Instancia'), | |
servidor: DS.attr("string"), | |
usuario: DS.attr("string"), | |
password: DS.attr("string"), | |
nombre_base_de_datos: DS.attr("string"), | |
uid: DS.attr('string'), | |
cronexp: DS.attr('string'), | |
tipodb: DS.attr("number") | |
, tipodbinfo: function () { | |
idtipo = this.get("tipodb"); | |
return App.tiposDb.filter(function (data) { return data.id == idtipo })[0].get("desc"); | |
}.property("tipodb") | |
}); | |
DS.RESTAdapter.configure("plurals", { | |
aplicacion: "aplicaciones", | |
instancia: "instancias", | |
base_de_datos: "baseDeDatos" | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment