-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Radu Matei <[email protected]>
- Loading branch information
1 parent
680fbf7
commit 3d28892
Showing
10 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,7 @@ | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" | ||
crossorigin="anonymous"> | ||
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> | ||
|
||
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> | ||
|
||
|
@@ -40,12 +39,10 @@ <h6 id="storeName"> Default</h6> | |
</table> | ||
<div class="row mb-2"> | ||
<div class="col-md-2"> | ||
<input id="keyInput" type="text" class="form-control" | ||
placeholder="Key"> | ||
<input id="keyInput" type="text" class="form-control" placeholder="Key"> | ||
</div> | ||
<div class="col-md-2"> | ||
<input id="valueInput" type="text" class="form-control" | ||
placeholder="Value"> | ||
<input id="valueInput" type="text" class="form-control" placeholder="Value"> | ||
</div> | ||
<div class="col-md-1"> | ||
<button id="add" class="btn btn-primary">Add</button> | ||
|
@@ -70,7 +67,7 @@ <h6 id="storeName"> Default</h6> | |
|
||
<script> | ||
|
||
fetch("/api/stores/default") | ||
fetch("/internal/kv-explorer/api/stores/default") | ||
.then((response) => response.json()) | ||
.then((data) => { | ||
data.keys.forEach((item) => { | ||
|
@@ -89,7 +86,7 @@ <h6 id="storeName"> Default</h6> | |
|
||
$(`#${key}View`).click(function () { | ||
var key = $(this).data("key"); | ||
fetch(`/api/stores/default/keys/${key}`).then((response) => response.json()).then((data) => { | ||
fetch(`/internal/kv-explorer/api/stores/default/keys/${key}`).then((response) => response.json()).then((data) => { | ||
let decoder = new TextDecoder(); | ||
let value = decoder.decode(new Uint8Array(data.value)); | ||
$("#valueContent").text(value); | ||
|
@@ -100,7 +97,7 @@ <h6 id="storeName"> Default</h6> | |
|
||
$(`#${key}Delete`).click(function () { | ||
var key = $(this).data("key"); | ||
fetch(`/api/stores/default/keys/${key}`, { | ||
fetch(`/internal/kv-explorer/api/stores/default/keys/${key}`, { | ||
method: 'DELETE', | ||
}) | ||
.then(() => { | ||
|
@@ -126,7 +123,7 @@ <h6 id="storeName"> Default</h6> | |
key: key, | ||
value: value | ||
}; | ||
fetch("/api/stores/default", { | ||
fetch("/internal/kv-explorer/api/stores/default", { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# Spin key/value explorer | ||
|
||
This is a simple Spin component for exploring the contents of key/value storages, which only supports the default key/value store. | ||
This is a simple Spin component for exploring the contents of key/value stores. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
spin_version = "1" | ||
name = "{{project-name}}" | ||
trigger = { type = "http", base = "/" } | ||
version = "0.1.0" | ||
|
||
[[component]] | ||
source = { url = "https://github.com/radu-matei/spin-kv-explorer/releases/download/v0.3.0/spin-http-js.wasm", digest = "sha256:c009e0d6f9e764d6628eb02515b7b029e44d53dcb49cc21a1ffed26be1db5bf3" } | ||
id = "kv-explorer" | ||
# add or remove stores you want to explore here | ||
key_value_stores = ["default"] | ||
[component.trigger] | ||
route = "/internal/kv-explorer/..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[[component]] | ||
source = { url = "https://github.com/radu-matei/spin-kv-explorer/releases/download/v0.3.0/spin-http-js.wasm", digest = "sha256:c009e0d6f9e764d6628eb02515b7b029e44d53dcb49cc21a1ffed26be1db5bf3" } | ||
id = "kv-explorer" | ||
# add or remove stores you want to explore here | ||
key_value_stores = ["default"] | ||
[component.trigger] | ||
route = "/internal/kv-explorer/..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
manifest_version = "1" | ||
id = "kv-explorer" | ||
description = "Explore the contents of Spin KV stores" | ||
trigger_type = "http" | ||
tags = ["http", "kv"] | ||
|
||
[add_component] | ||
skip_files = ["spin.toml"] | ||
[add_component.snippets] | ||
component = "component.txt" | ||
|
||
[parameters] |