Files
pipeline/frontend/lib/api/pipelineDevice.ts
T
chpark 4c1dc4082e
Build and Push Images / build-and-push (push) Has been cancelled
feat: Fleet/Collector/엣지 배포 관련 누적 작업 일괄 커밋
이전 세션들에서 작업된 아래 범위를 모두 포함:

Fleet 서브시스템 (src/fleet/)
- fleetDeviceService / fleetCommandService / fleetDeploymentService / fleetReleaseService
- fleetMetricsService, fleetScriptService, fleetEdgeConfigService
- Edge 디바이스 관리, 커맨드 발행, 배포/릴리스, 스크립트 동기화

Collector 확장
- centralMqttForwarder / centralForwarderConfigService
- equipmentStateService, pythonHookRunner, scriptCache
- Modbus/OPC-UA/S7/XGT 프로토콜 클라이언트
- targetDbIntrospection (저장 DB 조회)

Routes / API
- automationDashboardRoutes, centralForwarderRoutes, equipmentStateRoutes

DB
- importEdgeConfig (Python cached config → Pipeline DB)
- seedDataSources (external_db_connections 초기 시드)

엣지 배포 리소스
- docker/edge/Dockerfile.backend.prod, Dockerfile.frontend.prod
- docker/edge/docker-compose.edge.yml

프론트엔드
- admin/automaticMng (centralForwarder, dashboard, equipmentState)
- admin/fleet (commands, devices, deployments, releases, scripts, alerts)
- admin/pipeline-device 개선 (저장 DB 드롭다운, 태그 매핑 등)
- ExternalDbConnectionModal, ScriptsManagerDialog 등 신규 컴포넌트
- lib/api: automationDashboard, centralForwarder, equipmentState, fleet

docs/
- EDGE_SERVER_STRUCTURE, FLEET_COMPLETE, FLEET_EDGE_INTEGRATION, FLEET_HOOK_INTEGRATION

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 20:00:06 +09:00

68 lines
2.7 KiB
TypeScript

import { apiClient } from "./client";
const BASE = "/pipeline-device-connections";
export const pipelineDeviceApi = {
// 프로토콜 옵션
getProtocols: () =>
apiClient.get(`${BASE}/protocols`).then((r) => r.data),
// 장비 목록 (pipeline_equipment)
getEquipmentList: (search?: string) =>
apiClient.get(`${BASE}/equipment-list`, { params: search ? { search } : {} }).then((r) => r.data),
// 연결 CRUD
getConnections: (params?: { protocol?: string; is_active?: string; search?: string; status?: string }) =>
apiClient.get(BASE, { params }).then((r) => r.data),
getConnectionById: (id: number) =>
apiClient.get(`${BASE}/${id}`).then((r) => r.data),
createConnection: (data: any) =>
apiClient.post(BASE, data).then((r) => r.data),
updateConnection: (id: number, data: any) =>
apiClient.put(`${BASE}/${id}`, data).then((r) => r.data),
deleteConnection: (id: number) =>
apiClient.delete(`${BASE}/${id}`).then((r) => r.data),
testConnection: (id: number) =>
apiClient.post(`${BASE}/${id}/test`).then((r) => r.data),
// 훅 체인 테스트 (원본값 → 체인 실행 → 결과 + DB 저장 옵션)
testChain: (
id: number,
payload: { tag_name: string; raw_value: unknown; save_to_db?: boolean }
) =>
apiClient.post(`${BASE}/${id}/test-chain`, payload).then((r) => r.data),
// 수동 1회 수집 (실제 PLC에서 읽기 + 훅 적용 + DB 저장)
collectOnce: (id: number) =>
apiClient.post(`${BASE}/${id}/collect-once`).then((r) => r.data),
// Target DB introspection
listTargetDatabases: () =>
apiClient.get(`${BASE}/target-databases`).then((r) => r.data),
listTargetTables: (dbId: number) =>
apiClient.get(`${BASE}/target-databases/${dbId}/tables`).then((r) => r.data),
listTargetColumns: (dbId: number, tableName: string) =>
apiClient
.get(`${BASE}/target-databases/${dbId}/tables/${tableName}/columns`)
.then((r) => r.data),
// 태그 컬럼 매핑 일괄 업데이트
updateTagColumnMapping: (
connectionId: number,
mapping: Array<{ tag_id: number; target_column_name: string | null }>
) =>
apiClient
.put(`${BASE}/${connectionId}/tag-column-mapping`, { mapping })
.then((r) => r.data),
// 태그 매핑
getTagMappings: (connectionId: number) =>
apiClient.get(`${BASE}/${connectionId}/tags`).then((r) => r.data),
createTagMapping: (connectionId: number, data: any) =>
apiClient.post(`${BASE}/${connectionId}/tags`, data).then((r) => r.data),
updateTagMapping: (tagId: number, data: any) =>
apiClient.put(`${BASE}/tags/${tagId}`, data).then((r) => r.data),
deleteTagMapping: (tagId: number) =>
apiClient.delete(`${BASE}/tags/${tagId}`).then((r) => r.data),
};