patch_action_chain_template_pin_login.js 7.62 KB
use DMAMANAGER

db.dma_action_chain_template.update(
	{"actionType": "loginPin_confirm_api_change"},
	{
		"actionType": "loginPin_confirm_api_change",
		"chainTemplate": {
			"type": "$util.alert",
			"dmaType": "confirm_dialog",
			"options": {
				"title": "Hello",
				"description": "This is a message",
				"positiveText": "Yes",
				"negetiveText": "No"
			},
			"success": {
				"type": "$loading",
				"dmaType": "open_loading",
				"options": {
					"lock": "true"
				},
				"success": {
					"type": "$set",
					"dmaType": "set_global_to_api",
					"options": {},
					"success": {
						"type": "$network.request",
						"dmaType": "network_request",
						"options": {
							"url": "http://www.dma.beebuddy.net/myfile.json",
							"method": "post",
							"header": {
								"content_type": "json"
							},
							"data": {}
						},
						"success": {
							"type": "$set",
							"dmaType": "response_to_local",
							"options": {
								"result": "{{$jason}}"
							},
							"success": {
								"type": "$loading",
								"dmaType": "hide_loading",
								"options": {
									"lock": "false"
								},
								"success": {
									"type": "$util.condition",
									"dmaType": "check_condition",
									"options": {
										"expression": "true"
									},
									"success": {
										"type": "$global.set",
										"dmaType": "set_global",
										"options": {
											"output1": "{{$get.result.resultData}}"
										},
										"success": {
											"type": "$session.set",
											"dmaType": "set_session",
											"options": {
												"domain": "jasonbase.com",
												"header": {},
												"body": {}
											},
											"success": {
												"type": "$passcode.create",
												"dmaType": "passcode_create",
												"options": {},
												"success": {
													"type": "$passcode.unlock",
													"dmaType": "passcode_unlock",
													"options": {},
													"success": {
														"type": "$href",
														"dmaType": "change_page",
														"options": {
															"url": "www.mylinkurl.com/myfile.json"
														},
														"success": {},
														"error": {}
													},
													"error": {}
												},
												"error": {
													"type": "$util.banner",
													"dmaType": "network_banner",
													"options": {
														"title": "Result",
														"description": "Error",
														"type": "error"
													},
													"success": {},
													"error": {}
												}
											},
											"error": {
												"type": "$util.banner",
												"dmaType": "network_banner",
												"options": {
													"title": "Result",
													"description": "Error",
													"type": "error"
												},
												"success": {},
												"error": {}
											}
										},
										"error": {}
									},
									"error": {
										"type": "$util.banner",
										"dmaType": "condition_Banner",
										"options": {
											"title": "Hello",
											"description": "{{$get.result.resultMessage}}",
											"type": "error"
										},
										"success": {},
										"error": {}
									}
								}
							}
						},
						"error": {
							"type": "$loading",
							"dmaType": "hide_loading",
							"options": {
								"lock": "false"
							},
							"success": {

								"type": "$util.banner",
								"dmaType": "network_banner",
								"options": {
									"title": "Hello",
									"description": "Can not connect to server.",
									"type": "error"
								},
								"success": {},
								"error": {
									"type": "$util.alert",
									"dmaType": "network_banner",
									"options": {
										"title": "Hello",
										"description": "Do you want to exit?",
										"positiveText": "Yes",
										"negetiveText": "No",
										"form": []
									},
									"success": {},
									"error": {}
								}
							}
						}
					},
					"error": {}
				}
			},
			"error": {}
		}
	},
	{upsert : true}
)

db.dma_action_chain_template.update(
	{"actionType": "loginPin_noconfirm_api_change"},
	{
		"actionType" : "loginPin_noconfirm_api_change",
		"chainTemplate" : {
			"type": "$loading",
			"dmaType": "open_loading",
			"options": {
				"lock": "true"
			},
			"success": {
				"type": "$set",
				"dmaType": "set_global_to_api",
				"options": {},
				"success": {
					"type": "$network.request",
					"dmaType": "network_request",
					"options": {
						"url": "http://www.dma.beebuddy.net/myfile.json",
						"method": "post",
						"header": {
							"content_type": "json"
						},
						"data": {}
					},
					"success": {
						"type": "$set",
						"dmaType": "response_to_local",
						"options": {
							"result": "{{$jason}}"
						},
						"success": {
							"type": "$loading",
							"dmaType": "hide_loading",
							"options": {
								"lock": "false"
							},
							"success": {
								"type": "$util.condition",
								"dmaType": "check_condition",
								"options": {
									"expression": "true"
								},
								"success": {
									"type": "$global.set",
									"dmaType": "set_global",
									"options": {
										"output1": "{{$get.result.resultData}}"
									},
									"success": {
										"type": "$session.set",
										"dmaType": "set_session",
										"options": {
											"domain": "jasonbase.com",
											"header": {},
											"body": {}
										},
										"success": {
											"type": "$passcode.create",
											"dmaType": "passcode_create",
											"options": {},
											"success": {
												"type": "$passcode.unlock",
												"dmaType": "passcode_unlock",
												"options": {},
												"success": {
													"type": "$href",
													"dmaType": "change_page",
													"options": {
														"url": "www.mylinkurl.com/myfile.json"
													},
													"success": {},
													"error": {}
												},
												"error": {}
											},
											"error": {
												"type": "$util.banner",
												"dmaType": "network_banner",
												"options": {
													"title": "Result",
													"description": "Error",
													"type": "error"
												},
												"success": {},
												"error": {}
											}
										},
										"error": {
											"type": "$util.banner",
											"dmaType": "network_banner",
											"options": {
												"title": "Result",
												"description": "Error",
												"type": "error"
											},
											"success": {},
											"error": {}
										}
									},
									"error": {}
								},
								"error": {
									"type": "$util.banner",
									"dmaType": "condition_Banner",
									"options": {
										"title": "Hello",
										"description": "{{$get.result.resultMessage}}",
										"type": "error"
									},
									"success": {},
									"error": {}
								}
							}
						}
					},
					"error": {
						"type": "$loading",
						"dmaType": "hide_loading",
						"options": {
							"lock": "false"
						},
						"success": {

							"type": "$util.banner",
							"dmaType": "network_banner",
							"options": {
								"title": "Hello",
								"description": "Can not connect to server.",
								"type": "error"
							},
							"success": {},
							"error": {
								"type": "$util.alert",
								"dmaType": "network_banner",
								"options": {
									"title": "Hello",
									"description": "Do you want to exit?",
									"positiveText": "Yes",
									"negetiveText": "No",
									"form": []
								},
								"success": {},
								"error": {}
							}
						}
					}
				},
				"error": {}
			}
		}
	},
	{upsert : true}
)