Skip to content

Commit c4cbdd0

Browse files
authored
Merge pull request #51 from techvariable/bug/add-node-datatype
Add node data type auto generate bug fix
2 parents d79b843 + 58ab6ed commit c4cbdd0

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/components/editorPage/insert-node-modal/insert-node-modal.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export class InsertNodeModal {
2323
{ label: 'String', selected: true },
2424
{ label: 'Number', selected: false },
2525
];
26-
@State() propSelectedOptionLabel: string = 'String';
2726
@State() isFormValid: boolean = true;
2827

2928
componentWillLoad() {
@@ -47,7 +46,7 @@ export class InsertNodeModal {
4746
discardAddNode() {
4847
this.isFormValid = true;
4948
this.toggleModalState();
50-
this.addNodeState = [{ property: '', value: '', valueType: '' }];
49+
this.addNodeState = [{ property: '', value: '', valueType: 'string' }];
5150
}
5251

5352
async submitHandler(e) {
@@ -56,7 +55,9 @@ export class InsertNodeModal {
5655

5756
handleChange(event, key, index) {
5857
if (key === 'value') {
59-
this.propSelectedOptionLabel = /^-?\d+\.?\d*$/.test(event.target.value) ? 'Number' : 'String';
58+
const copyAddNodeState = [...this.addNodeState];
59+
copyAddNodeState[index]["valueType"] = /^-?\d+\.?\d*$/.test(event.target.value) ? 'Number' : 'String';
60+
this.addNodeState = copyAddNodeState;
6061
}
6162
this.addNodeState[index][key] = event.target.value;
6263
}
@@ -163,7 +164,7 @@ export class InsertNodeModal {
163164
</div>
164165
<custom-drop-down class="py-4" selectHandler={value => this.handleCustomSelect(value)} optionListProp={this.nodeMapper()}></custom-drop-down>
165166
<div class="max-h-60 overflow-auto custom-scrollbar">
166-
{this.addNodeState.map((_node, index) => {
167+
{this.addNodeState.map((node, index) => {
167168
return (
168169
<div class="mt-2 flex gap-4">
169170
<div>
@@ -201,7 +202,7 @@ export class InsertNodeModal {
201202
<basic-dropdown
202203
label="Select:"
203204
propOptions={this.valueOptions}
204-
propSelectedOptionLabel={this.propSelectedOptionLabel}
205+
propSelectedOptionLabel={node["valueType"]}
205206
optionHandler={selectedLabel => this.optionHandler(index, selectedLabel)}
206207
class="w-40"
207208
id="valueType"

src/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<!-- <editor-res></editor-res> -->
2828
<!-- <permission-editor url="http://localhost:3000/api/permissions" rolesurl="http://localhost:3000/api/permissions/all"></permission-editor> -->
2929
<!-- <tabs-component></tabs-component> -->
30-
<editor-page url="http://localhost:3000/api/editor"></editor-page>
30+
<!-- <editor-page url="http://localhost:3000/api/editor"></editor-page> -->
3131
<!-- <query-logs ></query-logs> -->
3232
<!-- <navigators-component></navigators-component> -->
3333
<!-- <users-component></users-component> -->
@@ -49,6 +49,7 @@
4949
<!-- <login-form></login-form> -->
5050
<!-- </fluid-container> -->
5151
<!-- <banner-component></banner-component> -->
52+
<insert-node-model ></insert-node-model>
5253
</div>
5354
</body>
5455

0 commit comments

Comments
 (0)