SSE ETL Component & Integration Guide
This document provides a technical guide for developers on the three-stage import system. It covers the purpose of each Vue component, their API (props and events), and the required Laravel backend setup for Server-Sent Events (SSE) interaction.(English)
Part 1: Component Architecture Overview
The import process is managed by three distinct Vue components that create a robust, three-stage user experience:AttachmentLinkUpload.vue: The initial file uploader. It handles the first stage (Upload) and, when configured, triggers the second stage.SseProgressBar.vue: A reusable component that provides real-time progress for any long-running background task (Buffering and Commit stages).EtlImportModal.vue: The main orchestrator. It controls the overall workflow, showing the correct component for each stage and managing the state of the import process.
Part 2: Component Documentation
1. SseProgressBar.vue
A general-purpose component for displaying real-time progress from an SSE stream.
Purpose
To connect to a server endpoint, listen for progress events, and display the status and percentage to the user.Props
Events
Usage Example
2. AttachmentLinkUpload.vue
A flexible file uploader that can operate in a standard mode or in a background-processing mode with SSE.
Purpose
To handle the initial file upload. In “SSE mode,” it uploads the file and then immediately hands off to theSseProgressBar to track the background job it just triggered.
Key Props for ETL Integration
Key Events for ETL Integration
Usage Example
3. EtlImportModal.vue
The main modal component that orchestrates the entire import flow.
Purpose
To provide a complete UI for the three-stage import process by managing and displaying the other two components based on the currentstage.
Props
Public Methods
Events
Part 3: Backend Setup for SSE Interaction
The frontend components rely on specific backend endpoints to function correctly.1. Required Routes
Ensure these routes are defined in yourroutes/api.php file.
2. Controller Logic for SSE
The controller needs methods to handle the SSE connections. A helper function can reduce code duplication. File:app/Http/Controllers/EtlController.php
3. Job Progress Reporting
Your background jobs must periodically update a value in the cache that the controller can read. Example fromProcessImportFileJob.php:
(Bahasa Indonesia)
Bagian 1: Gambaran Arsitektur Komponen
Proses impor dikelola oleh tiga komponen Vue yang berbeda untuk menciptakan pengalaman pengguna tiga tahap yang tangguh:AttachmentLinkUpload.vue: Pengunggah file awal. Komponen ini menangani tahap pertama (Upload) dan, saat dikonfigurasi, akan memicu tahap kedua.SseProgressBar.vue: Komponen yang dapat digunakan kembali yang menyediakan progres real-time untuk tugas latar belakang apa pun yang berjalan lama (tahap Buffering dan Commit).EtlImportModal.vue: Orkestrator utama. Komponen ini mengontrol alur kerja secara keseluruhan, menampilkan komponen yang benar untuk setiap tahap, dan mengelola status proses impor.
Bagian 2: Dokumentasi Komponen
1. SseProgressBar.vue
Komponen serbaguna untuk menampilkan progres real-time dari stream Server-Sent Events (SSE).
Tujuan
Untuk terhubung ke endpoint server, mendengarkan event progres, dan menampilkan status serta persentase kepada pengguna.Props
Event
2. AttachmentLinkUpload.vue
Pengunggah file fleksibel yang dapat beroperasi dalam mode standar atau mode pemrosesan latar belakang dengan SSE.
Tujuan
Untuk menangani unggahan file awal. Dalam “mode SSE”, komponen ini mengunggah file dan segera menyerahkannya keSseProgressBar untuk melacak tugas latar belakang yang baru saja dipicu.
Props Kunci untuk Integrasi ETL
Event Kunci untuk Integrasi ETL
3. EtlImportModal.vue
Komponen modal utama yang mengatur seluruh alur impor.
Tujuan
Menyediakan UI lengkap untuk proses impor tiga tahap dengan mengelola dan menampilkan dua komponen lainnya berdasarkanstage saat ini.
Props
Method Publik
Event
Bagian 3: Pengaturan Backend untuk Interaksi SSE
Komponen frontend bergantung pada endpoint backend tertentu agar dapat berfungsi dengan benar.1. Rute yang Diperlukan
Pastikan rute-rute ini didefinisikan dalam fileroutes/api.php Anda.
2. Logika Controller untuk SSE
Controller memerlukan method untuk menangani koneksi SSE. Fungsi pembantu dapat mengurangi duplikasi kode. File:app/Http/Controllers/EtlController.php
3. Pelaporan Progres dari Job
Job latar belakang Anda harus secara berkala memperbarui nilai di cache yang dapat dibaca oleh controller. Contoh dariProcessImportFileJob.php:

