Merge "add translation and cleanup resource-browser-item.html"

This commit is contained in:
Jenkins 2016-08-25 12:22:42 +00:00 committed by Gerrit Code Review
commit f7b6ecdb4c
4 changed files with 212 additions and 220 deletions

View File

@ -19,11 +19,13 @@
angular
.module('horizon.dashboard.developer.resource-browser')
.controller('horizon.dashboard.developer.resource-browser.ResourceBrowserItemController', ResourceBrowserItemController);
.controller('horizon.dashboard.developer.resource-browser.ResourceBrowserItemController',
ResourceBrowserItemController);
ResourceBrowserItemController.$inject = [
'$scope',
'horizon.dashboard.developer.resource-browser.BASE_ROUTE'
'horizon.dashboard.developer.resource-browser.BASE_ROUTE',
'horizon.framework.widgets.toast.service'
];
/**
@ -32,7 +34,7 @@
* @description
* This controller allows the launching of any actions registered for resource types
*/
function ResourceBrowserItemController($scope, baseRoute) {
function ResourceBrowserItemController($scope, baseRoute, toastService) {
/**
* Directive data (Private)
@ -85,11 +87,11 @@
* Implementation
*/
function fullySupported() {
return (supportsGenericDetailsView() &&
return supportsGenericDetailsView() &&
supportsGenericTableView() &&
hasSummaryView() &&
hasGlobalActions() &&
hasItemActions());
hasItemActions();
}
function getName() {
@ -97,13 +99,11 @@
}
function supportsGenericTableView() {
return (
getName() &&
return getName() &&
hasListFunction() &&
hasProperties() &&
hasTableColumns() &&
hasSummaryView()
);
hasSummaryView();
}
function hasListFunction() {
@ -126,10 +126,6 @@
return typeData.tableColumns.length > 0;
}
function getProperties() {
return Object.keys(typeData.getProperties());
}
function getProperties() {
var properties = typeData.getProperties();
var keys = Object.keys(properties);
@ -153,12 +149,11 @@
}
function supportsGenericDetailsView() {
return (hasDetailView() &&
hasLoadFunction());
return hasDetailView() && hasLoadFunction();
}
function hasDetailView() {
return typeData.detailsViews.length > 0
return typeData.detailsViews.length > 0;
}
function getDetailViewLabels() {
@ -176,21 +171,21 @@
function loadFunctionNameLabel() {
var label = gettext("Not Set");
if (hasLoadFunction()) {
label = typeData.load.name
label = typeData.load.name;
}
return label;
}
function hasGlobalActions() {
return typeData.globalActions.length != 0
return typeData.globalActions.length !== 0;
}
function hasBatchActions() {
return typeData.batchActions.length != 0
return typeData.batchActions.length !== 0;
}
function hasItemActions() {
return typeData.itemActions.length != 0;
return typeData.itemActions.length !== 0;
}
function hasSummaryView() {
@ -219,7 +214,7 @@
}
function loadFailed(reason) {
window.alert(gettext("resource load failed" + ":" + reason));
toastService.add('error', gettext("resource load failed: " + reason));
}
}
}

View File

@ -8,15 +8,16 @@
</div>
</div>
<div>
<div class="panel-body" collapse="ctrl.collapsed">
<!-- Has generic table view -->
<div class="row"><label>
<div class="row">
<div class="col-xs-12">
<h4>
<span class="fa" ng-class="ctrl.supportsGenericTableView ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<a ng-href="{$ ctrl.tableUrl $}">
<label>Generic Table View:</label>
<label translate>Generic Table View:</label>
</a>
</h4>
</div>
@ -26,7 +27,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.nameLabel ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Names:</label>
<label translate>Names:</label>
<ul ng-repeat="label in ctrl.allNameLabels">
<li>{$ label $}</li>
</ul>
@ -37,7 +38,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.hasListFunction ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>List Function:</label> {$ ctrl.listFunctionNameLabel $}
<label translate>List Function:</label> {$ ctrl.listFunctionNameLabel $}
</div>
</div>
@ -45,7 +46,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.hasProperties ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Properties:</label>
<label translate>Properties:</label>
<ul ng-repeat="label in ctrl.propertyLabels">
<li>{$ label $}</li>
</ul>
@ -56,7 +57,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.hasTableColumns > 0 ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Table Columns:</label>
<label translate>Table Columns:</label>
<ul ng-repeat="label in ctrl.tableColumnLabels">
<li>{$ label $}</li>
</ul>
@ -67,7 +68,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.hasSummaryView ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Summary Template URL:</label> {$ ctrl.summaryTemplateUrl $}
<label translate>Summary Template URL:</label> {$ ctrl.summaryTemplateUrl $}
</div>
</div>
@ -76,7 +77,7 @@
<div class="col-xs-12">
<h4>
<span class="fa" ng-class="ctrl.supportsGenericDetailsView ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Supports Details View:</label>
<label translate>Supports Details View:</label>
</h4>
</div>
</div>
@ -85,7 +86,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.hasLoadFunction ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Load Function:</label> {$ ctrl.loadFunctionNameLabel $}
<label translate>Load Function:</label> {$ ctrl.loadFunctionNameLabel $}
</div>
</div>
@ -93,7 +94,7 @@
<div class="row">
<div class="col-xs-offset-1 col-xs-11">
<span class="fa" ng-class="ctrl.hasDetailView ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Details Views:</label>
<label translate>Details Views:</label>
<ul ng-repeat="label in ctrl.detailViewLabels">
<li>{$ label $}</li>
</ul>{$ ctrl.detailsViewsLabel $}
@ -105,7 +106,7 @@
<div class="col-xs-12">
<h4>
<span class="fa" ng-class="ctrl.hasGlobalActions ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Global Actions:</label>
<label translate>Global Actions:</label>
</h4>
</div>
</div>
@ -115,8 +116,7 @@
<div class="col-xs-3 col-xs-offset-1">
{$ action.template.text $}
</div>
<div class="col-xs-4">
</div>
<div class="col-xs-4"></div>
<div class="col-xs-4">
<input type="button"
value="{$ action.template.text $}"
@ -131,7 +131,7 @@
<div class="col-xs-12">
<h4>
<span class="fa" ng-class="ctrl.hasBatchActions ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Batch Actions:</label>
<label translate>Batch Actions:</label>
</h4>
</div>
</div>
@ -141,8 +141,7 @@
<div class="col-xs-3 col-xs-offset-1">
{$ action.template.text $}
</div>
<div class="col-xs-4">
</div>
<div class="col-xs-4"></div>
<div class="col-xs-4">
<input type="button"
value="{$ action.template.text $}"
@ -157,7 +156,7 @@
<div class="col-xs-12">
<h4>
<span class="fa" ng-class="ctrl.hasItemActions ? 'text-success fa-check' : 'text-warning fa-warning'"></span>
<label>Item Actions:</label>
<label translate>Item Actions:</label>
</h4>
</div>
</div>
@ -172,20 +171,18 @@
<form name="resourceIdForm">
<input ng-model="ctrl.resourceId"
type="text"
placeholder="Resource ID(s)"/>
placeholder="{$ 'Resource ID(s)'|translate $}"/>
</form>
</div>
<div class="col-xs-4">
<div ng-repeat="action in ctrl.itemActions">
<input
type="button"
<input type="button"
value="{$ action.template.text $}"
ng-click="ctrl.onActionSelected(action)"/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- end of panel body -->
</div><!-- end of container div -->

View File

@ -1,4 +1,4 @@
<h2>
<h2 translate>
Registered Resource Types
</h2>
<div ng-repeat="(type, typeData) in ctrl.resourceTypes">

View File

@ -42,7 +42,7 @@
<li class="scope">
<input type="text"
class="form-control input-sm"
placeholder="Prefix"
placeholder="{$ 'PRefix'|translate $}"
ng-show="resource_type.selected"
ng-model="resource_type.prefix"/>
</li>