mirror of
https://github.com/OpenBankProject/API-Manager.git
synced 2026-02-06 18:36:51 +00:00
Merge pull request #293 from Reena-cell/develop
bugfix/ API Version in metric
This commit is contained in:
commit
8b0d96069e
@ -40,7 +40,7 @@ def get_api_versions(request):
|
||||
urlpath = '/api/versions'
|
||||
result = api.get(urlpath)
|
||||
if 'scanned_api_versions' in result:
|
||||
return [apiversion['apiShortVersion'] for apiversion in sorted(result['scanned_api_versions'], key=lambda d: d['apiShortVersion'])]
|
||||
return [apiversion['API_VERSION'] for apiversion in sorted(result['scanned_api_versions'], key=lambda d: d['API_VERSION'])]
|
||||
else:
|
||||
return []
|
||||
except APIError as err:
|
||||
|
||||
@ -192,7 +192,7 @@ class APIMetricsView(MetricsView):
|
||||
fields = form.fields
|
||||
try:
|
||||
fields['consumer_id'].choices = self.api.get_consumer_id_choices()
|
||||
#fields['apiShortVersion'].choices = self.api.get_api_version_choices()
|
||||
fields['implemented_in_version'].choices = self.api.get_api_version_choices()
|
||||
except APIError as err:
|
||||
messages.error(self.request, err)
|
||||
except Exception as err:
|
||||
@ -202,8 +202,8 @@ class APIMetricsView(MetricsView):
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(APIMetricsView, self).get_context_data(**kwargs)
|
||||
context.update({
|
||||
'consumer_id': get_consumers(self.request)
|
||||
#'API_VERSION': get_api_versions(self.request)
|
||||
'consumer_id': get_consumers(self.request),
|
||||
'API_VERSION': get_api_versions(self.request)
|
||||
})
|
||||
return context
|
||||
|
||||
|
||||
@ -172,8 +172,8 @@ class API(object):
|
||||
"""Gets a list of APIs Version and APIs Version as used by form choices"""
|
||||
choices = [('', _('Choose ...'))]
|
||||
result = self.get('/api/versions')
|
||||
for apiversion in sorted(result['scanned_api_versions'], key=lambda d: d['apiShortVersion']) :
|
||||
choices.append((apiversion['apiShortVersion'], apiversion['apiShortVersion']))
|
||||
for version in sorted(result['scanned_api_versions'], key=lambda d: d['API_VERSION']) :
|
||||
choices.append((version['API_VERSION'], version['API_VERSION']))
|
||||
return choices
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user