2015-01-25 12:02:20 +00:00
|
|
|
define([
|
2015-02-17 11:11:35 +00:00
|
|
|
'jquery', 'knockout', 'text!./Select.html', 'fgcommand', 'kojqui/button'
|
|
|
|
], function(jquery, ko, htmlString,fgcommand) {
|
|
|
|
|
2015-01-25 12:02:20 +00:00
|
|
|
function ViewModel(params) {
|
|
|
|
var self = this;
|
2015-02-17 11:11:35 +00:00
|
|
|
|
|
|
|
self.catalogs = ko.observableArray([]);
|
|
|
|
|
|
|
|
self.install = function(pack) {
|
|
|
|
console.log("install", pack);
|
|
|
|
// jquery.get('/pkg/install/'+pack.id);
|
|
|
|
fgcommand.switchAircraft(pack.id);
|
|
|
|
}
|
|
|
|
|
|
|
|
self.uninstall = function(pack) {
|
|
|
|
console.log("uninstall", pack);
|
|
|
|
}
|
|
|
|
|
|
|
|
self.select = function(pack) {
|
|
|
|
console.log("select", pack );
|
|
|
|
}
|
|
|
|
|
|
|
|
jquery.get('/pkg/catalogs', null, function(data) {
|
|
|
|
if( data.catalogs )
|
|
|
|
self.catalogs(data.catalogs);
|
2015-01-25 12:02:20 +00:00
|
|
|
|
2015-02-17 11:11:35 +00:00
|
|
|
});
|
2015-01-25 12:02:20 +00:00
|
|
|
}
|
|
|
|
|
2015-02-17 11:11:35 +00:00
|
|
|
// ViewModel.prototype.dispose = function() {
|
|
|
|
// }
|
|
|
|
|
2015-01-25 12:02:20 +00:00
|
|
|
// Return component definition
|
|
|
|
return {
|
|
|
|
viewModel : ViewModel,
|
|
|
|
template : htmlString
|
|
|
|
};
|
|
|
|
});
|