ArafatKhan2198 commented on code in PR #10787:
URL: https://github.com/apache/ozone/pull/10787#discussion_r3612874972


##########
ozone-ui/packages/shared/src/components/AppLayout/AppLayout.tsx:
##########
@@ -0,0 +1,109 @@
+/**
+ * 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.
+ */
+
+import React from 'react';
+import { Layout, Typography } from 'antd';
+import { semanticColors, spacing, textStyles } from '../../theme/tokens';
+
+const { Header, Content } = Layout;
+
+export interface AppLayoutProps {
+  /** Navigation rail, typically the shared `Sidebar`. */
+  sider?: React.ReactNode;
+  /** Page/section title rendered in the header. */
+  title?: React.ReactNode;
+  /** Right-aligned header content (actions, user menu, breadcrumbs, ...). */
+  headerExtra?: React.ReactNode;
+  /** Main page content. */
+  children?: React.ReactNode;
+  /** Constrain content width and centre it (useful for form/detail pages). */
+  maxContentWidth?: number;
+}

Review Comment:
   Could we import this asset through the module graph, for example `import 
logoUrl from '../../../icons/favicon.ico'`, or place it in an application 
`public` directory with an explicit copy strategy? The current absolute 
`/shared/icons/favicon.ico` URL is not emitted by either `tsc` or the 
application Vite builds, so the Sidebar logo will be broken after deployment.
   >



##########
ozone-ui/packages/shared/src/components/AppLayout/AppLayout.tsx:
##########
@@ -0,0 +1,109 @@
+/**
+ * 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.
+ */
+
+import React from 'react';
+import { Layout, Typography } from 'antd';
+import { semanticColors, spacing, textStyles } from '../../theme/tokens';
+
+const { Header, Content } = Layout;
+
+export interface AppLayoutProps {
+  /** Navigation rail, typically the shared `Sidebar`. */
+  sider?: React.ReactNode;

Review Comment:
   The component hardcodes Ozone branding, routes, menu labels, icons and 
header state management. OM, SCM and Recon cannot safely reuse it unless they 
all expose the same `/appconfig` and `/profileconfig` routes.
   
   Since this is now part of the shared UI library, could the 
application-specific navigation be passed through props? At minimum, the 
component should accept `items`, `logo`, `title`, `selectedKeys` and 
`onSelect`/`onHeaderChange`. As written, every consumer inherits the same 
Overview and Configuration routes, which makes the component difficult to reuse 
across OM, SCM and Recon.
   >



##########
ozone-ui/packages/shared/package.json:
##########
@@ -1,5 +1,5 @@
 {
-  "name": "@hadoop-ui/shared",
+  "name": "@ozone-ui/shared",
   "private": true,

Review Comment:
   `Sidebar` imports `useLocation`, but `@ozone-ui/shared` does not declare 
`react-router-dom`. This makes the package dependent on workspace hoisting and 
can fail when it is consumed independently. Please either add 
`react-router-dom` as a peer dependency with a development dependency for 
compilation, or make the Sidebar router-agnostic by receiving the current path 
and navigation callback from the application.
   



##########
ozone-ui/packages/shared/src/components/TextLink/TextLink.tsx:
##########
@@ -0,0 +1,66 @@
+/**
+ * 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.
+ */
+
+import React from 'react';
+import { Typography } from 'antd';
+import type { LinkProps } from 'antd/es/typography/Link';
+import { textStyles } from '../../theme/tokens';
+import Icon from '../Icon/Icon';
+
+export interface TextLinkProps extends LinkProps {
+  /** Render as an external link (opens in a new tab, shows an external icon). 
*/
+  external?: boolean;
+  /** Text size. Defaults to `standard`. */
+  size?: 'standard' | 'small';
+}
+
+/**
+ * Inline text link built on Ant Design's `Typography.Link`, themed with the
+ * design-system link colour and type scale. Set `external` for links that open
+ * in a new tab (adds a trailing external-link glyph).
+ */
+export const TextLink: React.FC<TextLinkProps> = ({
+  external = false,
+  size = 'standard',
+  style,
+  children,
+  ...rest
+}) => {
+  const scale = size === 'small' ? textStyles.bodySmall : 
textStyles.bodyStandard;
+  const externalProps = external ? { target: '_blank', rel: 'noopener 
noreferrer' } : {};
+
+  return (

Review Comment:
   `...rest` is applied after the safe external-link properties, allowing a 
caller to override `target` or remove `rel="noopener noreferrer"`.
   
    Because `...rest` is spread after `externalProps`, callers can override 
`target` or `rel`, even when `external={true}`. The component contract says 
external links open safely in a new tab, so these attributes should be applied 
after `...rest`, or `rel` should be explicitly merged to guarantee `noopener 
noreferrer`.
   
   
   Suggested order:
   
   ```tsx
   <Typography.Link
     {...rest}
     {...externalProps}
     style={...}
   />
   ```



##########
ozone-ui/src/.gitignore:
##########
@@ -1,2 +0,0 @@
-dist

Review Comment:
   It looks like the old `ozone-ui/src/.gitignore` was deleted during the 
directory move without being recreated at `ozone-ui/.gitignore`. Since the 
repository-level ignore file does not cover `node_modules` or `dist`, running 
`pnpm install` or `pnpm build:shared` will now leave a large number of 
untracked files. Could we move the ignore file to the new workspace root and 
use patterns such as `node_modules/` and `**/dist/`?
   



##########
ozone-ui/README.md:
##########
@@ -17,99 +17,163 @@
 
 # Ozone UI Monorepo
 
-This monorepo contains three React applications for Apache Ozone UI components:
+A Vite + React 18 + TypeScript monorepo (managed with **pnpm workspaces**) that

Review Comment:
   The root workspace has been upgraded to Vite 6, but the application packages 
still declare Vite 5. Because `pnpm --filter ... run build` uses each package’s 
local Vite dependency, the applications are still built using Vite 5 and the 
lockfile now contains both versions. Could we either upgrade all application 
packages together or keep the root on Vite 5 and update the README accordingly?
   



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