Skip to content

Commit

Permalink
Merge pull request #2784 from apinf/develop
Browse files Browse the repository at this point in the history
0.48.0 Release
  • Loading branch information
marla-singer authored Jul 24, 2017
2 parents 0886ac0 + 4b6d012 commit a297245
Show file tree
Hide file tree
Showing 44 changed files with 2,394 additions and 673 deletions.
2 changes: 1 addition & 1 deletion about/client/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ <h3>
Apinf
</dt>
<dd>
0.47.0
0.48.0
</dd>
<dt>
API Umbrella
Expand Down
8 changes: 4 additions & 4 deletions api_catalog/client/toolbar/toolbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@
<div class="btn-group navbar-btn" role="group" aria-label="Sort direction" data-toggle="buttons">
<label
class="btn btn-default toolbar-tooltip active"
title="{{_ 'catalogue_toolbar_sortMenuOptions_sortAscending' }}"
data-original-title="{{_ 'catalogue_toolbar_sortMenuOptions_sortAscending' }}"
id="sortDirection-ascending">
<input type="radio" name="sort-direction" id="sort-ascending" value="ascending" checked>
<i class="fa fa-sort-amount-asc" aria-hidden="true"></i>
</label>
<label
class="btn btn-default toolbar-tooltip"
title="{{_ 'catalogue_toolbar_sortMenuOptions_sortDescending' }}"
data-original-title="{{_ 'catalogue_toolbar_sortMenuOptions_sortDescending' }}"
id="sortDirection-descending">
<input type="radio" name="sort-direction" id="sort-descending" value="descending">
<i class="fa fa-sort-amount-desc" aria-hidden="true"></i>
Expand Down Expand Up @@ -88,14 +88,14 @@
<div class="btn-group navbar-btn" role="group" aria-label="View mode" data-toggle="buttons">
<label
class="btn btn-default toolbar-tooltip active"
title="{{_ 'catalogue_toolbar_viewMode_grid' }}"
data-original-title="{{_ 'catalogue_toolbar_viewMode_grid' }}"
id="viewMode-grid">
<input type="radio" name="view-mode" id="grid-mode" value="grid" checked>
<i class="fa fa-th-large" aria-hidden="true"></i>
</label>
<label
class="btn btn-default toolbar-tooltip"
title="{{_ 'catalogue_toolbar_viewMode_table' }}"
data-original-title="{{_ 'catalogue_toolbar_viewMode_table' }}"
id="viewMode-table">
<input type="radio" name="view-mode" id="table-mode" value="table">
<i class="fa fa-table" aria-hidden="true"></i>
Expand Down
2 changes: 1 addition & 1 deletion api_catalog/client/toolbar/toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Template.apiCatalogToolbar.onRendered(function () {
const viewModeParameter = FlowRouter.getQueryParam('viewMode');

// Set the sorting by UI state from URL parameter
instance.$('#sort-select').val(`${sortByParameter}`).change();
instance.$('#sort-select').val(`${sortByParameter}`);
// Set the sorting direction by UI state from URL parameter
instance.$(`#sortDirection-${sortDirectionParameter}`).button('toggle');
// Set the filter by UI state from URL parameter
Expand Down
130 changes: 125 additions & 5 deletions apis/server/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,45 @@
// Meteor packages imports
import { Meteor } from 'meteor/meteor';

// Meteor contributed packages imports
import { Roles } from 'meteor/alanning:roles';

// Collection imports
import Apis from '/apis/collection';
import ApiV1 from '/core/server/api';
import Organizations from '/organizations/collection';

ApiV1.swagger.meta.paths = {
'/login': {
post: {
tags: [
ApiV1.swagger.tags.login,
],
summary: 'Logging in.',
description: 'By giving existing username and password you get login credentials.',
produces: 'application/json',
parameters: [
ApiV1.swagger.params.login,
],
responses: {
200: {
description: 'Success',
schema: {
$ref: '#/definitions/loginResponse',
},
},
400: {
description: 'Bad query parameters',
},
401: {
description: 'Unauthorized',
},
},
},
},

};

// Request /rest/v1/apis for Apis collection
ApiV1.addCollection(Apis, {
routeOptions: {
Expand All @@ -23,7 +57,7 @@ ApiV1.addCollection(Apis, {
tags: [
ApiV1.swagger.tags.api,
],
summary: 'List and search public APIs.',
summary: 'List and search public API.',
description: 'List and search public APIs.',
parameters: [
ApiV1.swagger.params.optionalSearch,
Expand All @@ -35,6 +69,21 @@ ApiV1.addCollection(Apis, {
responses: {
200: {
description: 'Returns list of public APIs',
schema: {
type: 'object',
properties: {
status: {
type: 'string',
example: 'Success',
},
data: {
type: 'array',
items: {
$ref: '#/definitions/apiResponse',
},
},
},
},
},
400: {
description: 'Bad query parameters',
Expand Down Expand Up @@ -107,14 +156,26 @@ ApiV1.addCollection(Apis, {
tags: [
ApiV1.swagger.tags.api,
],
summary: 'Fetch API with specified ID',
description: 'Returns one API with specified ID or nothing if there is not match found',
summary: 'Fetch API with specified ID.',
description: 'Returns one API with specified ID or nothing if there is not match found.',
parameters: [
ApiV1.swagger.params.apiId,
],
responses: {
200: {
description: 'Returns API',
schema: {
type: 'object',
properties: {
status: {
type: 'string',
example: 'Success',
},
data: {
$ref: '#/definitions/apiResponse',
},
},
},
},
404: {
description: 'Bad parameter',
Expand All @@ -136,6 +197,21 @@ ApiV1.addCollection(Apis, {
responses: {
200: {
description: 'API successfully added',
schema: {
type: 'object',
properties: {
status: {
type: 'string',
example: 'Success',
},
data: {
$ref: '#/definitions/apiResponse',
},
},
},
},
400: {
description: 'Invalid input, object invalid',
},
401: {
description: 'Authentication is required',
Expand All @@ -148,6 +224,38 @@ ApiV1.addCollection(Apis, {
},
],
},
action () {
const userId = this.userId;
const mandatoryFieldsFilled = this.bodyParams.name && this.bodyParams.url;

// Make sure required fields are set
if (mandatoryFieldsFilled) {
// Add manager IDs list into
const apiData = Object.assign({ managerIds: [userId] }, this.bodyParams);

// Insert API data into collection
const apiId = Apis.insert(apiData);

// Give user manager role
Roles.addUsersToRoles(userId, 'manager');

return {
statusCode: 200,
body: {
status: 'Success',
data: Apis.findOne(apiId),
},
};
}

// Otherwise show message about required fields
return {
statusCode: 409,
body: {
message: 'Fields "name" and "url" are required',
},
};
},
},
// Modify the entity with the given :id with the data contained in the request body.
put: {
Expand All @@ -158,15 +266,27 @@ ApiV1.addCollection(Apis, {
tags: [
ApiV1.swagger.tags.api,
],
summary: 'Update API',
description: 'Update an API',
summary: 'Update API.',
description: 'Update an API.',
parameters: [
ApiV1.swagger.params.apiId,
ApiV1.swagger.params.api,
],
responses: {
200: {
description: 'API successfully edited.',
schema: {
type: 'object',
properties: {
status: {
type: 'string',
example: 'Success',
},
data: {
$ref: '#/definitions/apiResponse',
},
},
},
},
401: {
description: 'Authentication is required',
Expand Down
13 changes: 8 additions & 5 deletions apis/server/methods/apiBackends.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* Copyright 2017 Apinf Oy
This file is covered by the EUPL license.
You may obtain a copy of the licence at
https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11 */
This file is covered by the EUPL license.
You may obtain a copy of the licence at
https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11 */

// Meteor packages imports
import { Meteor } from 'meteor/meteor';
Expand All @@ -18,8 +18,11 @@ Meteor.methods({
// Look for API
const api = Apis.findOne({ slug });

// Attach logo url
api.logoUrl = api.logoUrl();
// Make sure API item exists
if (api) {
// Attach logo url
api.logoUrl = api.logoUrl();
}

// Return the API
return api;
Expand Down
2 changes: 1 addition & 1 deletion branding/client/branding.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h3 class="panel-title">
data-content="{{_ 'branding_homeCustomBlock_helpIcon_text' }}">
<i class="fa fa-question-circle" aria-hidden="true"></i>
</a>
{{> afQuickField name='homeCustomBlock' }}
{{> afQuickField name='homeCustomBlock' id="custom-html" }}
<div id="form-buttons">
<button id="branding-update-button" type="submit" class="btn btn-primary">
{{_ "branding_update" }}
Expand Down
1 change: 1 addition & 0 deletions core/lib/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,7 @@
"privacyPolicy_title": "Privacy Policy",
"profile_Header": "Profile",
"profile_UpdateButton": "Update",
"profile_labelText_registeredEmail": "Registered e-mail",
"profile_setUsername": "Please set your username.",
"profile_updatedSuccess": "Profile updated",
"profile_usernameInvalid": "Username must be 3-15 alphanumeric characters. Underscore and hyphens are allowed.",
Expand Down
Loading

0 comments on commit a297245

Please sign in to comment.