outposts: ensure Outpost API is backwards compatible

This commit is contained in:
Jens Langhammer 2021-02-08 19:51:46 +01:00
parent b64ecbde22
commit 78bcb90a1e
4 changed files with 11 additions and 3 deletions

View File

@ -16,7 +16,7 @@ class OutpostSerializer(ModelSerializer):
"""Outpost Serializer"""
_config = JSONField()
providers = ProviderSerializer(many=True, read_only=True)
providers_obj = ProviderSerializer(source="providers", many=True, read_only=True)
class Meta:
@ -25,6 +25,7 @@ class OutpostSerializer(ModelSerializer):
"pk",
"name",
"providers",
"providers_obj",
"service_connection",
"token_identifier",
"_config",

View File

@ -8159,6 +8159,7 @@ definitions:
description: Outpost Serializer
required:
- name
- providers
- _config
type: object
properties:
@ -8172,6 +8173,11 @@ definitions:
type: string
minLength: 1
providers:
type: array
items:
type: integer
uniqueItems: true
providers_obj:
description: ''
type: array
items:

View File

@ -12,7 +12,8 @@ export class Outpost {
pk: string;
name: string;
providers: Provider[];
providers: number[];
providers_obj: Provider[];
service_connection?: string;
_config: QueryArguments;
token_identifier: string;

View File

@ -46,7 +46,7 @@ export class OutpostListPage extends TablePage<Outpost> {
row(item: Outpost): TemplateResult[] {
return [
html`${item.name}`,
html`<ul>${item.providers.map((p) => {
html`<ul>${item.providers_obj.map((p) => {
return html`<li><a href="#/providers/${p.pk}">${p.name}</a></li>`;
})}</ul>`,
html`<ak-outpost-health outpostId=${item.pk}></ak-outpost-health>`,