You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "vanshuhassija (via GitHub)" <gi...@apache.org> on 2025/03/25 15:10:06 UTC

[PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

vanshuhassija opened a new pull request, #3971:
URL: https://github.com/apache/ambari/pull/3971

   ## What changes were proposed in this pull request?
   Add capability to register Stack version
   
   ## How was this patch tested?
   Manually, test cases included


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

Posted by "zRains (via GitHub)" <gi...@apache.org>.
zRains commented on code in PR #3971:
URL: https://github.com/apache/ambari/pull/3971#discussion_r2020146114


##########
ambari-admin/src/main/resources/ui/ambari-admin/src/screens/StackVersions/Register.tsx:
##########
@@ -0,0 +1,1287 @@
+/**
+ * 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.
+ */
+/* eslint-disable no-useless-escape */
+/* eslint-disable no-unsafe-optional-chaining */
+/* eslint-disable @typescript-eslint/ban-ts-comment */
+/* eslint-disable @typescript-eslint/no-explicit-any */

Review Comment:
   Please try to avoid using these identifiers; if certain factors necessitate their use, please specify the reasons.



##########
ambari-admin/src/main/resources/ui/ambari-admin/src/components/AddVersionModal/index.tsx:
##########
@@ -0,0 +1,134 @@
+/**
+ * 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.
+ */
+/* eslint-disable @typescript-eslint/ban-ts-comment */
+/* eslint-disable @typescript-eslint/ban-types */
+import { useState } from 'react'
+import { Button, Form, FormControl, Modal } from 'react-bootstrap'
+import toast from 'react-hot-toast'
+import { get } from 'lodash'
+import DefaultButton from '../DefaultButton'
+import VersionsApi from '../../api/versions'
+import { ReadOptions } from '../../constants'
+
+type ModalProps = {
+  isOpen: boolean
+  onClose: () => void
+  onReadVersion: Function

Review Comment:
   Type is vague, please specify.



##########
ambari-admin/src/main/resources/ui/ambari-admin/src/components/AddVersionModal/index.tsx:
##########
@@ -0,0 +1,134 @@
+/**
+ * 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.
+ */
+/* eslint-disable @typescript-eslint/ban-ts-comment */
+/* eslint-disable @typescript-eslint/ban-types */
+import { useState } from 'react'
+import { Button, Form, FormControl, Modal } from 'react-bootstrap'
+import toast from 'react-hot-toast'
+import { get } from 'lodash'
+import DefaultButton from '../DefaultButton'
+import VersionsApi from '../../api/versions'
+import { ReadOptions } from '../../constants'
+
+type ModalProps = {
+  isOpen: boolean
+  onClose: () => void
+  onReadVersion: Function
+}
+
+const AddVersionModal = ({ isOpen, onClose, onReadVersion }: ModalProps) => {
+  const [uploadOption, setUploadOption] = useState(ReadOptions.FILE)
+  const [file, setFile] = useState()
+  const [fileUrl, setFileUrl] = useState('')
+  const readVersionInfo = async () => {
+    try {
+      if (uploadOption === ReadOptions.FILE && file) {
+        const reader = new FileReader()
+        reader.onload = async function (event) {
+          const fileContents = get(event, 'target.result', undefined)
+          const versionResources = await VersionsApi.readVersionInfo(
+            fileContents,
+            {
+              'Content-Type': 'text/xml',
+            },
+          )
+          onReadVersion(versionResources)
+        }
+        reader.readAsText(file)
+      } else if (uploadOption === ReadOptions.URL && fileUrl) {
+        // Fetch the content from the URL
+        const versionResources = await VersionsApi.readVersionInfo({
+          VersionDefinition: {
+            version_url: fileUrl,
+          },
+        })
+        onReadVersion(versionResources)
+      }
+    } catch (err) {
+      toast.error('Could not read version defintion')
+    }
+  }
+  const handleClose=()=>{
+    setFile(undefined)
+    setFileUrl('')
+    onClose()
+  }
+  return (
+    <Modal show={isOpen} onHide={onClose} data-testid="add-version-modal">
+      <Modal.Header>
+        <Modal.Title>Add Version</Modal.Title>
+      </Modal.Header>
+      <Modal.Body>
+        <Form.Check
+          checked={uploadOption === ReadOptions.FILE}
+          type="radio"
+          id={ReadOptions.FILE}
+          onChange={() => {
+            setUploadOption(ReadOptions.FILE)
+          }}
+          label="Upload Version Definition File"
+          className="px-0"
+        />
+        <FormControl
+          type="file"
+          className="py-1"
+          onChange={() => {
+            //@ts-ignore

Review Comment:
   Please try to avoid using this identifier.



##########
ambari-admin/src/main/resources/ui/ambari-admin/src/components/LostNetworkModal/index.tsx:
##########
@@ -0,0 +1,56 @@
+/**
+ * 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 { Button, Modal } from "react-bootstrap";
+
+type PropTypes = {
+  onClose: () => void;
+  isOpen: boolean;
+};
+
+const LostNetworkModal = ({ onClose, isOpen }: PropTypes) => {
+  const options = [
+    "Configure your hosts for access to the Internet.",
+    " If you are using an Internet Proxy, refer to the Ambari Documentation on how to configure Ambari to use the Internet Proxy.",
+    "Use the Local Repository option.",
+  ];
+  return (
+    <Modal show={isOpen} onHide={onClose} size="lg">
+      <Modal.Header closeButton>
+        <Modal.Title>Public Repository Option Disabled</Modal.Title>
+      </Modal.Header>
+      <Modal.Body style={{ fontSize: 12 }}>

Review Comment:
   Please try to avoid using inline styles; you can use Tailwind instead.



-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

Posted by "vanshuhassija (via GitHub)" <gi...@apache.org>.
vanshuhassija commented on PR #3971:
URL: https://github.com/apache/ambari/pull/3971#issuecomment-2756693763

   @zRains Can you please help with the review?


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

Posted by "zRains (via GitHub)" <gi...@apache.org>.
zRains commented on PR #3971:
URL: https://github.com/apache/ambari/pull/3971#issuecomment-2757671760

   @vanshuhassija Sorry about this, I don’t have much spare time right now. I’ll get to it by the weekend at the latest.


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

Posted by "AiTian1211 (via GitHub)" <gi...@apache.org>.
AiTian1211 commented on PR #3971:
URL: https://github.com/apache/ambari/pull/3971#issuecomment-2788982573

   Here's the English translation:
   
   The RPM package names compiled by Ambari for Bigtop and their component names during yum installation are inconsistent with the official Bigtop binary RPM names. This situation forces users to only use Bigtop RPM packages compiled by Ambari. For example, the official Bigtop package name is 'hadoop-3.3.6-1.el7.x86_64.rpm', while the Ambari-compiled Bigtop RPM package name is 'hadoop_3_3_0-3.3.6-1.el8.x86_64.rpm'.


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

Posted by "vanshuhassija (via GitHub)" <gi...@apache.org>.
vanshuhassija commented on PR #3971:
URL: https://github.com/apache/ambari/pull/3971#issuecomment-2816859445

   @zRains I have addressed some of the typescript issues. I intend to address more in future PRs before finalising this project. Merging this PR can also open the feature to community to make some changes to the implemented feature. 


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org


Re: [PR] AMBARI-26175 Register version capabilities in Ambari Admin [ambari]

Posted by "JiaLiangC (via GitHub)" <gi...@apache.org>.
JiaLiangC merged PR #3971:
URL: https://github.com/apache/ambari/pull/3971


-- 
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: dev-unsubscribe@ambari.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ambari.apache.org
For additional commands, e-mail: dev-help@ambari.apache.org