Change field type of dataset

Modify field type so that user can select
from datasets without specify manually.

Change-Id: Idce312380a3c97c9e5653395a9bb4350c3655548
This commit is contained in:
Hiroyuki Eguchi 2017-02-09 21:09:45 +09:00
parent 9acd826f7a
commit f954622ae2
2 changed files with 19 additions and 5 deletions

View File

@ -28,11 +28,13 @@
commonDatasetController.$inject = [
'$scope',
'horizon.framework.util.i18n.gettext'
'horizon.framework.util.i18n.gettext',
'horizon.app.core.openstack-service-api.meteos'
];
function commonDatasetController($scope, gettext) {
function commonDatasetController($scope, gettext, meteos) {
var ctrl = this;
ctrl.datasets = [];
ctrl.datasetLocationOptions = [
{ label: gettext('Swift'), value: 'swift' },
@ -45,5 +47,15 @@
{ label: gettext('Text'), value: 'text' }
];
init();
function init() {
meteos.getDatasets().success(onGetDatasets);
}
function onGetDatasets(response) {
ctrl.datasets = response.items;
}
}
})();

View File

@ -65,9 +65,11 @@
<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 $}">
<select class="form-control"
ng-model="model.newCommonDataset.dataset_uuid"
ng-required="true"
ng-options="dataset.id as dataset.name + ':' + dataset.id for dataset in ctrl.datasets">
</select>
</div>
</div>
<div class="col-xs-12"