Skip to content

Commit df11b5d

Browse files
authored
Merge pull request #3441 from apinf/feature/0.55.0
Feature/0.55.0
2 parents ada20c7 + adc8b7f commit df11b5d

File tree

70 files changed

+1240
-415
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1240
-415
lines changed

.travis.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
sudo: required
2-
dist: trusty
3-
group: deprecated-2017Q4
1+
sudo: false
42

53
language: node_js
64
node_js:
@@ -30,8 +28,11 @@ services:
3028
- docker
3129

3230
before_install:
31+
- pwd
32+
- ls -la
3333
# Install meteor locally on CI
34-
- if [ ! -e "$HOME/.meteor/meteor" ]; then cat $HOME/.travis_install_meteor | sed s/--progress-bar/-sL/g | /bin/sh; fi
34+
- if [ ! -e "$HOME/.meteor/meteor" ]; then cat .travis_install_meteor | sed s/--progress-bar/-sL/g | /bin/sh; fi
35+
3536

3637
before_script:
3738
- yarn

apinf_packages/about/client/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ <h3>
3333
Apinf
3434
</dt>
3535
<dd>
36-
0.54.0
36+
0.55.0
3737
</dd>
3838
<dt>
3939
API Umbrella

apinf_packages/api_catalog/client/api_catalog.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ import 'locale-compare-polyfill';
2525
// Npm packages imports
2626
import _ from 'lodash';
2727

28+
// APInf imports
29+
import localisedSorting from '/apinf_packages/core/helper_functions/string_utils';
30+
2831
Template.apiCatalog.onCreated(function () {
2932
// Get reference to template instance
3033
const instance = this;
@@ -213,15 +216,14 @@ Template.apiCatalog.helpers({
213216
apis () {
214217
// Get apis collection via Pagination
215218
const apis = Template.instance().pagination.getPage();
216-
// Get the language
217-
const language = TAPi18n.getLanguage();
219+
218220
// Get the sort via Pagination
219221
const sort = Template.instance().pagination.sort();
220222
// When sorted by name
221223
if (sort.name) {
222224
// use custom sort function with i18n support
223225
apis.sort((a, b) => {
224-
return a.name.localeCompare(b.name, language) * sort.name;
226+
return localisedSorting(a.name, b.name, sort.name);
225227
});
226228
}
227229
return apis;

apinf_packages/api_docs/client/manage/manage.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,18 @@ Template.manageApiDocumentationModal.events({
152152
Modal.hide('manageApiDocumentationModal');
153153
},
154154
'click #cancel-button': function (event, templateInstance) {
155-
// Get fileId value
156-
const fileId = Session.get('fileId');
155+
const apiDocs = ApiDocs.findOne();
157156

158-
// If file is uploaded and a user clicks on "Cancel" button
159-
if (fileId) {
160-
// Remove uploaded file from collection
161-
templateInstance.removeDocumentationFile(fileId);
157+
// Make sure File isn't uploaded
158+
if (!apiDocs || !apiDocs.fileId) {
159+
// Get fileId value
160+
const fileId = Session.get('fileId');
161+
162+
// If file is uploaded and a user clicks on "Cancel" button
163+
if (fileId) {
164+
// Remove uploaded file from collection
165+
templateInstance.removeDocumentationFile(fileId);
166+
}
162167
}
163168
},
164169
'click #add-link': function () {

apinf_packages/api_docs/client/swagger_ui/content/content.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Template.swaggerUiContent.onRendered(function () {
146146
const ui = SwaggerUIBundle({
147147
url: api.documentationUrl(),
148148
dom_id: '#swagger-ui',
149+
defaultModelsExpandDepth: 0,
149150
// Provides custom configs for Swagger
150151
configs: this.configs,
151152
presets: [

apinf_packages/api_docs/client/view/documentation.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
{{_ "apiDocumentation_buttonText_closeEditor" }}
2828
</button>
2929
{{ else }}
30-
<button
31-
class="btn btn-xs btn-info editor">
32-
<i class="fa fa-file-text-o"></i>&nbsp;
33-
{{_ "apiDocumentation_buttonText_openEditor" }}
34-
</button>
30+
{{# if developmentFeatures }}
31+
<button
32+
class="btn btn-xs btn-info editor">
33+
<i class="fa fa-file-text-o"></i>&nbsp;
34+
{{_ "apiDocumentation_buttonText_openEditor" }}
35+
</button>
36+
{{/ if }}
3537
{{/ if }}
3638
<button
3739
id="manage-api-documentation"

apinf_packages/api_docs/client/view/documentation.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Template.apiDocumentation.onCreated(function () {
5252

5353
// Subscribe to code generator settings
5454
instance.subscribe('singleSetting', 'sdkCodeGenerator');
55+
// Subscribe to development Features settings
56+
instance.subscribe('singleSetting', 'developmentFeatures');
5557
});
5658

5759
Template.apiDocumentation.onRendered(() => {
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/* Copyright 2017 Apinf Oy
2+
This file is covered by the EUPL license.
3+
You may obtain a copy of the licence at
4+
https://joinup.ec.europa.eu/community/eupl/og_page/european-union-public-licence-eupl-v11 */
5+
6+
// Meteor contributed packages imports
7+
import { AutoForm } from 'meteor/aldeed:autoform';
8+
import { TAPi18n } from 'meteor/tap:i18n';
9+
import { sAlert } from 'meteor/juliancwirko:s-alert';
10+
11+
AutoForm.hooks({
12+
authorizedUserForm: {
13+
onSuccess () {
14+
// Get success message translation
15+
const message = TAPi18n.__('authorizedUserForm_success_message');
16+
17+
// Alert user of success
18+
sAlert.success(message);
19+
},
20+
onError (formType, error) {
21+
// Get error type string from error object
22+
const errorType = error.error;
23+
24+
if (errorType === 'user-not-registered') {
25+
// Get error message translation
26+
const message = TAPi18n.__('authorizedUserForm_errorText_userNotRegistered');
27+
28+
// Display error
29+
sAlert.error(message, { timeout: 'none' });
30+
}
31+
32+
if (errorType === 'user-already-exist') {
33+
// Get error message translation
34+
const message = TAPi18n.__('authorizedUserForm_errorText_alreadyAuthorized');
35+
36+
// Display error
37+
sAlert.error(message, { timeout: 'none' });
38+
}
39+
},
40+
},
41+
});

apinf_packages/apis_authorization/client/form/form.html renamed to apinf_packages/apis/client/authorized_user/form/form.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ <h4>
1010
{{# autoForm
1111
schema=emailSchema
1212
id="authorizedUserForm"
13-
class="form-inline" }}
13+
class="form-inline"
14+
type="method"
15+
meteormethod="addAuthorizedUser"
16+
}}
1417
<fieldset>
15-
{{> afQuickField name='email' }}
16-
{{> afQuickField name='apiId' value=apiId type="hidden" }}
18+
<p>
19+
{{_ "apiUserAuthorizationForm_helpText_usernameEmail" }}
20+
</p>
21+
{{> afQuickField name='user' }}
22+
{{> afQuickField name='apiId' value=api._id type="hidden" }}
1723
</fieldset>
1824

1925
<button type="submit" class="btn btn-primary">

apinf_packages/apis_authorization/client/form/form.js renamed to apinf_packages/apis/client/authorized_user/form/form.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,7 @@ import { Template } from 'meteor/templating';
1010
import emailSchema from './schema';
1111

1212
Template.apiUserAuthorizationForm.helpers({
13-
apiId () {
14-
// Get API ID
15-
const apiId = Template.instance().data.api._id;
16-
17-
return apiId;
18-
},
1913
emailSchema () {
2014
return emailSchema;
2115
},
2216
});
23-
24-
Template.apiUserAuthorizationForm.events({
25-
'submit #authorizedUserForm': function (event) {
26-
// Prevent form from reloading page
27-
event.preventDefault();
28-
},
29-
});

0 commit comments

Comments
 (0)