Skip to content
Snippets Groups Projects
Unverified Commit f69a2889 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire:
Browse files

Remove "consts" dependencies

parent 08cd88a9
No related branches found
No related tags found
No related merge requests found
Pipeline #16166 passed
...@@ -8,7 +8,6 @@ import {AuthMenuButton} from './auth-menu-button.js'; ...@@ -8,7 +8,6 @@ import {AuthMenuButton} from './auth-menu-button.js';
import {Notification} from '@dbp-toolkit/notification'; import {Notification} from '@dbp-toolkit/notification';
import * as commonStyles from '@dbp-toolkit/common/styles'; import * as commonStyles from '@dbp-toolkit/common/styles';
import * as commonUtils from '@dbp-toolkit/common/utils'; import * as commonUtils from '@dbp-toolkit/common/utils';
import buildinfo from 'consts:buildinfo';
import {classMap} from 'lit-html/directives/class-map.js'; import {classMap} from 'lit-html/directives/class-map.js';
import {Router} from './router.js'; import {Router} from './router.js';
import {BuildInfo} from './build-info.js'; import {BuildInfo} from './build-info.js';
...@@ -58,6 +57,10 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -58,6 +57,10 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
this.keycloakConfig = null; this.keycloakConfig = null;
this.noWelcomePage = false; this.noWelcomePage = false;
this.menuHeight = -1; this.menuHeight = -1;
this.gitInfo = '';
this.env = '';
this.buildUrl = '';
this.buildTime = '';
this._updateAuth = this._updateAuth.bind(this); this._updateAuth = this._updateAuth.bind(this);
this._loginStatus = 'unknown'; this._loginStatus = 'unknown';
...@@ -242,7 +245,11 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -242,7 +245,11 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
noWelcomePage: { type: Boolean, attribute: "no-welcome-page" }, noWelcomePage: { type: Boolean, attribute: "no-welcome-page" },
shellName: { type: String, attribute: "shell-name" }, shellName: { type: String, attribute: "shell-name" },
shellSubname: { type: String, attribute: "shell-subname" }, shellSubname: { type: String, attribute: "shell-subname" },
noBrand: { type: Boolean, attribute: "no-brand" } noBrand: { type: Boolean, attribute: "no-brand" },
gitInfo: { type: String, attribute: "git-info" },
buildUrl: { type: String, attribute: "build-url" },
buildTime: { type: String, attribute: "build-time" },
env: { type: String },
}); });
} }
...@@ -786,7 +793,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -786,7 +793,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
}); });
} }
const prodClassMap = classMap({hidden: buildinfo.env === 'production' || buildinfo.env === 'demo'}); const prodClassMap = classMap({hidden: this.env === 'production' || this.env === 'demo' || this.env === ''});
this.updatePageTitle(); this.updatePageTitle();
...@@ -809,7 +816,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -809,7 +816,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
return html` return html`
<slot class="${slotClassMap}"></slot> <slot class="${slotClassMap}"></slot>
<dbp-auth-keycloak lang="${this.lang}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" idp-hint="${kc.idpHint || ''}" load-person ?force-login="${kc.forceLogin}" ?try-login="${!kc.forceLogin}"></dbp-auth-keycloak> <dbp-auth-keycloak lang="${this.lang}" url="${kc.url}" realm="${kc.realm}" client-id="${kc.clientId}" silent-check-sso-redirect-uri="${kc.silentCheckSsoRedirectUri || ''}" scope="${kc.scope || ''}" idp-hint="${kc.idpHint || ''}" load-person ?force-login="${kc.forceLogin}" ?try-login="${!kc.forceLogin}"></dbp-auth-keycloak>
<dbp-matomo endpoint="${this.matomoUrl}" site-id="${this.matomoSiteId}"></dbp-matomo> <dbp-matomo endpoint="${this.matomoUrl}" site-id="${this.matomoSiteId}" git-info="${this.gitInfo}"></dbp-matomo>
<div class="${mainClassMap}"> <div class="${mainClassMap}">
<div id="main"> <div id="main">
<dbp-notification lang="${this.lang}"></dbp-notification> <dbp-notification lang="${this.lang}"></dbp-notification>
...@@ -854,7 +861,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) { ...@@ -854,7 +861,7 @@ export class AppShell extends ScopedElementsMixin(AdapterLitElement) {
<a target="_blank" rel="noopener" class="int-link-external" href="https://datenschutz.tugraz.at/erklaerung/">${i18n.t('privacy-policy')}</a> <a target="_blank" rel="noopener" class="int-link-external" href="https://datenschutz.tugraz.at/erklaerung/">${i18n.t('privacy-policy')}</a>
<a target="_blank" rel="noopener" class="int-link-external" href="${imprintUrl}">${i18n.t('imprint')}</a> <a target="_blank" rel="noopener" class="int-link-external" href="${imprintUrl}">${i18n.t('imprint')}</a>
<a rel="noopener" class="int-link-external" href="mailto:it-support@tugraz.at">${i18n.t('contact')}</a> <a rel="noopener" class="int-link-external" href="mailto:it-support@tugraz.at">${i18n.t('contact')}</a>
<dbp-build-info class="${prodClassMap}"></dbp-build-info> <dbp-build-info class="${prodClassMap}" git-info="${this.gitInfo}" env="${this.env}" build-url="${this.buildUrl}" build-time="${this.buildTime}"></dbp-build-info>
</footer> </footer>
</div> </div>
</div> </div>
......
import {html, LitElement, css} from 'lit-element'; import {html, css} from 'lit-element';
import * as commonStyles from '@dbp-toolkit/common/styles'; import * as commonStyles from '@dbp-toolkit/common/styles';
import buildinfo from 'consts:buildinfo'; import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element";
export class BuildInfo extends LitElement { export class BuildInfo extends AdapterLitElement {
constructor() { constructor() {
super(); super();
this.env = '';
this.gitInfo = '';
this.buildUrl = '';
this.buildTime = '';
}
static get properties() {
return this.getProperties({
env: { type: String },
buildUrl: { type: String, attribute: "build-url" },
buildTime: { type: String, attribute: "build-time" },
gitInfo: { type: String, attribute: "git-info" }
});
} }
static get styles() { static get styles() {
...@@ -21,13 +34,13 @@ export class BuildInfo extends LitElement { ...@@ -21,13 +34,13 @@ export class BuildInfo extends LitElement {
} }
render() { render() {
const date = new Date(buildinfo.time); const date = new Date(this.buildTime);
return html` return html`
<a href="${buildinfo.url}" style="float: right"> <a href="${this.buildUrl}" style="float: right">
<div class="tags has-addons" title="Build Time: ${date.toString()}"> <div class="tags has-addons" title="Build Time: ${date.toString()}">
<span class="tag is-light">build</span> <span class="tag is-light">build</span>
<span class="tag is-dark">${buildinfo.info} (${buildinfo.env})</span> <span class="tag is-dark">${this.gitInfo} (${this.env})</span>
</div> </div>
</a> </a>
`; `;
......
import * as Sentry from '@sentry/browser'; import * as Sentry from '@sentry/browser';
import environment from 'consts:environment';
let _isInitialized = false; let _isInitialized = false;
let _canReportEvent = false; let _canReportEvent = false;
...@@ -24,12 +23,16 @@ export function init(options) { ...@@ -24,12 +23,16 @@ export function init(options) {
if (_isInitialized) if (_isInitialized)
throw new Error("Already initialized"); throw new Error("Already initialized");
let sentryOptions = {debug: actual.debug, environment: environment}; let sentryOptions = {debug: actual.debug};
if (actual.release) { if (actual.release) {
sentryOptions['release'] = actual.release; sentryOptions['release'] = actual.release;
} }
if (actual.environment) {
sentryOptions['environment'] = actual.environment;
}
if (!sentryDSN) { if (!sentryDSN) {
if (options.debug) if (options.debug)
console.log("No sentry DSN set, sentry disabled"); console.log("No sentry DSN set, sentry disabled");
......
import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element'; import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element';
import {EventBus} from '@dbp-toolkit/common'; import {EventBus} from '@dbp-toolkit/common';
import buildInfo from 'consts:buildinfo';
function pushEvent(event) { function pushEvent(event) {
window._paq = window._paq || []; window._paq = window._paq || [];
...@@ -15,6 +14,7 @@ export class MatomoElement extends DBPLitElement { ...@@ -15,6 +14,7 @@ export class MatomoElement extends DBPLitElement {
this.siteId = -1; this.siteId = -1;
this.isRunning = false; this.isRunning = false;
this.lastEvent = []; this.lastEvent = [];
this.gitInfo = '';
} }
...@@ -22,6 +22,7 @@ export class MatomoElement extends DBPLitElement { ...@@ -22,6 +22,7 @@ export class MatomoElement extends DBPLitElement {
return { return {
endpoint: { type: String }, endpoint: { type: String },
siteId: { type: Number, attribute: 'site-id' }, siteId: { type: Number, attribute: 'site-id' },
gitInfo: { type: Number, attribute: 'git-info' },
}; };
} }
...@@ -55,7 +56,7 @@ export class MatomoElement extends DBPLitElement { ...@@ -55,7 +56,7 @@ export class MatomoElement extends DBPLitElement {
} }
console.log('add matomo...'); console.log('add matomo...');
pushEvent(['setCustomVariable', 1, "GitCommit", buildInfo.info, "visit"]); pushEvent(['setCustomVariable', 1, "GitCommit", this.gitInfo, "visit"]);
pushEvent(['enableHeartBeatTimer']); pushEvent(['enableHeartBeatTimer']);
pushEvent(['disableCookies']); pushEvent(['disableCookies']);
pushEvent(['trackPageView']); pushEvent(['trackPageView']);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment