Skip to content

Commit 00dfbbf

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents d00ca2f + ac09617 commit 00dfbbf

File tree

3 files changed

+51
-7
lines changed

3 files changed

+51
-7
lines changed

adminforth/documentation/docs/tutorial/08-Plugins/17-bulk-ai-flow.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,4 +381,46 @@ The user will now see a popup with a "Start generation" button and an "Edit prom
381381
![alt text](Bulk-vision-5.png)
382382
![alt text](Bulk-vision-6.png)
383383
384-
> ☝️ Updated prompts are stored in the user's local storage. Changes are local to that browser and do not affect other users or devices.
384+
> ☝️ Updated prompts are stored in the user's local storage. Changes are local to that browser and do not affect other users or devices.
385+
386+
## Processing big sets of data ( filtered records )
387+
388+
There might be cases when you want to process more records than can fit your list view.
389+
Here you can use the `recordSelector` param.
390+
It can be `checkbox` (default) or `filtered`.
391+
`filtered` uses all filtered records for generation, so you can even process the whole resource.
392+
393+
394+
```ts
395+
new BulkAiFlowPlugin({
396+
actionName: 'Generate description and Price',
397+
398+
//diff-add
399+
recordSelector: 'filtered', // default is 'checkbox'
400+
401+
...
402+
403+
});
404+
```
405+
>❗️❗️❗️ Using `recordSelector: 'filtered'` might be expensive. Before processing large data sets, we recommend starting with smaller sets to make sure everything is fine.
406+
407+
408+
## Limiting amount of parallel requests using p-limit
409+
410+
If you are processing large sets of data, you might want to limit the number of parallel requests. For this, you can use the `concurrencyLimit` param:
411+
412+
```ts
413+
new BulkAiFlowPlugin({
414+
actionName: 'Generate description and Price',
415+
416+
//diff-add
417+
concurrencyLimit: 5, //default is 10
418+
419+
...
420+
421+
});
422+
```
423+
424+
And there won't be more than 5 parallel requests being handled.
425+
426+

adminforth/modules/restApi.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ import { ActionCheckSource, AdminForthConfigMenuItem, AdminForthDataTypes, Admin
2626
GetBaseConfigResponse,
2727
ShowInResolved} from "../types/Common.js";
2828
import { filtersTools } from "../modules/filtersTools.js";
29+
import is_ip_private from 'private-ip'
30+
2931

3032
async function resolveBoolOrFn(
3133
val: BackendOnlyInput | undefined,
@@ -380,9 +382,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
380382
if (username === 'adminforth') {
381383
defaultUserExists = true;
382384
}
383-
const clientIp = this.adminforth.auth.getClientIp(response.getHeaders?.() || {});
384-
const isPrivateIP = clientIp === null ? true : false;
385-
385+
386386
const publicPart = {
387387
brandName: this.adminforth.config.customization.brandName,
388388
usernameFieldName: usernameColumn.label,
@@ -411,7 +411,7 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
411411
globalInjections: this.adminforth.config.customization.globalInjections,
412412
userFullnameField: this.adminforth.config.auth.userFullNameField,
413413
settingPages: settingPages,
414-
hasDefaultUserOnPublicNetwork: defaultUserExists && !isPrivateIP
414+
defaultUserExists: defaultUserExists,
415415
}
416416

417417
// translate menu labels
@@ -1584,4 +1584,4 @@ export default class AdminForthRestAPI implements IAdminForthRestAPI {
15841584
});
15851585

15861586
}
1587-
}
1587+
}

adminforth/spa/src/components/Sidebar.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</div>
5252
</div>
5353

54-
<div v-if="coreStore.config.hasDefaultUserOnPublicNetwork" class="p-4 mb-4 text-white rounded-lg bg-red-700/80 fill-white text-sm">
54+
<div v-if="coreStore.config.defaultUserExists && !isLocalhost" class="p-4 mb-4 text-white rounded-lg bg-red-700/80 fill-white text-sm">
5555
<IconExclamationCircleOutline class="inline-block align-text-bottom mr-0,5 w-5 h-5" />
5656
Default user <strong>"adminforth"</strong> detected. Delete it and create your own account.
5757
</div>
@@ -307,6 +307,8 @@ import type { AnnouncementBadgeResponse } from '@/types/Common';
307307
import { useAdminforth } from '@/adminforth';
308308
import { IconExclamationCircleOutline} from '@iconify-prerendered/vue-flowbite';
309309
310+
const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1' || window.location.hostname === '::1';
311+
310312
const { menu } = useAdminforth();
311313
312314
interface Props {

0 commit comments

Comments
 (0)