diff --git a/ApiTestManager/src/components/LayoutGrid.js b/ApiTestManager/src/components/LayoutGrid.js
index 3649adb..ec99430 100644
--- a/ApiTestManager/src/components/LayoutGrid.js
+++ b/ApiTestManager/src/components/LayoutGrid.js
@@ -213,22 +213,22 @@ class LayoutGridView {
${item.loutItemSerno}
').addClass('treegrid-' + node.id).data('nodeId', node.id);
if (depth === 0) {
tr.css({'display': 'none'});
}
- if (node.parent || (node.parent !== null && parseInt(node.parent) !== this.model.rootId)) {
+ if (node.parent !== undefined && node.parent !== null && parseInt(node.parent) !== this.model.rootId) {
const parentSelector = `.treegrid-${node.parent}`;
const lastChildSelector = `.treegrid-parent-${node.parent}`;
if ($(this.view.table).find(lastChildSelector).length > 0) {
const lastChild = $(this.view.table).find(lastChildSelector).last();
- console.log('lastChild: ', lastChild);
tr.insertAfter(lastChild);
+ console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterLastChild: ', lastChild);
} else {
- console.log('parentSelector: ', parentSelector);
+ console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'insertAfterParent: ', parentSelector);
tr.insertAfter($(this.view.table).find(parentSelector));
}
tr.addClass('treegrid-parent-' + node.parent);
} else {
- console.log('no parent');
tr.appendTo(this.view.table);
+ console.log('addRow, node: ', node.id, ' parent: ', node.parent, 'tr: ', tr, 'no parent');
}
- console.log('addRow, node: ', node.id, ' parent: ', node.parent);
- console.log('addRow tr: ', tr);
+
+ console.log('================================ row Added');
return tr;
}
-
addCell(row, node, fieldInfo, depth) {
const td = $('| ').appendTo(row);
const padding = fieldInfo.isFirst ? this.getIndent(depth) : '';
- const nodePath = this.model.getNodePath(this.model.root, node.id) + ".value";
+ const nodePath = this.model.getNodePath(this.model.root, node.id) + '.value';
if (node.loutItemType === 'Field' && fieldInfo.type === 'textfield') {
const div = $(' ');
@@ -175,7 +207,7 @@ class LayoutTreeGridController {
}
processNode(node, depth) {
- console.log('node: ', node.id);
+ // console.log('node: ', node.id);
const tr = this.addRow(node, depth);
this.options.forEach((fieldInfo) => {
diff --git a/ApiTestManager/src/components/ServerManager.js b/ApiTestManager/src/components/ServerManager.js
index bfd250c..4158bda 100644
--- a/ApiTestManager/src/components/ServerManager.js
+++ b/ApiTestManager/src/components/ServerManager.js
@@ -1,8 +1,10 @@
import EditableInput from './EditableInput';
+import APIClient from '../APIClient';
class ServerManager {
constructor(servers) {
this.servers = servers || [];
+ this.apiClient = new APIClient();
}
basePath(serverId) {
@@ -117,6 +119,31 @@ class ServerManager {
${optionsHtml}`;
}
+
+ async fillPadding(apiRequest, value, dataLength) {
+ let paddedValue = await this.apiClient.processPreScriptAndVariables(apiRequest, value);
+
+ while (paddedValue.length < dataLength) {
+ paddedValue = ' ' + paddedValue; // Prepend a space character to the string
+ }
+
+ return paddedValue;
+ }
+
+ async renderServerPrefix(serverOptions, apiRequest) {
+ let message = '';
+ for (let i = 0; i < serverOptions.length; i++) {
+ //header 에서 값을 가져와야 함.
+ let value = '';
+ let found = apiRequest.headers.filter(header => header.key === serverOptions[i].optionKey);
+ if (found.length > 0) {
+ value = found[0].value;
+ }
+
+ message += await this.fillPadding(apiRequest, value, serverOptions[i].length);
+ }
+ return message;
+ }
}
export default ServerManager;
diff --git a/ApiTestManager/src/components/TCPClientView.js b/ApiTestManager/src/components/TCPClientView.js
index edc0cda..efd4b7a 100644
--- a/ApiTestManager/src/components/TCPClientView.js
+++ b/ApiTestManager/src/components/TCPClientView.js
@@ -54,7 +54,8 @@ class TCPClientView {
let layoutTreeDataGrid = new LayoutTreeDataGrid(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.request_layout_data_tree'), layoutDataRoot, this.model, layoutDataTreeOptions, this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.total_message_length'));
layoutTreeDataGrid.init( async (finalMessage) => {
- this.requestBodyEditor.setValue(finalMessage);
+ const prefix = await this.serverManager.renderServerPrefix(this.server.serverOptions, this.model);
+ this.requestBodyEditor.setValue(prefix + finalMessage);
});
let layoutTreeGrid = new LayoutTreeGrid(this.apiRequestTabContent.find(`#api_request_${this.model.id}`).find('.request_layout_tree'), layoutRoot, layoutDataTreeOptions, (root) => {
|