8338b9b0e3
Dynamically generate views from OpenAPI document to List/CRUD LDAP users and groups in the UI
36 lines
763 B
JavaScript
36 lines
763 B
JavaScript
import { assign } from '@ember/polyfills';
|
|
import ApplicationAdapter from './application';
|
|
|
|
export default ApplicationAdapter.extend({
|
|
namespace: 'v1',
|
|
urlForItem() {},
|
|
optionsForQuery(id) {
|
|
let data = {};
|
|
if (!id) {
|
|
data['list'] = true;
|
|
}
|
|
return { data };
|
|
},
|
|
|
|
fetchByQuery(store, query) {
|
|
const { id, method, type } = query;
|
|
return this.ajax(this.urlForItem(method, id, type), 'GET', this.optionsForQuery(id)).then(resp => {
|
|
const data = {
|
|
id,
|
|
name: id,
|
|
method,
|
|
};
|
|
|
|
return assign({}, resp, data);
|
|
});
|
|
},
|
|
|
|
query(store, type, query) {
|
|
return this.fetchByQuery(store, query);
|
|
},
|
|
|
|
queryRecord(store, type, query) {
|
|
return this.fetchByQuery(store, query);
|
|
},
|
|
});
|