aboutsummaryrefslogtreecommitdiffstats
path: root/ll-database-binding/htdocs/persistence/index.html
blob: 50999d93dbfe546f5b596e9a09b7e032e5b6375a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!doctype html>
<html>
	<head>
		<title>agl-service-data-persistence</title>
		<meta charset="UTF-8">
		<script type="text/javascript" src="AFB-websock.js"></script>
		<script type="text/javascript" src="persistence-binding.js"></script>
		<link rel="stylesheet" type="text/css" href="binding-debug.css" />
	</head>
	<body onload="init();" id="app-body">
		<div id="debug-panel-container"></div>
		<h1>agl-service-identity</h1>
		<h2>Raw data access</h2>
		<p>
			<ul>
				<li><input type="text" name="read-key" id="read-key" /> <button onclick="readData();">Read Data</button> <button onclick="deleteData();">Delete Data</button></li>
				<li>
					<p><label>Key:&nbsp;</label><input type="text" name="write-key" id="write-key"/></p>
					<p><label>Data:</label></p>
					<p><textarea id="write-data"></textarea></p>
					<p><button onclick="writeData();">Write Data</button></p>
				</li>
			</ul>
		</p>
		<h2>User Profile (VIN: <input type="text" name="profile-vin" id="profile-vin" value="WVGGF7BP7HD005986" />)</h2>
		<ul>
			<li><input type="text" name="get-profile-key" id="get-profile-key" /> <button onclick="readProfile();">Get Profile</button> <button onclick="deleteProfile();">Delete Profile</button></li>
			<li>
				<h3>Update user profile</h3>
				<ul>
					<li><p><label>Key Token:</label> <input type="text" name="set-profile-key" id="set-profile-key"/></p></li>
					<li><p><label>Login:</label> <input type="text" name="set-profile-login" id="set-profile-login"/></p></li>
					<li><p><label>First Name:</label> <input type="text" name="set-profile-first-name" id="set-profile-first-name"/></p></li>
					<li><p><label>Last Name:</label> <input type="text" name="set-profile-last-name" id="set-profile-last-name"/></p></li>
					<li><p><label>Language:</label> <input type="text" name="set-profile-language" id="set-profile-language"/></p></li>
					<button onclick="writeProfile();">Save</button>
				</ul>
			</li>
		</ul>
	</body>
</html>
span class="p">); getDaemons(source->api, &daemons); if (daemons == NULL || daemons->count <= 0) { AFB_ReqFail(source->request, "failed", "No daemon found"); } // search server and client pid DAEMON_T *pid_s = NULL, *pid_c = NULL; for (int i = 0; i < daemons->count; i++) { AFB_ApiDebug(source->api, "_DEBUG_ svr %s", json_object_to_json_string(daemons->daemons[i]->ws_servers)); AFB_ApiDebug(source->api, "_DEBUG_ cli %s", json_object_to_json_string(daemons->daemons[i]->ws_clients)); json_object* ws_servers = daemons->daemons[i]->ws_servers; for (int j = 0; j < json_object_array_length(ws_servers); j++) { wsn = json_object_get_string(json_object_array_get_idx(ws_servers, j++)); if (wsn && strstr(wsn, ws_name) != NULL) { pid_s = daemons->daemons[i]; break; } } json_object* ws_clients = daemons->daemons[i]->ws_clients; for (int j = 0; j < json_object_array_length(ws_clients); j++) { wsn = json_object_get_string(json_object_array_get_idx(ws_clients, j++)); if (wsn && strstr(wsn, ws_name) != NULL) { pid_c = daemons->daemons[i]; break; } } if (pid_s != NULL && pid_c != NULL) { if ((rc = trace_exchange(source->api, pid_s, pid_c)) < 0) { AFB_ReqFailF(source->request, "failed", "Trace error %d", rc); } break; } } if (pid_s == NULL || pid_c == NULL) { AFB_ReqFail(source->request, "failed", "Cannot determine Server or Client"); return ERROR; } AFB_ReqSucessF(source->request, result, "Tracing Server pid=%d <-> Client pid=%d", pid_s->pid, pid_c->pid); return 0; } /* SEB TODO void xds_event_cb(const char* evtname, json_object* j_event) { int rc; METRIC_T metric; const char* type = NULL; struct json_object* request = NULL; AFB_NOTICE("RECV Event %s : %s", evtname, json_object_to_json_string(j_event)); if (strcmp(evtname, "supervisor/trace") != 0) { return; } if ((rc = wrap_json_unpack(j_event, "{s:?s}", "type", &type)) < 0) { AFB_ERROR("Cannot decode event type"); return; } if (strcmp(type, "request") == 0) { if (!json_object_object_get_ex(j_event, "request", &request)) { AFB_ERROR("Cannot decode event request"); return; } metric.name = "trace"; metric.data = request; rc = harvester_post_data(&metric); if (rc < 0) { AFB_ERROR("ERROR harvester_post_data: rc %d", rc); } } } */