Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

Commit

Permalink
Merge branch 'hotfix/69'
Browse files Browse the repository at this point in the history
Close #69
  • Loading branch information
weierophinney committed Jul 23, 2015
2 parents 4bd95cc + 785f494 commit 1daff7a
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 25 deletions.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

<script src="apigility-ui/6a8334db.vendor.js" charset="utf-8"></script>

<script src="apigility-ui/1b07d878.apigility.js" charset="utf-8"></script>
<script src="apigility-ui/c22d22af.apigility.js" charset="utf-8"></script>

<script>
$(document).ready(function () {
Expand Down
3 changes: 3 additions & 0 deletions src/apigility-ui/modal/new-service.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@
vm.loading = false;
return;
}
if (vm.rest.table_name) {
vm.dbServices = [{ table_name : vm.rest.table_name, columns : [] }];
}
if (vm.dbServices.length == 0) {
vm.alert = 'Please choose at least one table';
vm.loading = false;
Expand Down
3 changes: 2 additions & 1 deletion src/apigility-ui/modal/new-service.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ <h3>No DB Adapters Present</h3>
</div>
<div ng-if="vm.tables && vm.tables.length == 0 && !vm.discovering && !vm.loading">
<h3>No tables found</h3>
<p>Autodiscovery could not find any existing tables, or those tables have already been exposed through DB-connected services.</p>
<p>Autodiscovery could not find any existing tables, you can insert the table name here:</p>
<input type="text" class="form-control" ng-model="vm.rest.table_name" ng-disabled="vm.loading" placeholder="Insert the table name">
</div>
</tab>
<tab heading="Doctrine Connected" ng-if="vm.hasDoctrine" active="vm.tabs.doctrine">
Expand Down
18 changes: 6 additions & 12 deletions src/apigility-ui/rest/rest.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@
vm.restName = $stateParams.rest;
vm.httpMethods = [ 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
vm.disabled = !SidebarService.isLastVersion(vm.version, vm.apiName);
vm.selectorNames = [];

function initGeneral() {
vm.selectorNames = [];
vm.adapterNames = [];

vm.tags = {
accept_whitelist : [],
content_type_whitelist : [],
Expand All @@ -31,11 +33,12 @@
});

api.getDatabase(function(err, response){
vm.db = response;
for(var i in response.db_adapter){
vm.adapterNames.push(response.db_adapter[i].adapter_name);
}
});

api.getDoctrineAdapters(function(err, response) {

vm.doctrine = response.doctrine_adapter;
});

Expand Down Expand Up @@ -65,15 +68,6 @@
vm.doctrineMetadata = response;
});
}
if (vm.rest.hasOwnProperty('table_name') &&
vm.rest.hasOwnProperty('db')) {
for (var i = 0; i < vm.db.db_adapter.length; i++) {
if (vm.db.db_adapter[i].adapter_name == vm.rest.adapter_name) {
vm.adapter = vm.db.db_adapter[i];
break;
}
}
}
vm.rest.source_code = [
{ name : 'Collection Class', classname: vm.rest.collection_class },
{ name : 'Entity Class', classname: vm.rest.entity_class },
Expand Down
10 changes: 9 additions & 1 deletion src/apigility-ui/rest/rest.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,15 @@ <h3 class="panel-title">
<div class="form-group">
<label for="db_adapter_name" class="col-sm-2 control-label">Adapter name</label>
<div class="col-sm-8">
<select class="form-control" id="db_adapter_name" ng-model="vm.adapter" ng-options="db.adapter_name for db in vm.db.db_adapter" ng-disabled="vm.disabled"></select>
<ui-select
ng-model="vm.rest.adapter_name"
ng-disabled="vm.disabled">
<ui-select-match placeholder="Select db adapter name...">{{$select.selected}}</ui-select-match>
<ui-select-choices
repeat="adapter in vm.adapterNames | filter: $select.search">
<div ng-bind-html="adapter | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
</div>
</div>
<div class="form-group">
Expand Down
11 changes: 9 additions & 2 deletions src/apigility-ui/service/api.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,11 +758,18 @@
var doctrine_route = isDoctrine ? 'doctrine/' : '';
xhr.get(agApiPath + '/module/' + module + '/' + version + '/autodiscovery/' + doctrine_route + name)
.then(function (response) {
growl.success('Doctrine service(s) created');
return callback(true, response);
})
.catch(function (err) {
growl.error('Error creating Doctrine service(s)', {ttl: -1});
if (err.data.detail) {
growl.error(err.data.detail, {ttl: -1});
} else {
if (isDoctrine) {
growl.error('Error getting Doctrine service(s)', {ttl: -1});
} else {
growl.error('Error getting db service(s)', {ttl: -1});
}
}
return callback(true, null);
});
};
Expand Down
13 changes: 11 additions & 2 deletions src/apigility-ui/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,8 @@ angular.module("apigility-ui/modal/new-service.html", []).run(["$templateCache",
" </div>\n" +
" <div ng-if=\"vm.tables && vm.tables.length == 0 && !vm.discovering && !vm.loading\">\n" +
" <h3>No tables found</h3>\n" +
" <p>Autodiscovery could not find any existing tables, or those tables have already been exposed through DB-connected services.</p>\n" +
" <p>Autodiscovery could not find any existing tables, you can insert the table name here:</p>\n" +
" <input type=\"text\" class=\"form-control\" ng-model=\"vm.rest.table_name\" ng-disabled=\"vm.loading\" placeholder=\"Insert the table name\">\n" +
" </div>\n" +
" </tab>\n" +
" <tab heading=\"Doctrine Connected\" ng-if=\"vm.hasDoctrine\" active=\"vm.tabs.doctrine\">\n" +
Expand Down Expand Up @@ -1994,7 +1995,15 @@ angular.module("apigility-ui/rest/rest.html", []).run(["$templateCache", functio
" <div class=\"form-group\">\n" +
" <label for=\"db_adapter_name\" class=\"col-sm-2 control-label\">Adapter name</label>\n" +
" <div class=\"col-sm-8\">\n" +
" <select class=\"form-control\" id=\"db_adapter_name\" ng-model=\"vm.adapter\" ng-options=\"db.adapter_name for db in vm.db.db_adapter\" ng-disabled=\"vm.disabled\"></select>\n" +
" <ui-select\n" +
" ng-model=\"vm.rest.adapter_name\"\n" +
" ng-disabled=\"vm.disabled\">\n" +
" <ui-select-match placeholder=\"Select db adapter name...\">{{$select.selected}}</ui-select-match>\n" +
" <ui-select-choices\n" +
" repeat=\"adapter in vm.adapterNames | filter: $select.search\">\n" +
" <div ng-bind-html=\"adapter | highlight: $select.search\"></div>\n" +
" </ui-select-choices>\n" +
" </ui-select>\n" +
" </div>\n" +
" </div>\n" +
" <div class=\"form-group\">\n" +
Expand Down
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<link href="vendor/angular-growl-v2/build/angular-growl.css" rel="stylesheet">
<link href="vendor/angular-ui-tree/dist/angular-ui-tree.min.css" rel="stylesheet">
<link href="vendor/ladda/dist/ladda-themeless.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="apigility-ui/css/dashboard.css" rel="stylesheet" type="text/css">
<!-- endbuild -->
Expand Down

0 comments on commit 1daff7a

Please sign in to comment.