-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Phillip Kruger <[email protected]>
- Loading branch information
1 parent
18ab50d
commit 699f323
Showing
3 changed files
with
27 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,46 @@ | ||
import { LitElement, html, css} from 'lit'; | ||
import { JsonRpc } from 'jsonrpc'; | ||
import '@vaadin/icon'; | ||
import '@vaadin/button'; | ||
import '@vaadin/text-field'; | ||
import '@vaadin/text-area'; | ||
import '@vaadin/form-layout'; | ||
import '@vaadin/progress-bar'; | ||
import '@vaadin/checkbox'; | ||
import { LitElement, html} from 'lit'; | ||
import '@vaadin/grid'; | ||
import 'qui-alert'; | ||
import { columnBodyRenderer } from '@vaadin/grid/lit.js'; | ||
import '@vaadin/grid/vaadin-grid-sort-column.js'; | ||
|
||
import {tools} from 'build-time-data'; | ||
|
||
|
||
export class QwcTools extends LitElement { | ||
|
||
static styles = css` | ||
.button { | ||
cursor: pointer; | ||
} | ||
.clearIcon { | ||
color: orange; | ||
} | ||
.message { | ||
padding: 15px; | ||
text-align: center; | ||
margin-left: 20%; | ||
margin-right: 20%; | ||
border: 2px solid orange; | ||
border-radius: 10px; | ||
font-size: large; | ||
} | ||
`; | ||
|
||
static properties = { | ||
"_tools": {state: true}, | ||
} | ||
|
||
connectedCallback() { | ||
super.connectedCallback(); | ||
constructor() { | ||
super(); | ||
this._tools = tools; | ||
} | ||
|
||
render() { | ||
if (this._tools) { | ||
return this._renderToolTable(); | ||
} else { | ||
return html`<span>Loading tools...</span>`; | ||
return html`<span>No tools found</span>`; | ||
} | ||
} | ||
|
||
_renderToolTable() { | ||
return html` | ||
<vaadin-grid .items="${this._tools}" class="datatable" theme="no-border"> | ||
<vaadin-grid .items="${this._tools}" theme="no-border"> | ||
<vaadin-grid-sort-column auto-width | ||
path="className" | ||
header="Class name"> | ||
</vaadin-grid-sort-column> | ||
<vaadin-grid-column auto-width | ||
header="Class name" | ||
${columnBodyRenderer(this._classNameRenderer, [])}> | ||
path="name" | ||
header="Tool name"> | ||
</vaadin-grid-column> | ||
<vaadin-grid-column auto-width | ||
header="Tool name" | ||
${columnBodyRenderer(this._nameRenderer, [])}> | ||
</vaadin-grid-column> | ||
<vaadin-grid-column auto-width | ||
header="Description" | ||
${columnBodyRenderer(this._descriptionRenderer, [])}> | ||
path="description" | ||
header="Description"> | ||
</vaadin-grid-column> | ||
</vaadin-grid>`; | ||
} | ||
|
||
_actionRenderer(tool) { | ||
return html` | ||
<vaadin-button theme="small" @click=${() => this._reset(ds)} class="button"> | ||
<vaadin-icon class="clearIcon" icon="font-awesome-solid:broom"></vaadin-icon> Reset | ||
</vaadin-button>`; | ||
} | ||
|
||
_classNameRenderer(tool) { | ||
return html`${tool.className}`; | ||
} | ||
|
||
|
||
_nameRenderer(tool) { | ||
return html`${tool.name}`; | ||
} | ||
|
||
_descriptionRenderer(tool) { | ||
return html`${tool.description}`; | ||
} | ||
|
||
} | ||
customElements.define('qwc-tools', QwcTools); |