Oscarcheng0312 opened a new pull request, #7692:
URL: https://github.com/apache/incubator-seata/pull/7692

   <!--
       Licensed to the Apache Software Foundation (ASF) under one or more
       contributor license agreements.  See the NOTICE file distributed with
       this work for additional information regarding copyright ownership.
       The ASF licenses this file to You under the Apache License, Version 2.0
       (the "License"); you may not use this file except in compliance with
       the License.  You may obtain a copy of the License at
   
           http://www.apache.org/licenses/LICENSE-2.0
       
       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.
   -->
   <!-- Please make sure you have read and understood the contributing 
guidelines -->
   
   - [x] I have read the 
[CONTRIBUTING.md](https://github.com/apache/incubator-seata/blob/2.x/CONTRIBUTING.md)
 guidelines.  
   - [x] I have registered the PR 
[changes](https://github.com/apache/incubator-seata/tree/2.x/changes).
   
   > **Note:** This is a **Draft PR** to collect early feedback on the UI and 
structure.  
   > The data source can be switched between **backend API** and **mock** via a 
simple flag.
   
   ---
   
   ## Ⅰ. Describe what this PR did
   
   This PR adds a **standalone frontend module** for **Connection Pool 
Monitoring (CPM)** located under  
   `console/src/main/resources/static/cpm`.
   
   ### Main Features
   - Metrics overview (active/idle connections, waiting threads, execution 
counts)  
   - Table with expandable per-service details  
   - Druid & HikariCP specific metric panels (charts)  
   - Inline configuration editor dialog  
   - i18n (language toggle) and filter/search bar  
   - **Pluggable data source:** supports both backend endpoints and built-in 
mock data (for local demo)
   
   This module is **self-contained** and does **not** modify the existing 
`console-fe`.  
   Currently, data are based on **mockData.ts**, and backend API integration 
will be implemented once `ConnectionPoolController` endpoints are finalized.  
   This PR is temporarily a draft for mentor review and will later be rebased 
onto `2.x` for the official merge.
   
   ---
   
   ## Ⅱ. Does this pull request fix one issue?
   
   No specific issue is fixed.  
   This is part of the **GSoC 2025 project**: *Connection Pool Monitoring and 
Configuration Framework* (Seata AT/XA modes).
   
   ---
   
   ## Ⅲ. Why are there no test cases (unit/integration)?
   
   This PR only adds frontend static resources (React + TypeScript).  
   It does not include Java modules or backend logic that require test 
coverage.  
   Frontend UI tests and API integration tests will be added in a follow-up PR 
once backend endpoints are finalized.
   
   ---
   
   ## Ⅳ. How to verify it
   
   ### A) Use **Backend API** (recommended once endpoints are available)
   
   1. Ensure the console exposes CPM endpoints such as:
      ```
      GET /api/v1/connection-pools/metrics
      GET /api/v1/connection-pools/configs
      PUT /api/v1/connection-pools/{serviceName}/config
      ```
   2. In `console/src/main/resources/static/cpm/src/services/api.ts`, set:
      ```ts
      const USE_MOCK_DATA = false;
      ```
   3. Build and run:
      ```bash
      cd console/src/main/resources/static/cpm
      npm ci
      npm run build
   
      # In another terminal
      mvn -DskipTests -pl :seata-console -am spring-boot:run
      ```
   4. Open http://localhost:7091/cpm/ and verify:
      - Metrics grid and table render real data  
      - Expanded rows show Druid/Hikari charts  
      - “Edit Config” works (submit + refresh)
   
   ---
   
   ### B) Use **Mock Data** (for local demo)
   
   1. In `src/services/api.ts`, set:
      ```ts
      const USE_MOCK_DATA = true;
      ```
   2. Build & run as above, then open http://localhost:7091/cpm/.  
      Mock data will populate the metrics, tables, and charts for UI review.
   
   ---
   
   ## Ⅴ. Special notes for reviewers
   
   - ASF headers added to `.ts`, `.tsx`, `.css`, `.html`, and `.md` files.  
     Headers are omitted for `manifest.json`, `package.json`, 
`package-lock.json`, and image assets.  
   - The CPM module uses **Ant Design v4**, **TypeScript**, and **React**, and 
is fully isolated under `/static/cpm`.  
   - No modifications were made to the existing `console-fe`.  
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to