Qiang Zhang created RANGER-1860:
-----------------------------------

             Summary: Provide a new service interface prompt function framework 
to resolved the defect of the current service interface, increase the 
flexibility of the function, improve user ease of use
                 Key: RANGER-1860
                 URL: https://issues.apache.org/jira/browse/RANGER-1860
             Project: Ranger
          Issue Type: Bug
          Components: admin
            Reporter: Qiang Zhang
            Assignee: Qiang Zhang


The ranger used the hard-coded way to achieve the service interface prompt 
function, the result is that the codes have worse maintainability.
{code}
if(!isPolicyForm) {
        if(v.name == 'yarn.url'){
                formObj.type = 'TextFiledWithIcon';
                formObj.errorMsg = localization.tt("hintMsg.yarnRestUrl");
        }else if(v.name == 'sqoop.url'){
                formObj.type = 'TextFiledWithIcon';
                formObj.errorMsg = localization.tt("hintMsg.sqoopRestUrl");
        }else if(v.name == 'jdbc.url'){
                formObj.type = 'TextFiledWithIcon';
                formObj.errorMsg = localization.tt("hintMsg.hiveJDBCUrl");
        }else if(v.name == 'fs.default.name'){
                formObj.type = 'TextFiledWithIcon';
                formObj.errorMsg = localization.tt("hintMsg.hdfsNameNodeUrl");
        }else{
                formObj.type = 'Text';
        }
        break;
}
{code}
Using the new issue we can directly modify the configuration file to meet the 
requirements of the new prompt function. Such as we can modify the following 
configuration to meet following requirements: 
the configuration in the ranger-servicedef-yarn.json is as follows:
{code}
"configs": 
[
        {
                "itemId": 3,
                "name": "yarn.url",
                "type": "string",
                "mandatory": true,
                "defaultValue": "",
                "validationRegEx":"",
                "validationMessage": "",
                "uiHint":"{\"TextFiledWithIcon\":true, \"info\": \"1.For one 
url, eg.<br>'http or https://&lt;ipaddr&gt;:8088'<br>2.For multiple urls (use , 
or ; delimiter), 
eg.<br>'http://&lt;ipaddr1&gt;:8088,http://&lt;ipaddr2&gt;:8088'\"}",
                "label": "YARN REST URL"
        }
]
{code}
requirements: 
adding text field with an icon( i.e information) on service form page,we should 
add unified configuration management functions in the service definition.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to