@sassoftware/viya-serverjs 0.5.4 → 0.6.1-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +14 -30
- package/.env.proxy +24 -0
- package/.env.server +20 -35
- package/Dockerfile +7 -7
- package/README.md +69 -37
- package/cli.js +2 -1
- package/lib/handlers/codeAuth.js +11 -9
- package/lib/handlers/getApp.js +5 -2
- package/lib/handlers/logon.js +4 -5
- package/lib/handlers/proxyMapUri.js +1 -1
- package/lib/handlers/setCookies.js +23 -12
- package/lib/iService.js +98 -234
- package/lib/index.js +29 -15
- package/lib/plugins/SASauth.js +2 -4
- package/lib/plugins/appCookie.js +3 -4
- package/lib/plugins/setContext.js +3 -1
- package/lib/plugins/setDefaultRoutes.js +33 -61
- package/lib/plugins/setupUserRoutes.js +11 -5
- package/lib/readCerts.js +38 -0
- package/package.json +14 -19
- package/public/help.html +1 -1
- package/public/index.html +302 -304
- package/public/indexold.html +356 -0
- package/server.js +10 -11
- package/src/handlers/codeAuth.js +10 -10
- package/src/handlers/getApp.js +4 -1
- package/src/handlers/logon.js +3 -4
- package/src/handlers/proxyMapUri.js +3 -3
- package/src/handlers/setCookies.js +8 -8
- package/src/iService.js +82 -173
- package/src/index.js +30 -17
- package/src/plugins/SASauth.js +2 -6
- package/src/plugins/appCookie.js +4 -5
- package/src/plugins/setContext.js +3 -2
- package/src/plugins/setDefaultRoutes.js +19 -25
- package/src/plugins/setupUserRoutes.js +6 -3
- package/src/readCerts.js +33 -0
- package/tls/viyatls.sh +3 -0
- package/mcpServer.js +0 -364
- package/public/auth.html +0 -24
- package/testca.js +0 -10
package/public/index.html
CHANGED
|
@@ -18,344 +18,342 @@
|
|
|
18
18
|
-->
|
|
19
19
|
|
|
20
20
|
<html lang="en">
|
|
21
|
+
<head>
|
|
22
|
+
<meta charset="UTF-8" />
|
|
21
23
|
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.elabel {
|
|
43
|
-
display: inline-block;
|
|
44
|
-
|
|
45
|
-
clear: left;
|
|
46
|
-
width: 250px;
|
|
47
|
-
text-align: right;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.einput {
|
|
51
|
-
display: inline-block;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.div1 {
|
|
55
|
-
border: 1px solid black;
|
|
56
|
-
background: lightskyblue;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.div2 {
|
|
60
|
-
border: 1px solid black;
|
|
61
|
-
background: lightskyblue;
|
|
62
|
-
height: 200px;
|
|
63
|
-
}
|
|
64
|
-
</style>
|
|
65
|
-
|
|
66
|
-
<script>
|
|
67
|
-
debugger;
|
|
68
|
-
console.log(JSON.stringify(APPENV, null, 4));
|
|
69
|
-
let proxyServer = null;
|
|
70
|
-
if (APPENV.PROXY.toUpperCase() === 'TRUE') {
|
|
71
|
-
proxyServer = `${window.location.protocol}//${window.location.host}/${LOGONPAYLOAD.appName}/proxy`;
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
console.log('Proxy Server = ' + proxyServer);
|
|
75
|
-
let store = restaf.initStore({
|
|
76
|
-
casProxy: true,
|
|
77
|
-
options: {
|
|
78
|
-
proxyServer: proxyServer,
|
|
79
|
-
httpOptions: null
|
|
24
|
+
<script
|
|
25
|
+
crossorigin
|
|
26
|
+
src="https://unpkg.com/react@16/umd/react.production.min.js"
|
|
27
|
+
></script>
|
|
28
|
+
<script
|
|
29
|
+
crossorigin
|
|
30
|
+
src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"
|
|
31
|
+
></script>
|
|
32
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
|
|
33
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js"></script>
|
|
34
|
+
<script src="https://unpkg.com/@sassoftware/restaf@5.7.0"></script>
|
|
35
|
+
<script src="https://unpkg.com/@sassoftware/restaflib@5.7.0"></script>
|
|
36
|
+
<script src="/appenv"></script>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
.container {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
flex-wrap: nowrap;
|
|
43
|
+
min-height: 800px;
|
|
80
44
|
}
|
|
81
|
-
|
|
82
|
-
|
|
45
|
+
.elabel {
|
|
46
|
+
display: inline-block;
|
|
83
47
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
48
|
+
clear: left;
|
|
49
|
+
width: 250px;
|
|
50
|
+
text-align: right;
|
|
51
|
+
}
|
|
52
|
+
.einput {
|
|
53
|
+
display: inline-block;
|
|
54
|
+
}
|
|
55
|
+
.div1 {
|
|
56
|
+
border: 1px solid black;
|
|
57
|
+
background: lightskyblue;
|
|
58
|
+
}
|
|
59
|
+
.div2 {
|
|
60
|
+
border: 1px solid black;
|
|
61
|
+
background: lightskyblue;
|
|
62
|
+
height: 200px;
|
|
63
|
+
}
|
|
64
|
+
</style>
|
|
65
|
+
|
|
66
|
+
<script>
|
|
92
67
|
debugger;
|
|
93
|
-
|
|
68
|
+
if (APPENV.USEPROXY != null && APPENV.USEPROXY.toUpperCase() === 'YES') {
|
|
69
|
+
APPENV.PROXYSERVER = `${window.location.protocol}//${window.location.host}/${APPENV.appName}/proxy`;
|
|
70
|
+
} else {
|
|
71
|
+
APPENV.PROXYSERVER = null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let store = restaf.initStore({
|
|
75
|
+
casProxy: true,
|
|
76
|
+
options: {
|
|
77
|
+
proxyServer: APPENV.PROXYSERVER,
|
|
78
|
+
httpOptions: APPENV.viyaCert
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
debugger; console.log(store.config);
|
|
94
82
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
83
|
+
let session = null;
|
|
84
|
+
let servers = null;
|
|
85
|
+
let services = null;
|
|
86
|
+
let files = null;
|
|
87
|
+
let reports = null;
|
|
88
|
+
let compute = null;
|
|
101
89
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
store.keepViyaAlive(LOGONPAYLOAD.keepAlive, interval, timeout, () => {
|
|
116
|
-
console.log('timed out at', Date());
|
|
117
|
-
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=0,height=0,left=-1000,top=-1000`;
|
|
118
|
-
window.open(`${appOptions.logonPayload.host}/SASLogon/timedout`, 'Timed Out', params);
|
|
119
|
-
return true;
|
|
120
|
-
});
|
|
90
|
+
function setup() {
|
|
91
|
+
debugger;
|
|
92
|
+
document.getElementById('output').innerHTML = '...initializing';
|
|
93
|
+
|
|
94
|
+
initSession()
|
|
95
|
+
.then(r => {
|
|
96
|
+
document.getElementById('output').innerHTML = 'ready';
|
|
97
|
+
keepAlive();
|
|
98
|
+
})
|
|
99
|
+
.catch(e => {
|
|
100
|
+
|
|
101
|
+
console.log(e);
|
|
102
|
+
});
|
|
121
103
|
}
|
|
104
|
+
function keepAlive() {
|
|
105
|
+
if (LOGONPAYLOAD.keepAlive != null) {
|
|
106
|
+
let interval = 120;
|
|
107
|
+
let timeout = 14400;
|
|
108
|
+
if (LOGONPAYLOAD.timers != null) {
|
|
109
|
+
let opts = LOGONPAYLOAD.timers.split(',');
|
|
110
|
+
interval = parseInt(opts[ 0 ]);
|
|
111
|
+
timeout = parseInt(opts[ 1 ]);
|
|
112
|
+
}
|
|
113
|
+
console.log(`Keepalive is active`);
|
|
114
|
+
store.keepViyaAlive(LOGONPAYLOAD.keepAlive, interval, timeout, () => {
|
|
115
|
+
console.log('timed out at', Date());
|
|
116
|
+
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=0,height=0,left=-1000,top=-1000`;
|
|
117
|
+
window.open(`${appOptions.logonPayload.host}/SASLogon/timedout`, 'Timed Out', params);
|
|
118
|
+
return true;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
122
121
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
122
|
+
}
|
|
123
|
+
function logoff() {
|
|
124
|
+
let url = `${window.location.protocol}//${window.location.host}/${LOGONPAYLOAD.appName}/logout?callbackUrl=onlogoff.html`;
|
|
125
|
+
window.location.replace(url);
|
|
128
126
|
|
|
129
|
-
|
|
130
|
-
async function initSession() {
|
|
131
|
-
debugger;
|
|
132
|
-
console.log(APPENV);
|
|
133
|
-
console.log(LOGONPAYLOAD);
|
|
134
|
-
debugger;
|
|
135
|
-
if (LOGONPAYLOAD.host == null) {
|
|
136
|
-
return 'done';
|
|
127
|
+
|
|
137
128
|
}
|
|
138
|
-
|
|
129
|
+
async function initSession() {
|
|
130
|
+
|
|
131
|
+
console.log(APPENV);
|
|
132
|
+
|
|
133
|
+
console.log(LOGONPAYLOAD);
|
|
134
|
+
debugger;
|
|
135
|
+
//LOGONPAYLOAD.host = 'https://localhost:8080';
|
|
136
|
+
console.log('logonpayload', LOGONPAYLOAD);
|
|
139
137
|
let msg = await store.logon(LOGONPAYLOAD);
|
|
140
|
-
console.log(store.connection());
|
|
141
138
|
console.log(msg);
|
|
142
|
-
} catch (err) {
|
|
143
|
-
console.log('Error logging in', JSON.stringify(err, null, 4));
|
|
144
|
-
throw err;
|
|
145
|
-
}
|
|
146
|
-
let name = 'user';
|
|
147
|
-
|
|
148
139
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
140
|
+
/*
|
|
141
|
+
services = await store.addServices(
|
|
142
|
+
'files', 'compute', 'casManagement'
|
|
143
|
+
);
|
|
144
|
+
console.log(services.casManagement.links().toJS())
|
|
145
|
+
*/
|
|
146
|
+
debugger;
|
|
147
|
+
return 'done';
|
|
148
|
+
}
|
|
149
|
+
function runit(type) {
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
document.getElementById('output').innerHTML = '...running';
|
|
153
|
+
let testcase;
|
|
154
|
+
switch (type) {
|
|
155
|
+
case 'files': {
|
|
156
|
+
testcase = SASfileService;
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
case 'compute': {
|
|
160
|
+
testcase = dsCompute;
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
case 'cas': {
|
|
164
|
+
testcase = runCas;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
case 'timedout': {
|
|
168
|
+
testcase = timedout;
|
|
169
|
+
break;
|
|
170
|
+
}
|
|
171
|
+
case 'redir': {
|
|
172
|
+
testcase= noaction;
|
|
173
|
+
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
case 'spre': {
|
|
177
|
+
testcase= spre;
|
|
178
|
+
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
case 'proxy': {
|
|
182
|
+
testcase= testproxy;
|
|
183
|
+
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
default: {
|
|
188
|
+
testcase = SASfileService;
|
|
189
|
+
break;
|
|
190
|
+
}
|
|
170
191
|
}
|
|
171
|
-
case 'redir': {
|
|
172
|
-
testcase = noaction;
|
|
173
192
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
193
|
+
testcase(store)
|
|
194
|
+
.then(r => {
|
|
195
|
+
document.getElementById(
|
|
196
|
+
'output'
|
|
197
|
+
).innerHTML = JSON.stringify(r, null, 4);
|
|
198
|
+
})
|
|
199
|
+
.catch(err => {
|
|
200
|
+
|
|
201
|
+
document.getElementById(
|
|
202
|
+
'output'
|
|
203
|
+
).innerHTML = JSON.stringify(err, null, 4);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
178
206
|
|
|
179
|
-
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
207
|
+
async function noaction() {
|
|
208
|
+
r = {msg: 'redirects completed'};
|
|
209
|
+
return r;
|
|
210
|
+
}
|
|
211
|
+
async function spre(store) {
|
|
212
|
+
let p = {
|
|
213
|
+
method: 'GET',
|
|
214
|
+
url : 'http://localhost:3000/api/test',
|
|
215
|
+
withCredentials: true
|
|
184
216
|
}
|
|
217
|
+
let r = await store.request(p);
|
|
218
|
+
return r.data;
|
|
185
219
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
220
|
+
async function timedout(store) {
|
|
221
|
+
console.log('timed out at', Date() );
|
|
222
|
+
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=0,height=0,left=-1000,top=-1000`;
|
|
223
|
+
window.open(`${LOGONPAYLOAD.host}/SASLogon/timedout`,'Timed Out', params);
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
async function runCas(store) {
|
|
227
|
+
|
|
228
|
+
let {casManagement} = await store.addServices('casManagement');
|
|
229
|
+
let servers = await store.apiCall(
|
|
230
|
+
casManagement.links('servers')
|
|
231
|
+
);
|
|
232
|
+
let serverName = servers.itemsList(0);
|
|
233
|
+
let session = await store.apiCall(
|
|
234
|
+
servers.itemsCmd(serverName, 'createSession')
|
|
235
|
+
);
|
|
236
|
+
let payload = {
|
|
237
|
+
action: 'builtins.echo',
|
|
238
|
+
data: { code: { x: 1 } }
|
|
239
|
+
};
|
|
240
|
+
console.log(JSON.stringify(session.links("execute"), null, 4));
|
|
241
|
+
let r = await store.runAction(session, payload);
|
|
242
|
+
console.log('echo completed');
|
|
243
|
+
await store.apiCall(session.links('delete'));
|
|
244
|
+
return r.items();
|
|
209
245
|
}
|
|
210
|
-
let r = await store.request(p);
|
|
211
|
-
return r.data;
|
|
212
|
-
}
|
|
213
|
-
async function timedout(store) {
|
|
214
|
-
console.log('timed out at', Date());
|
|
215
|
-
let params = `scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=0,height=0,left=-1000,top=-1000`;
|
|
216
|
-
window.open(`${LOGONPAYLOAD.host}/SASLogon/timedout`, 'Timed Out', params);
|
|
217
|
-
return true;
|
|
218
|
-
}
|
|
219
|
-
async function runCas(store) {
|
|
220
|
-
debugger;
|
|
221
|
-
let { casManagement } = await store.addServices('casManagement');
|
|
222
|
-
let servers = await store.apiCall(
|
|
223
|
-
casManagement.links('servers')
|
|
224
|
-
);
|
|
225
|
-
let serverName = servers.itemsList(0);
|
|
226
|
-
let session = await store.apiCall(
|
|
227
|
-
servers.itemsCmd(serverName, 'createSession')
|
|
228
|
-
);
|
|
229
|
-
let payload = {
|
|
230
|
-
action: 'builtins.echo',
|
|
231
|
-
data: { code: { x: 1 } }
|
|
232
|
-
};
|
|
233
|
-
console.log(JSON.stringify(session.links("execute"), null, 4));
|
|
234
|
-
let r = await store.runAction(session, payload);
|
|
235
|
-
console.log('echo completed');
|
|
236
|
-
await store.apiCall(session.links('delete'));
|
|
237
|
-
return r.items();
|
|
238
|
-
}
|
|
239
246
|
|
|
240
|
-
|
|
241
|
-
debugger;
|
|
242
|
-
let content;
|
|
243
|
-
try {
|
|
247
|
+
async function SASfileService(store) {
|
|
244
248
|
debugger;
|
|
245
|
-
|
|
249
|
+
try {
|
|
250
|
+
debugger;
|
|
251
|
+
let {files} = await store.addServices('files');
|
|
246
252
|
debugger;
|
|
247
253
|
console.log(JSON.stringify(files.links(), null, 4));
|
|
248
|
-
|
|
249
|
-
|
|
254
|
+
console.log('items - should be an array of files(empty array is ok)')
|
|
255
|
+
console.log(files.items().toJS());
|
|
250
256
|
let payload = {
|
|
251
257
|
data: { x: 1, y: 'This was saved earlier in the step' },
|
|
252
258
|
headers: { 'content-type': 'application/json' }
|
|
253
259
|
};
|
|
254
260
|
let createCmd = files.links('create');
|
|
255
261
|
let newFile = await store.apiCall(createCmd, payload);
|
|
256
|
-
debugger;
|
|
257
|
-
console.log(JSON.stringify(newFile.links('content'), null, 4));
|
|
258
|
-
content = await store.apiCall(newFile.links('content'));
|
|
259
262
|
|
|
260
|
-
|
|
261
|
-
|
|
263
|
+
let content = await store.apiCall(newFile.links('content'));
|
|
264
|
+
} catch(err) {
|
|
265
|
+
console.log(err);
|
|
262
266
|
debugger;
|
|
263
267
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
268
|
+
|
|
269
|
+
return content.items();
|
|
270
|
+
}
|
|
271
|
+
async function dsCompute(store) {
|
|
272
|
+
let log = null;
|
|
273
|
+
debugger;
|
|
274
|
+
let {compute} = await store.addServices('compute');
|
|
275
|
+
let servers = await store.apiCall(compute.links('servers'));
|
|
272
276
|
|
|
273
|
-
|
|
277
|
+
let contexts = await store.apiCall(compute.links('contexts'));
|
|
274
278
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
let v = document.getElementById('computeInput').value;
|
|
282
|
-
console.log(v);
|
|
283
|
-
// Now run a simple data step in that session
|
|
284
|
-
let payload = {
|
|
285
|
-
data: {
|
|
286
|
-
code: [ `%let dsname = ${v} ; data work.&dsname; do i = 1 to 20; x=1; end; run;
|
|
287
|
-
proc print; run;`
|
|
288
|
-
]
|
|
289
|
-
}
|
|
290
|
-
};
|
|
291
|
-
console.log(payload);
|
|
292
|
-
// Now execute the data step and wait for completion
|
|
293
|
-
let job = await store.apiCall(
|
|
294
|
-
session.links('execute'),
|
|
295
|
-
payload
|
|
296
|
-
);
|
|
297
|
-
let status = await store.jobState(job, null, 5, 2);
|
|
279
|
+
// lookup the name of the first context and then use it to get the associated createSession restafLink
|
|
280
|
+
let createSession = contexts.itemsCmd(
|
|
281
|
+
contexts.itemsList(0),
|
|
282
|
+
'createSession'
|
|
283
|
+
);
|
|
284
|
+
let session = await store.apiCall(createSession);
|
|
298
285
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
break;
|
|
306
|
-
case 'error':
|
|
307
|
-
throw `Please correct errors and rerun program`;
|
|
308
|
-
default:
|
|
309
|
-
log = await store.apiCall(status.job.links('log'));
|
|
310
|
-
break;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
return log === null ? status : log.items();
|
|
314
|
-
}
|
|
315
|
-
</script>
|
|
316
|
-
</head>
|
|
286
|
+
// Now run a simple data step in that session
|
|
287
|
+
let payload = {
|
|
288
|
+
data: {
|
|
289
|
+
code: [`data _null_; do i = 1 to 100; x=1; end; run; `]
|
|
290
|
+
}
|
|
291
|
+
};
|
|
317
292
|
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
<button onclick="runit('files')">
|
|
325
|
-
Press to make a call to file service
|
|
326
|
-
</button>
|
|
327
|
-
<br />
|
|
328
|
-
<br />
|
|
329
|
-
<input id='computeInput'> </input>
|
|
330
|
-
<button onclick="runit('compute')">
|
|
331
|
-
Press to make a call compute service
|
|
332
|
-
</button>
|
|
333
|
-
<br />
|
|
334
|
-
<br />
|
|
335
|
-
<button onclick="runit('cas')">
|
|
336
|
-
Press to make a call to cas echo
|
|
337
|
-
</button>
|
|
338
|
-
<br />
|
|
339
|
-
<br />
|
|
340
|
-
<button onclick="runit('spre')">
|
|
341
|
-
REST call
|
|
342
|
-
</button>
|
|
343
|
-
<br />
|
|
344
|
-
<br />
|
|
345
|
-
<input id='filename'> </input>
|
|
346
|
-
<button onclick="runit('timedout')">
|
|
347
|
-
Press to test timedout
|
|
348
|
-
</button>
|
|
349
|
-
<br />
|
|
350
|
-
<br />
|
|
351
|
-
<button onclick="logoff()">
|
|
352
|
-
logoff
|
|
353
|
-
</button>
|
|
354
|
-
<br />
|
|
355
|
-
</div>
|
|
356
|
-
<div>
|
|
357
|
-
<pre id="output"></pre>
|
|
358
|
-
</div>
|
|
359
|
-
</body>
|
|
293
|
+
// Now execute the data step and wait for completion
|
|
294
|
+
let job = await store.apiCall(
|
|
295
|
+
session.links('execute'),
|
|
296
|
+
payload
|
|
297
|
+
);
|
|
298
|
+
let status = await store.jobState(job, null, 5, 2);
|
|
360
299
|
|
|
361
|
-
|
|
300
|
+
if (status.data === 'running') {
|
|
301
|
+
throw `ERROR: Job did not complete in allotted time`;
|
|
302
|
+
} else {
|
|
303
|
+
switch (status.data) {
|
|
304
|
+
case 'warning':
|
|
305
|
+
console.log(`Warning: check your log for warnings`);
|
|
306
|
+
break;
|
|
307
|
+
case 'error':
|
|
308
|
+
throw `Please correct errors and rerun program`;
|
|
309
|
+
default:
|
|
310
|
+
log = await store.apiCall(status.job.links('log'));
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
return log === null ? status : log.items();
|
|
315
|
+
}
|
|
316
|
+
</script>
|
|
317
|
+
</head>
|
|
318
|
+
<body onload="setup()">
|
|
319
|
+
<h1 id="head">Hi</h1>
|
|
320
|
+
<div>
|
|
321
|
+
<button onclick="runit('redir')">
|
|
322
|
+
Press to do some redirs
|
|
323
|
+
</button>
|
|
324
|
+
<button onclick="runit('files')">
|
|
325
|
+
Press to make a call to file service
|
|
326
|
+
</button>
|
|
327
|
+
<br />
|
|
328
|
+
<br />
|
|
329
|
+
<button onclick="runit('compute')">
|
|
330
|
+
Press to make a call compute service
|
|
331
|
+
</button>
|
|
332
|
+
<br />
|
|
333
|
+
<br />
|
|
334
|
+
<button onclick="runit('cas')">
|
|
335
|
+
Press to make a call to cas echo
|
|
336
|
+
</button>
|
|
337
|
+
<br />
|
|
338
|
+
<br />
|
|
339
|
+
<button onclick="runit('spre')">
|
|
340
|
+
REST call
|
|
341
|
+
</button>
|
|
342
|
+
<br />
|
|
343
|
+
<br />
|
|
344
|
+
<input id='filename'> </input>
|
|
345
|
+
<button onclick="runit('timedout')">
|
|
346
|
+
Press to test timedout
|
|
347
|
+
</button>
|
|
348
|
+
<br />
|
|
349
|
+
<br />
|
|
350
|
+
<button onclick="logoff()">
|
|
351
|
+
logoff
|
|
352
|
+
</button>
|
|
353
|
+
<br />
|
|
354
|
+
</div>
|
|
355
|
+
<div>
|
|
356
|
+
<pre id="output"></pre>
|
|
357
|
+
</div>
|
|
358
|
+
</body>
|
|
359
|
+
</html>
|