Add a common Dataset dialog
Dataset parameters are needed when creating some resources for instance Dataset, Model, Model Evaluation. Add a common dataset dialog to avoid redundant expression.
This commit is contained in:
parent
c34df76c7a
commit
2feb484c93
|
@ -17,27 +17,33 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ngdoc controller
|
* @ngdoc controller
|
||||||
* @name createModelEvaluationSpecController
|
* @name commonDatasetController
|
||||||
* @ngController
|
* @ngController
|
||||||
* @description
|
* @description
|
||||||
* Controller for the model_evaluation spec step in create workflow
|
* Controller for the dataset step in create workflow
|
||||||
*/
|
*/
|
||||||
angular
|
angular
|
||||||
.module('horizon.dashboard.machine_learning.model_evaluations')
|
.module('horizon.dashboard.machine_learning.models')
|
||||||
.controller('createModelEvaluationSpecController', createModelEvaluationSpecController);
|
.controller('commonDatasetController', commonDatasetController);
|
||||||
|
|
||||||
createModelEvaluationSpecController.$inject = [
|
commonDatasetController.$inject = [
|
||||||
'$scope',
|
'$scope',
|
||||||
'horizon.framework.util.i18n.gettext'
|
'horizon.framework.util.i18n.gettext'
|
||||||
];
|
];
|
||||||
|
|
||||||
function createModelEvaluationSpecController($scope, gettext) {
|
function commonDatasetController($scope, gettext) {
|
||||||
var ctrl = this;
|
var ctrl = this;
|
||||||
|
|
||||||
ctrl.model_evaluationFormatOptions = [
|
ctrl.datasetLocationOptions = [
|
||||||
|
{ label: gettext('Swift'), value: 'swift' },
|
||||||
|
{ label: gettext('Internal HDFS'), value: 'internal' }
|
||||||
|
];
|
||||||
|
|
||||||
|
ctrl.datasetFormatOptions = [
|
||||||
{ label: gettext('CSV'), value: 'csv' },
|
{ label: gettext('CSV'), value: 'csv' },
|
||||||
{ label: gettext('LibSVM'), value: 'libsvm' },
|
{ label: gettext('LibSVM'), value: 'libsvm' },
|
||||||
{ label: gettext('Text'), value: 'text' }
|
{ label: gettext('Text'), value: 'text' }
|
||||||
];
|
];
|
||||||
|
|
||||||
}
|
}
|
||||||
})();
|
})();
|
|
@ -1,8 +1,14 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt translate>Source Dataset URL</dt>
|
<dt translate>Dataset Location</dt>
|
||||||
<dd translate>URL of Dataset stored Swift or Internal HDFS.</dd>
|
<dd translate>Location where Dataset stored (Swift or Internal HDFS).</dd>
|
||||||
<dt translate>Dataset Format</dt>
|
<dt translate>Dataset Format</dt>
|
||||||
<dd translate>Dataset Format (csv or libsvm or text).</dd>
|
<dd translate>Dataset Format (csv or libsvm or text).</dd>
|
||||||
|
<dt translate>Dataset UUID</dt>
|
||||||
|
<dd translate>UUID of Meteos Dataset.</dd>
|
||||||
|
<dt translate>Container Name</dt>
|
||||||
|
<dd translate>Swift Container Name.</dd>
|
||||||
|
<dt translate>Object Name</dt>
|
||||||
|
<dd translate>Swift Object Name.</dd>
|
||||||
<dt translate>Swift Tenant</dt>
|
<dt translate>Swift Tenant</dt>
|
||||||
<dd translate>Tenant name of Swift.</dd>
|
<dd translate>Tenant name of Swift.</dd>
|
||||||
<dt translate>Swift User Name</dt>
|
<dt translate>Swift User Name</dt>
|
|
@ -0,0 +1,110 @@
|
||||||
|
<div ng-controller="commonDatasetController as ctrl">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="location">
|
||||||
|
<translate>Dataset Location</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<div class="form-field">
|
||||||
|
<div class="btn-group">
|
||||||
|
<label class="btn btn-default"
|
||||||
|
ng-repeat="option in ctrl.datasetLocationOptions"
|
||||||
|
ng-model="model.newCommonDataset.location"
|
||||||
|
uib-btn-radio="option.value">{$ ::option.label $}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="format">
|
||||||
|
<translate>Dataset Format</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<div class="form-field">
|
||||||
|
<div class="btn-group">
|
||||||
|
<label class="btn btn-default"
|
||||||
|
ng-repeat="option in ctrl.datasetFormatOptions"
|
||||||
|
ng-model="model.newCommonDataset.format"
|
||||||
|
uib-btn-radio="option.value">{$ ::option.label $}</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12"
|
||||||
|
ng-if="model.newCommonDataset.location == 'swift'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="container-name">
|
||||||
|
<translate>Container Name</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="container-name" type="text" class="form-control" id="container-name"
|
||||||
|
ng-model="model.newCommonDataset.container_name"
|
||||||
|
placeholder="{$ 'Swift Container Name.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12"
|
||||||
|
ng-if="model.newCommonDataset.location == 'swift'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="object-name">
|
||||||
|
<translate>Object Name</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="object-name" type="text" class="form-control" id="object-name"
|
||||||
|
ng-model="model.newCommonDataset.object_name"
|
||||||
|
placeholder="{$ 'Swift Object Name.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12"
|
||||||
|
ng-if="model.newCommonDataset.location == 'internal'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="dataset-uuid">
|
||||||
|
<translate>Dataset UUID</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="dataset-uuid" type="text" class="form-control" id="dataset-uuid"
|
||||||
|
ng-model="model.newCommonDataset.dataset_uuid"
|
||||||
|
placeholder="{$ 'UUID of Meteos Dataset.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12"
|
||||||
|
ng-if="model.newCommonDataset.location == 'swift'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="swift-tenant">
|
||||||
|
<translate>Swift Tenant</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="swift-tenant" type="text" class="form-control" id="swift-tenant"
|
||||||
|
ng-model="model.newCommonDataset.swift_tenant"
|
||||||
|
placeholder="{$ 'Tenant name of Swift.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12"
|
||||||
|
ng-if="model.newCommonDataset.location == 'swift'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="swift-username">
|
||||||
|
<translate>Swift User Name</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="swift-username" type="text" class="form-control" id="swift-username"
|
||||||
|
ng-model="model.newCommonDataset.swift_username"
|
||||||
|
placeholder="{$ 'User name of Swift.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12"
|
||||||
|
ng-if="model.newCommonDataset.location == 'swift'">
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="control-label" for="swift-password">
|
||||||
|
<translate>Swift User Password</translate>
|
||||||
|
<span class="hz-icon-required fa fa-asterisk"></span>
|
||||||
|
</label>
|
||||||
|
<input name="swift-password" type="text" class="form-control" id="swift-password"
|
||||||
|
ng-model="model.newCommonDataset.swift_password"
|
||||||
|
placeholder="{$ 'Password of Swift User.'|translate $}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -36,6 +36,12 @@
|
||||||
helpUrl: basePath + 'datasets/create/info/info.help.html',
|
helpUrl: basePath + 'datasets/create/info/info.help.html',
|
||||||
formName: 'datasetInfoForm'
|
formName: 'datasetInfoForm'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: gettext('Dataset'),
|
||||||
|
templateUrl: basePath + 'common/dataset/dataset.html',
|
||||||
|
helpUrl: basePath + 'common/dataset/dataset.help.html',
|
||||||
|
formName: 'commonDatasetForm'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: gettext('Spec'),
|
title: gettext('Spec'),
|
||||||
templateUrl: basePath + 'datasets/create/spec/spec.html',
|
templateUrl: basePath + 'datasets/create/spec/spec.html',
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
function datasetModel(meteos) {
|
function datasetModel(meteos) {
|
||||||
var model = {
|
var model = {
|
||||||
newDatasetSpec: {},
|
newDatasetSpec: {},
|
||||||
|
newCommonDataset: {},
|
||||||
|
|
||||||
// API methods
|
// API methods
|
||||||
init: init,
|
init: init,
|
||||||
|
@ -44,6 +45,17 @@
|
||||||
swift_username: null,
|
swift_username: null,
|
||||||
swift_password: null
|
swift_password: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
model.newCommonDataset = {
|
||||||
|
location: null,
|
||||||
|
format: null,
|
||||||
|
dataset_uuid: null,
|
||||||
|
container_name: null,
|
||||||
|
object_name: null,
|
||||||
|
swift_tenant: null,
|
||||||
|
swift_username: null,
|
||||||
|
swift_password: null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -53,23 +65,25 @@
|
||||||
|
|
||||||
function createDataset() {
|
function createDataset() {
|
||||||
var finalSpec = angular.copy(model.newDatasetSpec);
|
var finalSpec = angular.copy(model.newDatasetSpec);
|
||||||
|
var commonDataset = angular.copy(model.newCommonDataset);
|
||||||
|
var url = "";
|
||||||
|
|
||||||
cleanNullProperties(finalSpec);
|
if(commonDataset.location == 'swift'){
|
||||||
|
url = 'swift://' +
|
||||||
|
commonDataset.container_name + '/' +
|
||||||
|
commonDataset.object_name;
|
||||||
|
}else{
|
||||||
|
url = 'internal://' + commonDataset.dataset_uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
finalSpec.source_dataset_url = url;
|
||||||
|
finalSpec.swift_tenant = commonDataset.swift_tenant;
|
||||||
|
finalSpec.swift_username = commonDataset.swift_username;
|
||||||
|
finalSpec.swift_password = commonDataset.swift_password;
|
||||||
|
|
||||||
return meteos.createDataset(finalSpec);
|
return meteos.createDataset(finalSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanNullProperties(finalSpec) {
|
|
||||||
// Initially clean fields that don't have any value.
|
|
||||||
// Not only "null", blank too.
|
|
||||||
for (var key in finalSpec) {
|
|
||||||
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
|
||||||
|| finalSpec[key] === "") {
|
|
||||||
delete finalSpec[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,14 +1,6 @@
|
||||||
<dl>
|
<dl>
|
||||||
<dt translate>Method</dt>
|
<dt translate>Method</dt>
|
||||||
<dd translate>Download : Download dataset to Internal HDFS.</br>Parse : Parse dataset and download to Internal HDFS.</br></dd>
|
<dd translate>Download : Download dataset to Internal HDFS.</br>Parse : Parse dataset and download to Internal HDFS.</br></dd>
|
||||||
<dt translate>Source Dataset URL</dt>
|
|
||||||
<dd translate>URL of Dataset stored Swift or Internal HDFS.</dd>
|
|
||||||
<dt translate>Params</dt>
|
<dt translate>Params</dt>
|
||||||
<dd translate>Parameters when parsing dataset.</dd>
|
<dd translate>Parameters when parsing dataset.</dd>
|
||||||
<dt translate>Swift Tenant</dt>
|
|
||||||
<dd translate>Tenant name of Swift.</dd>
|
|
||||||
<dt translate>Swift User Name</dt>
|
|
||||||
<dd translate>User name of Swift.</dd>
|
|
||||||
<dt translate>Swift User Password</dt>
|
|
||||||
<dd translate>Password of Swift User.</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -16,18 +16,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="dataset-source-dataset-url">
|
|
||||||
<translate>Source Dataset URL</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="dataset-source-dataset-url" type="text" class="form-control" id="dataset-source-dataset-url"
|
|
||||||
ng-model="model.newDatasetSpec.source_dataset_url"
|
|
||||||
ng-required="true"
|
|
||||||
placeholder="{$ 'URL of Dataset stored Swift or Internal HDFS.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
<div class="col-xs-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label" for="dataset-params">
|
<label class="control-label" for="dataset-params">
|
||||||
|
@ -39,38 +27,5 @@
|
||||||
placeholder="{$ 'Parameters when parsing dataset.'|translate $}">
|
placeholder="{$ 'Parameters when parsing dataset.'|translate $}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="dataset-swift-tenant">
|
|
||||||
<translate>Swift Tenant</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="dataset-swift-tenant" type="text" class="form-control" id="dataset-swift-tenant"
|
|
||||||
ng-model="model.newDatasetSpec.swift_tenant"
|
|
||||||
placeholder="{$ 'Tenant name of Swift.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="dataset-swift-username">
|
|
||||||
<translate>Swift User Name</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="dataset-swift-username" type="text" class="form-control" id="dataset-swift-username"
|
|
||||||
ng-model="model.newDatasetSpec.swift_username"
|
|
||||||
placeholder="{$ 'User name of Swift.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="dataset-swift-password">
|
|
||||||
<translate>Swift User Password</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="dataset-swift-password" type="text" class="form-control" id="dataset-swift-password"
|
|
||||||
ng-model="model.newDatasetSpec.swift_password"
|
|
||||||
placeholder="{$ 'Password of Swift User.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -37,10 +37,10 @@
|
||||||
formName: 'model_evaluationInfoForm'
|
formName: 'model_evaluationInfoForm'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: gettext('Spec'),
|
title: gettext('Dataset'),
|
||||||
templateUrl: basePath + 'model_evaluations/create/spec/spec.html',
|
templateUrl: basePath + 'common/dataset/dataset.html',
|
||||||
helpUrl: basePath + 'model_evaluations/create/spec/spec.help.html',
|
helpUrl: basePath + 'common/dataset/dataset.help.html',
|
||||||
formName: 'model_evaluationSpecForm'
|
formName: 'commonDatasetForm'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
function model_evaluationModel(meteos) {
|
function model_evaluationModel(meteos) {
|
||||||
var model = {
|
var model = {
|
||||||
newModelEvaluationSpec: {},
|
newModelEvaluationSpec: {},
|
||||||
|
newCommonDataset: {},
|
||||||
|
|
||||||
// API methods
|
// API methods
|
||||||
init: init,
|
init: init,
|
||||||
|
@ -42,6 +43,18 @@
|
||||||
swift_username: null,
|
swift_username: null,
|
||||||
swift_password: null
|
swift_password: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
model.newCommonDataset = {
|
||||||
|
location: null,
|
||||||
|
format: null,
|
||||||
|
dataset_uuid: null,
|
||||||
|
dataset_format: null,
|
||||||
|
container_name: null,
|
||||||
|
object_name: null,
|
||||||
|
swift_tenant: null,
|
||||||
|
swift_username: null,
|
||||||
|
swift_password: null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -51,23 +64,26 @@
|
||||||
|
|
||||||
function createModelEvaluation() {
|
function createModelEvaluation() {
|
||||||
var finalSpec = angular.copy(model.newModelEvaluationSpec);
|
var finalSpec = angular.copy(model.newModelEvaluationSpec);
|
||||||
|
var commonDataset = angular.copy(model.newCommonDataset);
|
||||||
|
var url = "";
|
||||||
|
|
||||||
cleanNullProperties(finalSpec);
|
if(commonDataset.location == 'swift'){
|
||||||
|
url = 'swift://' +
|
||||||
|
commonDataset.container_name + '/' +
|
||||||
|
commonDataset.object_name;
|
||||||
|
}else{
|
||||||
|
url = 'internal://' + commonDataset.dataset_uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
finalSpec.source_dataset_url = url;
|
||||||
|
finalSpec.dataset_format = commonDataset.dataset_format;
|
||||||
|
finalSpec.swift_tenant = commonDataset.swift_tenant;
|
||||||
|
finalSpec.swift_username = commonDataset.swift_username;
|
||||||
|
finalSpec.swift_password = commonDataset.swift_password;
|
||||||
|
|
||||||
return meteos.createModelEvaluation(finalSpec);
|
return meteos.createModelEvaluation(finalSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanNullProperties(finalSpec) {
|
|
||||||
// Initially clean fields that don't have any value.
|
|
||||||
// Not only "null", blank too.
|
|
||||||
for (var key in finalSpec) {
|
|
||||||
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
|
||||||
|| finalSpec[key] === "") {
|
|
||||||
delete finalSpec[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -1,66 +0,0 @@
|
||||||
<div ng-controller="createModelEvaluationSpecController as ctrl">
|
|
||||||
<div class="row">
|
|
||||||
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model_evaluation-source-dataset-url">
|
|
||||||
<translate>Source Dataset URL</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model_evaluation-source-dataset-url" type="text" class="form-control" id="model_evaluation-source-dataset-url"
|
|
||||||
ng-model="model.newModelEvaluationSpec.source_dataset_url"
|
|
||||||
ng-required="true"
|
|
||||||
placeholder="{$ 'URL of Dataset stored Swift of Internal HDFS.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model_evaluation-dataset-format">
|
|
||||||
<translate>Dataset Format</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<div class="form-field">
|
|
||||||
<div class="btn-group">
|
|
||||||
<label class="btn btn-default"
|
|
||||||
ng-repeat="option in ctrl.model_evaluationFormatOptions"
|
|
||||||
ng-model="model.newModelEvaluationSpec.dataset_format"
|
|
||||||
uib-btn-radio="option.value">{$ ::option.label $}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model_evaluation-swift-tenant">
|
|
||||||
<translate>Swift Tenant</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model_evaluation-swift-tenant" type="text" class="form-control" id="model_evaluation-swift-tenant"
|
|
||||||
ng-model="model.newModelEvaluationSpec.swift_tenant"
|
|
||||||
placeholder="{$ 'Tenant name of Swift.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model_evaluation-swift-username">
|
|
||||||
<translate>Swift User Name</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model_evaluation-swift-username" type="text" class="form-control" id="model_evaluation-swift-username"
|
|
||||||
ng-model="model.newModelEvaluationSpec.swift_username"
|
|
||||||
placeholder="{$ 'User name of Swift.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model_evaluation-swift-password">
|
|
||||||
<translate>Swift User Password</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model_evaluation-swift-password" type="text" class="form-control" id="model_evaluation-swift-password"
|
|
||||||
ng-model="model.newModelEvaluationSpec.swift_password"
|
|
||||||
placeholder="{$ 'Password of Swift User.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
|
@ -36,6 +36,12 @@
|
||||||
helpUrl: basePath + 'models/create/info/info.help.html',
|
helpUrl: basePath + 'models/create/info/info.help.html',
|
||||||
formName: 'modelInfoForm'
|
formName: 'modelInfoForm'
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: gettext('Dataset'),
|
||||||
|
templateUrl: basePath + 'common/dataset/dataset.html',
|
||||||
|
helpUrl: basePath + 'common/dataset/dataset.help.html',
|
||||||
|
formName: 'commonDatasetForm'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: gettext('Spec'),
|
title: gettext('Spec'),
|
||||||
templateUrl: basePath + 'models/create/spec/spec.html',
|
templateUrl: basePath + 'models/create/spec/spec.html',
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
function modelModel(meteos) {
|
function modelModel(meteos) {
|
||||||
var model = {
|
var model = {
|
||||||
newModelSpec: {},
|
newModelSpec: {},
|
||||||
|
newCommonDataset: {},
|
||||||
|
|
||||||
// API methods
|
// API methods
|
||||||
init: init,
|
init: init,
|
||||||
|
@ -45,6 +46,18 @@
|
||||||
swift_username: null,
|
swift_username: null,
|
||||||
swift_password: null
|
swift_password: null
|
||||||
};
|
};
|
||||||
|
|
||||||
|
model.newCommonDataset = {
|
||||||
|
location: null,
|
||||||
|
format: null,
|
||||||
|
dataset_uuid: null,
|
||||||
|
dataset_format: null,
|
||||||
|
container_name: null,
|
||||||
|
object_name: null,
|
||||||
|
swift_tenant: null,
|
||||||
|
swift_username: null,
|
||||||
|
swift_password: null
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
@ -54,23 +67,26 @@
|
||||||
|
|
||||||
function createModel() {
|
function createModel() {
|
||||||
var finalSpec = angular.copy(model.newModelSpec);
|
var finalSpec = angular.copy(model.newModelSpec);
|
||||||
|
var commonDataset = angular.copy(model.newCommonDataset);
|
||||||
|
var url = "";
|
||||||
|
|
||||||
cleanNullProperties(finalSpec);
|
if(commonDataset.location == 'swift'){
|
||||||
|
url = 'swift://' +
|
||||||
|
commonDataset.container_name + '/' +
|
||||||
|
commonDataset.object_name;
|
||||||
|
}else{
|
||||||
|
url = 'internal://' + commonDataset.dataset_uuid;
|
||||||
|
}
|
||||||
|
|
||||||
|
finalSpec.source_dataset_url = url;
|
||||||
|
finalSpec.dataset_format = commonDataset.dataset_format;
|
||||||
|
finalSpec.swift_tenant = commonDataset.swift_tenant;
|
||||||
|
finalSpec.swift_username = commonDataset.swift_username;
|
||||||
|
finalSpec.swift_password = commonDataset.swift_password;
|
||||||
|
|
||||||
return meteos.createModel(finalSpec);
|
return meteos.createModel(finalSpec);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cleanNullProperties(finalSpec) {
|
|
||||||
// Initially clean fields that don't have any value.
|
|
||||||
// Not only "null", blank too.
|
|
||||||
for (var key in finalSpec) {
|
|
||||||
if (finalSpec.hasOwnProperty(key) && finalSpec[key] === null
|
|
||||||
|| finalSpec[key] === "") {
|
|
||||||
delete finalSpec[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
|
@ -3,14 +3,4 @@
|
||||||
<dd translate>Prediction Model Type.</dd>
|
<dd translate>Prediction Model Type.</dd>
|
||||||
<dt translate>Model Params</dt>
|
<dt translate>Model Params</dt>
|
||||||
<dd translate>Parameters when creating model.</dd>
|
<dd translate>Parameters when creating model.</dd>
|
||||||
<dt translate>Source Dataset URL</dt>
|
|
||||||
<dd translate>URL of Dataset stored Swift or Internal HDFS.</dd>
|
|
||||||
<dt translate>Dataset Format</dt>
|
|
||||||
<dd translate>Dataset Format (csv or libsvm or text).</dd>
|
|
||||||
<dt translate>Swift Tenant</dt>
|
|
||||||
<dd translate>Tenant name of Swift.</dd>
|
|
||||||
<dt translate>Swift User Name</dt>
|
|
||||||
<dd translate>User name of Swift.</dd>
|
|
||||||
<dt translate>Swift User Password</dt>
|
|
||||||
<dd translate>Password of Swift User.</dd>
|
|
||||||
</dl>
|
</dl>
|
||||||
|
|
|
@ -24,66 +24,5 @@
|
||||||
placeholder="{$ 'Parameters when creating model.'|translate $}">
|
placeholder="{$ 'Parameters when creating model.'|translate $}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model-source-dataset-url">
|
|
||||||
<translate>Source Dataset URL</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model-source-dataset-url" type="text" class="form-control" id="model-source-dataset-url"
|
|
||||||
ng-model="model.newModelSpec.source_dataset_url"
|
|
||||||
ng-required="true"
|
|
||||||
placeholder="{$ 'URL of Model stored Swift of Internal HDFS.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model-dataset-format">
|
|
||||||
<translate>Dataset Format</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<div class="form-field">
|
|
||||||
<div class="btn-group">
|
|
||||||
<label class="btn btn-default"
|
|
||||||
ng-repeat="option in ctrl.modelFormatOptions"
|
|
||||||
ng-model="model.newModelSpec.dataset_format"
|
|
||||||
uib-btn-radio="option.value">{$ ::option.label $}</label>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model-swift-tenant">
|
|
||||||
<translate>Swift Tenant</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model-swift-tenant" type="text" class="form-control" id="model-swift-tenant"
|
|
||||||
ng-model="model.newModelSpec.swift_tenant"
|
|
||||||
placeholder="{$ 'Tenant name of Swift.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model-swift-username">
|
|
||||||
<translate>Swift User Name</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model-swift-username" type="text" class="form-control" id="model-swift-username"
|
|
||||||
ng-model="model.newModelSpec.swift_username"
|
|
||||||
placeholder="{$ 'User name of Swift.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="col-xs-12">
|
|
||||||
<div class="form-group">
|
|
||||||
<label class="control-label" for="model-swift-password">
|
|
||||||
<translate>Swift User Password</translate>
|
|
||||||
<span class="hz-icon-required fa fa-asterisk"></span>
|
|
||||||
</label>
|
|
||||||
<input name="model-swift-password" type="text" class="form-control" id="model-swift-password"
|
|
||||||
ng-model="model.newModelSpec.swift_password"
|
|
||||||
placeholder="{$ 'Password of Swift User.'|translate $}">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue