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

View File

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

View File

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

View File

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