pierrejeambrun commented on code in PR #45535:
URL: https://github.com/apache/airflow/pull/45535#discussion_r1931912676


##########
airflow/ui/src/pages/Providers.tsx:
##########
@@ -0,0 +1,75 @@
+/*!
+ * 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 { Box, Heading, Link, Table } from "@chakra-ui/react";
+
+import { useProviderServiceGetProviders } from "openapi/queries";
+
+const embedLinks = (text: string) => {
+  const urlRegex = 
/http(s)?:\/\/[\w.-]+(\.?:[\w.-]+)*([/?#][\w\-._~:/?#[\]@!$&'()*+,;=.%]*)?/gu;

Review Comment:
   ```suggestion
     const urlRegex = 
/http(s)?:\/\/[\w.-]+(\.?:[\w.-]+)*([/?#][\w\-._~:/?#[\]@!$&'()*+,;=.%]*)?/g;
   ```
   
   I think it should be consistent with how we detect urls in the rest of the 
airflow application. If unicode matching is more appropriate we can update all 
the regexp in a follow up PR.



##########
airflow/ui/src/pages/Providers.tsx:
##########
@@ -0,0 +1,75 @@
+/*!
+ * 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 { Box, Heading, Link, Table } from "@chakra-ui/react";
+
+import { useProviderServiceGetProviders } from "openapi/queries";
+
+const embedLinks = (text: string) => {
+  const urlRegex = 
/http(s)?:\/\/[\w.-]+(\.?:[\w.-]+)*([/?#][\w\-._~:/?#[\]@!$&'()*+,;=.%]*)?/gu;
+  const urls = text.match(urlRegex);
+  const cleanText = text.replaceAll(/\n(?:and)?/gu, " ").split(" ");
+
+  return cleanText.map((part) =>
+    urls?.includes(part) ? (
+      <Link color="fg.info" href={part} key={part} rel="noopener noreferrer" 
target="_blank">
+        {part}
+      </Link>
+    ) : (
+      `${part} `
+    ),
+  );
+};
+
+export const Providers = () => {
+  const { data } = useProviderServiceGetProviders();
+
+  return (
+    <Box p={2}>
+      <Heading>Providers</Heading>
+      <Table.Root striped>
+        <Table.Header>
+          <Table.Row>
+            <Table.ColumnHeader>Package Name</Table.ColumnHeader>
+            <Table.ColumnHeader>Version</Table.ColumnHeader>
+            <Table.ColumnHeader>Description</Table.ColumnHeader>
+          </Table.Row>
+        </Table.Header>
+        <Table.Body>

Review Comment:
   Can use the DataTable components (leveraging react table) instead of making 
a new table from scratch.



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