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""" """Stage Serializer"""
object_type = SerializerMethodField() object_type = SerializerMethodField()
flow_set = FlowSerializer(many=True) flow_set = FlowSerializer(many=True, required=False)
def get_object_type(self, obj: Stage) -> str: 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""" """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",
"verbose_name_plural", "verbose_name_plural",
"object_type", "object_type",
"flow_set",
) )
for to_remove_name in to_remove: for to_remove_name in to_remove:
if to_remove_name in data: if to_remove_name in data:

View File

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

View File

@ -8570,82 +8570,6 @@ definitions:
webhook_url: webhook_url:
title: Webhook url title: Webhook url
type: string 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: Flow:
description: Flow Serializer description: Flow Serializer
required: required:
@ -8718,6 +8642,87 @@ definitions:
title: Cache count title: Cache count
type: string type: string
readOnly: true 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: Cache:
description: Generic cache stats for an object description: Generic cache stats for an object
type: object type: object
@ -10913,6 +10918,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
configure_flow: configure_flow:
title: Configure flow title: Configure flow
description: Flow used by an authenticated user to configure this Stage. If description: Flow used by an authenticated user to configure this Stage. If
@ -10953,6 +10963,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
configure_flow: configure_flow:
title: Configure flow title: Configure flow
description: Flow used by an authenticated user to configure this Stage. If description: Flow used by an authenticated user to configure this Stage. If
@ -10993,6 +11008,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
not_configured_action: not_configured_action:
title: Not configured action title: Not configured action
type: string type: string
@ -11032,6 +11052,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
CaptchaStage: CaptchaStage:
description: CaptchaStage Serializer description: CaptchaStage Serializer
required: required:
@ -11061,6 +11086,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
public_key: public_key:
title: Public key title: Public key
description: Public key, acquired from https://www.google.com/recaptcha/intro/v3.html description: Public key, acquired from https://www.google.com/recaptcha/intro/v3.html
@ -11098,6 +11128,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
mode: mode:
title: Mode title: Mode
type: string type: string
@ -11137,6 +11172,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
EmailStage: EmailStage:
description: EmailStage Serializer description: EmailStage Serializer
required: required:
@ -11164,6 +11204,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
use_global_settings: use_global_settings:
title: Use global settings title: Use global settings
description: When enabled, global Email connection settings will be used and description: When enabled, global Email connection settings will be used and
@ -11246,6 +11291,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
user_fields: user_fields:
description: '' description: ''
type: array type: array
@ -11312,6 +11362,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
continue_flow_without_invitation: continue_flow_without_invitation:
title: Continue flow without invitation title: Continue flow without invitation
description: If this flag is set, this Stage will jump to the next Stage when description: If this flag is set, this Stage will jump to the next Stage when
@ -11364,6 +11419,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
backends: backends:
description: '' description: ''
type: array type: array
@ -11464,6 +11524,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
fields: fields:
type: array type: array
items: items:
@ -11503,6 +11568,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
UserLoginStage: UserLoginStage:
description: UserLoginStage Serializer description: UserLoginStage Serializer
required: required:
@ -11530,6 +11600,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
session_duration: session_duration:
title: Session duration title: Session duration
description: 'Determines how long a session lasts. Default of 0 means that description: 'Determines how long a session lasts. Default of 0 means that
@ -11563,6 +11638,11 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'
UserWriteStage: UserWriteStage:
description: UserWriteStage Serializer description: UserWriteStage Serializer
required: required:
@ -11590,3 +11670,8 @@ definitions:
title: Verbose name plural title: Verbose name plural
type: string type: string
readOnly: true readOnly: true
flow_set:
description: ''
type: array
items:
$ref: '#/definitions/Flow'

View File

@ -38,7 +38,14 @@ export class ApplicationViewPage extends LitElement {
render(): TemplateResult { render(): TemplateResult {
if (!this.application) { 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"> return html`<section class="pf-c-page__main-section pf-m-light">
<div class="pf-c-content"> <div class="pf-c-content">

View File

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