diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/template.spec.controller.js b/meteos_ui/static/dashboard/machine_learning/common/dataset/common.dataset.controller.js similarity index 64% rename from meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/template.spec.controller.js rename to meteos_ui/static/dashboard/machine_learning/common/dataset/common.dataset.controller.js index f683d44..ffe8461 100644 --- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/template.spec.controller.js +++ b/meteos_ui/static/dashboard/machine_learning/common/dataset/common.dataset.controller.js @@ -17,27 +17,33 @@ /** * @ngdoc controller - * @name createModelEvaluationSpecController + * @name commonDatasetController * @ngController * @description - * Controller for the model_evaluation spec step in create workflow + * Controller for the dataset step in create workflow */ angular - .module('horizon.dashboard.machine_learning.model_evaluations') - .controller('createModelEvaluationSpecController', createModelEvaluationSpecController); + .module('horizon.dashboard.machine_learning.models') + .controller('commonDatasetController', commonDatasetController); - createModelEvaluationSpecController.$inject = [ + commonDatasetController.$inject = [ '$scope', 'horizon.framework.util.i18n.gettext' ]; - function createModelEvaluationSpecController($scope, gettext) { + function commonDatasetController($scope, gettext) { 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('LibSVM'), value: 'libsvm' }, { label: gettext('Text'), value: 'text' } ]; + } })(); diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/spec.help.html b/meteos_ui/static/dashboard/machine_learning/common/dataset/dataset.help.html similarity index 50% rename from meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/spec.help.html rename to meteos_ui/static/dashboard/machine_learning/common/dataset/dataset.help.html index b18a3a8..d9eedda 100644 --- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/spec.help.html +++ b/meteos_ui/static/dashboard/machine_learning/common/dataset/dataset.help.html @@ -1,8 +1,14 @@
-
Source Dataset URL
-
URL of Dataset stored Swift or Internal HDFS.
+
Dataset Location
+
Location where Dataset stored (Swift or Internal HDFS).
Dataset Format
Dataset Format (csv or libsvm or text).
+
Dataset UUID
+
UUID of Meteos Dataset.
+
Container Name
+
Swift Container Name.
+
Object Name
+
Swift Object Name.
Swift Tenant
Tenant name of Swift.
Swift User Name
diff --git a/meteos_ui/static/dashboard/machine_learning/common/dataset/dataset.html b/meteos_ui/static/dashboard/machine_learning/common/dataset/dataset.html new file mode 100644 index 0000000..662d178 --- /dev/null +++ b/meteos_ui/static/dashboard/machine_learning/common/dataset/dataset.html @@ -0,0 +1,110 @@ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
diff --git a/meteos_ui/static/dashboard/machine_learning/datasets/create/create-workflow.service.js b/meteos_ui/static/dashboard/machine_learning/datasets/create/create-workflow.service.js index 7454e1d..eaaf96d 100644 --- a/meteos_ui/static/dashboard/machine_learning/datasets/create/create-workflow.service.js +++ b/meteos_ui/static/dashboard/machine_learning/datasets/create/create-workflow.service.js @@ -36,6 +36,12 @@ helpUrl: basePath + 'datasets/create/info/info.help.html', formName: 'datasetInfoForm' }, + { + title: gettext('Dataset'), + templateUrl: basePath + 'common/dataset/dataset.html', + helpUrl: basePath + 'common/dataset/dataset.help.html', + formName: 'commonDatasetForm' + }, { title: gettext('Spec'), templateUrl: basePath + 'datasets/create/spec/spec.html', diff --git a/meteos_ui/static/dashboard/machine_learning/datasets/create/dataset-model.js b/meteos_ui/static/dashboard/machine_learning/datasets/create/dataset-model.js index 3c06217..068f90f 100644 --- a/meteos_ui/static/dashboard/machine_learning/datasets/create/dataset-model.js +++ b/meteos_ui/static/dashboard/machine_learning/datasets/create/dataset-model.js @@ -26,6 +26,7 @@ function datasetModel(meteos) { var model = { newDatasetSpec: {}, + newCommonDataset: {}, // API methods init: init, @@ -44,6 +45,17 @@ swift_username: 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() { @@ -53,23 +65,25 @@ function createDataset() { 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); } - 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; } })(); diff --git a/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.help.html b/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.help.html index 9fc4ff4..dad3fab 100644 --- a/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.help.html +++ b/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.help.html @@ -1,14 +1,6 @@
Method
Download : Download dataset to Internal HDFS.
Parse : Parse dataset and download to Internal HDFS.
-
Source Dataset URL
-
URL of Dataset stored Swift or Internal HDFS.
Params
Parameters when parsing dataset.
-
Swift Tenant
-
Tenant name of Swift.
-
Swift User Name
-
User name of Swift.
-
Swift User Password
-
Password of Swift User.
diff --git a/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.html b/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.html index 5348277..657aef3 100644 --- a/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.html +++ b/meteos_ui/static/dashboard/machine_learning/datasets/create/spec/spec.html @@ -16,18 +16,6 @@ -
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/create-workflow.service.js b/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/create-workflow.service.js index 05a6969..01ec43f 100644 --- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/create-workflow.service.js +++ b/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/create-workflow.service.js @@ -37,10 +37,10 @@ formName: 'model_evaluationInfoForm' }, { - title: gettext('Spec'), - templateUrl: basePath + 'model_evaluations/create/spec/spec.html', - helpUrl: basePath + 'model_evaluations/create/spec/spec.help.html', - formName: 'model_evaluationSpecForm' + title: gettext('Dataset'), + templateUrl: basePath + 'common/dataset/dataset.html', + helpUrl: basePath + 'common/dataset/dataset.help.html', + formName: 'commonDatasetForm' }, ], diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/model_evaluation-model.js b/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/model_evaluation-model.js index bbb6b4a..e683fca 100644 --- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/model_evaluation-model.js +++ b/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/model_evaluation-model.js @@ -26,6 +26,7 @@ function model_evaluationModel(meteos) { var model = { newModelEvaluationSpec: {}, + newCommonDataset: {}, // API methods init: init, @@ -42,6 +43,18 @@ swift_username: 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() { @@ -51,23 +64,26 @@ function createModelEvaluation() { 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); } - 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; } })(); diff --git a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/spec.html b/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/spec.html deleted file mode 100644 index 5ba7938..0000000 --- a/meteos_ui/static/dashboard/machine_learning/model_evaluations/create/spec/spec.html +++ /dev/null @@ -1,66 +0,0 @@ -
-
- -
-
- - -
-
-
-
- -
-
- -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
diff --git a/meteos_ui/static/dashboard/machine_learning/models/create/create-workflow.service.js b/meteos_ui/static/dashboard/machine_learning/models/create/create-workflow.service.js index a9744b7..dbee964 100644 --- a/meteos_ui/static/dashboard/machine_learning/models/create/create-workflow.service.js +++ b/meteos_ui/static/dashboard/machine_learning/models/create/create-workflow.service.js @@ -36,6 +36,12 @@ helpUrl: basePath + 'models/create/info/info.help.html', formName: 'modelInfoForm' }, + { + title: gettext('Dataset'), + templateUrl: basePath + 'common/dataset/dataset.html', + helpUrl: basePath + 'common/dataset/dataset.help.html', + formName: 'commonDatasetForm' + }, { title: gettext('Spec'), templateUrl: basePath + 'models/create/spec/spec.html', diff --git a/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js b/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js index 2b22661..db7c0e9 100644 --- a/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js +++ b/meteos_ui/static/dashboard/machine_learning/models/create/model-model.js @@ -26,6 +26,7 @@ function modelModel(meteos) { var model = { newModelSpec: {}, + newCommonDataset: {}, // API methods init: init, @@ -45,6 +46,18 @@ swift_username: 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() { @@ -54,23 +67,26 @@ function createModel() { 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); } - 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; } })(); diff --git a/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.help.html b/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.help.html index 5945c3e..4000cee 100644 --- a/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.help.html +++ b/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.help.html @@ -3,14 +3,4 @@
Prediction Model Type.
Model Params
Parameters when creating model.
-
Source Dataset URL
-
URL of Dataset stored Swift or Internal HDFS.
-
Dataset Format
-
Dataset Format (csv or libsvm or text).
-
Swift Tenant
-
Tenant name of Swift.
-
Swift User Name
-
User name of Swift.
-
Swift User Password
-
Password of Swift User.
diff --git a/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html b/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html index 27e6627..f2ce43d 100644 --- a/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html +++ b/meteos_ui/static/dashboard/machine_learning/models/create/spec/spec.html @@ -24,66 +24,5 @@ placeholder="{$ 'Parameters when creating model.'|translate $}"> -
-
- - -
-
-
-
- -
-
- -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-