@nymphjs/tilmeld-setup 1.0.0-beta.11 → 1.0.0-beta.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ {#if $clientConfig == null || $user == null}
2
+ <section>
3
+ <div style="display: flex; justify-content: center; align-items: center;">
4
+ <CircularProgress style="height: 45px; width: 45px;" indeterminate />
5
+ </div>
6
+ </section>
7
+ {:else}
8
+ <div class="solo-search-container solo-container">
9
+ <Fab
10
+ href="#/users/edit/+"
11
+ color="primary"
12
+ mini
13
+ class="solo-fab"
14
+ title="New User"
15
+ >
16
+ <Icon tag="svg" viewBox="0 0 24 24">
17
+ <path fill="currentColor" d={mdiPlus} />
18
+ </Icon>
19
+ </Fab>
20
+ <Paper class="solo-paper" elevation={6}>
21
+ <Icon class="solo-icon" tag="svg" viewBox="0 0 24 24">
22
+ <path fill="currentColor" d={mdiMagnify} />
23
+ </Icon>
24
+ <Input
25
+ bind:value={entitySearch}
26
+ onkeydown={entitySearchKeyDown}
27
+ placeholder="User Search"
28
+ class="solo-input"
29
+ />
30
+ </Paper>
31
+ <Fab
32
+ onclick={searchEntities}
33
+ disabled={entitySearch === ''}
34
+ color="primary"
35
+ mini
36
+ class="solo-fab"
37
+ title="Search"
38
+ >
39
+ <Icon tag="svg" viewBox="0 0 24 24">
40
+ <path fill="currentColor" d={mdiArrowRight} />
41
+ </Icon>
42
+ </Fab>
43
+ </div>
44
+ <section>
45
+ {#if failureMessage}
46
+ <div class="tilmeld-failure">
47
+ {failureMessage}
48
+ </div>
49
+ {/if}
50
+
51
+ {#if entitiesSearching}
52
+ <div style="display: flex; justify-content: center; align-items: center;">
53
+ <CircularProgress style="height: 32px; width: 32px;" indeterminate />
54
+ </div>
55
+ {:else if entities != null}
56
+ <DataTable table$aria-label="User list" style="width: 100%;">
57
+ <Head>
58
+ <Row>
59
+ {#if !$clientConfig.emailUsernames}
60
+ <Cell>Username</Cell>
61
+ {/if}
62
+ {#if $clientConfig.userFields.includes('name')}
63
+ <Cell>Name</Cell>
64
+ {/if}
65
+ {#if $clientConfig.userFields.includes('email')}
66
+ <Cell>Email</Cell>
67
+ {/if}
68
+ <Cell>Enabled</Cell>
69
+ </Row>
70
+ </Head>
71
+ <Body>
72
+ {#each entities as curEntity (curEntity.guid)}
73
+ <Row>
74
+ {#if !$clientConfig.emailUsernames}
75
+ <Cell
76
+ ><a
77
+ href="#/users/edit/{encodeURIComponent(
78
+ curEntity.guid || '',
79
+ )}">{curEntity.username}</a
80
+ ></Cell
81
+ >
82
+ {/if}
83
+ {#if $clientConfig.userFields.includes('name')}
84
+ <Cell
85
+ ><a
86
+ href="#/users/edit/{encodeURIComponent(
87
+ curEntity.guid || '',
88
+ )}">{curEntity.name}</a
89
+ ></Cell
90
+ >
91
+ {/if}
92
+ {#if $clientConfig.userFields.includes('email')}
93
+ <Cell
94
+ ><a
95
+ href="#/users/edit/{encodeURIComponent(
96
+ curEntity.guid || '',
97
+ )}">{curEntity.email}</a
98
+ ></Cell
99
+ >
100
+ {/if}
101
+ <Cell>{curEntity.enabled ? 'Yes' : 'No'}</Cell>
102
+ </Row>
103
+ {:else}
104
+ <Row>
105
+ <Cell
106
+ colspan={1 +
107
+ (!$clientConfig.emailUsernames ? 1 : 0) +
108
+ ($clientConfig.userFields.includes('name') ? 1 : 0) +
109
+ ($clientConfig.userFields.includes('email') ? 1 : 0)}
110
+ >None found.</Cell
111
+ >
112
+ </Row>
113
+ {/each}
114
+ </Body>
115
+ </DataTable>
116
+ {/if}
117
+ </section>
118
+ {/if}
119
+
120
+ <script lang="ts">
121
+ import type { Writable } from 'svelte/store';
122
+ import type Navigo from 'navigo';
123
+ import queryParser from '@nymphjs/query-parser';
124
+ import type {
125
+ AdminUserData,
126
+ ClientConfig,
127
+ CurrentUserData,
128
+ } from '@nymphjs/tilmeld-client';
129
+ import type {
130
+ Group as GroupClass,
131
+ User as UserClass,
132
+ } from '@nymphjs/tilmeld-client';
133
+ import { mdiMagnify, mdiArrowRight, mdiPlus } from '@mdi/js';
134
+ import CircularProgress from '@smui/circular-progress';
135
+ import Paper from '@smui/paper';
136
+ import DataTable, { Head, Body, Row, Cell } from '@smui/data-table';
137
+ import { Input } from '@smui/textfield';
138
+ import Fab from '@smui/fab';
139
+ import { Icon } from '@smui/common';
140
+
141
+ import { nymph, User, Group } from '../nymph';
142
+
143
+ let {
144
+ router,
145
+ params,
146
+ clientConfig,
147
+ user,
148
+ }: {
149
+ router: Navigo;
150
+ params: { query?: string };
151
+ clientConfig: Writable<ClientConfig | undefined>;
152
+ user: Writable<(UserClass & CurrentUserData) | null | undefined>;
153
+ } = $props();
154
+
155
+ let entitySearch = $state(params.query ?? '');
156
+ let failureMessage: string | undefined = $state();
157
+
158
+ $effect(() => {
159
+ if (params) {
160
+ handleSearchParam();
161
+ }
162
+ });
163
+
164
+ async function handleSearchParam() {
165
+ if (params.query && params.query !== '') {
166
+ entitiesSearching = true;
167
+ failureMessage = undefined;
168
+ try {
169
+ const query = queryParser({
170
+ query: params.query,
171
+ entityClass: User,
172
+ defaultFields: ['username', 'name', 'email'],
173
+ qrefMap: {
174
+ User: {
175
+ class: User,
176
+ defaultFields: ['username', 'name', 'email'],
177
+ },
178
+ Group: {
179
+ class: Group,
180
+ defaultFields: ['groupname', 'name', 'email'],
181
+ },
182
+ },
183
+ });
184
+ entities = await nymph.getEntities(...query);
185
+ } catch (e: any) {
186
+ failureMessage = e?.message;
187
+ }
188
+ entitiesSearching = false;
189
+ }
190
+ }
191
+
192
+ let entitiesSearching = $state(false);
193
+ let entities: (UserClass & AdminUserData)[] | undefined = $state();
194
+ async function searchEntities() {
195
+ router.navigate(`/users/${encodeURIComponent(entitySearch)}`);
196
+ }
197
+ function entitySearchKeyDown(event: CustomEvent | KeyboardEvent) {
198
+ event = event as KeyboardEvent;
199
+ if (event.key === 'Enter') searchEntities();
200
+ }
201
+ </script>
@@ -0,0 +1,105 @@
1
+
2
+ .mdc-dialog .mdc-dialog__surface.tilmeld-password-dialog-surface {
3
+ width: 360px;
4
+ max-width: calc(100vw - 32px);
5
+ }
6
+ .tilmeld-password-failure.svelte-1oizvng {
7
+ margin-top: 1em;
8
+ color: var(--mdc-theme-error, #f00);
9
+ }
10
+ .tilmeld-password-loading.svelte-1oizvng {
11
+ display: flex;
12
+ justify-content: center;
13
+ align-items: center;
14
+ }
15
+
16
+
17
+
18
+ .mdc-dialog .mdc-dialog__surface.tilmeld-revoke-tokens-dialog-surface
19
+ {
20
+ width: 360px;
21
+ max-width: calc(100vw - 32px);
22
+ }
23
+ .tilmeld-revoke-tokens-failure.svelte-1llryk7 {
24
+ margin-top: 1em;
25
+ color: var(--mdc-theme-error, #f00);
26
+ }
27
+ .tilmeld-revoke-tokens-loading.svelte-1llryk7 {
28
+ display: flex;
29
+ justify-content: center;
30
+ align-items: center;
31
+ }
32
+
33
+
34
+ .mdc-dialog .mdc-dialog__surface.tilmeld-two-factor-dialog-surface {
35
+ width: 400px;
36
+ max-width: calc(100vw - 32px);
37
+ }
38
+ .tilmeld-two-factor-failure.svelte-1bkes2m {
39
+ margin-top: 1em;
40
+ color: var(--mdc-theme-error, #f00);
41
+ }
42
+ .tilmeld-two-factor-loading.svelte-1bkes2m {
43
+ display: flex;
44
+ justify-content: center;
45
+ align-items: center;
46
+ }
47
+
48
+
49
+ .mdc-dialog .mdc-dialog__surface.tilmeld-account-dialog-surface {
50
+ width: 360px;
51
+ max-width: calc(100vw - 32px);
52
+ }
53
+ .tilmeld-account-failure.svelte-1g5qls0 {
54
+ margin-top: 1em;
55
+ color: var(--mdc-theme-error, #f00);
56
+ }
57
+ .tilmeld-account-action.svelte-1g5qls0 {
58
+ margin-top: 1em;
59
+ }
60
+ .tilmeld-account-loading.svelte-1g5qls0 {
61
+ display: flex;
62
+ justify-content: center;
63
+ align-items: center;
64
+ }
65
+
66
+
67
+ .mdc-dialog .mdc-dialog__surface.tilmeld-recover-dialog-surface {
68
+ width: 540px;
69
+ max-width: calc(100vw - 32px);
70
+ }
71
+ .tilmeld-recover-action.svelte-1b72kkn {
72
+ margin-top: 1em;
73
+ }
74
+ .tilmeld-recover-failure.svelte-1b72kkn {
75
+ margin-top: 1em;
76
+ color: var(--mdc-theme-error, #f00);
77
+ }
78
+ .tilmeld-recover-loading.svelte-1b72kkn {
79
+ display: flex;
80
+ justify-content: center;
81
+ align-items: center;
82
+ }
83
+
84
+
85
+ .tilmeld-login-buttons.svelte-1nt1tpa {
86
+ display: flex;
87
+ flex-direction: row;
88
+ justify-content: start;
89
+ align-items: center;
90
+ margin-top: 1em;
91
+ }
92
+ .tilmeld-login-action.svelte-1nt1tpa {
93
+ margin-top: 1em;
94
+ }
95
+ .tilmeld-login-failure.svelte-1nt1tpa {
96
+ margin-top: 1em;
97
+ color: var(--mdc-theme-error, #f00);
98
+ }
99
+
100
+
101
+ @media (max-width: 720px) {
102
+ * > .hide-initial-small {
103
+ display: none;
104
+ }
105
+ }
@@ -0,0 +1 @@
1
+ export {};