-
Notifications
You must be signed in to change notification settings - Fork 33
Try-out button for Swagger file #1563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
0224569
change addHooks to hooks
marla-singer 7964a03
fix codegen feature
marla-singer 95ef85d
add field in Manage modal for checking methods
marla-singer 832948e
work version
marla-singer 9fe75f5
Fix console error with conflictof available doc editor
marla-singer 7298b3c
realize updating methods in swagger
marla-singer a557700
fix duplicated sAlert on Manage module
marla-singer 999207c
update swagger-ui-browserify version
marla-singer 209b7a0
fix sAlert on clicking button Choose File
marla-singer b02083d
add i18n in schema
marla-singer 0422cde
separate long line with sAlert
marla-singer 8799a81
replace Glyphicon icon to font awesome
marla-singer 8a82642
add comment to helper
marla-singer 395b72e
replace class of button to id
marla-singer cc99194
lint
marla-singer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| AutoForm.addHooks(['apiDocumentationForm'], { | ||
| onSuccess () { | ||
| sAlert.success(TAPi18n.__('manageApiDocumentationModal_LinkField_Updated_Message')); | ||
| }, | ||
| }); | ||
| AutoForm.hooks({ | ||
| apiDocumentationForm: { | ||
| onSuccess () { | ||
| // Get success message translation | ||
| const message = TAPi18n.__('manageApiDocumentationModal_LinkField_Updated_Message'); | ||
|
|
||
| // Alert user of success | ||
| sAlert.success(message); | ||
| }, | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| <template name="manageApiDocumentationModalUploadButton"> | ||
| <button class="btn btn-primary fileBrowse">{{_ "manageApiDocumentationModalUploadButton" }}</button> | ||
| <button type="button" class="btn btn-primary" id="file-browse"> | ||
| {{_ "manageApiDocumentationModalUploadButton" }} | ||
| </button> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,29 @@ | ||
| <template name="swaggerUi"> | ||
| <div class="swagger-section"> | ||
| <div id="header"> | ||
| <div class="swagger-ui-wrap"> | ||
| <a id="logo" href="http://swagger.io" target="_blank" rel="nofollow"> | ||
| <img src="/img/logo_small.png" class="logo__img" alt="swagger" height="30" width="30"> | ||
| <span class="logo__title">swagger</span> | ||
| </a> | ||
| <form id="api_selector"> | ||
| <div class="input"><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> | ||
| <div id="auth_container"></div> | ||
| <div class="input"><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| <div id="message-bar" class="swagger-ui-wrap message-success" data-sw-translate=""></div> | ||
| {{#if dataFetched}} | ||
| {{#if documentationValid}} | ||
| {{>swaggerUiContent apiDocumentation=apiDocumentation}} | ||
| {{else}} | ||
| <i> | ||
| {{_ 'swaggerUi_swaggerDocumentInvalidText'}} | ||
| </i> | ||
| {{/if}} | ||
| {{else}} | ||
| {{>spinner}} | ||
| {{/if}} | ||
| <div class="swagger-section"> | ||
| <div id="header"> | ||
| <div class="swagger-ui-wrap"> | ||
| <a id="logo" href="http://swagger.io" target="_blank" rel="nofollow"> | ||
| <img src="/img/logo_small.png" class="logo__img" alt="swagger" height="30" width="30"> | ||
| <span class="logo__title">swagger</span> | ||
| </a> | ||
| <form id="api_selector"> | ||
| <div class="input"><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div> | ||
| <div id="auth_container"></div> | ||
| <div class="input"><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div> | ||
| </form> | ||
| </div> | ||
| </div> | ||
| <div id="message-bar" class="swagger-ui-wrap message-success" data-sw-translate=""></div> | ||
| {{#if dataFetched}} | ||
| {{#if documentationValid}} | ||
| {{>swaggerUiContent apiDoc=apiDoc api=api}} | ||
| {{else}} | ||
| <i> | ||
| {{_ 'swaggerUi_swaggerDocumentInvalidText'}} | ||
| </i> | ||
| {{/if}} | ||
| {{else}} | ||
| {{>spinner}} | ||
| {{/if}} | ||
| </div> | ||
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
documentation/client/swaggerUI/swaggerUiContent/swaggerUiContent.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| <template name="swaggerUiContent"> | ||
| <div id="swagger-ui-container" class="swagger-ui-wrap"></div> | ||
| <div id="swagger-ui-container" class="swagger-ui-wrap"></div> | ||
| </template> |
40 changes: 23 additions & 17 deletions
40
documentation/client/swaggerUI/swaggerUiContent/swaggerUiContent.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,35 @@ | ||
| import SwaggerUi from 'swagger-ui-browserify'; | ||
| import { Apis } from '/apis/collection'; | ||
|
|
||
| Template.swaggerUiContent.onCreated(function () { | ||
| const instance = this; | ||
|
|
||
| // Get URL of api documentation | ||
| const documentationURL = this.data.apiDocumentation; | ||
|
|
||
| // Create Swagger UI | ||
| const swagger = window.swaggerUi = new SwaggerUi({ | ||
| const documentationURL = this.data.apiDoc; | ||
| // Create Swagger UI object | ||
| const swagger = new SwaggerUi({ | ||
| url: documentationURL, | ||
| dom_id: 'swagger-ui-container', | ||
| useJQuery: true, | ||
| supportHeaderParams: true, | ||
| supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], | ||
| apisSorter: 'alpha', | ||
| operationsSorter: 'alpha', | ||
| docExpansion: 'none' | ||
| docExpansion: 'none', | ||
| }); | ||
|
|
||
| // Subscribe to api collection | ||
| instance.autorun(() => { | ||
| // Get relevant api collection | ||
| instance.subscribe('apiBackend', instance.data.api._id); | ||
|
|
||
| // Get api | ||
| const api = Apis.findOne(instance.data.api._id); | ||
|
|
||
| // Set selected methods in Swagger | ||
| swagger.setOption('supportedSubmitMethods', api.submit_methods); | ||
|
|
||
| // Load Swagger UI | ||
| swagger.load(); | ||
| }); | ||
|
|
||
| // Load Swagger UI | ||
| swagger.load(); | ||
| }); | ||
|
|
||
| Template.swaggerUiContent.onRendered(function () { | ||
| // Get URL of api documentation | ||
| const documentationURL = this.data.apiDocumentation; | ||
|
|
||
| // Display URL on Swagger UI input | ||
| $('#input_baseUrl').val(documentationURL); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add comment, and/or semantic variable name, describing this return object. E.g. what is it used for?