Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions client/views/api_backends/edit_api_backend/edit_api_backend.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<template name="editApiBackend">
<div class="api-backends-content">
<h1>Edit API</h1>
{{#autoForm collection="ApiBackends" doc=apiBackend id="apiBackends" type="update"}}
{{> afQuickField name='name'}}
<span class="help-block">API's name</span>
{{> afQuickField name='documentation_link'}}
<span class="help-block">Link to documentation</span>
{{> importSwaggerConfiguration}}
<legend>Backend</legend>
<span class="help-block">Define the server where the API is hosted. Multiple servers can be defined to perform load balancing.</span>
{{> afQuickField name='backend_protocol' options="allowed"}}
{{> afQuickField name='servers'}}
<legend>Host</legend>
<div class="row">
<div class="col-lg-4">
{{> afQuickField name='backend_host'}}
</div>
<div class="col-lg-4 arrow">
<i class="fa fa-arrow-right fa-2x"></i>
<div>rewrite to</div>
</div>
<div class="col-lg-4">
{{> afQuickField name='frontend_host'}}
</div>
</div>
<legend>Matching URL Prefixes</legend>
<span class="help-block">What URL prefixes should be routed to this backend?</span>
{{> afQuickField name='url_matches'}}
<legend data-toggle="collapse" data-target="#global-request-block" aria-expanded="false"><i class="fa fa-chevron-right"></i> Global Request Settings</legend>
<div id="global-request-block" class="collapse in">
{{> afQuickField name='append_query_string'}}
{{> afQuickField name='set_headers'}}
{{> afQuickField name='http_basic_auth'}}
{{> afQuickField name='require_https' options="allowed"}}
{{> afQuickField name='api_key_verification_level' options="allowed"}}
{{> afQuickField name='required_roles'}}
{{> afQuickField name='pass_api_key_header'}}
{{> afQuickField name='pass_api_key_query_param'}}
{{> afQuickField name='rate_limit_mode' options="allowed"}}
{{#if afFieldValueIs name='rate_limit_mode' value="Custom rate limits"}}
{{> afQuickField name='custom_rate_limits'}}
{{/if}}
</div>
<legend data-toggle="collapse" data-target="#advanced-rewriting-block" aria-expanded="false"><i class="fa fa-chevron-right"></i> Advanced Requests Rewriting</legend>
<div id="advanced-rewriting-block" class="collapse in">
<span class="help-block">Modify the incoming request's URL or headers before passing it to the backend.</span>
{{> afQuickField name='rewrite'}}
</div>
<legend data-toggle="collapse" data-target="#advanced-block" aria-expanded="false"><i class="fa fa-chevron-right"></i> Advanced Settings</legend>
<div id="advanced-block" class="collapse in">
{{> afQuickField name='balance_algorithm' options="allowed"}}
{{> afQuickField name='error_templates'}}
</div>
<div id="form-buttons">
<button type="submit" class="btn btn-lg btn-success">Submit</button>
</div>
{{/autoForm}}
</div>
</template>
14 changes: 14 additions & 0 deletions lib/router/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,18 @@ Router.map(function() {
layoutTemplate: "masterLayout",
render: "importApiConfiguration"
});

this.route("editApiBackend", {
path: "/api/:_id/edit",
waitOn: function() {
return this.subscribe('singleApiBackend', this.params._id);
},
data: function () {
var templateDate = ApiBackends.findOne({_id: this.params._id});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps rename this variable to apiBackend, so it is consistent with its purpose.

return { apiBackend: templateDate }
},
layoutTemplate: "masterLayout",
render: "editApiBackend"
})

});
4 changes: 4 additions & 0 deletions server/publish/apiBackends.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ Meteor.publish('myBookmarkedApis', function () {
// get apibackends by id
return ApiBackends.find({_id: {$in: bookmarkedApiIds}});
});

Meteor.publish('singleApiBackend', function (backendId) {
return ApiBackends.find({_id: backendId});
});