Skip to content

Commit 3c7bf99

Browse files
author
Jicheng Lu
committed
relocate spinner
1 parent 5f1e85c commit 3c7bf99

File tree

8 files changed

+59
-20
lines changed

8 files changed

+59
-20
lines changed

src/lib/common/LoadingToComplete.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,20 @@
55
export let isLoading = false;
66
export let isComplete = false;
77
export let isError = false;
8+
export let spinnerClasses = '';
9+
export let spinnerStyles = '';
10+
export let spinnerSize = 50;
811
912
export let successText = 'Update completed!';
1013
export let errorText = 'Error!';
11-
export let spinnerSize = 50;
1214
</script>
1315

1416
{#if isLoading}
15-
<Loader size={spinnerSize} />
17+
<Loader
18+
size={spinnerSize}
19+
containerClasses={spinnerClasses}
20+
containerStyles={spinnerStyles}
21+
/>
1622
{/if}
1723

1824

src/lib/helpers/http.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,24 +208,32 @@ function skipLoader(config) {
208208

209209
/** @type {RegExp[]} */
210210
const getRegexes = [
211+
new RegExp('http(s*)://(.*?)/plugin/menu', 'g'),
212+
new RegExp('http(s*)://(.*?)/settings', 'g'),
211213
new RegExp('http(s*)://(.*?)/setting/(.*?)', 'g'),
214+
new RegExp('http(s*)://(.*?)/roles', 'g'),
215+
new RegExp('http(s*)://(.*?)/role/options', 'g'),
216+
new RegExp('http(s*)://(.*?)/role/(.*?)/details', 'g'),
217+
new RegExp('http(s*)://(.*?)/user/(.*?)/details', 'g'),
212218
new RegExp('http(s*)://(.*?)/user/me', 'g'),
213-
new RegExp('http(s*)://(.*?)/plugin/menu', 'g'),
214219
new RegExp('http(s*)://(.*?)/address/options(.*?)', 'g'),
220+
new RegExp('http(s*)://(.*?)/agent/options', 'g'),
221+
new RegExp('http(s*)://(.*?)/agent/labels', 'g'),
222+
new RegExp('http(s*)://(.*?)/agent/tasks', 'g'),
223+
new RegExp('http(s*)://(.*?)/agent/(.*?)/code-scripts', 'g'),
224+
new RegExp('http(s*)://(.*?)/conversations', 'g'),
225+
new RegExp('http(s*)://(.*?)/conversation/state/keys', 'g'),
215226
new RegExp('http(s*)://(.*?)/conversation/(.*?)/files/(.*?)', 'g'),
227+
new RegExp('http(s*)://(.*?)/llm-configs', 'g'),
216228
new RegExp('http(s*)://(.*?)/llm-provider/(.*?)/models', 'g'),
217229
new RegExp('http(s*)://(.*?)/knowledge/vector/collections', 'g'),
218230
new RegExp('http(s*)://(.*?)/knowledge/vector/(.*?)/exist', 'g'),
219-
new RegExp('http(s*)://(.*?)/role/options', 'g'),
220-
new RegExp('http(s*)://(.*?)/role/(.*?)/details', 'g'),
221-
new RegExp('http(s*)://(.*?)/user/(.*?)/details', 'g'),
222-
new RegExp('http(s*)://(.*?)/agent/labels', 'g'),
223-
new RegExp('http(s*)://(.*?)/conversation/state/keys', 'g'),
231+
new RegExp('http(s*)://(.*?)/logger/instruction/log', 'g'),
224232
new RegExp('http(s*)://(.*?)/logger/instruction/log/keys', 'g'),
225233
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/content-log', 'g'),
226234
new RegExp('http(s*)://(.*?)/logger/conversation/(.*?)/state-log', 'g'),
227235
new RegExp('http(s*)://(.*?)/mcp/server-configs', 'g'),
228-
new RegExp('http(s*)://(.*?)/agent/(.*?)/code-scripts', 'g')
236+
229237
];
230238

231239
if (config.method === 'post' && postRegexes.some(regex => regex.test(config.url || ''))) {
@@ -241,6 +249,7 @@ function skipLoader(config) {
241249
}
242250

243251
if (config.method === 'get' && getRegexes.some(regex => regex.test(config.url || ''))) {
252+
console.log('url', config.url);
244253
return true;
245254
}
246255

src/lib/services/role-service.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { endpoints } from './api-endpoints.js';
22
import axios from 'axios';
3+
import qs from 'qs';
34

45
/**
56
* Get role options
@@ -17,7 +18,10 @@ export async function getRoleOptions() {
1718
* @returns {Promise<import('$roleTypes').RoleModel[]>}
1819
*/
1920
export async function getRoles(filter = null) {
20-
const response = await axios.post(endpoints.rolesUrl, filter);
21+
const response = await axios.get(endpoints.rolesUrl, {
22+
params: filter,
23+
paramsSerializer: (params) => qs.stringify(params, { encode: false, allowDots: true, arrayFormat: "indices" })
24+
});
2125
return response.data;
2226
}
2327

src/routes/page/conversation/+page.svelte

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,6 @@
414414
415415
<HeadTitle title="{$_('Conversation List')}" />
416416
<Breadcrumb title="{$_('Communication')}" pagetitle="{$_('Conversations')}" />
417-
<LoadingToComplete isLoading={isLoading} isComplete={isComplete} successText={'Delete completed!'} />
418417
419418
<Row>
420419
<Col lg="12">
@@ -529,6 +528,12 @@
529528
</CardBody>
530529
<CardBody>
531530
<div class="table-responsive thin-scrollbar">
531+
<LoadingToComplete
532+
spinnerStyles={'position: absolute;'}
533+
isLoading={isLoading}
534+
isComplete={isComplete}
535+
successText={'Delete completed!'}
536+
/>
532537
<Table class="align-middle nowrap" bordered>
533538
<thead>
534539
<tr>

src/routes/page/instruction/log/+page.svelte

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import { TimeRange } from '$lib/helpers/enums';
2424
import { TIME_RANGE_OPTIONS } from '$lib/helpers/constants';
2525
import LogItem from './log-item.svelte';
26+
import Loader from '$lib/common/Loader.svelte';
2627
2728
2829
const firstPage = 1;
@@ -291,7 +292,6 @@
291292
292293
<HeadTitle title="{$_('Instruction Log')}" />
293294
<Breadcrumb pagetitle="{$_('Log')}" title="{$_('Instruction')}"/>
294-
<LoadingToComplete isLoading={isLoading} />
295295
296296
<Row>
297297
<Col lg="12">
@@ -393,6 +393,7 @@
393393
</CardBody>
394394
<CardBody>
395395
<div class="table-responsive thin-scrollbar">
396+
<LoadingToComplete spinnerStyles={'position: absolute;'} isLoading={isLoading} />
396397
<Table class="align-middle nowrap users-table" bordered>
397398
<thead>
398399
<tr>
@@ -407,9 +408,7 @@
407408
</thead>
408409
<tbody>
409410
{#each logItems as item, idx (idx)}
410-
<LogItem
411-
item={item}
412-
/>
411+
<LogItem item={item} />
413412
{/each}
414413
</tbody>
415414
</Table>

src/routes/page/roles/+page.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@
147147
148148
<HeadTitle title="{$_('Role List')}" />
149149
<Breadcrumb title="{$_('Management')}" pagetitle="{$_('Roles')}" />
150-
<LoadingToComplete isLoading={isLoading} isComplete={isComplete} isError={isError} successText={successText} errorText={errorText} />
151-
152150
153151
<Row>
154152
<Col lg="12">
@@ -160,6 +158,14 @@
160158
</CardBody>
161159
<CardBody>
162160
<div class="table-responsive thin-scrollbar">
161+
<LoadingToComplete
162+
spinnerStyles={'position: absolute;'}
163+
isLoading={isLoading}
164+
isComplete={isComplete}
165+
isError={isError}
166+
successText={successText}
167+
errorText={errorText}
168+
/>
163169
<Table class="align-middle nowrap roles-table" bordered>
164170
<thead>
165171
<tr>

src/routes/page/task/+page.svelte

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@
260260
261261
<HeadTitle title="{$_('Task List')}" />
262262
<Breadcrumb title="{$_('Agent')}" pagetitle="{$_('Task')}" />
263-
<LoadingToComplete isLoading={isLoading} isComplete={isComplete} />
264263
265264
<Row>
266265
<Col lg="12">
@@ -313,6 +312,11 @@
313312
</CardBody>
314313
<CardBody>
315314
<div class="table-responsive">
315+
<LoadingToComplete
316+
spinnerStyles={'position: absolute;'}
317+
isLoading={isLoading}
318+
isComplete={isComplete}
319+
/>
316320
<Table class="align-middle nowrap" bordered>
317321
<thead>
318322
<tr>

src/routes/page/users/+page.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,6 @@
232232
233233
<HeadTitle title="{$_('User List')}" />
234234
<Breadcrumb title="{$_('Management')}" pagetitle="{$_('Users')}" />
235-
<LoadingToComplete isLoading={isLoading} isComplete={isComplete} isError={isError} successText={successText} errorText={errorText} />
236-
237235
238236
<Row>
239237
<Col lg="12">
@@ -272,6 +270,14 @@
272270
</CardBody>
273271
<CardBody>
274272
<div class="table-responsive thin-scrollbar">
273+
<LoadingToComplete
274+
spinnerStyles={'position: absolute;'}
275+
isLoading={isLoading}
276+
isComplete={isComplete}
277+
isError={isError}
278+
successText={successText}
279+
errorText={errorText}
280+
/>
275281
<Table class="align-middle nowrap users-table" bordered>
276282
<thead>
277283
<tr>

0 commit comments

Comments
 (0)