You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by "unical1988 (via GitHub)" <gi...@apache.org> on 2025/02/06 18:47:10 UTC

[PR] front end and backend added for the feature #1243 [answer]

unical1988 opened a new pull request, #1244:
URL: https://github.com/apache/answer/pull/1244

   I added tsx and go codes for backend and frontend to support SSL for PostgreSQL.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2686690691

   > @shuashuai how to format the front-end according to the project styling? is there a prettier command to execute to do so?
   
   
   This kind of problem should be solved on its own by searching or AI.
   
   Fix single file command `npx eslint --fix  [filepath]`
   
   It should also be noted that I'm not going to look at the implementation logic until it passes format checking
   
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1977443958


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -46,13 +46,36 @@ const sqlData = [
   },
 ];
 
+const sslModes = [
+  {
+    value: 'require',
+  },
+  {
+    value: 'verify-ca',
+  },
+  {
+    value: 'verify-full',
+  },
+];
+
 const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'install' });
 
   const checkValidated = (): boolean => {
     let bol = true;

Review Comment:
   @shuashuai  you mean I should include the disabled case?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1980782752


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   The `ssl_enabled` and `ssl_mode ` checksum is not needed and is meaningless, it's just a variable that controls the data underneath.
   
   What needs to be checked is the value of `key_file` and `pen_file` and `cert_file `if ssl_enabled is true and ssl_mode is not required.
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1972722063


##########
mingw32-make:
##########


Review Comment:
   Why should  submit this file?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1974965956


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +242,107 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check type="checkbox" id="sslEnabled">
+                <Form.Check.Input
+                  value={data.ssl_enabled.value}
+                  type="checkbox"
+                  onChange={(e) => {
+                    changeCallback({
+                      ssl_enabled: {
+                        value: e.target.checked,
+                        isInvalid: false,
+                        errorMsg: '',
+                      },
+                    });
+                  }}
+                />
+                <Form.Label className="ms-1" htmlFor="ssl_enabled">
+                  {t('ssl_enabled.label')}
+                </Form.Label>
+              </Form.Check>
+            </Form.Group>

Review Comment:
   Use the switch component instead of the checkbox component to control whether ssl is enabled or not.
       ![image](https://github.com/user-attachments/assets/53b59ef7-c9a9-41ff-a3e2-209d813735b4)
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1981470283


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   but aren't ssl_enabled  initialized somewhere? I can edit the code to account only for the values of `%_file` but how and where default values for `ssl_mode ` and `ssl_enabled ` are set?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1948479585


##########
cmd/answer/data/i18n/af_ZA.yaml:
##########


Review Comment:
   Ok, but then how to generate translated files for the new fields?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1948702036


##########
cmd/answer/data/i18n/af_ZA.yaml:
##########


Review Comment:
   > Ok, but then how to generate translated files for the new fields?
   
   Translated content is added manually, in most cases, just consider adding it in `en_US.yaml` and `zh_CN.yaml`.
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644518247

   I made few other frontend fixes (except relating to handle the translations)


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644531386

   > I made few other frontend fixes (except relating to handle the translations)
   
   1. there are still ts errors reported in development mode
       
     ![image](https://github.com/user-attachments/assets/65640924-316f-4c47-b749-64481fd6fb46)
   
   2. the translation file should be in the `i18n` directory. What do you ask about creating and submitting the language file in the cmd directory
   
   
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2678237479

   @LinkinStars I found the previous error cause: I was running Answer without specifying the config, so when I added it: `go run main.go run -C ./data` the error disappeared.
   Now I will have to test the certificates for the ssl modes.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1983233919


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"

Review Comment:
   so I should remove the related <Form.Label>?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1980782752


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   The `ssl_enabled` and `ssl_mode ` checksum is not needed and is meaningless, it's just a variable that controls the data underneath.
   
   What needs to be checked is the value of `key_file` and `pen_file` and `cert_file `if ssl_enabled is true and ssl_mode is not required.
   
   In addition, when switching ssl_anabled, please reinitialize these relevant values (ssl_mode、key_file、pen_file、cert_file)
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1981470283


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   is `ssl_enabled  `initialized somewhere? I can edit the code to account only for the values of `%_file` but how and where default values for `ssl_mode ` and `ssl_enabled ` are set?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1980782752


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   The `ssl_enabled` and `ssl_mode ` checksum is not needed and is meaningless, it's just a variable that controls the data underneath.
   
   What needs to be checked is the value of `key_file` and `pen_file` and `cert_file `if ssl_enabled is true and ssl_mode is not required.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1982841156


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">

Review Comment:
   className="mb-3"



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1981470283


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   is `ssl_enabled  `initialized somewhere? I can edit the code to account only for the values of `%_file` but how and where default values for `ssl_mode ` and `ssl_enabled ` are set? the current logic initilizes them, but you say it is not needed.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1983233919


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"

Review Comment:
   so I should remove the related <Form.Label>?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2670301462

   > @shuashuai eslint and preittier are causing the ui not to build correctly. what is wrong with the logic of `checkValidated`? after the next commits, the form submits but the then the application doesn't execute after installation but returns 50x error.
   
   1. The code must be formatted to match the current project style. There are eslint and prettier errors that you should fix first.
   2. You added your own checksum logic that doesn't pass in the check method, so hit the log yourself to find out what's wrong!
   3. Check out the documentation and blogs on the official website to see how to develop and debug the project.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1975431787


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +242,107 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check type="checkbox" id="sslEnabled">
+                <Form.Check.Input
+                  value={data.ssl_enabled.value}
+                  type="checkbox"
+                  onChange={(e) => {
+                    changeCallback({
+                      ssl_enabled: {
+                        value: e.target.checked,
+                        isInvalid: false,
+                        errorMsg: '',
+                      },
+                    });
+                  }}
+                />
+                <Form.Label className="ms-1" htmlFor="ssl_enabled">
+                  {t('ssl_enabled.label')}
+                </Form.Label>
+              </Form.Check>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return <option value={item.value}>{item.value}</option>;
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}

Review Comment:
   I find it more convenient here to use a select instead of a radio box



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2656222937

   @LinkinStars I used this command to upgrade answer version: 
   answer.exe upgrade -f v1.4.2 -C ./tmp/answer-data/
   Which returned this output:
   ```
   
   [migrate] user set upgrade to version: v1.4.2
   [migrate] current db version is 24, try to migrate version 25, latest version is 25
   [migrate] try to migrate Answer version v1.4.2, description: add the number of question links
   [migrate] migrate to db version 25 success
   try to save cache file to tmp\answer-data\cache\cache.db
   upgrade done
   ```
   
   
   Then to test it again
   `answer.exe run` but the error above persisted.
   
   Here's the database `question `table schema:
   
   ![question_table](https://github.com/user-attachments/assets/97ad5dc4-b787-48ef-9dff-934e9bed90c6)
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2655727092

   > I have been testing the features over a Postgres database (with require ssl mode), but when I try to list the questions I get the following error:
   > 
   > ```
   > 2025-02-11 19:24:02.507 ERROR   handler/handler.go:53   code: 500, reason: base.database_error, message: , error: SQL logic error: no such column: linked_count (1)
   > C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/repo/question/question_repo.go:253 github.com/apache/answer/internal/repo/question.(*questionRepo).FindByID
   > C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/service/question_common/question.go:210 github.com/apache/answer/internal/service/question_common.(*QuestionCommon).FindInfoByID
   > C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/service/content/question_service.go:1218 github.com/apache/answer/internal/service/content.(*QuestionService).PersonalCollectionPage
   > C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/controller/question_controller.go:907 github.com/apache/answer/internal/controller.(*QuestionController).PersonalCollectionPage
   > C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 github.com/gin-gonic/gin.(*Context).Next
   > C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/base/middleware/auth.go:168 github.com/apache/answer/internal/base/middleware.(*AuthUserMiddleware).MustAuthAndAccountAvailable.func1
   > C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 github.com/gin-gonic/gin.(*Context).Next
   > C:/Users/SelimSoufargi/go/pkg/mod/github.com/anargu/gin-brotli@v0.0.0-20220116052358-12bf532d5267/gin_brotli.go:71 github.com/anargu/gin-brotli.Brotli.func1
   > C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 github.com/gin-gonic/gin.(*Context).Next
   > C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
   > C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589 github.com/gin-gonic/gin.(*Engine).ServeHTTP
   > C:/Program Files/Go/src/net/http/server.go:3210 net/http.serverHandler.ServeHTTP
   > C:/Program Files/Go/src/net/http/server.go:2092 net/http.(*conn).serve
   > C:/Program Files/Go/src/runtime/asm_amd64.s:1700 runtime.goexit
   > ```
   > 
   > Would you know if this relates to the code or the database?
   
   @unical1988 This looks like it was caused by a lack of upgrading. You can use the upgrade command to upgrade the version.
   
   ```
   ./answer upgrade -f v1.4.2 -C ./data/
   ```


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1945873290


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -113,6 +113,14 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
     nextCallback();
   };
 
+  //checkbox for sslmode enabled or not
+  const [checked, setChecked] = useState(false);
+
+  const handleChange = () => {
+    // Change state to the opposite when checkbox changes
+    setChecked(!checked);
+  };
+

Review Comment:
   I will do that asap



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1945572213


##########
internal/install/install_req.go:
##########
@@ -21,12 +21,14 @@ package install
 
 import (
 	"fmt"
+	"log"
 	"net/url"
+	"os"
 	"strings"
 
-	"github.com/apache/answer/internal/base/reason"
-	"github.com/apache/answer/internal/base/validator"
-	"github.com/apache/answer/pkg/checker"
+	"github.com/apache/incubator-answer/internal/base/reason"
+	"github.com/apache/incubator-answer/internal/base/validator"
+	"github.com/apache/incubator-answer/pkg/checker"

Review Comment:
   remove `incubator`



##########
internal/install/install_req.go:
##########
@@ -40,12 +42,17 @@ type CheckConfigFileResp struct {
 
 // CheckDatabaseReq check database
 type CheckDatabaseReq struct {
-	DbType     string `validate:"required,oneof=postgres sqlite3 mysql" json:"db_type"`
-	DbUsername string `json:"db_username"`
-	DbPassword string `json:"db_password"`
-	DbHost     string `json:"db_host"`
-	DbName     string `json:"db_name"`
-	DbFile     string `json:"db_file"`
+	DbType       string `validate:"required,oneof=postgres sqlite3 mysql" json:"db_type"`
+	DbUsername   string `json:"db_username"`
+	DbPassword   string `json:"db_password"`
+	DbHost       string `json:"db_host"`
+	DbName       string `json:"db_name"`
+	DbFile       string `json:"db_file"`
+	Ssl          bool   `json:"ssl_enabled"`
+	SslMode      string `json:"ssl_mode"`
+	SslCrt       string `json:"server-ca.pem"`
+	SslKey       string `json:"client-cert.pem"`
+	SslCrtClient string `json:"client-key.pem"`

Review Comment:
   Please check these json keys.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1948328735


##########
ui/.eslintrc.js:
##########
@@ -44,7 +44,7 @@ module.exports = {
   },
   plugins: ['react', '@typescript-eslint', 'prettier'],
   rules: {
-    'prettier/prettier': 'error',
+    'prettier/prettier': 0,

Review Comment:
   Why disable it?
   
   Most formatting problems can be solved through eslint + prettier. What you need to do is install the eslint plug-in in your editor, and use the plug-in to solve the problem of code formatting, rather than disabling the configuration in the project.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2671110532

   @shuashuai i was referring to server logs, where to find them?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1977443958


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -46,13 +46,36 @@ const sqlData = [
   },
 ];
 
+const sslModes = [
+  {
+    value: 'require',
+  },
+  {
+    value: 'verify-ca',
+  },
+  {
+    value: 'verify-full',
+  },
+];
+
 const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'install' });
 
   const checkValidated = (): boolean => {
     let bol = true;

Review Comment:
   @shuashuai  I do not see the problem with the `checkValidated()`



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1975432883


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +242,107 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check type="checkbox" id="sslEnabled">
+                <Form.Check.Input
+                  value={data.ssl_enabled.value}
+                  type="checkbox"
+                  onChange={(e) => {
+                    changeCallback({
+                      ssl_enabled: {
+                        value: e.target.checked,
+                        isInvalid: false,
+                        errorMsg: '',
+                      },
+                    });
+                  }}
+                />
+                <Form.Label className="ms-1" htmlFor="ssl_enabled">
+                  {t('ssl_enabled.label')}
+                </Form.Label>
+              </Form.Check>
+            </Form.Group>

Review Comment:
   done!



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1982860477


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    ssl_mode: {
+                      value: 'require',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    key_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    cert_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    pem_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return (
+                    <option value={item.value} key={item.value}>
+                      {item.value}
+                    </option>
+                  );
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' &&
+            data.ssl_enabled.value &&
+            (data.ssl_mode.value === 'verify-ca' ||
+              data.ssl_mode.value === 'verify-full') && (
+              <Row className="mb-3">
+                <Form.Group as={Col} controlId="key_file" className="mb-3 me-1">

Review Comment:
   Class `mb-3` has been added to the Row component, remove the className of the inner Form.Group, and `me-1` is not required.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2646305592

   So I am testing the backend with the new parameters of the postgres DB and faced this problem where the initial configuration of the database/connection is by default loaded and therefore cannot go through the installation steps when trying to debug the target code.
   
   Specifically command.go (in `answer/cmd`) has this function: 
   
   
   ```
   initCmd = &cobra.Command{
           Use:   "init",
           Short: "init answer application",
           Long:  `init answer application`,
           Run: func(_ *cobra.Command, _ []string) {
               // check config file and database. if config file exists and database is already created, init done
               cli.InstallAllInitialEnvironment(dataDirPath)
   
               configFileExist := cli.CheckConfigFile(cli.GetConfigFilePath())
               if configFileExist {
                   fmt.Println("config file exists, try to read the config...")
                   c, err := conf.ReadConfig(cli.GetConfigFilePath())
                   if err != nil {
                       fmt.Println("read config failed: ", err.Error())
                       return
                   }
   
                   fmt.Println("config file read successfully, try to connect database...")
                   if cli.CheckDBTableExist(c.Data.Database) {
                       fmt.Println("connect to database successfully and table already exists, do nothing.")
                       return
                   }
               }
   
               // start installation server to install
               install.Run(cli.GetConfigFilePath())
           },
       }
   ```
   and the configuration is always loaded as `/data/ `(`cli.GetConfigFilePath()`).
   Can I know how to make `cli.GetConfigFilePath()` not return `/data/` so that I go through the install steps, knowing that there isn't no /data/ folder in the source (I deleted it)? that is emptying some related cache I cannot find.
   
   PS: the cmd  I am using to debug isn't `answer init -C ./data/` (this one would launch the install steps) but one without `-C`  flag


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1946622064


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -113,6 +113,14 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
     nextCallback();
   };
 
+  //checkbox for sslmode enabled or not
+  const [checked, setChecked] = useState(false);
+
+  const handleChange = () => {
+    // Change state to the opposite when checkbox changes
+    setChecked(!checked);
+  };
+

Review Comment:
   I have a question: how to deal with the certification keys? also after executing answer init (for the installation) how to empty the cache again? (it seems that all next executions will skip the installation phase, and I want to test the installation phase, so I need to empty db cache). where to find the db_cache folder?
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2658920106

   @LinkinStars @shuashuai now testing for the sqllite to check everythings alright, but encountered this error:
   
   `ERROR   handler/handler.go:68   http_handle BindAndCheck fail, json: cannot unmarshal string into Go struct field CheckDatabaseReq.ssl_enabled of type bool`
   
   Any idea what would be causing this error on the installation second step interface?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "sy-records (via GitHub)" <gi...@apache.org>.
sy-records commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2686802671

   By the way, the base branch of PR should be `dev`, you'll need to work out the conflicts locally.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2678253749

   @shuashuai how to format the front-end according to the project styling? is there a prettier command to execute to do so?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1981591153


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +243,119 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                label={t('ssl_enabled.label')}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return (
+                    <option value={item.value} key={item.value}>
+                      {item.value}
+                    </option>
+                  );
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' &&
+            data.ssl_enabled.value &&
+            (data.ssl_mode.value === 'verify-ca' ||
+              data.ssl_mode.value === 'verify-full') && (
+              <InputGroup className="mb-3" hasValidation>
+                <Form.Control

Review Comment:
   fixed!



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1984337195


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    ssl_mode: {
+                      value: 'require',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    key_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    cert_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    pem_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return (
+                    <option value={item.value} key={item.value}>
+                      {item.value}
+                    </option>
+                  );
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' &&
+            data.ssl_enabled.value &&
+            (data.ssl_mode.value === 'verify-ca' ||
+              data.ssl_mode.value === 'verify-full') && (
+              <Row className="mb-3">
+                <Form.Group as={Col} controlId="key_file" className="mb-3 me-1">

Review Comment:
   You have three `Form.Group` components here, why did you adjust only one?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644490311

   > Your comments suggest fixing the frontend part of the new feature, are there problems with the backend commited code?
   
   I currently only review the front-end code, and the back-end code needs to wait for @LinkinStars  to review it.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1948329140


##########
cmd/answer/data/i18n/af_ZA.yaml:
##########


Review Comment:
   The translated files are not here, please delete these files.
   
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1945870725


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -183,6 +191,35 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
+              <div className='conditional-checkbox'>
+                <label htmlFor='sslMode' className='switch switch-default'>
+                  SSL Mode On
+                </label>
+                <input
+                  id='sslMode'
+                  type='checkbox'
+                  checked={checked}
+                  onChange={handleChange}
+                />
+
+                {/* Inline conditional if checked state is `true` will show the div, otherwise, it won't */}
+
+                {checked && (
+                  <div
+                    number-input
+                    id='sslmodeOptionsDropdown'
+                    className='form-group col-lg-2 col-md-4 col-sm-8'
+                  >
+                    <label htmlFor ='sslmodeOptions'>
+                      <span className='requiredAsterisk' />
+                    </label>
+                    <select id='sslmode' className='form-control'>
+                      <option>require</option>
+                      <option>verify-ca</option>
+                    </select>
+                  </div>
+                  )}
+                </div>
           </Form.Group>

Review Comment:
   1. Our UI uses bootstrap and react-bootstrap. Please adjust the UI to keep it consistent.
       ![image](https://github.com/user-attachments/assets/a8341aa8-669d-4694-8f43-f31a86798aee)
   2. All copywriting in the project needs to be processed using i18n. You can refer to the existing usage in the project.
   3. This feature should be displayed only when selecting PostgreSQL.
   
   After the functions are completed, you can test your own advancedness, including UI and functions. 
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1945870725


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -183,6 +191,35 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
+              <div className='conditional-checkbox'>
+                <label htmlFor='sslMode' className='switch switch-default'>
+                  SSL Mode On
+                </label>
+                <input
+                  id='sslMode'
+                  type='checkbox'
+                  checked={checked}
+                  onChange={handleChange}
+                />
+
+                {/* Inline conditional if checked state is `true` will show the div, otherwise, it won't */}
+
+                {checked && (
+                  <div
+                    number-input
+                    id='sslmodeOptionsDropdown'
+                    className='form-group col-lg-2 col-md-4 col-sm-8'
+                  >
+                    <label htmlFor ='sslmodeOptions'>
+                      <span className='requiredAsterisk' />
+                    </label>
+                    <select id='sslmode' className='form-control'>
+                      <option>require</option>
+                      <option>verify-ca</option>
+                    </select>
+                  </div>
+                  )}
+                </div>
           </Form.Group>

Review Comment:
   1. Our UI uses bootstrap and react-bootstrap. Please adjust the UI to keep it consistent.
       ![image](https://github.com/user-attachments/assets/a8341aa8-669d-4694-8f43-f31a86798aee)
   2. All copywriting in the project needs to be processed using i18n. You can refer to the existing usage in the project.
   
   After the functions are completed, you can test your own advancedness, including UI and functions. 
   
   
   



##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -113,6 +113,14 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
     nextCallback();
   };
 
+  //checkbox for sslmode enabled or not
+  const [checked, setChecked] = useState(false);
+
+  const handleChange = () => {
+    // Change state to the opposite when checkbox changes
+    setChecked(!checked);
+  };
+

Review Comment:
   Your customized handlechange function doesn't pass the required content, it just saves it on the current page, so you need to add the parameters on the `/Install/index.tsxt`.
   ![image](https://github.com/user-attachments/assets/38356dae-c2ee-4a16-a1ee-f7db9be2aad4)
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644490686

   I am in the process of testing right now, I will check your comments and make the changes in the next commits
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1948327239


##########
.vscode/launch.json:
##########
@@ -0,0 +1,22 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+
+        {
+            "name": "Launch Package",
+            "type": "go",
+            "debugAdapter": "dlv-dap",
+            "request": "attach",
+            "mode": "remote",
+            "port": 2345,
+            "host": "127.0.0.1", // can skip for localhost
+            "logOutput": "dap",
+            "showLog": true,
+            "program": "${fileDirname}/../cmd/answer/myApp.exe",
+            
+        }
+    ]
+}

Review Comment:
   Do not submit local debug files to the project



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2669037093

   @shuashuai eslint and preittier are causing the ui not to build correctly.
   what is wrong with the logic of `checkValidated`?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1978976535


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -46,13 +46,36 @@ const sqlData = [
   },
 ];
 
+const sslModes = [
+  {
+    value: 'require',
+  },
+  {
+    value: 'verify-ca',
+  },
+  {
+    value: 'verify-full',
+  },
+];
+
 const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'install' });
 
   const checkValidated = (): boolean => {
     let bol = true;

Review Comment:
   The ssl related configuration should only be checked if postgres is selected, is your current logic correct?
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] Support PostgreSQL connection with SSL #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1987316661


##########
internal/install/install_req.go:
##########
@@ -59,8 +66,22 @@ func (r *CheckDatabaseReq) GetConnection() string {
 	}
 	if r.DbType == string(schemas.POSTGRES) {
 		host, port := parsePgSQLHostPort(r.DbHost)
-		return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
-			host, port, r.DbUsername, r.DbPassword, r.DbName)
+		if !r.Ssl {
+			return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
+				host, port, r.DbUsername, r.DbPassword, r.DbName)
+		} else if r.SslMode == "require" {
+			return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
+				host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode)
+		} else if r.SslMode == "verify-ca" || r.SslMode == "verify-full" {
+			_, err_server_ca := os.Stat(r.SslCrt)
+			_, err_client_cert := os.Stat(r.SslKey)
+			_, err_client_key := os.Stat(r.SslCrtClient)
+			if err_server_ca == nil || err_client_cert == nil || err_client_key == nil {
+				return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s sslrootcert=%s sslcert=%s sslkey=%s",
+					host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode, r.SslCrt, r.SslCrtClient, r.SslKey)
+			}
+			log.Fatal("Certificate not Found !!")

Review Comment:
   @LinkinStars I don't see `log.Warnf()` here : https://pkg.go.dev/log



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] Support PostgreSQL connection with SSL #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1986783426


##########
internal/install/install_req.go:
##########
@@ -59,8 +66,22 @@ func (r *CheckDatabaseReq) GetConnection() string {
 	}
 	if r.DbType == string(schemas.POSTGRES) {
 		host, port := parsePgSQLHostPort(r.DbHost)
-		return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
-			host, port, r.DbUsername, r.DbPassword, r.DbName)
+		if !r.Ssl {
+			return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
+				host, port, r.DbUsername, r.DbPassword, r.DbName)
+		} else if r.SslMode == "require" {
+			return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
+				host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode)
+		} else if r.SslMode == "verify-ca" || r.SslMode == "verify-full" {
+			_, err_server_ca := os.Stat(r.SslCrt)
+			_, err_client_cert := os.Stat(r.SslKey)
+			_, err_client_key := os.Stat(r.SslCrtClient)
+			if err_server_ca == nil || err_client_cert == nil || err_client_key == nil {
+				return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s sslrootcert=%s sslcert=%s sslkey=%s",
+					host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode, r.SslCrt, r.SslCrtClient, r.SslKey)
+			}
+			log.Fatal("Certificate not Found !!")

Review Comment:
   @unical1988 Almost done. This part needs to be adjusted.
   
   1. Use the `dir.CheckFileExist` instead.
   2. You don't need to `log.Fatal` if the file does not exist in this part. `log.Fatal` will cause panic.
   
   If the file does not exist, the front end will show the error message when calling the `/installation/db/check` API. You can just log the warning message.
   
   ```go
   if dir.CheckFileExist(r.SslCrt) {
       log.Warnf("ssl crt file not exist: %s", r.SslCrt)
   }
   if dir.CheckFileExist(r.SslCrtClient) {
       log.Warnf("ssl crt client file not exist: %s", r.SslCrtClient)
   }
   if dir.CheckFileExist(r.SslKey) {
       log.Warnf("ssl key file not exist: %s", r.SslKey)
   }
   return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s sslrootcert=%s sslcert=%s sslkey=%s",
       host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode, r.SslCrt, r.SslCrtClient, r.SslKey)
   ```
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2645662540

   All the files required for SSL, such as .pem and .crt, have an input field where users can directly enter the directory path. Users can place the files in the specified directory themselves.
   > does it mean I have to create input text elements (3) in the UI while SSL is enabled to enable the user to specify the paths ? or is it an upload 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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2683739908

   > sslcert
   
   @unical1988 It's okay. But is there an extra space before `sslcert`?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1948480368


##########
.vscode/launch.json:
##########
@@ -0,0 +1,22 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+
+        {
+            "name": "Launch Package",
+            "type": "go",
+            "debugAdapter": "dlv-dap",
+            "request": "attach",
+            "mode": "remote",
+            "port": 2345,
+            "host": "127.0.0.1", // can skip for localhost
+            "logOutput": "dap",
+            "showLog": true,
+            "program": "${fileDirname}/../cmd/answer/myApp.exe",
+            
+        }
+    ]
+}

Review Comment:
   Ok



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2658131160

   @unical1988 Get it. From your screenshot, no fields are missing from the database, so I tested it again locally. I don't encounter the issue. I use the v1.4.2 version and re-install using PostgreSQL. I have not found any error log.
   
   ![image](https://github.com/user-attachments/assets/a79b5e46-92bd-44ce-854f-116e88e30f04)
   
   1. Make sure you connect the right database in your screenshot.
   2. Try to verify the error is caused by using SSL.
   3. Use a new database and re-install it to check it.
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1946802958


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -113,6 +113,14 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
     nextCallback();
   };
 
+  //checkbox for sslmode enabled or not
+  const [checked, setChecked] = useState(false);
+
+  const handleChange = () => {
+    // Change state to the opposite when checkbox changes
+    setChecked(!checked);
+  };
+

Review Comment:
   I first do:
   `go build -gcflags="all=-N -l" -o testApp.exe`
   
   and then I execute `answer init` I get: 
   
   ```
   [upload-dir] try to install...
   [upload-dir] install success, upload directory is \data\uploads
   [i18n] try to install i18n bundle...
   [i18n] find i18n bundle 45
   install all initial environment done
   config file exists, try to read the config...
   config file read successfully, try to connect database...
   connect to database successfully and table already exists, do nothing.
   ```
   
   Which I don't want, but I want to reinitiate the process of installation.
   How to do that?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644479206

   Is the connection string building for the DB correct (in internal/install/install_req.go)?. I assume the pem and crt files should be found in the folder data/cache/certs/


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644478980

   Your comments suggest fixing the frontend part of the new feature, are there problems with the backend commited code?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644900885

   > Is the connection string building for the DB correct (in internal/install/install_req.go)?. I assume the pem and crt files should be found in the folder data/cache/certs/
   
   All the files required for SSL, such as .pem and .crt, have an input field where users can directly enter the directory path. Users can place the files in the specified directory themselves.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1947414428


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -183,6 +207,52 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
+            {data.db_type.value=== 'postgres' && (

Review Comment:
   Don't put the content of a form into a Form.Group element, you can see that every Form.Group in the afternoon is a complete form content. So you need to split the checkbox and select you added into two fast contents, and the copywriting needs to be translated using i18n. It is recommended that you become more familiar with the overall development style of the project first.
   
   In addition, please use the key of the single sign form for the controlId value on Form.Group,  Please delete the code (handleChange function) that is not used in time.
   
   
   
   
   
   ![image](https://github.com/user-attachments/assets/c3b525f4-5b1b-419c-ad74-27aa17fe75e1)
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2656189679

   > @LinkinStars "./answer upgrade -f v1.4.2 -C ./data/" didn't work. I still get the same reported SQL error. (PS: I am using Postgres v16)
   
   @unical1988 First of all, let's explain why this problem occurs, it is caused by the missing `linked_count` field in the `question` table in the database. This field was added in v1.4.2. You can try to check and solve the problem by the following ways.
   1. Whether you are using the latest v1.4.2 code or not.
   2. If the installed Answer instance is already v1.4.2 version and upgraded to the latest version.
   3. If the database question table contains this `linked_count` field.
   4. If any error in executing the upgrade command.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2656010751

   @LinkinStars "./answer upgrade -f v1.4.2 -C ./data/" didn't work. I still get the same reported SQL error. (PS: I am using Postgres v16)


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2671030256

   > @shuashuai where to find the logs?
   
   You add the logs you need in development mode, and then view them in the browser console, or debug them in your editor, whichever you prefer.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1976968729


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -46,13 +46,36 @@ const sqlData = [
   },
 ];
 
+const sslModes = [
+  {
+    value: 'require',
+  },
+  {
+    value: 'verify-ca',
+  },
+  {
+    value: 'verify-full',
+  },
+];
+
 const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'install' });
 
   const checkValidated = (): boolean => {
     let bol = true;

Review Comment:
   The checksum logic here is still incorrect, please double check the



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1986783426


##########
internal/install/install_req.go:
##########
@@ -59,8 +66,22 @@ func (r *CheckDatabaseReq) GetConnection() string {
 	}
 	if r.DbType == string(schemas.POSTGRES) {
 		host, port := parsePgSQLHostPort(r.DbHost)
-		return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
-			host, port, r.DbUsername, r.DbPassword, r.DbName)
+		if !r.Ssl {
+			return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=disable",
+				host, port, r.DbUsername, r.DbPassword, r.DbName)
+		} else if r.SslMode == "require" {
+			return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s",
+				host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode)
+		} else if r.SslMode == "verify-ca" || r.SslMode == "verify-full" {
+			_, err_server_ca := os.Stat(r.SslCrt)
+			_, err_client_cert := os.Stat(r.SslKey)
+			_, err_client_key := os.Stat(r.SslCrtClient)
+			if err_server_ca == nil || err_client_cert == nil || err_client_key == nil {
+				return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s sslrootcert=%s sslcert=%s sslkey=%s",
+					host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode, r.SslCrt, r.SslCrtClient, r.SslKey)
+			}
+			log.Fatal("Certificate not Found !!")

Review Comment:
   1. Use the `dir.CheckFileExist` instead.
   2. You don't need to `log.Fatal` if the file does not exist in this part. `log.Fatal` will cause panic.
   
   If the file does not exist, the front end will show the error message when calling the `/installation/db/check` API. You can just log the warning message.
   
   ```go
   if dir.CheckFileExist(r.SslCrt) {
       log.Warnf("ssl crt file not exist: %s", r.SslCrt)
   }
   if dir.CheckFileExist(r.SslCrtClient) {
       log.Warnf("ssl crt client file not exist: %s", r.SslCrtClient)
   }
   if dir.CheckFileExist(r.SslKey) {
       log.Warnf("ssl key file not exist: %s", r.SslKey)
   }
   return fmt.Sprintf("host=%s port=%s user=%s password=%s dbname=%s sslmode=%s sslrootcert=%s sslcert=%s sslkey=%s",
       host, port, r.DbUsername, r.DbPassword, r.DbName, r.SslMode, r.SslCrt, r.SslCrtClient, r.SslKey)
   ```
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] Support PostgreSQL connection with SSL #1243 [answer]

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


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1947411493


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -113,6 +113,14 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
     nextCallback();
   };
 
+  //checkbox for sslmode enabled or not
+  const [checked, setChecked] = useState(false);
+
+  const handleChange = () => {
+    // Change state to the opposite when checkbox changes
+    setChecked(!checked);
+  };
+

Review Comment:
   > I have a question: how to deal with the certification keys?
   
   You can refer to the process of passing and using formData data in any step. All keys are initialized in FormData, click Next to save only the current data in FormData, know that the last step is completed together for submission.
   
   So what you need to do first is to initialize the key of the parameters you need to submit in the formData format, and then do the corresponding processing according to the current step's value transmission and data processing logic.
   
   >also after executing answer init (for the installation) how to empty the cache again? (it seems that all next executions will skip the installation phase, and I want to test the installation phase, so I need to empty db cache). where to find the db_cache folder?
   
   There is a processing in the program. If it is detected that the installation step has been performed, the step will be automatically skipped next time.
   
   If you remember the directory where your data is saved, you just need to delete all the contents in that directory and recompile it.
   
   
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2651039789

   @shuashuai I am waiting for @LinkinStars to reply to the previous debug related question, so that I can test this (front-end and back-end altogether).
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2651667879

   I have been testing the features over a Postgres database, but when I try to list the questions I get the following error:
   
   ```
   2025-02-11 19:24:02.507 ERROR   handler/handler.go:53   code: 500, reason: base.database_error, message: , error: SQL logic error: no such column: linked_count (1)
   C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/repo/question/question_repo.go:253 github.com/apache/answer/internal/repo/question.(*questionRepo).FindByID
   C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/service/question_common/question.go:210 github.com/apache/answer/internal/service/question_common.(*QuestionCommon).FindInfoByID
   C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/service/content/question_service.go:1218 github.com/apache/answer/internal/service/content.(*QuestionService).PersonalCollectionPage
   C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/controller/question_controller.go:907 github.com/apache/answer/internal/controller.(*QuestionController).PersonalCollectionPage
   C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 github.com/gin-gonic/gin.(*Context).Next
   C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/base/middleware/auth.go:168 github.com/apache/answer/internal/base/middleware.(*AuthUserMiddleware).MustAuthAndAccountAvailable.func1
   C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 github.com/gin-gonic/gin.(*Context).Next
   C:/Users/SelimSoufargi/go/pkg/mod/github.com/anargu/gin-brotli@v0.0.0-20220116052358-12bf532d5267/gin_brotli.go:71 github.com/anargu/gin-brotli.Brotli.func1
   C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/context.go:185 github.com/gin-gonic/gin.(*Context).Next
   C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:633 github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
   C:/Users/SelimSoufargi/go/pkg/mod/github.com/gin-gonic/gin@v1.10.0/gin.go:589 github.com/gin-gonic/gin.(*Engine).ServeHTTP
   C:/Program Files/Go/src/net/http/server.go:3210 net/http.serverHandler.ServeHTTP
   C:/Program Files/Go/src/net/http/server.go:2092 net/http.(*conn).serve
   C:/Program Files/Go/src/runtime/asm_amd64.s:1700 runtime.goexit
   ```
   
   Would you know if this relates to the code or the database?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1975483383


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -81,7 +104,47 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_host.msg'),
         };
       }
-
+      if (!ssl_enabled.value) {
+        bol = true;
+        data.ssl_enabled = {
+          value: false,
+          isInvalid: true,
+          errorMsg: t('ssl_enabled.msg'),
+        };
+      } else if (!ssl_mode.value) {
+        bol = true;
+        data.ssl_mode = {
+          value: 'require',
+          isInvalid: true,
+          errorMsg: '',
+        };
+      }
+      if (ssl_mode.value === 'verify-ca' || ssl_mode.value === 'verify-full') {
+        if (!key_file.value) {
+          bol = false;
+          data.key_file = {
+            value: '',
+            isInvalid: true,
+            errorMsg: t('key_file.msg'),
+          };
+        }
+        if (!pem_file.value) {
+          bol = false;
+          data.pem_file = {
+            value: '',
+            isInvalid: true,
+            errorMsg: t('pem_file.msg'),
+          };
+        }
+        if (!cert_file.value) {
+          bol = false;
+          data.cert_file = {
+            value: '',
+            isInvalid: true,
+            errorMsg: t('cert_file.msg'),
+          };
+        }
+      }

Review Comment:
   all of the 3 points above have been addressed and tested locally/



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1976968729


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -46,13 +46,36 @@ const sqlData = [
   },
 ];
 
+const sslModes = [
+  {
+    value: 'require',
+  },
+  {
+    value: 'verify-ca',
+  },
+  {
+    value: 'verify-full',
+  },
+];
+
 const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'install' });
 
   const checkValidated = (): boolean => {
     let bol = true;

Review Comment:
   The checksum logic in `checkValidated`  is still incorrect, please double check the!



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1980791566


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +243,119 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                label={t('ssl_enabled.label')}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>

Review Comment:
   To keep the UI consistent, add Form.label
   
   ![image](https://github.com/user-attachments/assets/b41eb135-60b0-45ca-94c0-8856e35c6785)
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1984337195


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    ssl_mode: {
+                      value: 'require',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    key_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    cert_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                    pem_file: {
+                      value: '',
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return (
+                    <option value={item.value} key={item.value}>
+                      {item.value}
+                    </option>
+                  );
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' &&
+            data.ssl_enabled.value &&
+            (data.ssl_mode.value === 'verify-ca' ||
+              data.ssl_mode.value === 'verify-full') && (
+              <Row className="mb-3">
+                <Form.Group as={Col} controlId="key_file" className="mb-3 me-1">

Review Comment:
   You have three Form.Group components here, why did you adjust only one?



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1984340962


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"

Review Comment:
   The value of lable would be better used as `Enable SSL` or `Enable SSL for PostgreSQL`.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1981700196


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -90,6 +111,49 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_name.msg'),
         };
       }
+      if (db_type.value === 'postgres') {
+        if (!ssl_enabled.value) {
+          data.ssl_enabled = {
+            value: false,
+            isInvalid: false,
+            errorMsg: t('ssl_enabled.msg'),
+          };
+        } else if (!ssl_mode.value) {
+          data.ssl_mode = {
+            value: 'require',
+            isInvalid: false,
+            errorMsg: '',
+          };

Review Comment:
   I have also added the re-initialization of the relevant variables when switching `ssl_enabled `



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1982846176


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"

Review Comment:
   1. delete id, The controld of Form.Group will automatically match it.
   2. Form.check should has a label sttribute.
   
   now:
   ![image](https://github.com/user-attachments/assets/77168ef4-83fb-4c78-8af4-4c920c5073d0)
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1982846176


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"

Review Comment:
   delete id, The controld of Form.Group will automatically match it.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2670898279

   @shuashuai where to find the logs?


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644478896

   I now made the select and checkbox two seperated form groups and remove handleChange()


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2644489820

   > I now made the select and checkbox two seperated form groups and remove handleChange()
   
   **An important point** is that you have locally verified the code you submitted now? Can the front-end project run correctly?
   If you haven't read the development guide, please go to the official website to read the [development guide](https://answer.apache.org/docs/development) first.
   
   ![image](https://github.com/user-attachments/assets/05e2bbe9-1242-4361-a5ab-e3ee12527a7c)
   
   
   I checked it and it still didn't handle the translation completely. In addition, if your editor uses vscode, it is recommended to install the eslint plugin.
   
   SSL Mode On element, why not apply to react-bootstrap components? And why doesn't the checkbox value apply to the value you passed in, but continue to use the value on the current page?
   
   I'm not sure if you end up submitting and saving the value of SSL Mode checkbox to the database. If it's just a logic of whether select is displayed, then it doesn't need to be saved in formData, it just needs to be processed within the current component.
   
   
   ![image](https://github.com/user-attachments/assets/817fe46c-ac5d-4c30-bbf9-da1c2c54b452)
   
   
   The following is content without translation
   ![image](https://github.com/user-attachments/assets/d622ee20-92ac-48fe-a569-1a2698bfac6e)
   
   ![image](https://github.com/user-attachments/assets/4a138f4c-5d31-4a8c-9f35-25d8e804e5d5)
   
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2655749327

   > So I am testing the backend with the new parameters of the postgres DB and faced this problem where the initial configuration of the database/connection is by default loaded and therefore cannot go through the installation steps when trying to debug the target code.
   > 
   > Specifically command.go (in `answer/cmd`) has this function:
   > 
   > ```
   > initCmd = &cobra.Command{
   >         Use:   "init",
   >         Short: "init answer application",
   >         Long:  `init answer application`,
   >         Run: func(_ *cobra.Command, _ []string) {
   >             // check config file and database. if config file exists and database is already created, init done
   >             cli.InstallAllInitialEnvironment(dataDirPath)
   > 
   >             configFileExist := cli.CheckConfigFile(cli.GetConfigFilePath())// this line keeps loading the /data/ folder 
   >             if configFileExist {
   >                 fmt.Println("config file exists, try to read the config...")
   >                 c, err := conf.ReadConfig(cli.GetConfigFilePath())
   >                 if err != nil {
   >                     fmt.Println("read config failed: ", err.Error())
   >                     return
   >                 }
   > 
   >                 fmt.Println("config file read successfully, try to connect database...")
   >                 if cli.CheckDBTableExist(c.Data.Database) {
   >                     fmt.Println("connect to database successfully and table already exists, do nothing.")
   >                     return
   >                 }
   >             }
   > 
   >             // start installation server to install
   >             install.Run(cli.GetConfigFilePath())
   >         },
   >     }
   > ```
   > 
   > and the configuration is always loaded as `/data/ `(`cli.GetConfigFilePath()`). Can I know how to make `cli.GetConfigFilePath()` not return `/data/` so that I go through the install steps, knowing that there isn't no /data/ folder in the source (I deleted it)? that is emptying some related cache I cannot find.
   > 
   > PS: the cmd I am using to debug isn't `answer init -C ./data/` (this one would launch the install steps) but one without `-C` flag
   
   @unical1988 Maybe the only way you can help is to specify the data directory by using the `-C` flag. For me, I specify a fixed directory, such as `/tmp/answer-data/`, when testing the installation process. This directory is deleted at the end of each test.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "LinkinStars (via GitHub)" <gi...@apache.org>.
LinkinStars commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2645746391

   > All the files required for SSL, such as .pem and .crt, have an input field where users can directly enter the directory path. Users can place the files in the specified directory themselves.
   > 
   > > does it mean I have to create input text elements (3) in the UI while SSL is enabled to enable the user to specify the paths ? or is it an upload feature?
   
   @unical1988 Make it simple. Only need three input text fields.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2649656616

   Please ensure that the self-test passes before submitting the code, and there are no obvious errors!


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2682560415

   @LinkinStars @shuashuai i have tested the new feature and it works with the certificates.


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1974982792


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -81,7 +104,47 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
           errorMsg: t('db_host.msg'),
         };
       }
-
+      if (!ssl_enabled.value) {
+        bol = true;
+        data.ssl_enabled = {
+          value: false,
+          isInvalid: true,
+          errorMsg: t('ssl_enabled.msg'),
+        };
+      } else if (!ssl_mode.value) {
+        bol = true;
+        data.ssl_mode = {
+          value: 'require',
+          isInvalid: true,
+          errorMsg: '',
+        };
+      }
+      if (ssl_mode.value === 'verify-ca' || ssl_mode.value === 'verify-full') {
+        if (!key_file.value) {
+          bol = false;
+          data.key_file = {
+            value: '',
+            isInvalid: true,
+            errorMsg: t('key_file.msg'),
+          };
+        }
+        if (!pem_file.value) {
+          bol = false;
+          data.pem_file = {
+            value: '',
+            isInvalid: true,
+            errorMsg: t('pem_file.msg'),
+          };
+        }
+        if (!cert_file.value) {
+          bol = false;
+          data.cert_file = {
+            value: '',
+            isInvalid: true,
+            errorMsg: t('cert_file.msg'),
+          };
+        }
+      }

Review Comment:
   You've added the checksum logic here, and there are a couple of problems with it
   1.  you should only check for other content if ssl_enabled allows it.
   2. the errorMsg is not displayed on the ui when the validation fails.
   3.  why did you set the bol value to true when your own implementation didn't pass the checksum? What's the point of adding the checksum?
   
   Consider carefully the checksum logic here.
   
   Example of displaying a message on a page that does not pass validation
   ![image](https://github.com/user-attachments/assets/db0b2161-7c8f-4997-8935-13f64b1675b6)
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1974973992


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +242,107 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check type="checkbox" id="sslEnabled">
+                <Form.Check.Input
+                  value={data.ssl_enabled.value}
+                  type="checkbox"
+                  onChange={(e) => {
+                    changeCallback({
+                      ssl_enabled: {
+                        value: e.target.checked,
+                        isInvalid: false,
+                        errorMsg: '',
+                      },
+                    });
+                  }}
+                />
+                <Form.Label className="ms-1" htmlFor="ssl_enabled">
+                  {t('ssl_enabled.label')}
+                </Form.Label>
+              </Form.Check>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return <option value={item.value}>{item.value}</option>;
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}

Review Comment:
   It is more intuitive to use the radio component instead of select.
   ![image](https://github.com/user-attachments/assets/9f4601c6-d4ae-442d-8d92-fa2857e50aa3)
   
   When iterating through the generated content, you need to add a key to the subitem,
   ```
    return  <option value={item.value} key={item.value}>{item.value}</option>;
   ```
   
   
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1981483331


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +243,119 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                label={t('ssl_enabled.label')}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>

Review Comment:
   done!



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1983345249


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +228,148 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Label>{t('ssl_enabled.label')}</Form.Label>
+              <Form.Check
+                type="switch"
+                id="sslEnabled"

Review Comment:
   done with a dynamic label!



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1979482690


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -46,13 +46,36 @@ const sqlData = [
   },
 ];
 
+const sslModes = [
+  {
+    value: 'require',
+  },
+  {
+    value: 'verify-ca',
+  },
+  {
+    value: 'verify-full',
+  },
+];
+
 const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
   const { t } = useTranslation('translation', { keyPrefix: 'install' });
 
   const checkValidated = (): boolean => {
     let bol = true;

Review Comment:
   you are right, I added a check for that in the checksum logic.



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on code in PR #1244:
URL: https://github.com/apache/answer/pull/1244#discussion_r1980794989


##########
ui/src/pages/Install/components/SecondStep/index.tsx:
##########
@@ -179,12 +243,119 @@ const Index: FC<Props> = ({ visible, data, changeCallback, nextCallback }) => {
                 });
               }}
             />
-
             <Form.Control.Feedback type="invalid">
               {data.db_password.errorMsg}
             </Form.Control.Feedback>
           </Form.Group>
-
+          {data.db_type.value === 'postgres' && (
+            <Form.Group
+              controlId="ssl_enabled"
+              className="conditional-checkbox">
+              <Form.Check
+                type="switch"
+                id="sslEnabled"
+                checked={data.ssl_enabled.value}
+                label={t('ssl_enabled.label')}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_enabled: {
+                      value: e.target.checked,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}
+              />
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' && data.ssl_enabled.value && (
+            <Form.Group controlId="sslmodeOptionsDropdown" className="mb-3">
+              <Form.Label>{t('ssl_mode.label')}</Form.Label>
+              <Form.Select
+                value={data.ssl_mode.value}
+                onChange={(e) => {
+                  changeCallback({
+                    ssl_mode: {
+                      value: e.target.value,
+                      isInvalid: false,
+                      errorMsg: '',
+                    },
+                  });
+                }}>
+                {sslModes.map((item) => {
+                  return (
+                    <option value={item.value} key={item.value}>
+                      {item.value}
+                    </option>
+                  );
+                })}
+              </Form.Select>
+            </Form.Group>
+          )}
+          {data.db_type.value === 'postgres' &&
+            data.ssl_enabled.value &&
+            (data.ssl_mode.value === 'verify-ca' ||
+              data.ssl_mode.value === 'verify-full') && (
+              <InputGroup className="mb-3" hasValidation>
+                <Form.Control

Review Comment:
   UI exception when validation fails here
   ![image](https://github.com/user-attachments/assets/06c85a8c-45f5-4ace-9b8e-f9e9963c680e)
   
   The fetch can be split here into three separate Form.Group
   
   



-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "shuashuai (via GitHub)" <gi...@apache.org>.
shuashuai commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2667851908

   > @LinkinStars @shuashuai now testing for the postgres to check everythings alright, but encountered the error
   > 
   > `Form submission canceled because the form is not connected ` this appears and blocks going to the third step, when SSL is unchecked (never checked before). I have to trigger onChange for the form to pass
   > 
   > Any idea what would be causing this error on the installation second step interface?
   
   It has nothing to do with the error you're talking about, it's because the form validation logic within your page isn't working.You can check this method `checkValidated`。
   
   In addition to some of the changes mentioned above which you have already completed please click on `Resolve conversation`。
   
   Please restore the eslint and preittier configurations in your project first.
   


-- 
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: commits-unsubscribe@answer.apache.org

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


Re: [PR] front end and backend added for the feature #1243 [answer]

Posted by "unical1988 (via GitHub)" <gi...@apache.org>.
unical1988 commented on PR #1244:
URL: https://github.com/apache/answer/pull/1244#issuecomment-2671955277

   @LinkinStars The previous reported error is still being raised (linked_count not found), here's the error log (from the editor):
   
   *errors.Error {Code: 500, Reason: "base.database_error", Message: "", Err: error(*modernc.org/sqlite.Error) *{msg: "SQL logic error: no such column: linked_count (1)", code: 1}, Stack: "C:/Users/SelimSoufargi/Desktop/Answer/answer/internal/repo/question/question_repo.go:419 github.com/apache/answer/internal/repo/question.(*questionRepo).GetQuestionPage\nC:/Users/SelimSoufargi/Desktop/Answer/answer/internal/service/content/question_service.go:1420 github.com/apache/answer/internal/service/content.(*QuestionService).GetQuestionPage\nC:/Users/SelimSoufargi/Desktop/Answer/answer/internal/controller/question_controller.go:335 github.com/apache/answer/internal/controller.(*QuestionController).Ques...+1471 more"}


-- 
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: commits-unsubscribe@answer.apache.org

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