web: show header while loading application info

This commit is contained in:
Jens Langhammer 2021-02-19 19:33:58 +01:00
parent 9b12895fab
commit 9d4c22c706
6 changed files with 186 additions and 89 deletions

View File

@ -18,7 +18,7 @@ class StageSerializer(ModelSerializer, MetaNameSerializer):
"""Stage Serializer"""
object_type = SerializerMethodField()
flow_set = FlowSerializer(many=True)
flow_set = FlowSerializer(many=True, required=False)
def get_object_type(self, obj: Stage) -> str:
"""Get object type so that we know which API Endpoint to use to get the full object"""

View File

@ -22,6 +22,7 @@ def get_attrs(obj: SerializerModel) -> dict[str, Any]:
"verbose_name",
"verbose_name_plural",
"object_type",
"flow_set",
)
for to_remove_name in to_remove:
if to_remove_name in data:

View File

@ -65,14 +65,17 @@ class FlowImporter:
return value
for key, value in attrs.items():
if isinstance(value, dict):
for idx, _inner_key in enumerate(value):
value[_inner_key] = updater(value[_inner_key])
elif isinstance(value, list):
for idx, _inner_value in enumerate(value):
attrs[key][idx] = updater(_inner_value)
else:
attrs[key] = updater(value)
try:
if isinstance(value, dict):
for idx, _inner_key in enumerate(value):
value[_inner_key] = updater(value[_inner_key])
elif isinstance(value, list):
for idx, _inner_value in enumerate(value):
attrs[key][idx] = updater(_inner_value)
else:
attrs[key] = updater(value)
except TypeError:
continue
return attrs
def __query_from_identifier(self, attrs: dict[str, Any]) -> Q:

View File

@ -8570,82 +8570,6 @@ definitions:
webhook_url:
title: Webhook url
type: string
Stage:
title: Stage obj
description: Stage Serializer
required:
- name
type: object
properties:
pk:
title: Stage uuid
type: string
format: uuid
readOnly: true
name:
title: Name
type: string
minLength: 1
object_type:
title: Object type
type: string
readOnly: true
verbose_name:
title: Verbose name
type: string
readOnly: true
verbose_name_plural:
title: Verbose name plural
type: string
readOnly: true
FlowStageBinding:
description: FlowStageBinding Serializer
required:
- target
- stage
- order
type: object
properties:
pk:
title: Fsb uuid
type: string
format: uuid
readOnly: true
policybindingmodel_ptr_id:
title: Policybindingmodel ptr id
type: string
readOnly: true
target:
title: Target
type: string
format: uuid
stage:
title: Stage
type: string
format: uuid
stage_obj:
$ref: '#/definitions/Stage'
evaluate_on_plan:
title: Evaluate on plan
description: Evaluate policies during the Flow planning process. Disable this
for input-based policies.
type: boolean
re_evaluate_policies:
title: Re evaluate policies
description: Evaluate policies when the Stage is present to the user.
type: boolean
order:
title: Order
type: integer
maximum: 2147483647
minimum: -2147483648
policies:
type: array
items:
type: string
format: uuid
readOnly: true
uniqueItems: true
Flow:
description: Flow Serializer
required:
@ -8718,6 +8642,87 @@ definitions:
title: Cache count
type: string
readOnly: true
Stage:
title: Stage obj
description: Stage Serializer
required:
- name
type: object
properties:
pk:
title: Stage uuid
type: string
format: uuid
readOnly: true
name:
title: Name
type: string
minLength: 1
object_type:
title: Object type
type: string
readOnly: true
verbose_name:
title: Verbose name
type: string
readOnly: true
verbose_name_plural:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
FlowStageBinding:
description: FlowStageBinding Serializer
required:
- target
- stage
- order
type: object
properties:
pk:
title: Fsb uuid
type: string
format: uuid
readOnly: true
policybindingmodel_ptr_id:
title: Policybindingmodel ptr id
type: string
readOnly: true
target:
title: Target
type: string
format: uuid
stage:
title: Stage
type: string
format: uuid
stage_obj:
$ref: '#/definitions/Stage'
evaluate_on_plan:
title: Evaluate on plan
description: Evaluate policies during the Flow planning process. Disable this
for input-based policies.
type: boolean
re_evaluate_policies:
title: Re evaluate policies
description: Evaluate policies when the Stage is present to the user.
type: boolean
order:
title: Order
type: integer
maximum: 2147483647
minimum: -2147483648
policies:
type: array
items:
type: string
format: uuid
readOnly: true
uniqueItems: true
Cache:
description: Generic cache stats for an object
type: object
@ -10913,6 +10918,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
configure_flow:
title: Configure flow
description: Flow used by an authenticated user to configure this Stage. If
@ -10953,6 +10963,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
configure_flow:
title: Configure flow
description: Flow used by an authenticated user to configure this Stage. If
@ -10993,6 +11008,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
not_configured_action:
title: Not configured action
type: string
@ -11032,6 +11052,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
CaptchaStage:
description: CaptchaStage Serializer
required:
@ -11061,6 +11086,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
public_key:
title: Public key
description: Public key, acquired from https://www.google.com/recaptcha/intro/v3.html
@ -11098,6 +11128,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
mode:
title: Mode
type: string
@ -11137,6 +11172,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
EmailStage:
description: EmailStage Serializer
required:
@ -11164,6 +11204,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
use_global_settings:
title: Use global settings
description: When enabled, global Email connection settings will be used and
@ -11246,6 +11291,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
user_fields:
description: ''
type: array
@ -11312,6 +11362,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
continue_flow_without_invitation:
title: Continue flow without invitation
description: If this flag is set, this Stage will jump to the next Stage when
@ -11364,6 +11419,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
backends:
description: ''
type: array
@ -11464,6 +11524,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
fields:
type: array
items:
@ -11503,6 +11568,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
UserLoginStage:
description: UserLoginStage Serializer
required:
@ -11530,6 +11600,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
session_duration:
title: Session duration
description: 'Determines how long a session lasts. Default of 0 means that
@ -11563,6 +11638,11 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
UserWriteStage:
description: UserWriteStage Serializer
required:
@ -11590,3 +11670,8 @@ definitions:
title: Verbose name plural
type: string
readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'

View File

@ -38,7 +38,14 @@ export class ApplicationViewPage extends LitElement {
render(): TemplateResult {
if (!this.application) {
return html`<ak-loading-state></ak-loading-state>`;
return html`<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">
<h1>
${gettext("Loading...")}
</h1>
</div>
</section>
<ak-loading-state></ak-loading-state>`;
}
return html`<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content">

View File

@ -5,6 +5,7 @@ import { TablePage } from "../../elements/table/TablePage";
import "../../elements/buttons/ModalButton";
import "../../elements/buttons/Dropdown";
import "../../elements/buttons/TokenCopyButton";
import { TableColumn } from "../../elements/table/Table";
import { Token } from "../../api/Tokens";
@ -49,16 +50,16 @@ export class TokenListPage extends TablePage<Token> {
html`${item.identifier}`,
html`${item.user.username}`,
html`${item.expiring ? "Yes" : "No"}`,
html`${item.expiring ? new Date(item.expires * 1000).toLocaleString() : '-'}`,
html`${item.expiring ? new Date(item.expires * 1000).toLocaleString() : "-"}`,
html`
<ak-modal-button href="${Token.adminUrl(`${item.pk}/delete/`)}">
<ak-spinner-button slot="trigger" class="pf-m-danger">
${gettext('Delete')}
${gettext("Delete")}
</ak-spinner-button>
<div slot="modal"></div>
</ak-modal-button>
<ak-token-copy-button identifier="${item.identifier}">
${gettext('Copy Key')}
${gettext("Copy Key")}
</ak-token-copy-button>
`,
];