Skip to content

Commit 83a2a44

Browse files
Merge branch 'master' into fix/upload-queue
2 parents f44eaeb + 67b902e commit 83a2a44

File tree

112 files changed

+6354
-612
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+6354
-612
lines changed

.cursor/rules/accessibility.mdc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
description: Accessibility rules for components, styles, and templates.
3+
globs: ["**/*.tsx", "**/templates/**", "**/*.scss"]
4+
alwaysApply: false
5+
---
6+
7+
# A11y Essentials
8+
- Use semantic elements; controls must have accessible names.
9+
- Dialogs: trap focus, restore on close, label/describe properly.
10+
- Announce async states (loading, error, empty); no color-only meanings.
11+
- Use ARIA when elements might not fully describe a complex widget's purpose or behavior
12+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
description: Build/dev scripts norms; attach to package/build/config files.
3+
globs: ["package.json", "webpack*.js", "tsconfig.json", "Makefile", "pyproject.toml"]
4+
alwaysApply: false
5+
---
6+
7+
# Build/Dev
8+
- Frontend dev: `npm run dev`, `dev-login`, `dev-workers`.
9+
- Production bundles: `npm run webpack*`.
10+
- Python apps: `make apps` / `make desktop`.
11+
- CI: scripts must be non-interactive and idempotent.
12+
13+
## Checklists
14+
- Register new React roots in relevant imports/bootstrap as required by Hue.
15+
- Keep TS strict; no downlevel that breaks antd/cuix typings.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: ESLint/Prettier/Stylelint/TS strictness; attach broadly to source and configs.
3+
globs: [".eslintrc.*", ".prettierrc*", ".stylelintrc*", "**/*.ts", "**/*.tsx", "**/*.scss"]
4+
alwaysApply: false
5+
---
6+
7+
# Code Quality
8+
- Run `npm run lint`, `style-lint`, `prettier` before committing.
9+
- Do not disable rules without justification in-code.
10+
- Prefer `readonly`, narrow `unknown`, avoid `any`.
11+
- Keep imports ordered; avoid unused exports.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
description: Conventions for React/TS, imports, naming, structure; auto-attach to UI code.
3+
globs: ["**/*.ts", "**/*.tsx"]
4+
alwaysApply: false
5+
---
6+
7+
# React + TS Conventions
8+
- Use `interface` for props; no `any`; narrow `unknown`.
9+
- Import order: externals → internal utils/hooks → types → styles (last).
10+
- Keep components cohesive; lift state; split large parts into small pure pieces.
11+
12+
## New react components
13+
- Component folder: `ComponentName/ComponentName.tsx` + `ComponentName.test.tsx` + `ComponentName.scss`.
14+
- Do not create an index.ts file
15+
- Always the create a unit test and if needed the scss file
16+
- Always include the Cloudera copyright msg at the beginning of the file
17+
- Global and reusable components are placed in folder `desktop/core/src/desktop/js/reactComponents`
18+
- Put app specific components under that app, e.g. `desktop/core/src/desktop/js/apps/editor/components/`
19+
20+
## Example Skeleton
21+
```ts
22+
export interface FooProps { title: string; onAction?: () => void }
23+
export const Foo = ({ title, onAction }: FooProps) => (
24+
<div className="foo">
25+
<h2>{title}</h2>
26+
<button onClick={onAction}>{t('Click me')}</button>
27+
</div>
28+
);
29+
```
30+
31+
## Performance
32+
Lazy-load heavy chunks; debounce/cancel network work; memoize expensive calcs.

.cursor/rules/i18n-and-copy.mdc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
description: i18n and microcopy rules for all user-facing text.
3+
globs: ["**/*.tsx", "**/*.ts", "**/*.vue", "**/*.ko", "**/templates/**"]
4+
alwaysApply: false
5+
---
6+
7+
# i18n & Copy
8+
- All user-facing strings go through i18n (`useTranslation()` in `i18nReact`).
9+
- Copy should be concise, action-oriented, and consistent.
10+
- Error messages = clear cause + actionable next step.
11+
- Default namespace `translation` unless justified otherwise.
12+
13+
14+
## Example
15+
```ts
16+
import { i18nReact } from '../../../utils/i18nReact';
17+
18+
const { t } = i18nReact.useTranslation();
19+
20+
const buttonLabel = t('click me')
21+
```t
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
description: Guidance for React mounting in templates and KO/Vue boundaries.
3+
globs: ["**/templates/**", "**/*.ko", "**/*.vue", "**/*.tsx"]
4+
alwaysApply: false
5+
---
6+
7+
# Integration Patterns
8+
- **KO → React**: use `reactWrapper` binding; keep KO observables at boundary.
9+
- **Templates (Mako/HTML)**: mount via `data-reactcomponent` on stable containers.
10+
- **Vue legacy**: do not introduce new Vue; prefer React for new work.
11+
12+
## Pitfalls
13+
- Ensure cuix/antd CSS scope present at React root.
14+
- Avoid dual ownership of DOM by different frameworks.
15+

.cursor/rules/legacy-migration.mdc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Strategy for migrating jQuery/KO/Less pieces toward React/SCSS.
3+
globs: ["**/jquery/**", "**/*.less", "**/*.ko.js", "**/*.vue", "**/*.tsx"]
4+
alwaysApply: false
5+
---
6+
7+
# Migration Strategy
8+
- When touching legacy code, always ask before adding typed adapters and moving logic to React/TS.
9+
- Replace jQuery DOM ops with state/effects; keep remaining jQuery isolated.
10+
- Only convert Less→SCSS for code that is migrated to react.js, don't mix less and scss for the same component.
11+
- Add regression tests before refactors.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
description: PR review output policy and checklist;
3+
alwaysApply: false
4+
---
5+
# PR Review
6+
7+
## Instructions
8+
— Only Output Issues/Improvements, DO NOT list all that is already good.
9+
- Be concise.
10+
- Provide a general feedback section for issues spanning multiple files, e.g. architectural.
11+
- Provide a section per file with links to the source files.
12+
13+
## Always check for
14+
- Architecture: lift/split state; keep components cohesive.
15+
- Naming clarity: components, functions, variables.
16+
- Edge cases: loading/empty/error; network failures.
17+
- Accessibility: roles, labels, focus, contrast. Only comment where needed,
18+
- Check for aria- attributes ONLY when needed. e.g.
19+
- DO: comment if an icon inly button is missing aria-label.
20+
- DON'T: comment about missing aria-disabled if a native disabled attribute is used.
21+
- Copy: concise, consistent; i18n everywhere.
22+
- All files must start with the Cloudera copyright statement
23+
24+
## Make sure that test files
25+
- test main flows
26+
- use userEvent and avoid fireEvent unless realy needed.
27+
- does not test implementation details; assert on behavior and rendered screens.
28+
- use role/name queries, e.g. getByRole rather than getByText
29+
- uses toBeVisible() instead of toBeInTheDocument() where possible
30+
- use the component name in the describe function
31+
- use "it" function over "test" for better readbility
32+
33+
34+
## Make sure the style files
35+
- use BEM notation (avoid unnecessary nesting for classes but allow .antd.cuix on the root)
36+
- never use hardcoded colors; use tokens/variables.
37+
- avoid hardcoded variables for positioning/spacing if possible
38+
- do not contain unnused classes
39+
- use classes over HTML elements whenever possible
40+
41+

.cursor/rules/project-overview.mdc

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
description: Terse Hue overview + global constraints; always include in all requests.
3+
globs:
4+
alwaysApply: true
5+
---
6+
7+
# Hue Overview (short)
8+
- Backend: Python/Django; Frontend: React (primary) + some Vue/KO/jQuery.
9+
- Styling: SCSS (BEM). Avoid adding new Less; migrate to SCSS when touching.
10+
- UI libs: Ant Design (antd) + Cloudera UI (cuix).
11+
- TS strict; avoid `any`. Prefer named type imports.
12+
- No CSS Modules; use global SCSS conventions.
13+
14+
## Golden Rules
15+
- Focus on the task given, do not expand your tasks without requesting confirmation first.
16+
- Do not automatically start coding if you are asked a question. Only code when asked to.
17+
- Always try to follow best practices and avoid hacks
18+
- Write Clean Code with Meaningful names, Single responsibility, Expressive code etc
19+
- Prefer **React + TypeScript** for new UI.
20+
- Maintain KO↔React via `reactWrapper` where used.
21+
- No hardcoded color codes; use tokens/variables.
22+
- All user-facing text must be i18n'd.
23+
24+
25+
## Project Structure
26+
hue/
27+
├── apps/ # Backend Django applications
28+
│ ├── beeswax/ # Hive query interface
29+
│ ├── filebrowser/ # File system browser
30+
│ ├── impala/ # Impala query interface
31+
│ ├── jobbrowser/ # Job monitoring
32+
│ ├── metastore/ # DB Table Browser
33+
│ ├── notebook/ # Interactive sql Editor
34+
│ ├── oozie/ # Workflow management
35+
│ ├── rdbms/ # RDBMS connectors
36+
│ └── ... # Other backend apps
37+
├── desktop/ # Core desktop functionality
38+
│ ├── core/ # Core desktop components
39+
│ │ └── src/desktop/
40+
│ │ ├── js/ # Frontend JavaScript/TypeScript
41+
│ │ │ ├── apps/ # Application-specific components
42+
│ │ │ │ ├── editor/ # SQL Editor app
43+
│ │ │ │ ├── notebook/ # Notebook app
44+
│ │ │ │ ├── tableBrowser/
45+
│ │ │ │ └── jobBrowser/
46+
│ │ │ ├── reactComponents/ # Shared React components
47+
│ │ │ ├── vue/ # Vue.js components
48+
│ │ │ ├── ko/ # Knockout.js components
49+
│ │ │ ├── components/ # Legacy components
50+
│ │ │ ├── utils/ # Utility functions
51+
│ │ │ ├── api/ # API utilities
52+
│ │ │ └── types/ # TypeScript type definitions
53+
│ │ ├── static/ # Static assets
54+
│ │ └── templates/ # Django templates
55+
│ └── libs/ # Shared libraries
56+
├── tools/ # Build and development tools
57+
├── docs/ # Documentation
58+
├── ext/ # External dependencies
59+
├── maven/ # Maven build configuration
60+
├── package.json # Frontend dependencies
61+
├── pyproject.toml # Python project configuration
62+
├── webpack.config.js # Webpack configuration
63+
├── tsconfig.json # TypeScript configuration
64+
├── jest.config.js # Jest testing configuration
65+
├── .eslintrc.js # ESLint configuration
66+
├── .prettierrc # Prettier configuration
67+
├── .stylelintrc # Stylelint configuration
68+
└── Makefile # Build automation
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
description: SCSS + BEM rules; forbid hardcoded colors; attach to style files.
3+
globs: ["**/*.scss", "**/*.less"]
4+
alwaysApply: false
5+
---
6+
7+
# Styling Rules
8+
- **Primary:** SCSS with BEM; avoid adding new Less. Do not automigrate when touching unless you can easily migrate the entire file.
9+
- **No hardcoded colors**; use SCSS variables/tokens (cuix/antd) from
10+
- Co-locate `ComponentName.scss` with the component; keep selectors BEM-scoped.
11+
- Prefer BEM modifiers over state classes
12+
- Prefer classes over using HTML element selectors
13+
14+
## Example
15+
```scss
16+
@use 'variables' as vars;
17+
.component-name {
18+
&__title { color: vars.$hue-primary-color-dark;; }
19+
&--disabled { opacity: .5; cursor: not-allowed; }
20+
}
21+
```

0 commit comments

Comments
 (0)