feat(esi): add PostRouteForAllByNames and resolve system names in batch

This commit introduces a new function `PostRouteForAllByNames` to the ESI service, which allows setting a complete route (including waypoints) for all logged-in characters. This is achieved by batch resolving system names to their IDs, improving efficiency and simplifying the process of setting complex routes.

The changes include:
- Adding `ResolveSystemIDsByNames` to `ESISSO` to fetch multiple system IDs in a single ESI request.
- Implementing `PostRouteForAll` in `ESISSO` to handle the logic of setting the destination and waypoints for all characters.
- Updating `App.go` to expose `PostRouteForAllByNames` for frontend use.
- Modifying the frontend component `RegionMap.tsx` to utilize the new `PostRouteForAllByNames` function when setting routes, replacing the previous sequential calls to `SetDestinationForAll` and `AddWaypointForAllByName`.
- Updating Wails generated type definitions (`.d.ts` and `.js`) to reflect the new function.
This commit is contained in:
2025-08-09 20:01:59 +02:00
parent ef57bf4cde
commit f06a60c701
5 changed files with 96 additions and 40 deletions

View File

@@ -8,7 +8,7 @@ import { loadWormholeSystems, saveWormholeSystem, deleteWormholeSystem } from '@
import { System, Position, Connection as ConnectionType } from '@/lib/types';
import { getSecurityColor } from '@/utils/securityColors';
import { Header } from './Header';
import { ListCharacters, StartESILogin, SetDestinationForAll, AddWaypointForAllByName } from 'wailsjs/go/main/App';
import { ListCharacters, StartESILogin, SetDestinationForAll, AddWaypointForAllByName, PostRouteForAllByNames } from 'wailsjs/go/main/App';
import { toast } from '@/hooks/use-toast';
interface RegionMapProps {
@@ -76,14 +76,10 @@ export const RegionMap = ({ regionName, focusSystem, isCompact = false, isWormho
useEffect(() => {
const onKeyDown = async (e: KeyboardEvent) => {
if (e.key === 'Escape' && viaMode) {
// Commit the route: post destination then queued waypoints
try {
if (!(await ensureAnyLoggedIn())) return;
if (viaDest) {
await SetDestinationForAll(viaDest, true, false);
for (const name of viaQueue) {
await AddWaypointForAllByName(name, false);
}
await PostRouteForAllByNames(viaDest, viaQueue);
toast({ title: 'Route set', description: `${viaDest}${viaQueue.length ? ' via ' + viaQueue.join(', ') : ''}` });
}
} catch (err: any) {