Skip to content

Commit

Permalink
Merge pull request #1261 from rosensilva/main
Browse files Browse the repository at this point in the history
Add property type support for External sources
  • Loading branch information
rosensilva authored Oct 23, 2023
2 parents 8c407b1 + f8da837 commit df5e911
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function populateDSModal(root, dsId, metadata) {
$('#ds-enable-odata-check').prop("checked", false);
}

let properties = config.getElementsByTagName("property");
let properties = config.querySelectorAll("config > property");

// Populate data source ID
$("#ds-ds-id-input").val(dsId.toString().trim());
Expand Down Expand Up @@ -217,6 +217,24 @@ function populateDSModal(root, dsId, metadata) {
if (dsClassName != null && dsClassName != undefined) {
$("#ds-class-name-input").val(dsClassName.trim());
}

$("#ds-ext-properties-table tbody tr").remove();

for (let i = 0, len = properties.length; i < len; i++) {
let propertyName = properties[i].attributes.getNamedItem("name").value;
let propertyValue = properties[i].innerHTML;
if (propertyName != "dynamicUserAuthMapping" && propertyName != "dataSourceClassName" &&
propertyName != "dynamicUserAuthClass") {
let tableRow = "<tr><td><input class=\"form-control\" type=\"text\" " +
"placeholder=\"Property Name\" style=\"width: 100%;\" value='" + propertyName + "'></td>" +
"<td><input class=\"form-control\" type=\"text\" placeholder=\"Property Value\" " +
"style=\"width: 100%;\" value='" + propertyValue + "'></td><td " +
"class=\"text-center\"><input type=\"checkbox\"'></td><td class=\"text-center\">" +
"<i class=\"fa fa-trash\"></i></td></tr>";
$('#ds-ext-properties-table > tbody').append(tableRow);

}
}
}
} else if (dsType === DS_TYPE_CARBONDS) {
$("#ds-dstype-select").val(DS_TYPE_CARBONDS);
Expand Down Expand Up @@ -704,6 +722,18 @@ function processDSInputData(root, data, deleteIfExists) {

if (dbTypeExt === "external_ds") {
properties.push(createTextNode(root, createPropertyNode(root, "dataSourceClassName"), data['ds-class-name-input']));
//Add additional properties for data source
let rows = $('#ds-ext-properties-table').find('tr');
if (rows.length > 1) {
// Process external properties
for (let i = 1, len = rows.length; i < len; i++) {
let name = rows[i].cells[0].firstChild.value;
let value = rows[i].cells[1].firstChild.value;
let propertyItem = createPropertyNode(root, name);
createTextNode(root, propertyItem, value);
configElement.appendChild(propertyItem);
}
}
}
} else if (dsType === "carbon_ds") {
properties.push(createTextNode(root, createPropertyNode(root, "carbon_datasource_name"), data['ds-ds-name-input']));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,8 @@ <h4 class="modal-title" id="ds-modal-header">Create Datasource</h4><button type=
name="ds-class-name-input"><label class="mb-0" for="ds-class-name-input">Datasource
Class Name</label></div>
<div id="ds-ext-prop-group" class="form-custom-group">
<div class="table-responsive" id="ds-ext-properties-table">
<table class="table table-sm">
<div class="table-responsive">
<table class="table table-sm" id="ds-ext-properties-table">
<thead class="align-items-center">
<tr class="text-center">
<th>Property Name</th>
Expand All @@ -680,16 +680,13 @@ <h4 class="modal-title" id="ds-modal-header">Create Datasource</h4><button type=
</thead>
<tbody>
<tr>
<td><input class="form-control" type="text" placeholder="Property Name"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
style="width: 100%;"></td>
<td><input class="form-control" type="text" placeholder="Property Value"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
style="width: 100%;"></td>
<td><input class="form-control" type="text" placeholder="Property Name" autocomplete="off"
autocorrect="off" autocapitalize="off" spellcheck="false" style="width: 100%;"></td>
<td><input class="form-control" type="text" placeholder="Property Value" autocomplete="off"
autocorrect="off" autocapitalize="off" spellcheck="false" style="width: 100%;"></td>
<td class="text-center"><input type="checkbox"></td>
<td class="text-center"><i class="fa fa-trash"></i></td>
</tr>
<tr></tr>
</tbody>
</table>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@
</xs:annotation>
<xs:complexType mixed="true">
<xs:sequence minOccurs="0">
<xs:element name="configuration">
<xs:element name="configuration" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="entry" minOccurs="0" maxOccurs="unbounded">
Expand All @@ -146,6 +147,16 @@
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="property" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="name" type="xs:string" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="name" type="xs:string"
use="required" />
Expand Down

0 comments on commit df5e911

Please sign in to comment.