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

Autodiscover #179

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ public function getServiceConfig()
$model = $services->get('ZF\Apigility\Admin\Model\DbAdapterModel');
return new Model\DbAdapterResource($model);
},
'ZF\Apigility\Admin\Model\AutodiscoverTableModel' => function ($services) {
if (!$services->has('ZF\Apigility\Admin\Model\DbAdapterModel')) {
throw new ServiceNotCreatedException(
'Cannot create ZF\Apigility\Admin\Model\AutodiscoverTableModel service because ZF\Apigility\Admin\Model\DbAdapterModel service is not present'
);
}
$model = $services->get('ZF\Apigility\Admin\Model\DbAdapterModel');
$restFactory = $services->get('ZF\Apigility\Admin\Model\RestServiceModelFactory');
return new Model\AutodiscoverTableModel($model, $restFactory);
},
'ZF\Apigility\Admin\Model\ModuleModel' => function ($services) {
if (!$services->has('ModuleManager')) {
throw new ServiceNotCreatedException(
Expand Down Expand Up @@ -312,7 +322,7 @@ public function getControllerConfig()
/**
* Inject links into Module resources for the service services
*
* @param \Zend\Mvc\MvcEvent $e
* @param MvcEvent $e
*/
public function onRender($e)
{
Expand Down Expand Up @@ -361,11 +371,11 @@ protected function initializeUrlHelper()
/**
* Inject links for the service services of a module
*
* @param Entity $entity
* @param Entity $halEntity
* @param HalJsonModel $model
* @param \Zend\Mvc\MvcEvent $model
* @param \Zend\Mvc\MvcEvent $e
*/
protected function injectServiceLinks(Entity $halEntity, HalJsonModel $model, $e)
protected function injectServiceLinks(Entity $halEntity, HalJsonModel $model, MvcEvent $e)
{
$entity = $halEntity->entity;
$links = $halEntity->getLinks();
Expand Down
6 changes: 3 additions & 3 deletions asset/dist/zf-apigility-admin/css/apigility.css

Large diffs are not rendered by default.

Binary file not shown.
Binary file removed asset/dist/zf-apigility-admin/css/select2.png
Binary file not shown.
Binary file removed asset/dist/zf-apigility-admin/css/select2x2.png
Binary file not shown.
77 changes: 77 additions & 0 deletions asset/dist/zf-apigility-admin/html/api/rest-services/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,83 @@ <h4 class="panel-title">No DB Adapters Present</h4>
<div class="clearfix"></div>
</form>
</div></div></ag-tab-pane>
<ag-tab-pane title="DB-Autodiscovery">
<div class="panel">
<div class="panel-body">
<div class="panel panel-warning" ng-show="dbAdapters.length < 1">
<div class="panel-heading">
<h4 class="panel-title">No DB Adapters Present</h4>
</div>
<div class="panel-body">
<p>
You have not yet configured any database adapters, and
thus cannot create a DB-Connected REST service.
</p>

<p>
You can create adapters on the
<a ng-href="/apigility/ui#/global/db-adapters">Database Adapters setting page</a>.
</p>
</div>
</div>
<form class="form" ng-show="dbAdapters.length > 0" ng-submit="newService.generateAutoDiscoveredServices()" ag-form="">
<fieldset>
<div class="form-group">
<label class="control-label">DB Adapter Name</label>
<select class="form-control input-xlarge" ng-model="newService.dbAdapterName" ng-options="v.adapter_name as v.adapter_name for v in dbAdapters" ng-change="newService.autoDiscoverServices()"></select>
</div>
</fieldset>
<div class="panel-group tooltip-api">
<ag-collapse class="panel-info" ng-repeat="table in tables" name="table.name">
<collapse-header>
<h4 class="panel-title pull-left">
<i class="glyphicon glyphicon-list-alt"></i> {{table.name}}
</h4>
<div class="btn-group pull-right">

<button type="button" class="btn btn-sm btn-danger" title="Remove table" collapse-flag="" flags="{deleteSelector: true}" collapse-button="" criteria="{deleteSelector: false}">
<span class="glyphicon glyphicon-trash"></span>
</button>
</div>
<div class="clearfix"></div>

<span collapse-show="" criteria="{deleteSelector: false}" default-template="'html/empty-content.html'" toggled-template="'html/api/rest-services/table-remove.html'"></span>
</collapse-header>
<collapse-body>
<table class="table table-striped ng-scope">
<thead>
<tr>
<th width="20%">Field name</th>
<th width="20%">Field type</th>
<th width="20%">Field length</th>
<th width="20%">Nullable</th>
<th width="20%">Constraints</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="field in table.fields">
<td>{{field.name}}</td>
<td>{{field.type}}</td>
<td>{{field.length}}</td>
<td>{{field.nullable}}</td>
<td>{{field.constraints | implode}}</td>
</tr>
</tbody>
</table>
</collapse-body>
</ag-collapse>
</div>
<div class="btn-group pull-right">
<button type="button" class="btn btn-sm btn-default" ng-click="resetForm()">Cancel</button>
<button type="submit" class="btn btn-sm btn-primary" ng-disabled="!tables.length">
Generate DB-Connected REST Services</button>
</div>

<div class="clearfix"></div>
</form>
</div>
</div>
</ag-tab-pane>
</ag-tabs>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<div class="panel panel-danger">
<div class="panel-heading">Remove table from list</div>

<div class="panel-body">
<p>Are you sure you want to remove the table from the list?</p>

<div class="btn-group pull-right">
<button type="button" class="btn btn-sm btn-default" collapse-flag="" flags="{deleteSelector: false}">
No
</button>
<button type="button" class="btn btn-sm btn-danger" ng-click="removeTableFromList(table.name)">
Yes
</button>
</div>
</div>
</div>
4 changes: 2 additions & 2 deletions asset/dist/zf-apigility-admin/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion asset/dist/zf-apigility-admin/js/vendor-angular.js

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions asset/dist/zf-apigility-admin/js/vendor-ui.js

Large diffs are not rendered by default.

Loading