Skip to content

Commit 891673f

Browse files
committed
Add support for form.io forms
1 parent 30d2a56 commit 891673f

12 files changed

Lines changed: 527 additions & 170 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 342 additions & 162 deletions
Large diffs are not rendered by default.

OpenFlow/src/public/EditForm.html

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,34 @@
1+
<!-- <style>
2+
body {
3+
padding-top: 0px;
4+
}
5+
</style>
6+
<link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css'> -->
17
<section>
2-
<div class="form-group">
8+
<div class="form-inline">
39
<label for="sid" class="col-sm-2 control-label" translate lib="web">name</label>
410
<div class="col-sm-4">
511
<input ng-model="ctrl.model.name" class="form-control input-md" ng-disabled="ctrl.loading==true" />
12+
<button ng-click="ctrl.Save()" type="button" ng-disabled="ctrl.loading==true" class="btn btn-success "
13+
translate lib="web">save</button>
14+
</div>
15+
</div>
16+
<div class="form-inline">
17+
<label for="sid" class="col-sm-2 control-label" translate lib="web">fbeditor</label>
18+
<div class="col-sm-4">
19+
<input type="checkbox" ng-model="ctrl.model.fbeditor" class="form-control input-md"
20+
ng-change="ctrl.renderform()" ng-disabled="ctrl.loading==true" />
621
</div>
722
</div>
823
</section>
9-
<div id="fb-editor"></div>
24+
<div id="fb-editor" ng-show="ctrl.model.fbeditor==true"></div>
25+
<div ng-show="ctrl.model.fbeditor!=true">
26+
<div class="form-inline">
27+
<label for="sid" class="col-sm-2 control-label" translate lib="web">Wizard</label>
28+
<div class="col-sm-4">
29+
<input type="checkbox" ng-model="ctrl.model.wizard" class="form-control input-md"
30+
ng-change="ctrl.renderform()" ng-disabled="ctrl.loading==true" />
31+
</div>
32+
</div>
33+
</div>
34+
<div id="builder" ng-show="ctrl.model.fbeditor!=true"></div>

OpenFlow/src/public/Entities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,9 @@ module openflow {
207207
this._type = "form";
208208
this.dataType = "json";
209209
}
210+
public fbeditor: boolean;
211+
public wizard: boolean;
212+
public schema: any;
210213
public formData: any;
211214
public dataType: string;
212215
}
@@ -232,6 +235,7 @@ module openflow {
232235
public form: string;
233236
public workflow: string;
234237
public userData: string;
238+
public submission: any;
235239

236240
}
237241

OpenFlow/src/public/Form.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<div>{{ ctrl.message}} </div>
2+
<style>
3+
.alert-alert-success {
4+
display: none !important;
5+
}
6+
</style>
27
<form id="workflowform" ng-submit="ctrl.Save()">
3-
<div class="render-wrap">
8+
<div class="render-wrap" ng-show="ctrl.model.fbeditor==true">
49
</div>
10+
<div id='formio' ng-show="ctrl.model.fbeditor!=true"></div>
511
</form>

OpenFlow/src/public/Main.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ <h1 translate lib="web">sitename</h1>
1010
</div>
1111
</div>
1212
</div>
13-
1413
<table id="table1" class="table table-striped" when-scrolled="ctrl.more()" style="width: 100%;">
1514
<thead class="thead-dark">
1615
<tr>
75.4 KB
Binary file not shown.

OpenFlow/src/public/formio.full.min.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenFlow/src/public/formio.full.min.js

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OpenFlow/src/public/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
<link rel="stylesheet" href="openflow-font/styles.css">
7878
<link rel="stylesheet" href="site.css">
7979

80+
<link rel='stylesheet' href='formio.full.min.css'>
81+
<script src='formio.full.min.js'></script>
82+
8083
<script src="ReconnectingWebSocket.js"></script>
8184
<script src="CommonControllers.js"></script>
8285
<script src="Controllers.js"></script>

OpenFlowNodeRED/src/nodered/nodes/workflow_nodes.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ export class workflow_in_node {
7373
if (Object.keys(source).find(targetkey => targetkey === sourcekey) !== undefined &&
7474
Object.keys(source).find(targetkey => targetkey === sourcekey) !== null
7575
&& typeof source === "object" && typeof source[sourcekey] === "object") {
76-
target[sourcekey] = this.nestedassign(target[sourcekey], source[sourcekey]);
76+
if (target[sourcekey] === undefined || target[sourcekey] === null) {
77+
// target[sourcekey] = {};
78+
} else {
79+
target[sourcekey] = this.nestedassign(target[sourcekey], source[sourcekey]);
80+
}
7781
} else {
7882
target[sourcekey] = source[sourcekey];
7983
}
@@ -119,7 +123,8 @@ export class workflow_in_node {
119123
result._modified = res[0]._modified;
120124
result._modifiedby = res[0]._modifiedby;
121125
result._modifiedbyid = res[0]._modifiedbyid;
122-
result.payload = this.nestedassign(res[0].payload, result.payload.payload);
126+
// result.payload = this.nestedassign(res[0].payload, result.payload.payload);
127+
result.payload = Object.assign(res[0].payload, result.payload.payload);
123128
result.workflow = this.workflow._id;
124129

125130
// result = this.nestedassign(res[0], result);

0 commit comments

Comments
 (0)