kimyenac opened a new pull request, #5313:
URL: https://github.com/apache/zeppelin/pull/5313

   ### What is this PR for?
   
   The Angular frontend hardcoded the same aggregation-type set (count, sum, 
min, max, avg) in two independent places — the table visualization and the 
pivot setting UI — with no single source of truth. The table component declared 
a local, unexported `AggregationType` union plus a value array; the pivot 
component had only an untyped `string[]` with the same values in a different 
order. Duplication meant the two could silently drift, and type safety was 
inconsistent.
   
   This PR extracts a single shared constant and matching type, and has both 
components consume it.
   
   ### What changes were proposed in this PR?
   
   - Add `common/util/aggregation-type.ts` exporting `AGGREGATION_TYPES` (`as 
const`) and `AggregationType = (typeof AGGREGATION_TYPES)[number]` as the 
single source of truth.
   - `table-visualization.component.ts`: remove the local, unexported 
`AggregationType` type and the duplicated literal array; import the shared 
definition. `aggregations` is now `readonly AggregationType[]`.
   - `pivot-setting.component.ts`: replace the untyped `string[]` with 
`readonly AggregationType[]` from the shared constant, consistent with the 
table component.
   
   Both usages are read-only iteration/display (`@for`), so `as const` / 
`readonly` is safe.
   
   #### Canonical order (user-visible decision)
   
   The pivot array directly drives the aggregation dropdown display order. To 
avoid any user-visible change, the shared constant adopts the **pivot's 
existing order** (`sum, count, avg, min, max`). The table's internal array is 
reordered accordingly, but that array does not drive any display, so there is 
no visible impact. The pivot aggregation dropdown order is unchanged.
   
   ### How should this be tested?
   
   There is no frontend unit-test infrastructure in this project, so regression 
is confirmed via lint + build:
   
   ```
   cd zeppelin-web-angular && npm run lint && npm run build:angular
   ```
   
   Both pass (0 lint errors, successful production build). Manually verified 
the pivot aggregation dropdown still shows `sum, count, avg, min, max`.
   
   ### Questions
   
   - Does the license files need to update? No
   - Is there breaking change for older versions? No
   - Does this needs documentation? No
   


-- 
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]

Reply via email to