Magic Search, Local server, updates.
Port to horizon trunk. Switch to using Magic Search. Support testing app catalog servers. Also, the beginings of faceted search support. Change-Id: Ia0b3e808ebd623a58880086614c8b3d105b9b62f
This commit is contained in:
parent
57a958be87
commit
67ffbbb443
|
@ -20,7 +20,8 @@ How to try this package
|
|||
git clone http://github.com/openstack/horizon.git
|
||||
git clone http://github.com/stackforge/apps-catalog-ui.git
|
||||
cd horizon
|
||||
git fetch https://review.openstack.org/openstack/horizon refs/changes/73/206773/4 && git checkout FETCH_HEAD
|
||||
git fetch https://review.openstack.org/openstack/horizon refs/changes/73/206773/13 && git checkout FETCH_HEAD
|
||||
git fetch https://review.openstack.org/openstack/horizon refs/changes/82/201582/7 && git cherry-pick FETCH_HEAD
|
||||
./run_tests.sh -f --docs
|
||||
cp ./openstack_dashboard/local/local_settings.py.example ./openstack_dashboard/local/local_settings.py
|
||||
pushd ../apps-catalog-ui
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
appComponentCatalogTableCtrl
|
||||
]).service('appCatalogModel', [
|
||||
'$http',
|
||||
'horizon.openstack-service-api.heat',
|
||||
'horizon.openstack-service-api.glance',
|
||||
'horizon.app.core.openstack-service-api.heat',
|
||||
'horizon.app.core.openstack-service-api.glance',
|
||||
appCatalogModel
|
||||
]).directive('stars', stars);
|
||||
|
||||
|
@ -66,6 +66,25 @@
|
|||
$scope.assets_filtered.push(asset);
|
||||
}
|
||||
});
|
||||
var types = {};
|
||||
angular.forEach($scope.assets_filtered, function(asset){
|
||||
types[asset.service.type] = true;
|
||||
});
|
||||
//FIXME dedup some of this later.
|
||||
var map = {'heat': 'Orchestration', 'glance': 'Images'};
|
||||
var options = [];
|
||||
|
||||
for (var type in types) {
|
||||
if(type in map) {
|
||||
options.push({'key':type, 'label':map[type]});
|
||||
}
|
||||
}
|
||||
angular.forEach($scope.asset_filter_facets, function(facet){
|
||||
if(facet.name == 'service.type') {
|
||||
//FIXME Doesn't seem to work currently
|
||||
// facet['options'] = options;
|
||||
}
|
||||
});
|
||||
notify();
|
||||
};
|
||||
this.toggle_service_filter = function(service_name) {
|
||||
|
@ -81,57 +100,59 @@
|
|||
this.register_callback = function(callback) {
|
||||
callbacks.push(callback);
|
||||
};
|
||||
var heat_req = {
|
||||
url: 'http://apps.openstack.org/static/heat_templates.json',
|
||||
headers: {'X-Requested-With': undefined}
|
||||
}
|
||||
$http(heat_req).success(function(data) {
|
||||
for (var i in data.assets){
|
||||
var asset = data.assets[i];
|
||||
$scope.assets.push(asset);
|
||||
var process = function(asset) {
|
||||
var url = asset.attributes.url;
|
||||
heatAPI.validate({'template_url': url}).success(function(data){
|
||||
asset.validated = true;
|
||||
notify();
|
||||
}).error(function(data, status){
|
||||
var str = 'ERROR: Could not retrieve template:'
|
||||
asset.validated = 'unsupported';
|
||||
if(status == 400 && data.slice(0, str.length) == str) {
|
||||
asset.validated = 'error'
|
||||
}
|
||||
notify();
|
||||
});
|
||||
this.init = function(app_catalog_url) {
|
||||
var heat_req = {
|
||||
url: app_catalog_url + '/static/heat_templates.json',
|
||||
headers: {'X-Requested-With': undefined}
|
||||
}
|
||||
$http(heat_req).success(function(data) {
|
||||
for (var i in data.assets){
|
||||
var asset = data.assets[i];
|
||||
$scope.assets.push(asset);
|
||||
var process = function(asset) {
|
||||
var url = asset.attributes.url;
|
||||
heatAPI.validate({'template_url': url}, true).success(function(data){
|
||||
asset.validated = true;
|
||||
notify();
|
||||
}).error(function(data, status){
|
||||
var str = 'ERROR: Could not retrieve template:'
|
||||
asset.validated = 'unsupported';
|
||||
if(status == 400 && data.slice(0, str.length) == str) {
|
||||
asset.validated = 'error'
|
||||
}
|
||||
notify();
|
||||
});
|
||||
}
|
||||
process(asset);
|
||||
}
|
||||
process(asset);
|
||||
update_found_assets($scope)
|
||||
});
|
||||
var glance_req = {
|
||||
url: app_catalog_url + '/static/glance_images.json',
|
||||
headers: {'X-Requested-With': undefined}
|
||||
}
|
||||
update_found_assets($scope)
|
||||
});
|
||||
var glance_req = {
|
||||
url: 'http://apps.openstack.org/static/glance_images.json',
|
||||
headers: {'X-Requested-With': undefined}
|
||||
}
|
||||
glanceAPI.getImages().success(function(data) {
|
||||
$scope.glance_images = data;
|
||||
var glance_names = {}
|
||||
for (var i in data.items){
|
||||
var name = data.items[i]['name'];
|
||||
glance_names[name] = {'id': data.items[i]['id']};
|
||||
}
|
||||
$scope.glance_names = glance_names;
|
||||
update_found_assets($scope)
|
||||
});
|
||||
$http(glance_req).success(function(data) {
|
||||
for (var i in data.assets){
|
||||
var asset = data.assets[i];
|
||||
$scope.assets.push(asset);
|
||||
}
|
||||
$scope.glance_loaded = true;
|
||||
update_found_assets($scope);
|
||||
});
|
||||
glanceAPI.getImages().success(function(data) {
|
||||
$scope.glance_images = data;
|
||||
var glance_names = {}
|
||||
for (var i in data.items){
|
||||
var name = data.items[i]['name'];
|
||||
glance_names[name] = {'id': data.items[i]['id']};
|
||||
}
|
||||
$scope.glance_names = glance_names;
|
||||
update_found_assets($scope)
|
||||
});
|
||||
$http(glance_req).success(function(data) {
|
||||
for (var i in data.assets){
|
||||
var asset = data.assets[i];
|
||||
$scope.assets.push(asset);
|
||||
}
|
||||
$scope.glance_loaded = true;
|
||||
update_found_assets($scope);
|
||||
});
|
||||
};
|
||||
this.asset_filter_strings = {
|
||||
cancel: gettext('Cancel'),
|
||||
prompt: gettext('Prompt'),
|
||||
prompt: gettext('Search'),
|
||||
remove: gettext('Remove'),
|
||||
text: gettext('Text')
|
||||
};
|
||||
|
@ -140,6 +161,21 @@
|
|||
name: 'name',
|
||||
label: gettext('Name'),
|
||||
singleton: true
|
||||
},
|
||||
{
|
||||
name: 'license',
|
||||
label: gettext('License'),
|
||||
singleton: true
|
||||
},
|
||||
{
|
||||
name: 'service.type',
|
||||
label: gettext('Service Type'),
|
||||
//FIXME make dynamic later.
|
||||
options: [
|
||||
{key: 'heat', label: 'Orchestration'},
|
||||
{key: 'glance', label: 'Images'}
|
||||
],
|
||||
singleton: true
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -149,6 +185,7 @@
|
|||
$scope.service_filters_selections = appCatalogModel.service_filters_selections;
|
||||
$scope.asset_filter_strings = appCatalogModel.asset_filter_strings;
|
||||
$scope.asset_filter_facets = appCatalogModel.asset_filter_facets;
|
||||
$scope.init = appCatalogModel.init;
|
||||
}
|
||||
|
||||
function appCatalogTableCtrl($scope, $http, $timeout, appCatalogModel) {
|
||||
|
|
|
@ -12,13 +12,10 @@ Service Types: <label ng-repeat="service in service_filters">
|
|||
<thead>
|
||||
<tr>
|
||||
<th colspan="4">
|
||||
<hz-search-bar group-classes="input-group-sm" icon-classes="fa-search"></hz-search-bar>
|
||||
<!--
|
||||
<st-magic-search>
|
||||
<hz-magic-search-bar filter-facets="{$ asset_filter_facets $}" filter-strings="asset_filter_strings">
|
||||
<hz-magic-search-bar filter-facets="asset_filter_facets" filter-strings="asset_filter_strings">
|
||||
</hz-magic-search-bar>
|
||||
</st-magic-search>
|
||||
-->
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{% block main %}
|
||||
|
||||
<div ng-cloak
|
||||
ng-controller="appCatalogTableCtrl">
|
||||
ng-controller="appCatalogTableCtrl" ng-init="init('{{ APP_CATALOG_URL }}')">
|
||||
<ng-include src="'{{ STATIC_URL }}dashboard/project/app_catalog/main_panel.html'"></ng-include>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from horizon import views
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class IndexView(views.APIView):
|
||||
|
@ -6,5 +7,5 @@ class IndexView(views.APIView):
|
|||
template_name = 'app_catalog/index.html'
|
||||
|
||||
def get_data(self, request, context, *args, **kwargs):
|
||||
# Add data to the context here...
|
||||
context['APP_CATALOG_URL'] = getattr(settings, 'APP_CATALOG_URL', 'https://apps.openstack.org')
|
||||
return context
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{% block main %}
|
||||
|
||||
<div ng-cloak
|
||||
ng-controller="appComponentCatalogTableCtrl">
|
||||
ng-controller="appComponentCatalogTableCtrl" ng-init="init('{{ APP_CATALOG_URL }}')">
|
||||
<ng-include src="'{{ STATIC_URL }}dashboard/project/app_catalog/main_panel.html'"></ng-include>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
from horizon import views
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
class IndexView(views.APIView):
|
||||
|
@ -6,6 +7,6 @@ class IndexView(views.APIView):
|
|||
template_name = 'component_catalog/index.html'
|
||||
|
||||
def get_data(self, request, context, *args, **kwargs):
|
||||
# Add data to the context here...
|
||||
context['APP_CATALOG_URL'] = getattr(settings, 'APP_CATALOG_URL', 'https://apps.openstack.org')
|
||||
return context
|
||||
|
||||
|
|
Loading…
Reference in New Issue