aboutsummaryrefslogtreecommitdiff
path: root/_www/http_target.ts
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2021-09-25 13:23:43 +0700
committerShulhan <ms@kilabit.info>2021-09-25 13:23:43 +0700
commit264cb9882e6878d1b8038de153424f69a2fc2ac4 (patch)
tree0bf21702b937633b00cec9b829d5a8c651b0aaeb /_www/http_target.ts
parent1eac43241745b46aa16fdae17945409f8cf85203 (diff)
downloadgorankusu-264cb9882e6878d1b8038de153424f69a2fc2ac4.tar.xz
_www: store the variables, headers, and parameters to local storage
When user click "Run" button on any HttpTarget or WebSocketTarget, the application will store each dynamic values of input in Target's Variables, HttpTarget/WebSocketTarget Headers and Parameters into local storage. By storing the dynamic values of form input, different users can have their own dynamic values and automatically loaded when they re-open the Trunks website again.
Diffstat (limited to '_www/http_target.ts')
-rw-r--r--_www/http_target.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/_www/http_target.ts b/_www/http_target.ts
index c3965cd..bebed15 100644
--- a/_www/http_target.ts
+++ b/_www/http_target.ts
@@ -2,7 +2,11 @@ import { WuiInputNumber, WuiInputNumberOpts } from "./wui/input/number.js"
import { WuiInputSelect, WuiInputSelectOpts } from "./wui/input/select.js"
import { WuiInputString, WuiInputStringOpts } from "./wui/input/string.js"
-import { GenerateFormInput } from "./functions.js"
+import {
+ GenerateFormInput,
+ LoadHttpTargetHeader,
+ LoadHttpTargetParam,
+} from "./functions.js"
import {
CLASS_INPUT,
CLASS_INPUT_LABEL,
@@ -221,7 +225,8 @@ export class HttpTarget {
for (let key in this.opts.Headers) {
let fi = this.opts.Headers[key]
- GenerateFormInput(wrapper, fi)
+ let val = LoadHttpTargetHeader(this.target, this.opts, key)
+ GenerateFormInput(wrapper, fi, val)
}
parent.appendChild(wrapper)
@@ -244,7 +249,8 @@ export class HttpTarget {
for (let key in this.opts.Params) {
let fi = this.opts.Params[key]
- GenerateFormInput(wrapper, fi)
+ let val = LoadHttpTargetParam(this.target, this.opts, key)
+ GenerateFormInput(wrapper, fi, val)
}
parent.appendChild(wrapper)