ui rework
This commit is contained in:
@@ -0,0 +1,27 @@
|
|||||||
|
const Cluster = {
|
||||||
|
components: { ClusterAccess, ClusterCAs, GetCopy },
|
||||||
|
props: [ 'cluster', 'token', 'state' ],
|
||||||
|
template: `
|
||||||
|
<details open>
|
||||||
|
<summary>Access</summary>
|
||||||
|
<ClusterAccess :cluster="cluster" :token="token" :state="state" />
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>CAs</summary>
|
||||||
|
<ClusterCAs :cluster="cluster" :token="token" />
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>Secrets</summary>
|
||||||
|
<h4>Tokens</h4>
|
||||||
|
<section class="links">
|
||||||
|
<GetCopy v-for="n in cluster.Tokens" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/tokens/'+n" />
|
||||||
|
</section>
|
||||||
|
<h4>Passwords</h4>
|
||||||
|
<section class="links">
|
||||||
|
<GetCopy v-for="n in cluster.Passwords" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/passwords/'+n" />
|
||||||
|
</section>
|
||||||
|
</details>
|
||||||
|
`
|
||||||
|
}
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
const Cluster = {
|
|
||||||
components: { ClusterAccess, ClusterCAs, GetCopy },
|
|
||||||
props: [ 'cluster', 'token', 'state' ],
|
|
||||||
template: `
|
|
||||||
<ClusterAccess :cluster="cluster" :token="token" :state="state" />
|
|
||||||
|
|
||||||
<ClusterCAs :cluster="cluster" :token="token" />
|
|
||||||
|
|
||||||
<h3>Secrets</h3>
|
|
||||||
<h4>Tokens</h4>
|
|
||||||
<section class="links">
|
|
||||||
<GetCopy v-for="n in cluster.Tokens" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/tokens/'+n" />
|
|
||||||
</section>
|
|
||||||
<h4>Passwords</h4>
|
|
||||||
<section class="links">
|
|
||||||
<GetCopy v-for="n in cluster.Passwords" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/passwords/'+n" />
|
|
||||||
</section>
|
|
||||||
`
|
|
||||||
}
|
|
||||||
+33
-20
@@ -17,6 +17,8 @@ const ClusterAccess = {
|
|||||||
kubeUserCert: null,
|
kubeUserCert: null,
|
||||||
downloadSet: null,
|
downloadSet: null,
|
||||||
selectedAssets: {},
|
selectedAssets: {},
|
||||||
|
loading: false,
|
||||||
|
msg: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -48,36 +50,39 @@ const ClusterAccess = {
|
|||||||
methods: {
|
methods: {
|
||||||
sshCASign() {
|
sshCASign() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.loading = true; this.msg = null;
|
||||||
fetch(`/clusters/${this.cluster.Name}/ssh/user-ca/sign`, {
|
fetch(`/clusters/${this.cluster.Name}/ssh/user-ca/sign`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ ...this.sshSignReq, Validity: this.signReqValidity }),
|
body: JSON.stringify({ ...this.sshSignReq, Validity: this.signReqValidity }),
|
||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.blob().then((cert) => { this.sshUserCert = URL.createObjectURL(cert) })
|
resp.blob().then((cert) => { this.sshUserCert = URL.createObjectURL(cert); this.loading = false })
|
||||||
} else {
|
} else {
|
||||||
resp.json().then((resp) => alert('failed to sign: '+resp.message))
|
resp.json().then((resp) => { this.msg = 'failed to sign: '+resp.message; this.loading = false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => { alert('failed to sign: '+e); })
|
.catch((e) => { this.msg = 'failed to sign: '+e; this.loading = false })
|
||||||
},
|
},
|
||||||
kubeCASign() {
|
kubeCASign() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.loading = true; this.msg = null;
|
||||||
fetch(`/clusters/${this.cluster.Name}/kube/sign`, {
|
fetch(`/clusters/${this.cluster.Name}/kube/sign`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ ...this.kubeSignReq, Validity: this.signReqValidity }),
|
body: JSON.stringify({ ...this.kubeSignReq, Validity: this.signReqValidity }),
|
||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.blob().then((cert) => { this.kubeUserCert = URL.createObjectURL(cert) })
|
resp.blob().then((cert) => { this.kubeUserCert = URL.createObjectURL(cert); this.loading = false })
|
||||||
} else {
|
} else {
|
||||||
resp.json().then((resp) => alert('failed to sign: '+resp.message))
|
resp.json().then((resp) => { this.msg = 'failed to sign: '+resp.message; this.loading = false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => { alert('failed to sign: '+e); })
|
.catch((e) => { this.msg = 'failed to sign: '+e; this.loading = false })
|
||||||
},
|
},
|
||||||
generateDownloadSet() {
|
generateDownloadSet() {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
this.loading = true; this.msg = null;
|
||||||
|
|
||||||
const items = [{
|
const items = [{
|
||||||
Kind: "host",
|
Kind: "host",
|
||||||
@@ -91,18 +96,18 @@ const ClusterAccess = {
|
|||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.json().then((set) => { this.downloadSet = set })
|
resp.json().then((set) => { this.downloadSet = set; this.loading = false })
|
||||||
} else {
|
} else {
|
||||||
resp.json().then((resp) => alert('failed to generate: '+resp.message))
|
resp.json().then((resp) => { this.msg = 'failed to generate: '+resp.message; this.loading = false })
|
||||||
}
|
}
|
||||||
}).catch((e) => { alert('failed to generate: '+e) })
|
}).catch((e) => { this.msg = 'failed to generate: '+e; this.loading = false })
|
||||||
},
|
},
|
||||||
readFile(e, onload) {
|
readFile(e, onload) {
|
||||||
const file = e.target.files[0];
|
const file = e.target.files[0];
|
||||||
if (!file) { return; }
|
if (!file) { return; }
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = () => { onload(reader.result) };
|
reader.onload = () => { onload(reader.result) };
|
||||||
reader.onerror = () => { alert("error reading file"); };
|
reader.onerror = () => { this.msg = "error reading file" };
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
},
|
},
|
||||||
loadPubKey(e) {
|
loadPubKey(e) {
|
||||||
@@ -110,6 +115,14 @@ const ClusterAccess = {
|
|||||||
this.sshSignReq.PubKey = v;
|
this.sshSignReq.PubKey = v;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
copyDownloadSetUrl() {
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(window.location.origin+'/public/download-set?set='+this.downloadSet)
|
||||||
|
this.$root.toast('copied!', 'info')
|
||||||
|
} catch (e) {
|
||||||
|
this.$root.toast('copy failed', 'error')
|
||||||
|
}
|
||||||
|
},
|
||||||
loadCSR(e) {
|
loadCSR(e) {
|
||||||
this.readFile(e, (v) => {
|
this.readFile(e, (v) => {
|
||||||
this.kubeSignReq.CSR = v;
|
this.kubeSignReq.CSR = v;
|
||||||
@@ -117,8 +130,6 @@ const ClusterAccess = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<h3>Access</h3>
|
|
||||||
|
|
||||||
<p>Grant access to:
|
<p>Grant access to:
|
||||||
<label class="radio"><input type="radio" v-model="accessType" value="ssh" /> SSH</label>
|
<label class="radio"><input type="radio" v-model="accessType" value="ssh" /> SSH</label>
|
||||||
<label class="radio"><input type="radio" v-model="accessType" value="kube" /> Kubernetes</label>
|
<label class="radio"><input type="radio" v-model="accessType" value="kube" /> Kubernetes</label>
|
||||||
@@ -127,6 +138,8 @@ const ClusterAccess = {
|
|||||||
|
|
||||||
<p>Validity: <input type="text" v-model="signReqValidity"/> <small>time range, ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.</small></p>
|
<p>Validity: <input type="text" v-model="signReqValidity"/> <small>time range, ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.</small></p>
|
||||||
|
|
||||||
|
<p class="error" v-if="msg">{{ msg }} <button class="btn-close" @click="msg=null">×</button></p>
|
||||||
|
|
||||||
<div v-if="accessType == 'ssh'">
|
<div v-if="accessType == 'ssh'">
|
||||||
<h4>Grant SSH access</h4>
|
<h4>Grant SSH access</h4>
|
||||||
<p>User: <input type="text" v-model="sshSignReq.Principal"/></p>
|
<p>User: <input type="text" v-model="sshSignReq.Principal"/></p>
|
||||||
@@ -134,7 +147,7 @@ const ClusterAccess = {
|
|||||||
<span class="text-and-file"><textarea v-model="sshSignReq.PubKey" style="height:3lh"></textarea>
|
<span class="text-and-file"><textarea v-model="sshSignReq.PubKey" style="height:3lh"></textarea>
|
||||||
<input type="file" accept=".pub" @change="loadPubKey" /></span>
|
<input type="file" accept=".pub" @change="loadPubKey" /></span>
|
||||||
</p>
|
</p>
|
||||||
<p><button @click="sshCASign">Sign SSH access</button>
|
<p><button :disabled="loading" @click="sshCASign">{{ loading ? 'signing...' : 'Sign SSH access' }}</button>
|
||||||
<template v-if="sshUserCert">
|
<template v-if="sshUserCert">
|
||||||
=> <a :href="sshUserCert" download="ssh-cert.pub">Get certificate</a>
|
=> <a :href="sshUserCert" download="ssh-cert.pub">Get certificate</a>
|
||||||
</template>
|
</template>
|
||||||
@@ -149,9 +162,9 @@ const ClusterAccess = {
|
|||||||
<span class="text-and-file"><textarea v-model="kubeSignReq.CSR" style="height:7lh;"></textarea>
|
<span class="text-and-file"><textarea v-model="kubeSignReq.CSR" style="height:7lh;"></textarea>
|
||||||
<input type="file" accept=".csr" @change="loadCSR" /></span>
|
<input type="file" accept=".csr" @change="loadCSR" /></span>
|
||||||
</p>
|
</p>
|
||||||
<p><button @click="kubeCASign">Sign Kubernetes API access</button>
|
<p><button :disabled="loading" @click="kubeCASign">{{ loading ? 'signing...' : 'Sign Kubernetes API access' }}</button>
|
||||||
<template v-if="kubeUserCert">
|
<template v-if="kubeUserCert">
|
||||||
=> <a :href="kubeUserCert" download="kube-cert.pub">Get certificate</a>
|
=> <a :href="kubeUserCert" download="tls.crt">Get certificate</a>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -166,12 +179,12 @@ const ClusterAccess = {
|
|||||||
{{" "}}
|
{{" "}}
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
<p><button :disabled="selectedAssetList.length==0" @click="generateDownloadSet">Generate download set</button></p>
|
<p><button :disabled="loading || selectedAssetList.length==0" @click="generateDownloadSet">{{ loading ? 'generating...' : 'Generate download set' }}</button></p>
|
||||||
<p v-if="downloadSet" style="word-break:break-all">
|
<div v-if="downloadSet" class="term">
|
||||||
<a :href="'/public/download-set?set='+downloadSet" target="_blank">Open download set page</a>
|
<a :href="'/public/download-set?set='+downloadSet" target="_blank">/public/download-set?set={{ downloadSet }}</a>
|
||||||
<br/>
|
<br/>
|
||||||
<button @click="navigator.clipboard.writeText(window.location.origin+'/public/download-set?set='+downloadSet)">Copy URL</button>
|
<button @click="copyDownloadSetUrl">Copy URL</button>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
@@ -2,7 +2,6 @@ const ClusterCAs = {
|
|||||||
components: { GetCopy },
|
components: { GetCopy },
|
||||||
props: [ 'cluster', 'token' ],
|
props: [ 'cluster', 'token' ],
|
||||||
template: `
|
template: `
|
||||||
<h3>CAs</h3>
|
|
||||||
<table><tr><th>Name</th><th>Certificate</th><th>Signed certificates</th></tr>
|
<table><tr><th>Name</th><th>Certificate</th><th>Signed certificates</th></tr>
|
||||||
<tr v-for="ca in cluster.CAs">
|
<tr v-for="ca in cluster.CAs">
|
||||||
<td>{{ ca.Name }}</td>
|
<td>{{ ca.Name }}</td>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const Downloads = {
|
const Downloads = {
|
||||||
props: [ 'kind', 'name', 'token', 'state' ],
|
props: [ 'kind', 'name', 'token', 'state' ],
|
||||||
data() {
|
data() {
|
||||||
return { createDisabled: false, selectedAssets: {} }
|
return { createDisabled: false, selectedAssets: {}, msg: null }
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
availableAssets() {
|
availableAssets() {
|
||||||
@@ -50,11 +50,12 @@ const Downloads = {
|
|||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => resp.json())
|
}).then((resp) => resp.json())
|
||||||
.then((token) => { this.selectedAssets = {}; this.createDisabled = false })
|
.then((token) => { this.selectedAssets = {}; this.createDisabled = false })
|
||||||
.catch((e) => { alert('failed to create link'); this.createDisabled = false })
|
.catch((e) => { this.msg = 'failed to create link'; this.createDisabled = false })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<h4>Available assets</h4>
|
<h4>Available assets</h4>
|
||||||
|
<p class="error" v-if="msg">{{ msg }} <button class="btn-close" @click="msg=null">×</button></p>
|
||||||
<p class="downloads">
|
<p class="downloads">
|
||||||
<template v-for="asset in availableAssets">
|
<template v-for="asset in availableAssets">
|
||||||
<label :class="{selected: selectedAssets[asset]}"><input type="checkbox" v-model="selectedAssets[asset]" /> {{ asset }}</label>
|
<label :class="{selected: selectedAssets[asset]}"><input type="checkbox" v-model="selectedAssets[asset]" /> {{ asset }}</label>
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const GetCopy = {
|
const GetCopy = {
|
||||||
props: [ 'name', 'href', 'token' ],
|
props: [ 'name', 'href', 'token' ],
|
||||||
data() { return {showCopied: false} },
|
data() { return {showCopied: false} },
|
||||||
template: `<span class="notif"><div v-if="showCopied">copied!</div><a :href="href" @click="fetchAndSave()">{{name}}</a> <a href="#" class="copy" @click="fetchAndCopy()">🗐</a></span>`,
|
template: `<span><a :href="href" @click="fetchAndSave()">{{name}}</a> <a href="#" class="copy" @click="fetchAndCopy()">🗐</a></span>`,
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@@ -12,7 +12,7 @@ const GetCopy = {
|
|||||||
},
|
},
|
||||||
handleFetchError(e) {
|
handleFetchError(e) {
|
||||||
console.log("failed to get value:", e)
|
console.log("failed to get value:", e)
|
||||||
alert('failed to get value')
|
this.$root.toast('failed to get value', 'error')
|
||||||
},
|
},
|
||||||
fetchAndSave() {
|
fetchAndSave() {
|
||||||
this.fetch().then(resp => resp.blob()).then((value) => {
|
this.fetch().then(resp => resp.blob()).then((value) => {
|
||||||
@@ -23,9 +23,12 @@ const GetCopy = {
|
|||||||
this.fetch()
|
this.fetch()
|
||||||
.then((resp) => resp.headers.get("content-type") == "application/json" ? resp.json() : resp.text())
|
.then((resp) => resp.headers.get("content-type") == "application/json" ? resp.json() : resp.text())
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
|
try {
|
||||||
window.navigator.clipboard.writeText(value)
|
window.navigator.clipboard.writeText(value)
|
||||||
this.showCopied = true
|
this.$root.toast('copied!', 'info')
|
||||||
setTimeout(() => { this.showCopied = false }, 1000)
|
} catch (e) {
|
||||||
|
this.$root.toast('copy failed', 'error')
|
||||||
|
}
|
||||||
}).catch(this.handleFetchError)
|
}).catch(this.handleFetchError)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -21,11 +21,17 @@ createApp({
|
|||||||
uiHash: null,
|
uiHash: null,
|
||||||
watchingState: false,
|
watchingState: false,
|
||||||
state: null,
|
state: null,
|
||||||
|
toasts: [],
|
||||||
|
toastId: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.session = JSON.parse(sessionStorage.state || "{}")
|
this.session = JSON.parse(sessionStorage.state || "{}")
|
||||||
this.watchPublicState()
|
this.watchPublicState()
|
||||||
|
document.addEventListener('keydown', (e) => this.onKeydown(e))
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
document.removeEventListener('keydown', (e) => this.onKeydown(e))
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
session: {
|
session: {
|
||||||
@@ -56,13 +62,16 @@ createApp({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
views() {
|
adminViews() {
|
||||||
var views = [{type: "actions", name: "admin", title: "Admin actions"}];
|
return [{type: "actions", name: "admin", title: "Admin actions"}];
|
||||||
|
},
|
||||||
(this.state.Clusters||[]).forEach((c) => views.push({type: "cluster", name: c.Name, title: `Cluster ${c.Name}`}));
|
clusterViews() {
|
||||||
(this.state.Hosts ||[]).forEach((c) => views.push({type: "host", name: c.Name, title: `Host ${c.Name}`}));
|
return (this.state.Clusters||[]).map((c) => ({type: "cluster", name: c.Name, title: c.Name}));
|
||||||
|
},
|
||||||
return views.filter((v) => v.type != "host" || v.name.includes(this.viewFilter));
|
hostViews() {
|
||||||
|
return (this.state.Hosts||[])
|
||||||
|
.filter((h) => h.Name.includes(this.viewFilter))
|
||||||
|
.map((h) => ({type: "host", name: h.Name, title: h.Name}));
|
||||||
},
|
},
|
||||||
viewObj() {
|
viewObj() {
|
||||||
if (this.view) {
|
if (this.view) {
|
||||||
@@ -84,9 +93,32 @@ createApp({
|
|||||||
any(array) {
|
any(array) {
|
||||||
return array && array.length != 0;
|
return array && array.length != 0;
|
||||||
},
|
},
|
||||||
|
isActive(v) {
|
||||||
|
return this.view && this.view.type == v.type && this.view.name == v.name
|
||||||
|
},
|
||||||
|
onKeydown(e) {
|
||||||
|
if ((e.ctrlKey || e.metaKey) && e.key == 'k') {
|
||||||
|
e.preventDefault()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const el = document.querySelector('.sidebar input[type="search"]')
|
||||||
|
if (el) el.focus()
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.key == 'Escape') {
|
||||||
|
this.viewFilter = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
},
|
||||||
copyText(text) {
|
copyText(text) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
try {
|
||||||
window.navigator.clipboard.writeText(text)
|
window.navigator.clipboard.writeText(text)
|
||||||
|
this.toast('copied!', 'info')
|
||||||
|
} catch (e) {
|
||||||
|
this.toast('copy failed: ' + e, 'error')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setToken() {
|
setToken() {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@@ -177,16 +209,12 @@ createApp({
|
|||||||
var xhr = new XMLHttpRequest()
|
var xhr = new XMLHttpRequest()
|
||||||
|
|
||||||
xhr.responseType = 'json'
|
xhr.responseType = 'json'
|
||||||
// TODO spinner, pending action notification, or something
|
xhr.onerror = () => {}
|
||||||
xhr.onerror = () => {
|
|
||||||
// this.actionResults.splice(idx, 1, {...item, done: true, failed: true })
|
|
||||||
}
|
|
||||||
xhr.onload = (r) => {
|
xhr.onload = (r) => {
|
||||||
if (xhr.status != 200) {
|
if (xhr.status != 200) {
|
||||||
this.error = xhr.response
|
this.toast((xhr.response && xhr.response.message) || 'request failed', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// this.actionResults.splice(idx, 1, {...item, done: true, resp: xhr.responseText})
|
|
||||||
this.error = null
|
this.error = null
|
||||||
if (onload) {
|
if (onload) {
|
||||||
onload(xhr.response)
|
onload(xhr.response)
|
||||||
@@ -235,6 +263,14 @@ createApp({
|
|||||||
// TODO once-shot download link
|
// TODO once-shot download link
|
||||||
return url + '?token=' + this.session.token
|
return url + '?token=' + this.session.token
|
||||||
},
|
},
|
||||||
|
toast(message, kind) {
|
||||||
|
const id = ++this.toastId
|
||||||
|
this.toasts.push({id, message, kind: kind || 'info'})
|
||||||
|
setTimeout(() => this.dismissToast(id), 4000)
|
||||||
|
},
|
||||||
|
dismissToast(id) {
|
||||||
|
this.toasts = this.toasts.filter(t => t.id != id)
|
||||||
|
},
|
||||||
watchPublicState() {
|
watchPublicState() {
|
||||||
this.watchStream('publicState', '/public-state')
|
this.watchStream('publicState', '/public-state')
|
||||||
},
|
},
|
||||||
+2
-10
@@ -1,12 +1,7 @@
|
|||||||
|
|
||||||
.view-links > span {
|
.view-links > span {
|
||||||
display: inline-block;
|
display: block;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-right: 1ex;
|
|
||||||
margin-bottom: 1ex;
|
|
||||||
padding: 0.5ex;
|
|
||||||
border: 1pt solid;
|
|
||||||
border-radius: 1ex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,9 +10,6 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 1ex;
|
margin-right: 1ex;
|
||||||
margin-bottom: 1ex;
|
margin-bottom: 1ex;
|
||||||
padding: 0.5ex;
|
|
||||||
border: 1px solid !important;
|
|
||||||
border-radius: 1ex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +29,7 @@
|
|||||||
position:relative;
|
position:relative;
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 64em;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="file"] {
|
input[type="file"] {
|
||||||
|
|||||||
+32
-27
@@ -10,32 +10,27 @@
|
|||||||
|
|
||||||
<style>@import url('/ui/style.css');@import url('/ui/app.css');</style>
|
<style>@import url('/ui/style.css');@import url('/ui/app.css');</style>
|
||||||
<script src="/ui/jsonpatch.min-942279a1c4209cc2.js" integrity="sha384-GcPrkRS12jtrElEkbJcrZ8asvvb9s3mc+CUq9UW/8bL4L0bpkmh9M+oFnWN6qLq2"></script>
|
<script src="/ui/jsonpatch.min-942279a1c4209cc2.js" integrity="sha384-GcPrkRS12jtrElEkbJcrZ8asvvb9s3mc+CUq9UW/8bL4L0bpkmh9M+oFnWN6qLq2"></script>
|
||||||
<script src="/ui/app-e7fb26679b9aa0f2.js" defer integrity="sha384-4oRQalb7IIBcqQzfDkeCj53qYOP6dLsTwqcjnm3EiBa92oNDD3chUw38W2gEC+3p" type="module"></script>
|
<script src="/ui/app-4f0c6935250753e9.js" defer integrity="sha384-SrAfGs5pnGcgL5E78t2MszNYmdkGME9yPgtPsDg61Rljw+dfiP+rabjPnrMkWDUH" type="module"></script>
|
||||||
<script src="/ui/Downloads-25b2e1f4aeaaff61.js" integrity="sha384-MP2lefUuPRss5MQ11H5SzGp8Gmy+hPAdeEC79h4c/SDAp4qFGUjhxBtQL8rnP38U"></script>
|
<script src="/ui/Downloads-3c8cba0572aebfae.js" integrity="sha384-Pof/sPwhdqKGp7NUmYkDc0pSSyACabwLjkRRylZKHxRmiHBV3SGomPUMAWG9y7Ix"></script>
|
||||||
<script src="/ui/GetCopy-7e3c9678f9647d40.js" integrity="sha384-LzxUXylxE/t25HyTch8y2qvKcehvP2nqCo37swIBGEKZZUzHVJVQrS5UJDWNskTA"></script>
|
<script src="/ui/GetCopy-2e04b7b63750e25a.js" integrity="sha384-sNvTYXhjog3BkYL20RzrUWIG9VGyHNO8oEiP5oxL5f2WKmLj/03fdR79FgHfzlj+"></script>
|
||||||
<script src="/ui/ClusterAccess-e67af72c976d642c.js" integrity="sha384-QU0xM0hvd7tVSJ42IVfmL0u0uJbzyZBrxn1vVbOh/15Xa80JK9j9VieoACGYFjx2"></script>
|
<script src="/ui/ClusterAccess-8b4165435ba4fcac.js" integrity="sha384-C1mVnhsaxmn3Dpp1vtcBuctxxXI1Rlh+qmxicCIpNv7ukyTbB524pg0ZwhvAnfH7"></script>
|
||||||
<script src="/ui/ClusterCAs-d6eba07c367b6306.js" integrity="sha384-2zV1VzNHw7hUS6SNIqDzIczma3Ixp3G9u6BJI4MtGHK4rNYWeCOOu9kttsZzkPYC"></script>
|
<script src="/ui/ClusterCAs-4f0a381bfb0c1b88.js" integrity="sha384-QcSHKzEHNSCqyjFELXfYFAdfmIZZwJHDzPqI2prH47jHrkeomJD60rcEMLkVAO3o"></script>
|
||||||
<script src="/ui/Cluster-361bc6b76a062d88.js" integrity="sha384-msh65M8IktAuqPyO5c7GFLkRYTtN2wh5KN23SDNuC5m1gwPpuiEeY4qkr9g1bCi1"></script>
|
<script src="/ui/Cluster-34a012ee0910827c.js" integrity="sha384-Q0sXP0WFJu4gHOI/8NMOGwpJvvFDNBR3T/vDCYxCWL2szAu4+sQuwHm81Jcad/ve"></script>
|
||||||
<script src="/ui/Host-61916516a854adff.js" integrity="sha384-/wh3KrC0sb4MT7ekO2U84rswxI42WSH/0jB4dbDaaGaGhX60xTEZHFsdQAf7UgTG"></script>
|
<script src="/ui/Host-61916516a854adff.js" integrity="sha384-/wh3KrC0sb4MT7ekO2U84rswxI42WSH/0jB4dbDaaGaGhX60xTEZHFsdQAf7UgTG"></script>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<header>
|
<header>
|
||||||
<div id="logo">
|
<span id="logo"><img src="favicon.ico" /> Direktil Local Server</span>
|
||||||
<img src="favicon.ico" />
|
<span class="utils">
|
||||||
<span>Direktil Local Server</span>
|
|
||||||
</div>
|
|
||||||
<div class="utils">
|
|
||||||
<span id="login-hdr" v-if="session.token">
|
<span id="login-hdr" v-if="session.token">
|
||||||
Logged in
|
Logged in
|
||||||
<button class="link" @click="copyText(session.token)">🗐</button>
|
<button class="link" @click="copyText(session.token)">🗐</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>server <code>{{ serverVersion || '-----' }}</code></span>
|
<span>server <code>{{ serverVersion || '-----' }}</code></span>
|
||||||
<span>ui <code>{{ uiHash || '-----' }}</code></span>
|
<span>ui <code>{{ uiHash || '-----' }}</code></span>
|
||||||
|
|
||||||
<span :class="publicState ? 'green' : 'red'">🗲</span>
|
<span :class="publicState ? 'green' : 'red'">🗲</span>
|
||||||
</div>
|
</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="error" v-if="error">
|
<div class="error" v-if="error">
|
||||||
@@ -44,11 +39,13 @@
|
|||||||
<div class="message">{{ error.message }}</div>
|
<div class="message">{{ error.message }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-if="!publicState">
|
<div class="toasts"><div v-for="t in toasts" :class="'toast '+t.kind" @click="dismissToast(t.id)">{{ t.message }}</div></div>
|
||||||
<p>Not connected.</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else-if="publicState.Store.New">
|
<main class="content" v-if="!publicState">
|
||||||
|
<p>Not connected.</p>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<main class="content" v-else-if="publicState.Store.New">
|
||||||
<p>Store is new.</p>
|
<p>Store is new.</p>
|
||||||
<p>Option 1: initialize a new store</p>
|
<p>Option 1: initialize a new store</p>
|
||||||
<form @submit="unlockStore">
|
<form @submit="unlockStore">
|
||||||
@@ -62,17 +59,17 @@
|
|||||||
<input type="file" ref="storeUpload" />
|
<input type="file" ref="storeUpload" />
|
||||||
<input type="submit" value="upload" />
|
<input type="submit" value="upload" />
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</main>
|
||||||
|
|
||||||
<template v-else-if="!publicState.Store.Open">
|
<main class="content" v-else-if="!publicState.Store.Open">
|
||||||
<p>Store is not open.</p>
|
<p>Store is not open.</p>
|
||||||
<form @submit="unlockStore">
|
<form @submit="unlockStore">
|
||||||
<input type="password" name="passphrase" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
<input type="password" name="passphrase" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
||||||
<input type="submit" value="unlock" :disabled="!forms.store.pass1" />
|
<input type="submit" value="unlock" :disabled="!forms.store.pass1" />
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</main>
|
||||||
|
|
||||||
<template v-else-if="!state">
|
<main class="content" v-else-if="!state">
|
||||||
<p v-if="!session.token">Not logged in.</p>
|
<p v-if="!session.token">Not logged in.</p>
|
||||||
<p v-else>Invalid token</p>
|
<p v-else>Invalid token</p>
|
||||||
|
|
||||||
@@ -80,13 +77,20 @@
|
|||||||
<input type="password" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
<input type="password" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
||||||
<input type="submit" value="log in"/>
|
<input type="submit" value="log in"/>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</main>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div style="float:right;"><input type="search" placeholder="Filter" v-model="viewFilter"/></div>
|
<nav class="sidebar">
|
||||||
<p class="view-links"><span v-for="v in views" @click="view = v" :class="{selected: view.type==v.type && view.name==v.name}">{{v.title}}</span></p>
|
<input type="search" placeholder="Filter" v-model="viewFilter"/>
|
||||||
|
<p class="nav-section">Admin</p>
|
||||||
<h2 v-if="view">{{view.title}}</h2>
|
<p class="view-links"><button type="button" v-for="v in adminViews" @click="view = v" :class="{selected: isActive(v)}">{{v.title}}</button></p>
|
||||||
|
<p class="nav-section" v-if="clusterViews.length">Clusters</p>
|
||||||
|
<p class="view-links" v-if="clusterViews.length"><button type="button" v-for="v in clusterViews" @click="view = v" :class="{selected: isActive(v)}">{{v.title}}</button></p>
|
||||||
|
<p class="nav-section" v-if="hostViews.length">Hosts</p>
|
||||||
|
<p class="view-links" v-if="hostViews.length"><button type="button" v-for="v in hostViews" @click="view = v" :class="{selected: isActive(v)}">{{v.title}}</button></p>
|
||||||
|
</nav>
|
||||||
|
<main class="content">
|
||||||
|
<h2 v-if="view">{{ view.type == 'cluster' ? 'Cluster ' : view.type == 'host' ? 'Host ' : '' }}{{view.title}}</h2>
|
||||||
|
|
||||||
<div v-if="view.type == 'cluster'" id="clusters">
|
<div v-if="view.type == 'cluster'" id="clusters">
|
||||||
<Cluster :cluster="viewObj" :token="session.token" :state="state" />
|
<Cluster :cluster="viewObj" :token="session.token" :state="state" />
|
||||||
@@ -147,6 +151,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+358
-162
@@ -1,35 +1,231 @@
|
|||||||
:root {
|
:root {
|
||||||
--bg: #eee;
|
--bg: #000;
|
||||||
--color: black;
|
--color: #ddd;
|
||||||
--bevel-dark: darkgray;
|
--accent: #d4a017;
|
||||||
--bevel-light: lightgray;
|
--dim: #555;
|
||||||
--link: blue;
|
|
||||||
--input-bg: #ddd;
|
|
||||||
--input-text: white;
|
|
||||||
--btn-bg: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--bg: black;
|
|
||||||
--color: orange;
|
|
||||||
--bevel-dark: #402900;
|
|
||||||
--bevel-light: #805300;
|
|
||||||
--link: #31b0fa;
|
--link: #31b0fa;
|
||||||
--input-bg: #111;
|
--input-bg: #1a1a1a;
|
||||||
--input-text: #ddd;
|
--border: #333;
|
||||||
--btn-bg: #222;
|
--hover: #222;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
|
font-family: "Courier New", Courier, monospace;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
button[disabled] {
|
/* Layout */
|
||||||
opacity: 0.5;
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
#app {
|
||||||
|
display: grid;
|
||||||
|
height: 100vh;
|
||||||
|
grid-template: auto 1fr / 18em 1fr;
|
||||||
|
grid-template-areas: "h h" "s m";
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
grid-area: h;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
#logo > img {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
header .utils > * {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
grid-area: s;
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
padding: 0.5em;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.sidebar input[type="search"] {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
background: var(--input-bg);
|
||||||
|
color: var(--color);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
grid-area: m;
|
||||||
|
padding: 1em;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar nav sections */
|
||||||
|
|
||||||
|
.nav-section {
|
||||||
|
margin: 0.5em 0 0.2em;
|
||||||
|
padding: 0.2em 0.5em;
|
||||||
|
color: var(--dim);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
font-size: 0.85em;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar nav items */
|
||||||
|
|
||||||
|
.view-links {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.sidebar:focus-within .view-links > button {
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
.view-links > button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.2em 0.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: var(--dim);
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
background: none;
|
||||||
|
font: inherit;
|
||||||
|
text-align: left;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.view-links > button:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.view-links > button:hover {
|
||||||
|
background: var(--hover);
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
.view-links > button.selected {
|
||||||
|
color: var(--accent) !important;
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Headings */
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: var(--accent);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
color: var(--accent);
|
||||||
|
margin: 1em 0 0.5em;
|
||||||
|
}
|
||||||
|
h3::before {
|
||||||
|
content: "── ";
|
||||||
|
}
|
||||||
|
h3::after {
|
||||||
|
content: " ──";
|
||||||
|
}
|
||||||
|
h4 {
|
||||||
|
color: var(--color);
|
||||||
|
margin: 0.5em 0 0.3em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Details / summary (collapsible sections) */
|
||||||
|
|
||||||
|
details {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
details[open] {
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
summary {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
background: var(--hover);
|
||||||
|
color: var(--accent);
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
summary:hover {
|
||||||
|
background: #2a2a2a;
|
||||||
|
}
|
||||||
|
details[open] summary {
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tables */
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Form elements */
|
||||||
|
|
||||||
|
textarea, select, input {
|
||||||
|
background: var(--input-bg);
|
||||||
|
color: var(--color);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
textarea:focus, select:focus, input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
button, input[type=button], input[type=submit], ::file-selector-button {
|
||||||
|
background: var(--input-bg);
|
||||||
|
color: var(--color);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.7em;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
button:hover, input[type=button]:hover, input[type=submit]:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
button:active, input[type=button]:active, input[type=submit]:active {
|
||||||
|
background: var(--accent);
|
||||||
|
color: var(--bg);
|
||||||
|
}
|
||||||
|
button[disabled] {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
button[disabled]:hover {
|
||||||
|
border-color: var(--border);
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Links */
|
||||||
|
|
||||||
a[href], a[href]:visited, button.link {
|
a[href], a[href]:visited, button.link {
|
||||||
border: none;
|
border: none;
|
||||||
@@ -37,140 +233,153 @@ a[href], a[href]:visited, button.link {
|
|||||||
background: none;
|
background: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
a[href]:hover {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
/* Radio pills */
|
||||||
border-collapse: collapse;
|
|
||||||
|
label.radio {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
padding: 0.3em 0.7em;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
th, td {
|
label.radio:has(input:checked) {
|
||||||
border-left: dotted 1pt;
|
color: var(--accent);
|
||||||
border-right: dotted 1pt;
|
border-color: var(--accent);
|
||||||
border-bottom: dotted 1pt;
|
|
||||||
padding: 2pt 4pt;
|
|
||||||
}
|
}
|
||||||
tr:first-child {
|
label.radio input {
|
||||||
th, td {
|
position: absolute;
|
||||||
border-top: dotted 1pt;
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
}
|
}
|
||||||
|
label.radio:focus-within {
|
||||||
|
color: var(--accent);
|
||||||
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
th, tr:last-child > td {
|
|
||||||
border-bottom: solid 1pt;
|
/* Asset checkboxes → [x] / [ ] style */
|
||||||
|
|
||||||
|
.downloads label {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
padding: 0.2em 0;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
font-family: inherit;
|
||||||
|
border-bottom: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
.downloads label.selected {
|
||||||
|
color: var(--accent);
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
.downloads label input[type="checkbox"] {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
.downloads label:focus-within {
|
||||||
|
color: var(--accent);
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
.downloads label::before {
|
||||||
|
content: "[ ] ";
|
||||||
|
color: var(--dim);
|
||||||
|
}
|
||||||
|
.downloads label.selected::before {
|
||||||
|
content: "[x] ";
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toast notifications */
|
||||||
|
|
||||||
|
.toasts {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 1em;
|
||||||
|
right: 1em;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.3em;
|
||||||
|
}
|
||||||
|
.toast {
|
||||||
|
background: #1a1a1a;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
max-width: 30em;
|
||||||
|
animation: fadein 0.2s;
|
||||||
|
font-family: inherit;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.toast.info {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
.toast.error {
|
||||||
|
background: #100;
|
||||||
|
border-color: #c00;
|
||||||
|
color: #c00;
|
||||||
|
}
|
||||||
|
@keyframes fadein {
|
||||||
|
from { opacity: 0; transform: translateY(0.5em); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Terminal output block */
|
||||||
|
|
||||||
|
.term {
|
||||||
|
background: #000;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.5em;
|
||||||
|
word-break: break-all;
|
||||||
|
font-family: inherit;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
.term a {
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: var(--link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Misc */
|
||||||
|
|
||||||
|
.green { color: #0a0; }
|
||||||
|
.red { color: #c00; }
|
||||||
|
.copy { font-size: small; }
|
||||||
|
|
||||||
|
.links > * { margin-left: 1ex; }
|
||||||
|
.links > *:first-child { margin-left: 0; }
|
||||||
|
|
||||||
.flat > * { margin-left: 1ex; }
|
.flat > * { margin-left: 1ex; }
|
||||||
.flat > *:first-child { margin-left: 0; }
|
.flat > *:first-child { margin-left: 0; }
|
||||||
|
|
||||||
.green { color: green; }
|
|
||||||
.red { color: red; }
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.red { color: #c00; }
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea, select, input {
|
|
||||||
background: var(--input-bg);
|
|
||||||
color: var(--input-text);
|
|
||||||
border: solid 1pt;
|
|
||||||
border-color: var(--bevel-light);
|
|
||||||
border-top-color: var(--bevel-dark);
|
|
||||||
border-left-color: var(--bevel-dark);
|
|
||||||
margin: 1pt;
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
outline: solid 1pt var(--color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
button, input[type=button], input[type=submit], ::file-selector-button {
|
|
||||||
background: var(--btn-bg);
|
|
||||||
color: var(--color);
|
|
||||||
border: solid 2pt;
|
|
||||||
border-color: var(--bevel-dark);
|
|
||||||
border-top-color: var(--bevel-light);
|
|
||||||
border-left-color: var(--bevel-light);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--bevel-dark);
|
|
||||||
}
|
|
||||||
&:active {
|
|
||||||
background: var(--bevel-dark);
|
|
||||||
border-color: var(--bevel-light);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
border-bottom: 2pt solid;
|
|
||||||
margin: 0 0 1em 0;
|
|
||||||
padding: 1ex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
#logo > img {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
header .utils > * {
|
|
||||||
margin-left: 1ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
background: rgba(200,0,0,0.15);
|
||||||
background: rgba(255,0,0,0.2);
|
border: 1px solid #c00;
|
||||||
border: 1pt solid red;
|
padding: 0.5em;
|
||||||
|
margin: 0.5em 0;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.error .btn-close,
|
.error .btn-close {
|
||||||
.error .code {
|
|
||||||
background: #600;
|
background: #600;
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
|
||||||
border: none;
|
border: none;
|
||||||
align-self: stretch;
|
padding: 0.3em 0.7em;
|
||||||
padding: 1ex 1em;
|
cursor: pointer;
|
||||||
}
|
|
||||||
.error .code {
|
|
||||||
order: 1;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.error .message {
|
|
||||||
order: 2;
|
|
||||||
padding: 1ex 2em;
|
|
||||||
}
|
|
||||||
.error .btn-close {
|
|
||||||
order: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sheets {
|
|
||||||
display: flex;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
.sheets > div {
|
|
||||||
margin: 0 1ex;
|
|
||||||
border: 1pt solid;
|
|
||||||
border-radius: 6pt;
|
|
||||||
}
|
|
||||||
.sheets .title {
|
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: large;
|
|
||||||
padding: 2pt 6pt;
|
|
||||||
background: rgba(127,127,127,0.5);
|
|
||||||
}
|
|
||||||
.sheets .section {
|
|
||||||
padding: 2pt 6pt 2pt 6pt;
|
|
||||||
font-weight: bold;
|
|
||||||
border-top: 1px dotted;
|
|
||||||
}
|
|
||||||
.sheets section {
|
|
||||||
margin: 2pt 6pt 6pt 6pt;
|
|
||||||
}
|
|
||||||
.sheets > *:last-child > table:last-child > tr:last-child > td {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif {
|
.notif {
|
||||||
@@ -180,34 +389,21 @@ header .utils > * {
|
|||||||
.notif > div:first-child {
|
.notif > div:first-child {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
min-width: 100%; height: 100%;
|
min-width: 100%; height: 100%;
|
||||||
background: white;
|
background: var(--bg);
|
||||||
opacity: 75%;
|
opacity: 85%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.links > * { margin-left: 1ex; }
|
.text-and-file {
|
||||||
.links > *:first-child { margin-left: 0; }
|
position: relative;
|
||||||
|
display: block;
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.notif > div:first-child {
|
|
||||||
background: black;
|
|
||||||
}
|
}
|
||||||
|
.text-and-file textarea {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
.text-and-file input[type="file"] {
|
||||||
.copy { font-size: small; }
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
label.radio {
|
right: 0;
|
||||||
display: inline-block;
|
|
||||||
margin-right: 1ex;
|
|
||||||
margin-bottom: 1ex;
|
|
||||||
padding: 0.5ex;
|
|
||||||
border: 1pt solid;
|
|
||||||
border-radius: 1ex;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
label.radio:has(input:checked) {
|
|
||||||
color: var(--link);
|
|
||||||
}
|
|
||||||
label.radio input {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-10
@@ -1,12 +1,7 @@
|
|||||||
|
|
||||||
.view-links > span {
|
.view-links > span {
|
||||||
display: inline-block;
|
display: block;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
margin-right: 1ex;
|
|
||||||
margin-bottom: 1ex;
|
|
||||||
padding: 0.5ex;
|
|
||||||
border: 1pt solid;
|
|
||||||
border-radius: 1ex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,9 +10,6 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
margin-right: 1ex;
|
margin-right: 1ex;
|
||||||
margin-bottom: 1ex;
|
margin-bottom: 1ex;
|
||||||
padding: 0.5ex;
|
|
||||||
border: 1px solid !important;
|
|
||||||
border-radius: 1ex;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +29,7 @@
|
|||||||
position:relative;
|
position:relative;
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
width: 64em;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type="file"] {
|
input[type="file"] {
|
||||||
|
|||||||
+26
-21
@@ -21,21 +21,16 @@
|
|||||||
|
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<header>
|
<header>
|
||||||
<div id="logo">
|
<span id="logo"><img src="favicon.ico" /> Direktil Local Server</span>
|
||||||
<img src="favicon.ico" />
|
<span class="utils">
|
||||||
<span>Direktil Local Server</span>
|
|
||||||
</div>
|
|
||||||
<div class="utils">
|
|
||||||
<span id="login-hdr" v-if="session.token">
|
<span id="login-hdr" v-if="session.token">
|
||||||
Logged in
|
Logged in
|
||||||
<button class="link" @click="copyText(session.token)">🗐</button>
|
<button class="link" @click="copyText(session.token)">🗐</button>
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
<span>server <code>{{ serverVersion || '-----' }}</code></span>
|
<span>server <code>{{ serverVersion || '-----' }}</code></span>
|
||||||
<span>ui <code>{{ uiHash || '-----' }}</code></span>
|
<span>ui <code>{{ uiHash || '-----' }}</code></span>
|
||||||
|
|
||||||
<span :class="publicState ? 'green' : 'red'">🗲</span>
|
<span :class="publicState ? 'green' : 'red'">🗲</span>
|
||||||
</div>
|
</span>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<div class="error" v-if="error">
|
<div class="error" v-if="error">
|
||||||
@@ -44,11 +39,13 @@
|
|||||||
<div class="message">{{ error.message }}</div>
|
<div class="message">{{ error.message }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-if="!publicState">
|
<div class="toasts"><div v-for="t in toasts" :class="'toast '+t.kind" @click="dismissToast(t.id)">{{ t.message }}</div></div>
|
||||||
<p>Not connected.</p>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template v-else-if="publicState.Store.New">
|
<main class="content" v-if="!publicState">
|
||||||
|
<p>Not connected.</p>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<main class="content" v-else-if="publicState.Store.New">
|
||||||
<p>Store is new.</p>
|
<p>Store is new.</p>
|
||||||
<p>Option 1: initialize a new store</p>
|
<p>Option 1: initialize a new store</p>
|
||||||
<form @submit="unlockStore">
|
<form @submit="unlockStore">
|
||||||
@@ -62,17 +59,17 @@
|
|||||||
<input type="file" ref="storeUpload" />
|
<input type="file" ref="storeUpload" />
|
||||||
<input type="submit" value="upload" />
|
<input type="submit" value="upload" />
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</main>
|
||||||
|
|
||||||
<template v-else-if="!publicState.Store.Open">
|
<main class="content" v-else-if="!publicState.Store.Open">
|
||||||
<p>Store is not open.</p>
|
<p>Store is not open.</p>
|
||||||
<form @submit="unlockStore">
|
<form @submit="unlockStore">
|
||||||
<input type="password" name="passphrase" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
<input type="password" name="passphrase" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
||||||
<input type="submit" value="unlock" :disabled="!forms.store.pass1" />
|
<input type="submit" value="unlock" :disabled="!forms.store.pass1" />
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</main>
|
||||||
|
|
||||||
<template v-else-if="!state">
|
<main class="content" v-else-if="!state">
|
||||||
<p v-if="!session.token">Not logged in.</p>
|
<p v-if="!session.token">Not logged in.</p>
|
||||||
<p v-else>Invalid token</p>
|
<p v-else>Invalid token</p>
|
||||||
|
|
||||||
@@ -80,13 +77,20 @@
|
|||||||
<input type="password" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
<input type="password" v-model="forms.store.pass1" required placeholder="Passphrase" />
|
||||||
<input type="submit" value="log in"/>
|
<input type="submit" value="log in"/>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</main>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<div style="float:right;"><input type="search" placeholder="Filter" v-model="viewFilter"/></div>
|
<nav class="sidebar">
|
||||||
<p class="view-links"><span v-for="v in views" @click="view = v" :class="{selected: view.type==v.type && view.name==v.name}">{{v.title}}</span></p>
|
<input type="search" placeholder="Filter" v-model="viewFilter"/>
|
||||||
|
<p class="nav-section">Admin</p>
|
||||||
<h2 v-if="view">{{view.title}}</h2>
|
<p class="view-links"><button type="button" v-for="v in adminViews" @click="view = v" :class="{selected: isActive(v)}">{{v.title}}</button></p>
|
||||||
|
<p class="nav-section" v-if="clusterViews.length">Clusters</p>
|
||||||
|
<p class="view-links" v-if="clusterViews.length"><button type="button" v-for="v in clusterViews" @click="view = v" :class="{selected: isActive(v)}">{{v.title}}</button></p>
|
||||||
|
<p class="nav-section" v-if="hostViews.length">Hosts</p>
|
||||||
|
<p class="view-links" v-if="hostViews.length"><button type="button" v-for="v in hostViews" @click="view = v" :class="{selected: isActive(v)}">{{v.title}}</button></p>
|
||||||
|
</nav>
|
||||||
|
<main class="content">
|
||||||
|
<h2 v-if="view">{{ view.type == 'cluster' ? 'Cluster ' : view.type == 'host' ? 'Host ' : '' }}{{view.title}}</h2>
|
||||||
|
|
||||||
<div v-if="view.type == 'cluster'" id="clusters">
|
<div v-if="view.type == 'cluster'" id="clusters">
|
||||||
<Cluster :cluster="viewObj" :token="session.token" :state="state" />
|
<Cluster :cluster="viewObj" :token="session.token" :state="state" />
|
||||||
@@ -147,6 +151,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
</main>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
+9
-1
@@ -2,11 +2,18 @@ const Cluster = {
|
|||||||
components: { ClusterAccess, ClusterCAs, GetCopy },
|
components: { ClusterAccess, ClusterCAs, GetCopy },
|
||||||
props: [ 'cluster', 'token', 'state' ],
|
props: [ 'cluster', 'token', 'state' ],
|
||||||
template: `
|
template: `
|
||||||
|
<details open>
|
||||||
|
<summary>Access</summary>
|
||||||
<ClusterAccess :cluster="cluster" :token="token" :state="state" />
|
<ClusterAccess :cluster="cluster" :token="token" :state="state" />
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>CAs</summary>
|
||||||
<ClusterCAs :cluster="cluster" :token="token" />
|
<ClusterCAs :cluster="cluster" :token="token" />
|
||||||
|
</details>
|
||||||
|
|
||||||
<h3>Secrets</h3>
|
<details open>
|
||||||
|
<summary>Secrets</summary>
|
||||||
<h4>Tokens</h4>
|
<h4>Tokens</h4>
|
||||||
<section class="links">
|
<section class="links">
|
||||||
<GetCopy v-for="n in cluster.Tokens" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/tokens/'+n" />
|
<GetCopy v-for="n in cluster.Tokens" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/tokens/'+n" />
|
||||||
@@ -15,5 +22,6 @@ const Cluster = {
|
|||||||
<section class="links">
|
<section class="links">
|
||||||
<GetCopy v-for="n in cluster.Passwords" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/passwords/'+n" />
|
<GetCopy v-for="n in cluster.Passwords" :token="token" :name="n" :href="'/clusters/'+cluster.Name+'/passwords/'+n" />
|
||||||
</section>
|
</section>
|
||||||
|
</details>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
+33
-20
@@ -17,6 +17,8 @@ const ClusterAccess = {
|
|||||||
kubeUserCert: null,
|
kubeUserCert: null,
|
||||||
downloadSet: null,
|
downloadSet: null,
|
||||||
selectedAssets: {},
|
selectedAssets: {},
|
||||||
|
loading: false,
|
||||||
|
msg: null,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
@@ -48,36 +50,39 @@ const ClusterAccess = {
|
|||||||
methods: {
|
methods: {
|
||||||
sshCASign() {
|
sshCASign() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.loading = true; this.msg = null;
|
||||||
fetch(`/clusters/${this.cluster.Name}/ssh/user-ca/sign`, {
|
fetch(`/clusters/${this.cluster.Name}/ssh/user-ca/sign`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ ...this.sshSignReq, Validity: this.signReqValidity }),
|
body: JSON.stringify({ ...this.sshSignReq, Validity: this.signReqValidity }),
|
||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.blob().then((cert) => { this.sshUserCert = URL.createObjectURL(cert) })
|
resp.blob().then((cert) => { this.sshUserCert = URL.createObjectURL(cert); this.loading = false })
|
||||||
} else {
|
} else {
|
||||||
resp.json().then((resp) => alert('failed to sign: '+resp.message))
|
resp.json().then((resp) => { this.msg = 'failed to sign: '+resp.message; this.loading = false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => { alert('failed to sign: '+e); })
|
.catch((e) => { this.msg = 'failed to sign: '+e; this.loading = false })
|
||||||
},
|
},
|
||||||
kubeCASign() {
|
kubeCASign() {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
this.loading = true; this.msg = null;
|
||||||
fetch(`/clusters/${this.cluster.Name}/kube/sign`, {
|
fetch(`/clusters/${this.cluster.Name}/kube/sign`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({ ...this.kubeSignReq, Validity: this.signReqValidity }),
|
body: JSON.stringify({ ...this.kubeSignReq, Validity: this.signReqValidity }),
|
||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.blob().then((cert) => { this.kubeUserCert = URL.createObjectURL(cert) })
|
resp.blob().then((cert) => { this.kubeUserCert = URL.createObjectURL(cert); this.loading = false })
|
||||||
} else {
|
} else {
|
||||||
resp.json().then((resp) => alert('failed to sign: '+resp.message))
|
resp.json().then((resp) => { this.msg = 'failed to sign: '+resp.message; this.loading = false })
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => { alert('failed to sign: '+e); })
|
.catch((e) => { this.msg = 'failed to sign: '+e; this.loading = false })
|
||||||
},
|
},
|
||||||
generateDownloadSet() {
|
generateDownloadSet() {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
this.loading = true; this.msg = null;
|
||||||
|
|
||||||
const items = [{
|
const items = [{
|
||||||
Kind: "host",
|
Kind: "host",
|
||||||
@@ -91,18 +96,18 @@ const ClusterAccess = {
|
|||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
resp.json().then((set) => { this.downloadSet = set })
|
resp.json().then((set) => { this.downloadSet = set; this.loading = false })
|
||||||
} else {
|
} else {
|
||||||
resp.json().then((resp) => alert('failed to generate: '+resp.message))
|
resp.json().then((resp) => { this.msg = 'failed to generate: '+resp.message; this.loading = false })
|
||||||
}
|
}
|
||||||
}).catch((e) => { alert('failed to generate: '+e) })
|
}).catch((e) => { this.msg = 'failed to generate: '+e; this.loading = false })
|
||||||
},
|
},
|
||||||
readFile(e, onload) {
|
readFile(e, onload) {
|
||||||
const file = e.target.files[0];
|
const file = e.target.files[0];
|
||||||
if (!file) { return; }
|
if (!file) { return; }
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.onload = () => { onload(reader.result) };
|
reader.onload = () => { onload(reader.result) };
|
||||||
reader.onerror = () => { alert("error reading file"); };
|
reader.onerror = () => { this.msg = "error reading file" };
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
},
|
},
|
||||||
loadPubKey(e) {
|
loadPubKey(e) {
|
||||||
@@ -110,6 +115,14 @@ const ClusterAccess = {
|
|||||||
this.sshSignReq.PubKey = v;
|
this.sshSignReq.PubKey = v;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
copyDownloadSetUrl() {
|
||||||
|
try {
|
||||||
|
navigator.clipboard.writeText(window.location.origin+'/public/download-set?set='+this.downloadSet)
|
||||||
|
this.$root.toast('copied!', 'info')
|
||||||
|
} catch (e) {
|
||||||
|
this.$root.toast('copy failed', 'error')
|
||||||
|
}
|
||||||
|
},
|
||||||
loadCSR(e) {
|
loadCSR(e) {
|
||||||
this.readFile(e, (v) => {
|
this.readFile(e, (v) => {
|
||||||
this.kubeSignReq.CSR = v;
|
this.kubeSignReq.CSR = v;
|
||||||
@@ -117,8 +130,6 @@ const ClusterAccess = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<h3>Access</h3>
|
|
||||||
|
|
||||||
<p>Grant access to:
|
<p>Grant access to:
|
||||||
<label class="radio"><input type="radio" v-model="accessType" value="ssh" /> SSH</label>
|
<label class="radio"><input type="radio" v-model="accessType" value="ssh" /> SSH</label>
|
||||||
<label class="radio"><input type="radio" v-model="accessType" value="kube" /> Kubernetes</label>
|
<label class="radio"><input type="radio" v-model="accessType" value="kube" /> Kubernetes</label>
|
||||||
@@ -127,6 +138,8 @@ const ClusterAccess = {
|
|||||||
|
|
||||||
<p>Validity: <input type="text" v-model="signReqValidity"/> <small>time range, ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.</small></p>
|
<p>Validity: <input type="text" v-model="signReqValidity"/> <small>time range, ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.</small></p>
|
||||||
|
|
||||||
|
<p class="error" v-if="msg">{{ msg }} <button class="btn-close" @click="msg=null">×</button></p>
|
||||||
|
|
||||||
<div v-if="accessType == 'ssh'">
|
<div v-if="accessType == 'ssh'">
|
||||||
<h4>Grant SSH access</h4>
|
<h4>Grant SSH access</h4>
|
||||||
<p>User: <input type="text" v-model="sshSignReq.Principal"/></p>
|
<p>User: <input type="text" v-model="sshSignReq.Principal"/></p>
|
||||||
@@ -134,7 +147,7 @@ const ClusterAccess = {
|
|||||||
<span class="text-and-file"><textarea v-model="sshSignReq.PubKey" style="height:3lh"></textarea>
|
<span class="text-and-file"><textarea v-model="sshSignReq.PubKey" style="height:3lh"></textarea>
|
||||||
<input type="file" accept=".pub" @change="loadPubKey" /></span>
|
<input type="file" accept=".pub" @change="loadPubKey" /></span>
|
||||||
</p>
|
</p>
|
||||||
<p><button @click="sshCASign">Sign SSH access</button>
|
<p><button :disabled="loading" @click="sshCASign">{{ loading ? 'signing...' : 'Sign SSH access' }}</button>
|
||||||
<template v-if="sshUserCert">
|
<template v-if="sshUserCert">
|
||||||
=> <a :href="sshUserCert" download="ssh-cert.pub">Get certificate</a>
|
=> <a :href="sshUserCert" download="ssh-cert.pub">Get certificate</a>
|
||||||
</template>
|
</template>
|
||||||
@@ -149,9 +162,9 @@ const ClusterAccess = {
|
|||||||
<span class="text-and-file"><textarea v-model="kubeSignReq.CSR" style="height:7lh;"></textarea>
|
<span class="text-and-file"><textarea v-model="kubeSignReq.CSR" style="height:7lh;"></textarea>
|
||||||
<input type="file" accept=".csr" @change="loadCSR" /></span>
|
<input type="file" accept=".csr" @change="loadCSR" /></span>
|
||||||
</p>
|
</p>
|
||||||
<p><button @click="kubeCASign">Sign Kubernetes API access</button>
|
<p><button :disabled="loading" @click="kubeCASign">{{ loading ? 'signing...' : 'Sign Kubernetes API access' }}</button>
|
||||||
<template v-if="kubeUserCert">
|
<template v-if="kubeUserCert">
|
||||||
=> <a :href="kubeUserCert" download="kube-cert.pub">Get certificate</a>
|
=> <a :href="kubeUserCert" download="tls.crt">Get certificate</a>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -166,12 +179,12 @@ const ClusterAccess = {
|
|||||||
{{" "}}
|
{{" "}}
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
<p><button :disabled="selectedAssetList.length==0" @click="generateDownloadSet">Generate download set</button></p>
|
<p><button :disabled="loading || selectedAssetList.length==0" @click="generateDownloadSet">{{ loading ? 'generating...' : 'Generate download set' }}</button></p>
|
||||||
<p v-if="downloadSet" style="word-break:break-all">
|
<div v-if="downloadSet" class="term">
|
||||||
<a :href="'/public/download-set?set='+downloadSet" target="_blank">Open download set page</a>
|
<a :href="'/public/download-set?set='+downloadSet" target="_blank">/public/download-set?set={{ downloadSet }}</a>
|
||||||
<br/>
|
<br/>
|
||||||
<button @click="navigator.clipboard.writeText(window.location.origin+'/public/download-set?set='+downloadSet)">Copy URL</button>
|
<button @click="copyDownloadSetUrl">Copy URL</button>
|
||||||
</p>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ const ClusterCAs = {
|
|||||||
components: { GetCopy },
|
components: { GetCopy },
|
||||||
props: [ 'cluster', 'token' ],
|
props: [ 'cluster', 'token' ],
|
||||||
template: `
|
template: `
|
||||||
<h3>CAs</h3>
|
|
||||||
<table><tr><th>Name</th><th>Certificate</th><th>Signed certificates</th></tr>
|
<table><tr><th>Name</th><th>Certificate</th><th>Signed certificates</th></tr>
|
||||||
<tr v-for="ca in cluster.CAs">
|
<tr v-for="ca in cluster.CAs">
|
||||||
<td>{{ ca.Name }}</td>
|
<td>{{ ca.Name }}</td>
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
const ClusterDownloadSet = {
|
|
||||||
props: [ 'cluster', 'token', 'state' ],
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
signReqValidity: "1d",
|
|
||||||
downloadSet: null,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
generateDownloadSet() {
|
|
||||||
event.preventDefault()
|
|
||||||
|
|
||||||
const hosts = (this.state.Hosts||[]).filter(h => h.Cluster == this.cluster.Name)
|
|
||||||
const items = hosts.map(h => ({
|
|
||||||
Kind: "host",
|
|
||||||
Name: h.Name,
|
|
||||||
Assets: ["kernel", "initrd", "uki", "bootstrap.tar", "boot.img.gz", "boot.img", "boot.qcow2", "boot.iso", "boot.tar", "bootstrap-config", "config", "config.json", "ipxe"],
|
|
||||||
}))
|
|
||||||
|
|
||||||
fetch('/sign-download-set', {
|
|
||||||
method: 'POST',
|
|
||||||
body: JSON.stringify({Expiry: this.signReqValidity, Items: items}),
|
|
||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
|
||||||
}).then((resp) => {
|
|
||||||
if (resp.ok) {
|
|
||||||
resp.json().then((set) => { this.downloadSet = set })
|
|
||||||
} else {
|
|
||||||
resp.json().then((resp) => alert('failed to generate: '+resp.message))
|
|
||||||
}
|
|
||||||
}).catch((e) => { alert('failed to generate: '+e) })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
template: `
|
|
||||||
<h3>Download set</h3>
|
|
||||||
<p>Validity: <input type="text" v-model="signReqValidity"/> <small>time range, ie: -5m:1w, 5m, 1M, 1y, 1d-1s, etc.</small></p>
|
|
||||||
<p><button @click="generateDownloadSet">Generate download set ({{ (state.Hosts||[]).filter(h => h.Cluster == cluster.Name).length }} hosts)</button></p>
|
|
||||||
<p v-if="downloadSet" style="word-break:break-all">
|
|
||||||
<a :href="'/public/download-set?set='+downloadSet" target="_blank">Open download set page</a>
|
|
||||||
<br/>
|
|
||||||
<button @click="navigator.clipboard.writeText(window.location.origin+'/public/download-set?set='+downloadSet)">Copy URL</button>
|
|
||||||
</p>
|
|
||||||
`
|
|
||||||
}
|
|
||||||
+3
-2
@@ -1,7 +1,7 @@
|
|||||||
const Downloads = {
|
const Downloads = {
|
||||||
props: [ 'kind', 'name', 'token', 'state' ],
|
props: [ 'kind', 'name', 'token', 'state' ],
|
||||||
data() {
|
data() {
|
||||||
return { createDisabled: false, selectedAssets: {} }
|
return { createDisabled: false, selectedAssets: {}, msg: null }
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
availableAssets() {
|
availableAssets() {
|
||||||
@@ -50,11 +50,12 @@ const Downloads = {
|
|||||||
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
headers: { 'Authorization': 'Bearer ' + this.token, 'Content-Type': 'application/json' },
|
||||||
}).then((resp) => resp.json())
|
}).then((resp) => resp.json())
|
||||||
.then((token) => { this.selectedAssets = {}; this.createDisabled = false })
|
.then((token) => { this.selectedAssets = {}; this.createDisabled = false })
|
||||||
.catch((e) => { alert('failed to create link'); this.createDisabled = false })
|
.catch((e) => { this.msg = 'failed to create link'; this.createDisabled = false })
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
template: `
|
template: `
|
||||||
<h4>Available assets</h4>
|
<h4>Available assets</h4>
|
||||||
|
<p class="error" v-if="msg">{{ msg }} <button class="btn-close" @click="msg=null">×</button></p>
|
||||||
<p class="downloads">
|
<p class="downloads">
|
||||||
<template v-for="asset in availableAssets">
|
<template v-for="asset in availableAssets">
|
||||||
<label :class="{selected: selectedAssets[asset]}"><input type="checkbox" v-model="selectedAssets[asset]" /> {{ asset }}</label>
|
<label :class="{selected: selectedAssets[asset]}"><input type="checkbox" v-model="selectedAssets[asset]" /> {{ asset }}</label>
|
||||||
|
|||||||
+7
-4
@@ -1,7 +1,7 @@
|
|||||||
const GetCopy = {
|
const GetCopy = {
|
||||||
props: [ 'name', 'href', 'token' ],
|
props: [ 'name', 'href', 'token' ],
|
||||||
data() { return {showCopied: false} },
|
data() { return {showCopied: false} },
|
||||||
template: `<span class="notif"><div v-if="showCopied">copied!</div><a :href="href" @click="fetchAndSave()">{{name}}</a> <a href="#" class="copy" @click="fetchAndCopy()">🗐</a></span>`,
|
template: `<span><a :href="href" @click="fetchAndSave()">{{name}}</a> <a href="#" class="copy" @click="fetchAndCopy()">🗐</a></span>`,
|
||||||
methods: {
|
methods: {
|
||||||
fetch() {
|
fetch() {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@@ -12,7 +12,7 @@ const GetCopy = {
|
|||||||
},
|
},
|
||||||
handleFetchError(e) {
|
handleFetchError(e) {
|
||||||
console.log("failed to get value:", e)
|
console.log("failed to get value:", e)
|
||||||
alert('failed to get value')
|
this.$root.toast('failed to get value', 'error')
|
||||||
},
|
},
|
||||||
fetchAndSave() {
|
fetchAndSave() {
|
||||||
this.fetch().then(resp => resp.blob()).then((value) => {
|
this.fetch().then(resp => resp.blob()).then((value) => {
|
||||||
@@ -23,9 +23,12 @@ const GetCopy = {
|
|||||||
this.fetch()
|
this.fetch()
|
||||||
.then((resp) => resp.headers.get("content-type") == "application/json" ? resp.json() : resp.text())
|
.then((resp) => resp.headers.get("content-type") == "application/json" ? resp.json() : resp.text())
|
||||||
.then((value) => {
|
.then((value) => {
|
||||||
|
try {
|
||||||
window.navigator.clipboard.writeText(value)
|
window.navigator.clipboard.writeText(value)
|
||||||
this.showCopied = true
|
this.$root.toast('copied!', 'info')
|
||||||
setTimeout(() => { this.showCopied = false }, 1000)
|
} catch (e) {
|
||||||
|
this.$root.toast('copy failed', 'error')
|
||||||
|
}
|
||||||
}).catch(this.handleFetchError)
|
}).catch(this.handleFetchError)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+49
-13
@@ -21,11 +21,17 @@ createApp({
|
|||||||
uiHash: null,
|
uiHash: null,
|
||||||
watchingState: false,
|
watchingState: false,
|
||||||
state: null,
|
state: null,
|
||||||
|
toasts: [],
|
||||||
|
toastId: 0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.session = JSON.parse(sessionStorage.state || "{}")
|
this.session = JSON.parse(sessionStorage.state || "{}")
|
||||||
this.watchPublicState()
|
this.watchPublicState()
|
||||||
|
document.addEventListener('keydown', (e) => this.onKeydown(e))
|
||||||
|
},
|
||||||
|
unmounted() {
|
||||||
|
document.removeEventListener('keydown', (e) => this.onKeydown(e))
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
session: {
|
session: {
|
||||||
@@ -56,13 +62,16 @@ createApp({
|
|||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
views() {
|
adminViews() {
|
||||||
var views = [{type: "actions", name: "admin", title: "Admin actions"}];
|
return [{type: "actions", name: "admin", title: "Admin actions"}];
|
||||||
|
},
|
||||||
(this.state.Clusters||[]).forEach((c) => views.push({type: "cluster", name: c.Name, title: `Cluster ${c.Name}`}));
|
clusterViews() {
|
||||||
(this.state.Hosts ||[]).forEach((c) => views.push({type: "host", name: c.Name, title: `Host ${c.Name}`}));
|
return (this.state.Clusters||[]).map((c) => ({type: "cluster", name: c.Name, title: c.Name}));
|
||||||
|
},
|
||||||
return views.filter((v) => v.type != "host" || v.name.includes(this.viewFilter));
|
hostViews() {
|
||||||
|
return (this.state.Hosts||[])
|
||||||
|
.filter((h) => h.Name.includes(this.viewFilter))
|
||||||
|
.map((h) => ({type: "host", name: h.Name, title: h.Name}));
|
||||||
},
|
},
|
||||||
viewObj() {
|
viewObj() {
|
||||||
if (this.view) {
|
if (this.view) {
|
||||||
@@ -84,9 +93,32 @@ createApp({
|
|||||||
any(array) {
|
any(array) {
|
||||||
return array && array.length != 0;
|
return array && array.length != 0;
|
||||||
},
|
},
|
||||||
|
isActive(v) {
|
||||||
|
return this.view && this.view.type == v.type && this.view.name == v.name
|
||||||
|
},
|
||||||
|
onKeydown(e) {
|
||||||
|
if ((e.ctrlKey || e.metaKey) && e.key == 'k') {
|
||||||
|
e.preventDefault()
|
||||||
|
this.$nextTick(() => {
|
||||||
|
const el = document.querySelector('.sidebar input[type="search"]')
|
||||||
|
if (el) el.focus()
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e.key == 'Escape') {
|
||||||
|
this.viewFilter = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
},
|
||||||
copyText(text) {
|
copyText(text) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
try {
|
||||||
window.navigator.clipboard.writeText(text)
|
window.navigator.clipboard.writeText(text)
|
||||||
|
this.toast('copied!', 'info')
|
||||||
|
} catch (e) {
|
||||||
|
this.toast('copy failed: ' + e, 'error')
|
||||||
|
}
|
||||||
},
|
},
|
||||||
setToken() {
|
setToken() {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
@@ -177,16 +209,12 @@ createApp({
|
|||||||
var xhr = new XMLHttpRequest()
|
var xhr = new XMLHttpRequest()
|
||||||
|
|
||||||
xhr.responseType = 'json'
|
xhr.responseType = 'json'
|
||||||
// TODO spinner, pending action notification, or something
|
xhr.onerror = () => {}
|
||||||
xhr.onerror = () => {
|
|
||||||
// this.actionResults.splice(idx, 1, {...item, done: true, failed: true })
|
|
||||||
}
|
|
||||||
xhr.onload = (r) => {
|
xhr.onload = (r) => {
|
||||||
if (xhr.status != 200) {
|
if (xhr.status != 200) {
|
||||||
this.error = xhr.response
|
this.toast((xhr.response && xhr.response.message) || 'request failed', 'error')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// this.actionResults.splice(idx, 1, {...item, done: true, resp: xhr.responseText})
|
|
||||||
this.error = null
|
this.error = null
|
||||||
if (onload) {
|
if (onload) {
|
||||||
onload(xhr.response)
|
onload(xhr.response)
|
||||||
@@ -235,6 +263,14 @@ createApp({
|
|||||||
// TODO once-shot download link
|
// TODO once-shot download link
|
||||||
return url + '?token=' + this.session.token
|
return url + '?token=' + this.session.token
|
||||||
},
|
},
|
||||||
|
toast(message, kind) {
|
||||||
|
const id = ++this.toastId
|
||||||
|
this.toasts.push({id, message, kind: kind || 'info'})
|
||||||
|
setTimeout(() => this.dismissToast(id), 4000)
|
||||||
|
},
|
||||||
|
dismissToast(id) {
|
||||||
|
this.toasts = this.toasts.filter(t => t.id != id)
|
||||||
|
},
|
||||||
watchPublicState() {
|
watchPublicState() {
|
||||||
this.watchStream('publicState', '/public-state')
|
this.watchStream('publicState', '/public-state')
|
||||||
},
|
},
|
||||||
|
|||||||
+358
-162
@@ -1,35 +1,231 @@
|
|||||||
:root {
|
:root {
|
||||||
--bg: #eee;
|
--bg: #000;
|
||||||
--color: black;
|
--color: #ddd;
|
||||||
--bevel-dark: darkgray;
|
--accent: #d4a017;
|
||||||
--bevel-light: lightgray;
|
--dim: #555;
|
||||||
--link: blue;
|
|
||||||
--input-bg: #ddd;
|
|
||||||
--input-text: white;
|
|
||||||
--btn-bg: #eee;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--bg: black;
|
|
||||||
--color: orange;
|
|
||||||
--bevel-dark: #402900;
|
|
||||||
--bevel-light: #805300;
|
|
||||||
--link: #31b0fa;
|
--link: #31b0fa;
|
||||||
--input-bg: #111;
|
--input-bg: #1a1a1a;
|
||||||
--input-text: #ddd;
|
--border: #333;
|
||||||
--btn-bg: #222;
|
--hover: #222;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: var(--bg);
|
background: var(--bg);
|
||||||
color: var(--color);
|
color: var(--color);
|
||||||
|
font-family: "Courier New", Courier, monospace;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.5;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
button[disabled] {
|
/* Layout */
|
||||||
opacity: 0.5;
|
|
||||||
|
html, body {
|
||||||
|
height: 100%;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
#app {
|
||||||
|
display: grid;
|
||||||
|
height: 100vh;
|
||||||
|
grid-template: auto 1fr / 18em 1fr;
|
||||||
|
grid-template-areas: "h h" "s m";
|
||||||
|
}
|
||||||
|
header {
|
||||||
|
grid-area: h;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
#logo > img {
|
||||||
|
vertical-align: middle;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
}
|
||||||
|
header .utils > * {
|
||||||
|
margin-left: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar {
|
||||||
|
grid-area: s;
|
||||||
|
border-right: 1px solid var(--border);
|
||||||
|
padding: 0.5em;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
.sidebar input[type="search"] {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
background: var(--input-bg);
|
||||||
|
color: var(--color);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
font-family: inherit;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content {
|
||||||
|
grid-area: m;
|
||||||
|
padding: 1em;
|
||||||
|
overflow-y: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar nav sections */
|
||||||
|
|
||||||
|
.nav-section {
|
||||||
|
margin: 0.5em 0 0.2em;
|
||||||
|
padding: 0.2em 0.5em;
|
||||||
|
color: var(--dim);
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
font-size: 0.85em;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sidebar nav items */
|
||||||
|
|
||||||
|
.view-links {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.sidebar:focus-within .view-links > button {
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
.view-links > button {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.2em 0.5em;
|
||||||
|
cursor: pointer;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
color: var(--dim);
|
||||||
|
border: none;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
background: none;
|
||||||
|
font: inherit;
|
||||||
|
text-align: left;
|
||||||
|
border-radius: 0;
|
||||||
|
}
|
||||||
|
.view-links > button:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
.view-links > button:hover {
|
||||||
|
background: var(--hover);
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
.view-links > button.selected {
|
||||||
|
color: var(--accent) !important;
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Headings */
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
color: var(--accent);
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
padding-bottom: 0.3em;
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
h3 {
|
||||||
|
color: var(--accent);
|
||||||
|
margin: 1em 0 0.5em;
|
||||||
|
}
|
||||||
|
h3::before {
|
||||||
|
content: "── ";
|
||||||
|
}
|
||||||
|
h3::after {
|
||||||
|
content: " ──";
|
||||||
|
}
|
||||||
|
h4 {
|
||||||
|
color: var(--color);
|
||||||
|
margin: 0.5em 0 0.3em;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Details / summary (collapsible sections) */
|
||||||
|
|
||||||
|
details {
|
||||||
|
margin: 0.5em 0;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
details[open] {
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
summary {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
background: var(--hover);
|
||||||
|
color: var(--accent);
|
||||||
|
user-select: none;
|
||||||
|
}
|
||||||
|
summary:hover {
|
||||||
|
background: #2a2a2a;
|
||||||
|
}
|
||||||
|
details[open] summary {
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tables */
|
||||||
|
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
color: var(--accent);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Form elements */
|
||||||
|
|
||||||
|
textarea, select, input {
|
||||||
|
background: var(--input-bg);
|
||||||
|
color: var(--color);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.5em;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
textarea:focus, select:focus, input:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
button, input[type=button], input[type=submit], ::file-selector-button {
|
||||||
|
background: var(--input-bg);
|
||||||
|
color: var(--color);
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.3em 0.7em;
|
||||||
|
cursor: pointer;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
button:hover, input[type=button]:hover, input[type=submit]:hover {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
button:active, input[type=button]:active, input[type=submit]:active {
|
||||||
|
background: var(--accent);
|
||||||
|
color: var(--bg);
|
||||||
|
}
|
||||||
|
button[disabled] {
|
||||||
|
opacity: 0.4;
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
button[disabled]:hover {
|
||||||
|
border-color: var(--border);
|
||||||
|
color: var(--color);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Links */
|
||||||
|
|
||||||
a[href], a[href]:visited, button.link {
|
a[href], a[href]:visited, button.link {
|
||||||
border: none;
|
border: none;
|
||||||
@@ -37,140 +233,153 @@ a[href], a[href]:visited, button.link {
|
|||||||
background: none;
|
background: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
font-family: inherit;
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
a[href]:hover {
|
||||||
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
table {
|
/* Radio pills */
|
||||||
border-collapse: collapse;
|
|
||||||
|
label.radio {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
padding: 0.3em 0.7em;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
}
|
}
|
||||||
th, td {
|
label.radio:has(input:checked) {
|
||||||
border-left: dotted 1pt;
|
color: var(--accent);
|
||||||
border-right: dotted 1pt;
|
border-color: var(--accent);
|
||||||
border-bottom: dotted 1pt;
|
|
||||||
padding: 2pt 4pt;
|
|
||||||
}
|
}
|
||||||
tr:first-child {
|
label.radio input {
|
||||||
th, td {
|
position: absolute;
|
||||||
border-top: dotted 1pt;
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
}
|
}
|
||||||
|
label.radio:focus-within {
|
||||||
|
color: var(--accent);
|
||||||
|
border-color: var(--accent);
|
||||||
}
|
}
|
||||||
th, tr:last-child > td {
|
|
||||||
border-bottom: solid 1pt;
|
/* Asset checkboxes → [x] / [ ] style */
|
||||||
|
|
||||||
|
.downloads label {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 0.5em;
|
||||||
|
margin-bottom: 0.5em;
|
||||||
|
padding: 0.2em 0;
|
||||||
|
cursor: pointer;
|
||||||
|
user-select: none;
|
||||||
|
font-family: inherit;
|
||||||
|
border-bottom: 1px solid transparent;
|
||||||
}
|
}
|
||||||
|
.downloads label.selected {
|
||||||
|
color: var(--accent);
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
.downloads label input[type="checkbox"] {
|
||||||
|
position: absolute;
|
||||||
|
opacity: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
}
|
||||||
|
.downloads label:focus-within {
|
||||||
|
color: var(--accent);
|
||||||
|
border-bottom-color: var(--accent);
|
||||||
|
}
|
||||||
|
.downloads label::before {
|
||||||
|
content: "[ ] ";
|
||||||
|
color: var(--dim);
|
||||||
|
}
|
||||||
|
.downloads label.selected::before {
|
||||||
|
content: "[x] ";
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Toast notifications */
|
||||||
|
|
||||||
|
.toasts {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 1em;
|
||||||
|
right: 1em;
|
||||||
|
z-index: 1000;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 0.3em;
|
||||||
|
}
|
||||||
|
.toast {
|
||||||
|
background: #1a1a1a;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.5em 1em;
|
||||||
|
max-width: 30em;
|
||||||
|
animation: fadein 0.2s;
|
||||||
|
font-family: inherit;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.toast.info {
|
||||||
|
border-color: var(--accent);
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
.toast.error {
|
||||||
|
background: #100;
|
||||||
|
border-color: #c00;
|
||||||
|
color: #c00;
|
||||||
|
}
|
||||||
|
@keyframes fadein {
|
||||||
|
from { opacity: 0; transform: translateY(0.5em); }
|
||||||
|
to { opacity: 1; transform: translateY(0); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Terminal output block */
|
||||||
|
|
||||||
|
.term {
|
||||||
|
background: #000;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
padding: 0.5em;
|
||||||
|
word-break: break-all;
|
||||||
|
font-family: inherit;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
.term a {
|
||||||
|
display: block;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
color: var(--link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Misc */
|
||||||
|
|
||||||
|
.green { color: #0a0; }
|
||||||
|
.red { color: #c00; }
|
||||||
|
.copy { font-size: small; }
|
||||||
|
|
||||||
|
.links > * { margin-left: 1ex; }
|
||||||
|
.links > *:first-child { margin-left: 0; }
|
||||||
|
|
||||||
.flat > * { margin-left: 1ex; }
|
.flat > * { margin-left: 1ex; }
|
||||||
.flat > *:first-child { margin-left: 0; }
|
.flat > *:first-child { margin-left: 0; }
|
||||||
|
|
||||||
.green { color: green; }
|
|
||||||
.red { color: red; }
|
|
||||||
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.red { color: #c00; }
|
|
||||||
}
|
|
||||||
|
|
||||||
textarea, select, input {
|
|
||||||
background: var(--input-bg);
|
|
||||||
color: var(--input-text);
|
|
||||||
border: solid 1pt;
|
|
||||||
border-color: var(--bevel-light);
|
|
||||||
border-top-color: var(--bevel-dark);
|
|
||||||
border-left-color: var(--bevel-dark);
|
|
||||||
margin: 1pt;
|
|
||||||
|
|
||||||
&:focus {
|
|
||||||
outline: solid 1pt var(--color);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
button, input[type=button], input[type=submit], ::file-selector-button {
|
|
||||||
background: var(--btn-bg);
|
|
||||||
color: var(--color);
|
|
||||||
border: solid 2pt;
|
|
||||||
border-color: var(--bevel-dark);
|
|
||||||
border-top-color: var(--bevel-light);
|
|
||||||
border-left-color: var(--bevel-light);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: var(--bevel-dark);
|
|
||||||
}
|
|
||||||
&:active {
|
|
||||||
background: var(--bevel-dark);
|
|
||||||
border-color: var(--bevel-light);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
header {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
border-bottom: 2pt solid;
|
|
||||||
margin: 0 0 1em 0;
|
|
||||||
padding: 1ex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
#logo > img {
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
header .utils > * {
|
|
||||||
margin-left: 1ex;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error {
|
.error {
|
||||||
display: flex;
|
display: flex;
|
||||||
position: relative;
|
background: rgba(200,0,0,0.15);
|
||||||
background: rgba(255,0,0,0.2);
|
border: 1px solid #c00;
|
||||||
border: 1pt solid red;
|
padding: 0.5em;
|
||||||
|
margin: 0.5em 0;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.error .btn-close,
|
.error .btn-close {
|
||||||
.error .code {
|
|
||||||
background: #600;
|
background: #600;
|
||||||
color: white;
|
color: white;
|
||||||
font-weight: bold;
|
|
||||||
border: none;
|
border: none;
|
||||||
align-self: stretch;
|
padding: 0.3em 0.7em;
|
||||||
padding: 1ex 1em;
|
cursor: pointer;
|
||||||
}
|
|
||||||
.error .code {
|
|
||||||
order: 1;
|
|
||||||
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.error .message {
|
|
||||||
order: 2;
|
|
||||||
padding: 1ex 2em;
|
|
||||||
}
|
|
||||||
.error .btn-close {
|
|
||||||
order: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sheets {
|
|
||||||
display: flex;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
.sheets > div {
|
|
||||||
margin: 0 1ex;
|
|
||||||
border: 1pt solid;
|
|
||||||
border-radius: 6pt;
|
|
||||||
}
|
|
||||||
.sheets .title {
|
|
||||||
text-align: center;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: large;
|
|
||||||
padding: 2pt 6pt;
|
|
||||||
background: rgba(127,127,127,0.5);
|
|
||||||
}
|
|
||||||
.sheets .section {
|
|
||||||
padding: 2pt 6pt 2pt 6pt;
|
|
||||||
font-weight: bold;
|
|
||||||
border-top: 1px dotted;
|
|
||||||
}
|
|
||||||
.sheets section {
|
|
||||||
margin: 2pt 6pt 6pt 6pt;
|
|
||||||
}
|
|
||||||
.sheets > *:last-child > table:last-child > tr:last-child > td {
|
|
||||||
border-bottom: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.notif {
|
.notif {
|
||||||
@@ -180,34 +389,21 @@ header .utils > * {
|
|||||||
.notif > div:first-child {
|
.notif > div:first-child {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
min-width: 100%; height: 100%;
|
min-width: 100%; height: 100%;
|
||||||
background: white;
|
background: var(--bg);
|
||||||
opacity: 75%;
|
opacity: 85%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.links > * { margin-left: 1ex; }
|
.text-and-file {
|
||||||
.links > *:first-child { margin-left: 0; }
|
position: relative;
|
||||||
|
display: block;
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
.notif > div:first-child {
|
|
||||||
background: black;
|
|
||||||
}
|
}
|
||||||
|
.text-and-file textarea {
|
||||||
|
width: 100%;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
.text-and-file input[type="file"] {
|
||||||
.copy { font-size: small; }
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
label.radio {
|
right: 0;
|
||||||
display: inline-block;
|
|
||||||
margin-right: 1ex;
|
|
||||||
margin-bottom: 1ex;
|
|
||||||
padding: 0.5ex;
|
|
||||||
border: 1pt solid;
|
|
||||||
border-radius: 1ex;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
label.radio:has(input:checked) {
|
|
||||||
color: var(--link);
|
|
||||||
}
|
|
||||||
label.radio input {
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user