Skip to content

Commit aaded3b

Browse files
committed
11
1 parent 4f68ae8 commit aaded3b

2 files changed

Lines changed: 7 additions & 59 deletions

File tree

OpenFlow/src/public/Controllers.ts

Lines changed: 6 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,6 @@ module openflow {
11411141
if (this.instanceid !== null && this.instanceid !== undefined && this.instanceid !== "") {
11421142
var res = await this.api.Query("workflow_instances", { _id: this.instanceid }, null, { _created: -1 }, 1);
11431143
if (res.length > 0) { this.model = res[0]; } else { console.error(this.id + " workflow instances not found!"); return; }
1144-
1145-
// await this.SendOne(this.workflow.queue, this.message);
11461144
if (this.model.form !== "") {
11471145
var res = await this.api.Query("forms", { _id: this.model.form }, null, { _created: -1 }, 1);
11481146
if (res.length > 0) { this.form = res[0]; } else { console.error(this.id + " form not found!"); return; }
@@ -1152,6 +1150,7 @@ module openflow {
11521150
this.renderform();
11531151
} else {
11541152
console.log("No instance id found, send empty message");
1153+
console.log("SendOne: " + this.workflow._id + " / " + this.workflow.queue);
11551154
await this.SendOne(this.workflow.queue, {});
11561155
this.loadData();
11571156
}
@@ -1181,6 +1180,7 @@ module openflow {
11811180
}
11821181
var ele = $('.render-wrap');
11831182
ele.hide();
1183+
console.log("SendOne: " + this.workflow._id + " / " + this.workflow.queue);
11841184
await this.SendOne(this.workflow.queue, this.model);
11851185
this.loadData();
11861186
}
@@ -1195,10 +1195,11 @@ module openflow {
11951195
this.form.formData = JSON.parse((this.form.formData as any));
11961196
}
11971197
for (var i = 0; i < this.form.formData.length; i++) {
1198-
console.log(this.form.formData[i]);
1199-
this.form.formData[i].userData = [this.model.payload[this.form.formData[i].name]];
1198+
var value = this.model.payload[this.form.formData[i].name];
1199+
if (value == undefined || value == null) { value = ""; }
1200+
this.form.formData[i].userData = [value];
12001201
if (this.model.payload[this.form.formData[i].label] !== null && this.model.payload[this.form.formData[i].label] !== undefined) {
1201-
this.form.formData[i].label = this.model.payload[this.form.formData[i].label];
1202+
this.form.formData[i].label = value;
12021203
}
12031204
}
12041205
var formRenderOpts = {
@@ -1215,59 +1216,6 @@ module openflow {
12151216
ele.show();
12161217
this.formRender = ele.formRender(formRenderOpts);
12171218
}
1218-
1219-
// async loadData(): Promise<void> {
1220-
// this.loading = true;
1221-
// this.charts = [];
1222-
// // var res = await this.api.Query(this.collection, this.basequery, null, { _created: -1 }, 1);
1223-
// // if (res.length > 0) { this.model = res[0]; } else { console.error(this.id + " instance not found!"); return; }
1224-
// // res = await this.api.Query(this.collection, { _id: this.model.form }, null, { _created: -1 }, 1);
1225-
// // if (res.length > 0) { this.form = res[0]; } else { console.error(this.model.form + " form not found!"); return; }
1226-
1227-
// var res = await this.api.Query(this.collection, {}, null, { _created: -1 }, 1);
1228-
// if (res.length > 0) { this.form = res[0]; } else { console.error(this.id + " not found!"); return; }
1229-
1230-
// this.renderform();
1231-
// }
1232-
// async Save() {
1233-
// console.log(this.formRender.userData);
1234-
// this.model.userData = this.formRender.userData;
1235-
// // this.model.formData = this.formBuilder.actions.getData(this.model.dataType);
1236-
// // if (this.model._id) {
1237-
// // this.model = await this.api.Update(this.collection, this.model);
1238-
// // } else {
1239-
// // this.model = await this.api.Insert(this.collection, this.model);
1240-
// // }
1241-
// // var formRenderOpts = {
1242-
// // formData: this.model.formData,
1243-
// // dataType: this.model.dataType
1244-
// // };
1245-
// // var ele: any = $('.render-wrap');
1246-
// // ele.formRender(formRenderOpts);
1247-
// }
1248-
// async renderform() {
1249-
// // https://www.npmjs.com/package/angular2-json-schema-form
1250-
// // http://www.alpacajs.org/demos/form-builder/form-builder.html
1251-
// // https://github.com/kevinchappell/formBuilder - https://formbuilder.online/ - https://kevinchappell.github.io/formBuilder/
1252-
// var ele: any;
1253-
// var roles: any = {};
1254-
// this.WebSocketClient.user.roles.forEach(role => {
1255-
// roles[role._id] = role.name;
1256-
// });
1257-
// var formRenderOpts = {
1258-
// formData: this.form.formData,
1259-
// dataType: this.form.dataType,
1260-
// roles: roles,
1261-
// disabledActionButtons: ['data', 'clear'],
1262-
// onSave: this.Save.bind(this),
1263-
// };
1264-
// if (this.model.userData !== null && this.model.userData !== undefined && this.model.userData !== "") {
1265-
// formRenderOpts.formData = this.model.userData;
1266-
// }
1267-
// ele = $('.render-wrap');
1268-
// this.formRender = ele.formRender(formRenderOpts);
1269-
// }
1270-
12711219
}
12721220
export class jslogCtrl extends entitiesCtrl<openflow.Base> {
12731221
public message: string = "";

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.153
1+
0.0.154

0 commit comments

Comments
 (0)