Skip to content
Snippets Groups Projects
build-info.js 1.36 KiB
Newer Older
import {html, css} from 'lit';
import * as commonStyles from '@dbp-toolkit/common/styles';
import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
Reiter, Christoph's avatar
Reiter, Christoph committed

export class BuildInfo extends AdapterLitElement {
Reiter, Christoph's avatar
Reiter, Christoph committed

    constructor() {
        super();
        this.env = '';
        this.gitInfo = '';
        this.buildUrl = '';
        this.buildTime = '';
    }

    static get properties() {
        return {
            ...super.properties,
            env: { type: String },
            buildUrl: { type: String, attribute: "build-url" },
            buildTime: { type: String, attribute: "build-time" },
            gitInfo: { type: String, attribute: "git-info" }
Reiter, Christoph's avatar
Reiter, Christoph committed
    }

    static get styles() {
        return css`
            ${commonStyles.getThemeCSS()}
            ${commonStyles.getGeneralCSS()}
            ${commonStyles.getTagCSS()}

            :host {
                display: inline-block;
            }
        `;
    } 

    render() {
        const date = new Date(this.buildTime);
Reiter, Christoph's avatar
Reiter, Christoph committed

        return html`
            <a href="${this.buildUrl}" style="float: right">
Reiter, Christoph's avatar
Reiter, Christoph committed
                <div class="tags has-addons" title="Build Time: ${date.toString()}">
                    <span class="tag is-light">build</span>
                    <span class="tag is-dark">${this.gitInfo} (${this.env})</span>
Reiter, Christoph's avatar
Reiter, Christoph committed
                </div>
            </a>
        `;
    }