2015-06-25 17:53:03 -04:00
|
|
|
import RestModel from 'discourse/models/rest';
|
|
|
|
|
2015-06-30 13:20:22 -04:00
|
|
|
let Query;
|
|
|
|
Query = RestModel.extend({
|
|
|
|
dirty: false,
|
|
|
|
|
|
|
|
markDirty: function() {
|
|
|
|
this.set('dirty', true);
|
|
|
|
}.observes('name', 'description', 'sql', 'defaults'),
|
|
|
|
|
|
|
|
markNotDirty() {
|
|
|
|
this.set('dirty', false);
|
|
|
|
},
|
|
|
|
|
|
|
|
listName: function() {
|
|
|
|
if (this.get('dirty')) {
|
|
|
|
return this.get('name') + " (*)";
|
|
|
|
}
|
|
|
|
return this.get('name');
|
|
|
|
}.property('name', 'dirty'),
|
|
|
|
|
2015-06-25 17:53:03 -04:00
|
|
|
createProperties() {
|
2015-06-26 12:16:09 -04:00
|
|
|
return this.getProperties("name");
|
|
|
|
},
|
|
|
|
|
|
|
|
updateProperties() {
|
2015-06-30 13:20:22 -04:00
|
|
|
return this.getProperties(Query.updatePropertyNames);
|
2015-06-25 17:53:03 -04:00
|
|
|
},
|
|
|
|
|
|
|
|
run() {
|
|
|
|
console.log("Called query#run");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2015-06-30 13:20:22 -04:00
|
|
|
Query.reopenClass({
|
|
|
|
updatePropertyNames: ["name", "description", "sql", "defaults"]
|
|
|
|
});
|
|
|
|
|
2015-06-25 17:53:03 -04:00
|
|
|
export default Query;
|