chore: code formatting

This commit is contained in:
Tasia Iso 2024-05-11 23:44:09 +02:00
parent 7caf4a0173
commit b6871c0b1f
Signed by: tasiaiso
SSH Key Fingerprint: SHA256:KiRjUay5C9i6objsEOIycygBHn54pDBB3Lj7fyJ0Elw
7 changed files with 60 additions and 26 deletions

View File

@ -4,8 +4,9 @@
<script> <script>
const g_data = $data; const g_data = $data;
</script> </script>
<link rel="stylesheet" href="w3.css"></link> <link rel="stylesheet" href="w3.css" />
<style> <style>
/* TODO: tell prettier to ignore this */
/* 2018 Valiant Poppy */ /* 2018 Valiant Poppy */
.w3-theme-l5 {color:#000 !important; background-color:#fbf3f3 !important} .w3-theme-l5 {color:#000 !important; background-color:#fbf3f3 !important}
.w3-theme-l4 {color:#000 !important; background-color:#f3d7d6 !important} .w3-theme-l4 {color:#000 !important; background-color:#f3d7d6 !important}

View File

@ -42,10 +42,27 @@ window.addEventListener('load', function () {
} else if (description.type === 'textarea') { } else if (description.type === 'textarea') {
return html` return html`
<li class="w3-row"> <li class="w3-row">
<label class="w3-quarter" for=${'gs_' + key} style="font-weight: bold">${key}</label> <label class="w3-quarter" for=${'gs_' + key} style="font-weight: bold"
>${key}</label
>
<div class="w3-rest w3-padding">${description.description}</div> <div class="w3-rest w3-padding">${description.description}</div>
<textarea class="w3-input" style="vertical-align: top; resize: vertical" id=${'gs_' + key}>${description.value}</textarea> <textarea
<button class="w3-button w3-right w3-quarter w3-theme-action" @click=${(e) => global_settings_set(key, e.srcElement.previousElementSibling.value)}>Set</button> class="w3-input"
style="vertical-align: top; resize: vertical"
id=${'gs_' + key}
>
${description.value}</textarea
>
<button
class="w3-button w3-right w3-quarter w3-theme-action"
@click=${(e) =>
global_settings_set(
key,
e.srcElement.previousElementSibling.value
)}
>
Set
</button>
</li> </li>
`; `;
} else { } else {
@ -61,13 +78,17 @@ window.addEventListener('load', function () {
} }
const user_template = (user, permissions) => html` const user_template = (user, permissions) => html`
<li class="w3-card w3-margin"> <li class="w3-card w3-margin">
<button class="w3-button w3-theme-action" @click=${(e) => delete_user(user)}>Delete</button> <button
class="w3-button w3-theme-action"
@click=${(e) => delete_user(user)}
>
Delete
</button>
${user}: ${permissions.map((x) => permission_template(x))} ${user}: ${permissions.map((x) => permission_template(x))}
</li> </li>
`; `;
const users_template = (users) => const users_template = (users) =>
html` html` <header class="w3-container w3-theme-l2"><h2>Users</h2></header>
<header class="w3-container w3-theme-l2"><h2>Users</h2></header>
<ul class="w3-ul"> <ul class="w3-ul">
${Object.entries(users).map((u) => user_template(u[0], u[1]))} ${Object.entries(users).map((u) => user_template(u[0], u[1]))}
</ul>`; </ul>`;

View File

@ -118,7 +118,9 @@ async function main() {
<ul class="w3-ul">` + <ul class="w3-ul">` +
ids ids
.map( .map(
(id) => `<li style="overflow: hidden; text-wrap: nowrap; text-overflow: ellipsis"> (
id
) => `<li style="overflow: hidden; text-wrap: nowrap; text-overflow: ellipsis">
<button onclick="handler.export_id(event)" data-id="${id}" class="w3-button w3-theme">Export Identity</button> <button onclick="handler.export_id(event)" data-id="${id}" class="w3-button w3-theme">Export Identity</button>
<button onclick="handler.delete_id(event)" data-id="${id}" class="w3-button w3-theme">Delete Identity</button> <button onclick="handler.delete_id(event)" data-id="${id}" class="w3-button w3-theme">Delete Identity</button>
${id} ${id}

View File

@ -358,7 +358,9 @@ class TfElement extends LitElement {
`; `;
let contents = !this.loaded let contents = !this.loaded
? this.loading ? this.loading
? html`<div class="w3-panel w3-theme-l5 w3-card-4 w3-padding-large w3-round-xlarge"> ? html`<div
class="w3-panel w3-theme-l5 w3-card-4 w3-padding-large w3-round-xlarge"
>
Loading... Loading...
</div> </div>
${this.render_tab()}` ${this.render_tab()}`

View File

@ -295,14 +295,18 @@ class TfComposeElement extends LitElement {
{ {
values: values, values: values,
selectTemplate: function (item) { selectTemplate: function (item) {
return item ? `[@${item.original.key}](${item.original.value})` : undefined; return item
? `[@${item.original.key}](${item.original.value})`
: undefined;
}, },
}, },
{ {
trigger: '&', trigger: '&',
values: this.autocomplete, values: this.autocomplete,
selectTemplate: function (item) { selectTemplate: function (item) {
return item ? `![${item.original.key}](${item.original.value})` : undefined; return item
? `![${item.original.key}](${item.original.value})`
: undefined;
}, },
}, },
], ],

View File

@ -247,9 +247,7 @@ ${JSON.stringify(mention, null, 2)}</pre
if (mentions.length) { if (mentions.length) {
let self = this; let self = this;
return html` return html`
<fieldset <fieldset style="padding: 0.5em; border: 1px solid black">
style="padding: 0.5em; border: 1px solid black"
>
<legend>Mentions</legend> <legend>Mentions</legend>
${mentions.map((x) => self.render_mention(x))} ${mentions.map((x) => self.render_mention(x))}
</fieldset> </fieldset>

View File

@ -107,9 +107,15 @@ class TfTabConnectionsElement extends LitElement {
${connection.tunnel !== undefined ${connection.tunnel !== undefined
? '🚇' ? '🚇'
: html`(${connection.host}:${connection.port})`} : html`(${connection.host}:${connection.port})`}
<div>${connection.requests.map(x => html` <div>
<span class="w3-tag w3-small">${x.request_number > 0 ? '🟩' : '🟥'} ${x.name}</span> ${connection.requests.map(
`)}</div> (x) => html`
<span class="w3-tag w3-small"
>${x.request_number > 0 ? '🟩' : '🟥'} ${x.name}</span
>
`
)}
</div>
<ul> <ul>
${this.connections ${this.connections
.filter((x) => x.tunnel === this.connections.indexOf(connection)) .filter((x) => x.tunnel === this.connections.indexOf(connection))