/**
* Get ks file path from tic-core via RESTful API
- * @URI /api/exports:format
+ * @URI /api/exports
* @TYPE POST
*/
- router.post('/exports/:format', function (req, res) {
+ router.post('/exports', function (req, res) {
logger.info('an api called that /api/exports');
core.getExports(req, res);
});
* Get recipe data from tic-core via RESTful API
*/
ticcore.getImports = function getImports (req, res) {
+ logger.info('getImports');
var postData = JSON.stringify(req.body);
var addr = this.server.address();
};
ticcore.getExports = function getExports(req, res) {
- var postData = JSON.stringify(req.body);
- logger.info('getExports: ' + postData);
+ logger.info('getExports');
+ var format = req.body.format;
+ var defaultOutdir = AppConfig.TIC_WEB.PATH_RECIPE_EXPORT;
+ // FIXME: outdir setting for ks file when image creation
+ if (req.body.outdir) {
+ defaultOutdir = req.body.outdir;
+ }
+
+ var body = {
+ recipes: req.body.recipes,
+ packages: req.body.packages,
+ outdir: defaultOutdir
+ }
+ var postData = JSON.stringify(body);
var addr = this.server.address();
-
var options = {
host: addr.address,
port: AppConfig.TIC_CORE.PORT || addr.port + 1,
method: 'POST',
path: _.template(EXPORT_FORMAT)({
- format: req.params.format
+ format: format
}),
headers: {
'Content-Type': 'application/json',
function showExportDialog() {
Util.showConfirmDialog('Are you sure you want to export recipe?')
.then(function () {
- return Util.POST(CONFIG.EVENT.PACKAGE.EXPORT + CONFIG.EVENT.PACKAGE.EXPORT_RECIPE, {
+ return Util.POST(CONFIG.EVENT.PACKAGE.EXPORT, {
+ format: CONFIG.EVENT.PACKAGE.EXPORT_RECIPE,
recipes: require('js/page/settings').getRecipeStore(),
- packages: _.map(require('js/page/package').getCheckedPackages(), 'name'),
- outdir: CONFIG.TIC_WEB.PATH_RECIPE_EXPORT
+ packages: _.map(require('js/page/package').getCheckedPackages(), 'name')
});
})
.then(function (res) {
});
}
+ // TODO: move to server side
function getRecipeFile(newJobModel) {
var msgData = {
+ format: AppConfig.EVENT.PACKAGE.EXPORT_KS,
recipes: Settings.getRecipeStore(),
packages: _.map(checkedPackagesList, 'name'),
outdir: newJobModel.getJobPath()
}
function getKickStartFile () {
- return Util.POST(AppConfig.EVENT.PACKAGE.EXPORT + AppConfig.EVENT.PACKAGE.EXPORT_KS, msgData);
+ return Util.POST(AppConfig.EVENT.PACKAGE.EXPORT, msgData);
}
return getKickStartFile()