forked from starlight-go/starlight
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request starlight-go#12 from awans/rpc
RPC, Updates, Starlark improvements
- Loading branch information
Showing
48 changed files
with
1,633 additions
and
254 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
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,70 @@ | ||
<script> | ||
export let params; | ||
import client from '../../data/client.js'; | ||
import {Runtime} from '../../data/enums.js'; | ||
import { breadcrumbStore } from '../stores.js'; | ||
import {cap} from '../util.js'; | ||
import { getContext } from 'svelte' | ||
import HLRowButton from '../../ui/HLRowButton.svelte'; | ||
import HLTable from '../../ui/HLTable.svelte'; | ||
import HLCodeMirror from '../../ui/HLCodeMirror.svelte'; | ||
import HLButton from '../../ui/HLButton.svelte'; | ||
import HLRow from '../../ui/HLRow.svelte'; | ||
import HLTextBig from '../../ui/HLTextBig.svelte'; | ||
import HLSelect from '../../ui/HLSelect.svelte'; | ||
let id = params.id; | ||
let load = client.rpc.findOne({where: {id: id}, include: {code: true}}); | ||
var cm; | ||
var name = "code"; | ||
var code = ""; | ||
load.then(obj => { | ||
breadcrumbStore.set( | ||
[{ | ||
href: "/rpcs", | ||
text: "RPCs", | ||
}, { | ||
href: "/rpc/" + id, | ||
text: cap(obj.name), | ||
}] | ||
); | ||
code = obj.code.code; | ||
}); | ||
function setUpCM() { | ||
cm = getContext(name); | ||
cm.setValue(code); | ||
cm.setOption("readOnly", true); | ||
} | ||
</script> | ||
|
||
<style> | ||
.box { | ||
margin: 1em 1.5em; | ||
} | ||
h1 { | ||
font-size: var(--scale-3); | ||
font-weight: 600; | ||
} | ||
h2 { | ||
font-size: var(--scale--1); | ||
font-weight: 500; | ||
line-height: 1; | ||
} | ||
</style> | ||
|
||
<div class="box"> | ||
{#await load} | ||
| ||
{:then rpc} | ||
<h1>{cap(rpc.name)}</h1> | ||
<HLTable> | ||
<h2>Runtime: {Runtime[rpc.code.runtime]}</h2> | ||
</HLTable> | ||
<HLCodeMirror name={name} on:initialized={setUpCM}></HLCodeMirror> | ||
{:catch error} | ||
<div>Error..</div> | ||
{/await} | ||
</div> | ||
|
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,68 @@ | ||
<script> | ||
import client from '../../data/client.js'; | ||
import {Runtime} from '../../data/enums.js'; | ||
import {cap} from '../util.js'; | ||
let load = client.rpc.findMany({ include: { | ||
code: true, | ||
} | ||
}); | ||
import { breadcrumbStore } from '../stores.js'; | ||
breadcrumbStore.set( | ||
[{ | ||
href: "/rpcs", | ||
text: "RPCs", | ||
}] | ||
); | ||
</script> | ||
|
||
<style> | ||
.box { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
} | ||
.stuff { | ||
} | ||
a.object-box { | ||
display: flex; | ||
flex-direction: column; | ||
color: inherit; | ||
width: 150px; | ||
padding: 1em 1.5em; | ||
} | ||
a.object-box:hover { | ||
background: var(--background-highlight); | ||
} | ||
.spacer { | ||
width: 0; | ||
} | ||
.obj-title{ | ||
font-weight: 600; | ||
} | ||
</style> | ||
|
||
<div class="box"> | ||
{#await load} | ||
| ||
{:then rpcs} | ||
{#each rpcs as rpc} | ||
<a href="/rpc/{rpc.id}" class="object-box"> | ||
<div class="obj-title">{cap(rpc.name)}</div> | ||
<div>{Runtime[rpc.code.runtime]}</div> | ||
</a> | ||
<div class="spacer"/> | ||
{/each} | ||
<a href="/rpcs/new" class="object-box"> | ||
<div>+ Add</div> | ||
</a> | ||
<div class="spacer"/> | ||
{:catch error} | ||
<div>Error..</div> | ||
{/await} | ||
</div> |
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,79 @@ | ||
<script> | ||
import client from '../../data/client.js'; | ||
import {restrictToIdent} from '../util.js'; | ||
import { breadcrumbStore } from '../stores.js'; | ||
import { getContext } from 'svelte' | ||
import { Storage } from '../../data/enums.js'; | ||
import HLButton from '../../ui/HLButton.svelte'; | ||
import HLRowButton from '../../ui/HLRowButton.svelte'; | ||
import HLRow from '../../ui/HLRow.svelte'; | ||
import HLTextBig from '../../ui/HLTextBig.svelte'; | ||
import HLSelect from '../../ui/HLSelect.svelte'; | ||
import HLTable from '../../ui/HLTable.svelte'; | ||
import HLCodeMirror from '../../ui/HLCodeMirror.svelte'; | ||
breadcrumbStore.set( | ||
[{ | ||
href: "/rpcs", | ||
text: "RPCs", | ||
}, { | ||
href: "/rpcs/new", | ||
text: "New", | ||
}] | ||
); | ||
const newRPCOp = { | ||
name: "", | ||
code : { | ||
create : { | ||
name : "", | ||
runtime: 2, | ||
code: "", | ||
functionSignature: 1, | ||
} | ||
} | ||
} | ||
var cm; | ||
var name = "code"; | ||
function setUpCM() { | ||
cm = getContext(name); | ||
cm.setCursor({line: 0, ch: 0}); | ||
cm.focus(); | ||
}; | ||
import {router} from '../router.js'; | ||
async function saveRPC() { | ||
newRPCOp.code.create.name = newRPCOp.name; | ||
newRPCOp.code.create.code = cm.getValue(); | ||
const d = await client.rpc.create({data: newRPCOp}); | ||
router.route("/rpcs"); | ||
} | ||
</script> | ||
|
||
<style> | ||
.box { | ||
margin: 1em 1.5em; | ||
} | ||
h1 { | ||
font-size: var(--scale-3); | ||
font-weight: 600; | ||
} | ||
h2 { | ||
font-size: var(--scale--1); | ||
font-weight: 500; | ||
line-height: 1; | ||
} | ||
.v-space{ | ||
height: .5em; | ||
} | ||
</style> | ||
|
||
<div class="box"> | ||
<HLTextBig placeholder="Name" bind:value={newRPCOp.name} restrict={restrictToIdent}/> | ||
<h2>RPC</h2> | ||
<HLCodeMirror name={name} on:initialized={setUpCM}></HLCodeMirror> | ||
<HLRowButton on:click={saveRPC}> | ||
Save | ||
</HLRowButton> | ||
</div> |
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
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
Oops, something went wrong.