Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIGTOP-4167: Add longtext attr to config property and use textarea for UI display #24

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.model.dto;

import lombok.Data;

import java.io.Serializable;

@Data
public class AttrsDTO implements Serializable {

private String type;
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ public class PropertyDTO implements Serializable {
private String displayName;

private String desc;

private AttrsDTO attrs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.apache.bigtop.manager.dao.entity.Service;
import org.apache.bigtop.manager.server.model.dto.ComponentDTO;
import org.apache.bigtop.manager.server.model.vo.ComponentVO;
import org.apache.bigtop.manager.server.stack.pojo.ComponentModel;
import org.apache.bigtop.manager.server.stack.model.ComponentModel;

import org.mapstruct.Context;
import org.mapstruct.Mapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.apache.bigtop.manager.dao.entity.Service;
import org.apache.bigtop.manager.server.model.dto.ServiceDTO;
import org.apache.bigtop.manager.server.model.vo.ServiceVO;
import org.apache.bigtop.manager.server.stack.pojo.ServiceModel;
import org.apache.bigtop.manager.server.stack.model.ServiceModel;

import org.mapstruct.Context;
import org.mapstruct.Mapper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.apache.bigtop.manager.dao.entity.Stack;
import org.apache.bigtop.manager.server.model.dto.StackDTO;
import org.apache.bigtop.manager.server.model.vo.StackVO;
import org.apache.bigtop.manager.server.stack.pojo.StackModel;
import org.apache.bigtop.manager.server.stack.model.StackModel;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.model.req;

import lombok.Data;

@Data
public class AttrsReq {

private String type;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ public class PropertyReq {
private String displayName;

private String desc;

private AttrsReq attrs;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.model.vo;

import lombok.Data;

@Data
public class AttrsVO {

private String type;
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ public class PropertyVO {
private String displayName;

private String desc;

private AttrsVO attrs;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

import jakarta.xml.bind.annotation.XmlAccessType;
import jakarta.xml.bind.annotation.XmlAccessorType;

@Data
@XmlAccessorType(XmlAccessType.FIELD)
public class AttrsModel {

private String type;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand All @@ -37,4 +37,7 @@ public class PropertyModel {

@XmlElement(name = "description")
private String desc;

@XmlElement(name = "attrs")
private AttrsModel attrs;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.AllArgsConstructor;
import lombok.Data;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.bigtop.manager.server.stack.pojo;
package org.apache.bigtop.manager.server.stack.model;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.bigtop.manager.server.stack.xml;

import org.apache.bigtop.manager.server.stack.pojo.PropertyModel;
import org.apache.bigtop.manager.server.stack.model.PropertyModel;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.bigtop.manager.server.stack.xml;

import org.apache.bigtop.manager.server.stack.pojo.ServiceModel;
import org.apache.bigtop.manager.server.stack.model.ServiceModel;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.bigtop.manager.server.stack.xml;

import org.apache.bigtop.manager.server.stack.pojo.StackModel;
import org.apache.bigtop.manager.server.stack.model.StackModel;

import lombok.Data;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
*/
package org.apache.bigtop.manager.server.utils;

import org.apache.bigtop.manager.server.model.dto.AttrsDTO;
import org.apache.bigtop.manager.server.model.dto.PropertyDTO;
import org.apache.bigtop.manager.server.stack.pojo.PropertyModel;
import org.apache.bigtop.manager.server.stack.model.AttrsModel;
import org.apache.bigtop.manager.server.stack.model.PropertyModel;
import org.apache.bigtop.manager.server.stack.xml.ConfigurationXml;

import java.util.ArrayList;
Expand All @@ -41,17 +43,29 @@ public static List<PropertyDTO> loadConfig(String fileName) {

List<PropertyDTO> propertyDTOList = new ArrayList<>();
for (PropertyModel propertyModel : propertyModels) {
PropertyDTO propertyDTO = new PropertyDTO();
propertyDTO.setDisplayName(propertyModel.getDisplayName());
propertyDTO.setDesc(propertyModel.getDesc());
propertyDTO.setName(propertyModel.getName());
propertyDTO.setValue(propertyModel.getValue());
PropertyDTO propertyDTO = getPropertyDTO(propertyModel);
propertyDTOList.add(propertyDTO);
}

return propertyDTOList;
}

private static PropertyDTO getPropertyDTO(PropertyModel propertyModel) {
PropertyDTO propertyDTO = new PropertyDTO();
propertyDTO.setDisplayName(propertyModel.getDisplayName());
propertyDTO.setDesc(propertyModel.getDesc());
propertyDTO.setName(propertyModel.getName());
propertyDTO.setValue(propertyModel.getValue());
if (propertyModel.getAttrs() != null) {
AttrsModel attrsModel = propertyModel.getAttrs();
AttrsDTO attrsDTO = new AttrsDTO();
attrsDTO.setType(attrsModel.getType());
propertyDTO.setAttrs(attrsDTO);
}

return propertyDTO;
}

/**
* extract config from List<Map<String,Object>> to Map<String,Object>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import org.apache.bigtop.manager.server.stack.dag.ComponentCommandWrapper;
import org.apache.bigtop.manager.server.stack.dag.DAG;
import org.apache.bigtop.manager.server.stack.dag.DagGraphEdge;
import org.apache.bigtop.manager.server.stack.pojo.ServiceModel;
import org.apache.bigtop.manager.server.stack.pojo.StackModel;
import org.apache.bigtop.manager.server.stack.model.ServiceModel;
import org.apache.bigtop.manager.server.stack.model.StackModel;
import org.apache.bigtop.manager.server.stack.xml.ServiceMetainfoXml;
import org.apache.bigtop.manager.server.stack.xml.StackMetainfoXml;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,8 @@ export HADOOP_LIBEXEC_DIR=${hadoop_libexec_dir}

]]>
</value>
<attrs>
<type>longtext</type>
</attrs>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -376,5 +376,8 @@ log4j.logger.org.apache.commons.beanutils=WARN
</#noparse>
]]>
</value>
<attrs>
<type>longtext</type>
</attrs>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ ${hdfs_group} - nproc ${hdfs_user_nproc_limit}

]]>
</value>
<attrs>
<type>longtext</type>
</attrs>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,8 @@ ${host}

]]>
</value>
<attrs>
<type>longtext</type>
</attrs>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@ export KAFKA_OPTS={{kafka_kerberos_params}}
export CLASSPATH=$CLASSPATH:${kafka_conf_dir}
]]>
</value>
<attrs>
<type>longtext</type>
</attrs>
</property>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -136,5 +136,8 @@ log4j.logger.state.change.logger=TRACE, stateChangeAppender
log4j.additivity.state.change.logger=false
]]>
</value>
<attrs>
<type>longtext</type>
</attrs>
</property>
</configuration>
Loading
Loading