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/controller-identifiers'
Browse files Browse the repository at this point in the history
Close #114
  • Loading branch information
weierophinney committed Aug 6, 2016
2 parents eee21e3 + 873b614 commit 034bb37
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 23 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 1.3.1 - TBD
## 1.3.1 - 2016-08-06

### Added

Expand All @@ -18,7 +18,12 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- Nothing.
- [#114](https://github.com/zfcampus/zf-apigility-admin-ui/pull/114) fixes how
the UI generates URIs to the various service endpoints (REST and RPC services,
their input filters, their authorization rules, and their documentation) to
ensure they work with the latest admin changes. In particular, prior to this
patch, the service names were receiving both a duplicate prefix and suffix
that caused the URLs to be invalid.

## 1.3.0 - 2016-07-27

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
</footer>
</div>

<script src="apigility-ui/33a34f15.vendor.js" charset="utf-8"></script>
<script src="apigility-ui/1bc54cd5.vendor.js" charset="utf-8"></script>

<script src="apigility-ui/d3c50a75.apigility.js" charset="utf-8"></script>
<script src="apigility-ui/4a551c8b.apigility.js" charset="utf-8"></script>

<script>
$(document).ready(function () {
Expand Down
2 changes: 1 addition & 1 deletion src/apigility-ui/modal/new-field.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
$modalInstance.close(response);
});
}
}
};
}
})();
26 changes: 13 additions & 13 deletions src/apigility-ui/service/api.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
var result = filterData(data, allowed);
var path = isDoctrine ? '/doctrine/' : '/rest/';
var moduleParam = this.normalizeModuleName(module);
xhr.update(agApiPath + '/module/' + moduleParam + path + moduleParam + '-V' + version + '-Rest-' + capitalizeFirstLetter(name) + '-Controller', result.value, result.key)
xhr.update(agApiPath + '/module/' + moduleParam + path + name, result.value, result.key)
.then(function(response) {
growl.success('Service updated');
return callback(false, response);
Expand All @@ -154,7 +154,7 @@
];
var moduleParam = this.normalizeModuleName(module);
var result = filterData(data, allowed);
xhr.update(agApiPath + '/module/' + moduleParam + '/rest/' + moduleParam + '-V' + version + '-Rest-' + capitalizeFirstLetter(name) + '-Controller', result.value, result.key)
xhr.update(agApiPath + '/module/' + moduleParam + '/rest/' + name, result.value, result.key)
.then(function(response) {
growl.success('Content negotiation updated');
return callback(false, response);
Expand All @@ -168,7 +168,7 @@
this.deleteRest = function(module, version, name, isDoctrine, recursive, callback) {
var path = isDoctrine ? 'doctrine' : 'rest',
moduleParam = this.normalizeModuleName(module);
xhr.remove(agApiPath + '/module/' + moduleParam + '/' + path + '/' + moduleParam + '-V' + version + '-Rest-' + capitalizeFirstLetter(name) + '-Controller?recursive=' + (recursive ? 1 : 0))
xhr.remove(agApiPath + '/module/' + moduleParam + '/' + path + '/' + name + '?recursive=' + (recursive ? 1 : 0))
.then(function (response) {
growl.success('Service deleted');
return callback(false, response);
Expand All @@ -187,13 +187,13 @@
var data = {};
data.collection = [];
data.entity = [];
var collection = response[module + '\\V' + version + '\\Rest\\' + capitalizeFirstLetter(name) + '\\Controller::__collection__'];
var collection = response[name + '::__collection__'];
for (method in collection) {
if (collection[method]) {
data.collection.push(method);
}
}
var entity = response[module + '\\V' + version + '\\Rest\\' + capitalizeFirstLetter(name) + '\\Controller::__entity__'];
var entity = response[name + '::__entity__'];
for (method in entity) {
if (entity[method]) {
data.entity.push(method);
Expand All @@ -216,8 +216,8 @@
entity[method] = (auth.entity.indexOf(method) > -1);
});
var data = {};
data[module + '\\V' + version + '\\Rest\\' + capitalizeFirstLetter(name) + '\\Controller::__collection__'] = collection;
data[module + '\\V' + version + '\\Rest\\' + capitalizeFirstLetter(name) + '\\Controller::__entity__'] = entity;
data[name + '::__collection__'] = collection;
data[name + '::__entity__'] = entity;
xhr.save(agApiPath + '/module/' + moduleParam + '/authorization', data)
.then(function (response) {
growl.success('Authorization saved');
Expand Down Expand Up @@ -439,7 +439,7 @@
xhr.get(agApiPath + '/module/' + moduleParam + '/authorization')
.then(function (response) {
var data = [];
var controller = response[module + '\\V' + version + '\\Rpc\\' + capitalizeFirstLetter(name) + '\\Controller::' + name];
var controller = response[name + '::' + name];
for (var method in controller) {
if (controller[method]) {
data.push(method);
Expand All @@ -460,7 +460,7 @@
http[method] = (auth.indexOf(method) > -1);
});
var data = {};
data[module + '\\V' + version + '\\Rpc\\' + capitalizeFirstLetter(name) + '\\Controller::' + name] = http;
data[name + '::' + name] = http;
xhr.save(agApiPath + '/module/' + moduleParam + '/authorization', data)
.then(function (response) {
growl.success('Authorization updated');
Expand Down Expand Up @@ -497,7 +497,7 @@

this.saveRestDoc = function(module, version, restname, doc, callback) {
var moduleParam = this.normalizeModuleName(module);
xhr.save(agApiPath + '/module/' + moduleParam + '/rest/' + moduleParam + '-V' + version + '-Rest-' + capitalizeFirstLetter(restname) + '-Controller/doc', doc)
xhr.save(agApiPath + '/module/' + moduleParam + '/rest/' + restname + '/doc', doc)
.then(function(response) {
growl.success('Documentation saved');
// Remove unused properties from the response
Expand All @@ -512,7 +512,7 @@

this.saveRpcDoc = function(module, version, rpcname, doc, callback) {
var moduleParam = this.normalizeModuleName(module);
xhr.save(agApiPath + '/module/' + moduleParam + '/rpc/' + moduleParam + '-V' + version + '-Rpc-' + capitalizeFirstLetter(rpcname) + '-Controller/doc', doc)
xhr.save(agApiPath + '/module/' + moduleParam + '/rpc/' + rpcname + '/doc', doc)
.then(function(response) {
growl.success('Documentation saved');
// Remove unused properties from the response
Expand Down Expand Up @@ -586,7 +586,7 @@
'service_name'
];
var result = filterData(data, allowed);
xhr.update(agApiPath + '/module/' + moduleParam + '/rpc/' + moduleParam + '-V' + version + '-Rpc-' + capitalizeFirstLetter(rpc) + '-Controller', result.value, result.key)
xhr.update(agApiPath + '/module/' + moduleParam + '/rpc/' + rpc, result.value, result.key)
.then(function(response) {
growl.success('Service updated');
return callback(false, response);
Expand All @@ -603,7 +603,7 @@

this.deleteRpc = function(module, version, name, recursive, callback) {
var moduleParam = this.normalizeModuleName(module);
xhr.remove(agApiPath + '/module/' + moduleParam + '/rpc/' + moduleParam + '-V' + version + '-Rpc-' + capitalizeFirstLetter(name) + '-Controller?recursive=' + (recursive ? 1 : 0))
xhr.remove(agApiPath + '/module/' + moduleParam + '/rpc/' + name + '?recursive=' + (recursive ? 1 : 0))
.then(function (response) {
growl.success('Service deleted');
return callback(false, response);
Expand Down
5 changes: 3 additions & 2 deletions src/apigility-ui/service/xhr.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@
}

function send($http, $q, method, path, options, version) {
var headers;
if (version) {
var headers = { Accept: 'application/vnd.apigility.v2+json' };
headers = { Accept: 'application/vnd.apigility.v2+json' };
} else {
var headers = { Accept: 'application/json' };
headers = { Accept: 'application/json' };
}
if (method === 'POST' || method === 'PATCH' || method === 'PUT') {
headers['Content-Type'] = 'application/json';
Expand Down

0 comments on commit 034bb37

Please sign in to comment.