forked from aws/aws-toolkit-vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathremoteInvoke.vue
More file actions
358 lines (340 loc) · 18.2 KB
/
remoteInvoke.vue
File metadata and controls
358 lines (340 loc) · 18.2 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
/*! * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */
<script src="./remoteInvokeFrontend" lang="ts"></script>
<style scoped src="./remoteInvoke.css"></style>
<template>
<div class="Icontainer">
<div><h1>Remote invoke configuration</h1></div>
<div class="form-row" style="justify-content: flex-start; height: 28px; align-items: center">
<div>
<button class="button-theme-primary" v-on:click="sendInput">Remote Invoke</button>
</div>
<div>
<info>Function Name: {{ initialData.FunctionName }}</info>
</div>
</div>
<div class="form-row" style="justify-content: flex-start; height: 28px">
<label>Resource ARN</label>
<info-wrap>{{ initialData.FunctionArn }}</info-wrap>
</div>
<div class="form-row">
<label>Region</label>
<info-wrap
>{{ initialData.FunctionRegion }}
<b v-if="uiState.extraRegionInfo">{{ uiState.extraRegionInfo }}</b></info-wrap
>
</div>
<div class="form-row">
<label>Runtime</label>
<info>{{ initialData.Runtime }}</info>
</div>
<!-- Remote Debugging Configuration -->
<div>
<div class="vscode-setting-item">
<div class="setting-header">
<label class="setting-title">Remote debugging</label>
<button
v-if="debugState.isDebugging"
class="button-theme-inline"
v-on:click="removeDebugSetup"
style="margin-left: 10px"
>
Remove Debug Setup
</button>
<info v-if="debugState.isDebugging && debugState.showDebugTimer" style="margin-left: 10px"
>Auto remove after 60 second of inactive time</info
>
</div>
<div class="setting-body">
<input
type="checkbox"
id="attachDebugger"
v-model="debugState.remoteDebuggingEnabled"
@change="debugPreCheck"
:disabled="
!initialData.runtimeSupportsRemoteDebug ||
!initialData.remoteDebugLayer ||
(!initialData.LambdaFunctionNode?.configuration.SnapStart &&
initialData.LambdaFunctionNode?.configuration.State !== 'Active')
"
class="remote-debug-checkbox"
/>
<div class="setting-description">
<info-wrap
v-if="
initialData.runtimeSupportsRemoteDebug &&
initialData.remoteDebugLayer &&
initialData.LambdaFunctionNode?.configuration.SnapStart
"
>
Remote debugging is not recommended for production environments. The AWS Toolkit modifies
your function by deploying it with an additional layer to enable remote debugging. Your
local code breakpoints are then used to step through the remote function invocation.
<a
href="https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/lambda-remote-debug.html"
>Learn more</a
>
</info-wrap>
<info
v-if="!initialData.runtimeSupportsRemoteDebug && !initialData.remoteDebugLayer"
style="color: var(--vscode-errorForeground)"
>
Runtime {{ initialData.Runtime }} and region {{ initialData.FunctionRegion }} don't support
remote debugging yet
</info>
<info
v-else-if="!initialData.runtimeSupportsRemoteDebug"
style="color: var(--vscode-errorForeground)"
>
Runtime {{ initialData.Runtime }} doesn't support remote debugging
</info>
<info v-else-if="!initialData.remoteDebugLayer" style="color: var(--vscode-errorForeground)">
Region {{ initialData.FunctionRegion }} doesn't support remote debugging yet
</info>
<info
v-else-if="
!initialData.LambdaFunctionNode?.configuration.SnapStart &&
initialData.LambdaFunctionNode?.configuration.State !== 'Active'
"
style="color: var(--vscode-errorForeground)"
>
Doesn't support remote debugging yet
</info>
</div>
</div>
</div>
<div class="vscode-setting-item" v-if="debugState.remoteDebuggingEnabled">
<div class="setting-header">
<label class="setting-title">Local root path</label>
</div>
<div class="setting-description-full">
<info-wrap v-if="debugState.handlerFileAvailable">
Your handler file has been located. You can now <b>open handler</b> to set breakpoints in this
file for debugging.
</info-wrap>
<info-wrap v-else-if="initialData.supportCodeDownload">
<b>Browse</b> to specify the absolute path to your local directory that contains the handler
file for debugging. Or <b>Download</b> the handler file from your deployed function.
</info-wrap>
<info-wrap v-else>
<b>Browse</b> to specify the absolute path to your local directory that contains the handler
file for debugging.
</info-wrap>
</div>
<div class="setting-input-group-full">
<input
type="text"
v-model="debugConfig.localRootPath"
placeholder="Enter local root path"
title="The path to your local project root directory containing the source code"
@input="openHandlerWithDelay"
class="setting-input"
/>
<button
@click="openHandler"
class="button-theme-inline"
:disabled="!debugState.handlerFileAvailable"
:title="
!debugState.handlerFileAvailable
? 'Handler file not found. Please specify the correct local root path first.'
: 'Open handler file'
"
>
Open Handler
</button>
<button @click="promptForFolderLocation" class="button-theme-inline">Browse</button>
<button
v-if="initialData.supportCodeDownload"
@click="downloadRemoteCode"
class="button-theme-inline"
>
Download
</button>
</div>
</div>
<!-- Collapsible Remote Debug Additional Configuration -->
<div class="collapsible-section" v-if="debugState.remoteDebuggingEnabled">
<div class="collapsible-header" @click="toggleCollapsible">
<span>{{ uiState.isCollapsed ? '▶' : '▼' }} Remote debug additional configuration</span>
</div>
<div class="collapsible-content" v-if="!uiState.isCollapsed">
<div class="form-row-no-align">
<label>Remote root path</label>
<div class="form-double-row">
<info style="margin-bottom: 3px"
>Specify path to code directory on remote Lambda function.</info
>
<input
type="text"
v-model="debugConfig.remoteRootPath"
placeholder="Default to /var/task, the directory of your deployed lambda code"
title="The path to the code on the remote Lambda function"
/>
</div>
</div>
<div class="form-row-no-align">
<label>Debug port</label>
<div class="form-double-row">
<info style="margin-bottom: 3px"
>Specify the network port used for the debugger connection.</info
>
<input
type="number"
v-model="debugConfig.debugPort"
@input="onDebugPortChange"
:placeholder="
initialData.isLambdaRemote
? 'Default to 9229, the debug port that will be used for remote debugging'
: 'Default to a random debug port'
"
:title="
initialData.isLambdaRemote
? 'The network port used for the debugger connection (default to 9229)'
: 'The network port used for the debugger connection (default to a random port)'
"
:class="{ 'input-error': debugPortError !== '' }"
/>
<div v-if="debugPortError" class="error-message">{{ debugPortError }}</div>
</div>
</div>
<div v-if="initialData.isLambdaRemote" class="form-row">
<label for="shouldPublishVersionCheckbox">Publish version</label>
<div style="align-items: center">
<input
type="checkbox"
style="margin-right: 5px; vertical-align: middle"
id="shouldPublishVersionCheckbox"
v-model="debugConfig.shouldPublishVersion"
/>
<info>Debug with version. If unchecked, Debug $Latest</info>
</div>
</div>
<div class="form-row">
<label>Other debug params</label>
<div class="form-double-row">
<input
type="text"
v-model="debugConfig.otherDebugParams"
placeholder='{"smartStep":true,"resolveSourceMapLocations":["out/**/*.js"]}'
title="Additional debug parameters specific to the runtime"
:class="{ 'input-error': otherDebugParamsError !== '' }"
/>
<div v-if="otherDebugParamsError" class="error-message">{{ otherDebugParamsError }}</div>
</div>
</div>
<div v-if="initialData.isLambdaRemote" class="form-row">
<label>Timeout override</label>
<div class="form-double-row">
<input
type="number"
v-model="debugConfig.lambdaTimeout"
placeholder="Default to 900 (seconds), the time you can debug before lambda timeout, "
title="Specify timeout you want for remote debugging"
:class="{ 'input-error': lambdaTimeoutError !== '' }"
/>
<div v-if="lambdaTimeoutError" class="error-message">{{ lambdaTimeoutError }}</div>
</div>
</div>
<div v-if="initialData.isLambdaRemote" class="form-row">
<label>Layer override</label>
<div class="form-double-row">
<input
type="text"
v-model="initialData.remoteDebugLayer"
placeholder="Specify debug layer you want for remote debugging"
title="Specify debug layer you want for remote debugging"
:class="{ 'input-error': lambdaLayerError !== '' }"
/>
<div v-if="lambdaLayerError" class="error-message">{{ lambdaLayerError }}</div>
</div>
</div>
<!-- Node.js/JavaScript specific fields -->
<div v-if="hasRuntimePrefix('nodejs')" class="form-row">
<label for="sourceMapCheckbox">Source map</label>
<div style="align-items: center">
<input
type="checkbox"
style="margin-right: 5px; vertical-align: middle"
id="sourceMapCheckbox"
v-model="runtimeSettings.sourceMapEnabled"
/>
<info>Enable source map support</info>
</div>
</div>
<div v-if="hasRuntimePrefix('nodejs')" class="form-row">
<label>Skip files</label>
<input
type="text"
v-model="runtimeSettings.skipFiles"
placeholder="Default to /var/runtime/node_modules/**/*.js,<node_internals>/**/*.js"
title="The files to skip debugging"
/>
</div>
<div v-if="hasRuntimePrefix('nodejs')" class="form-row">
<label>Out files</label>
<input
type="text"
v-model="runtimeSettings.outFiles"
placeholder="./dist/*,./build/*,./.aws-sam/build/<functionName>/*"
title="outFiles to parse sourceMap"
/>
</div>
<!-- Python specific fields -->
<div v-if="hasRuntimePrefix('python')" class="form-row">
<label for="justMyCodeCheckbox">Just my code</label>
<div style="align-items: center">
<input
type="checkbox"
style="margin-right: 5px; vertical-align: middle"
id="justMyCodeCheckbox"
v-model="runtimeSettings.justMyCode"
/>
<info>restricts debugging to user-written code only(ignore system lib)</info>
</div>
</div>
<!-- Java specific fields -->
<div v-if="hasRuntimePrefix('java')" class="form-row">
<label>Project name</label>
<input
type="text"
v-model="runtimeSettings.projectName"
placeholder="YourJavaProjectName"
title="The name of the Java project for debugging"
/>
</div>
</div>
</div>
</div>
<!-- Payload Section -->
<div class="vscode-setting-item">
<div class="setting-header">
<label class="setting-title">Payload</label>
</div>
<div class="setting-description-full">
<info-wrap>
Enter the JSON payload for your Lambda function invocation. You can <b>Load sample event</b> from
AWS event templates, <b>Load local file</b> from your computer
</info-wrap>
<info-wrap v-if="initialData.isLambdaRemote"
><b>Load remote event</b> from your saved test events. You can <b>Save as remote event</b> to save
the event below for future use</info-wrap
>
</div>
<div class="payload-button-group">
<button @click="loadSampleEvent" class="button-theme-inline">Load sample event</button>
<button @click="promptForFileLocation" class="button-theme-inline">Load local file</button>
<button v-if="initialData.isLambdaRemote" @click="loadRemoteTestEvents" class="button-theme-inline">
Load remote event
</button>
<button v-if="initialData.isLambdaRemote" @click="saveEvent" class="button-theme-inline">
Save as remote event
</button>
</div>
<textarea
class="payload-textarea"
:rows="textareaRows"
v-model="payloadData.sampleText"
placeholder='{"key": "value"}'
></textarea>
</div>
</div>
</template>