Skip to content
Snippets Groups Projects
Commit 0d05dfa5 authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Merge branch 'master' of gitlab.tugraz.at:dbp/web-components/toolkit

parents 71e1d606 a7e66ec0
No related branches found
No related tags found
No related merge requests found
Pipeline #15172 passed
Showing
with 166 additions and 88 deletions
node_modules node_modules
demo/dist toolkit-showcase/dist
.idea .idea
yarn-error.log yarn-error.log
\ No newline at end of file
...@@ -7,7 +7,7 @@ cache: ...@@ -7,7 +7,7 @@ cache:
stages: stages:
- test - test
- publish - deploy
test: test:
stage: test stage: test
...@@ -16,11 +16,19 @@ test: ...@@ -16,11 +16,19 @@ test:
- yarn install - yarn install
- yarn run test - yarn run test
linting:
stage: test
allow_failure: true
script:
- yarn config set cache-folder "$CI_PROJECT_DIR/_yarn_cache"
- yarn install
- yarn run lint
publish: publish:
stage: publish stage: deploy
only: only:
refs: refs:
- publish - deploy
- master - master
script: script:
# https://www.npmjs.com/settings/dbp-deploy/tokens # https://www.npmjs.com/settings/dbp-deploy/tokens
...@@ -31,3 +39,45 @@ publish: ...@@ -31,3 +39,45 @@ publish:
- yarn install - yarn install
- yarn run build - yarn run build
- yarn run publish - yarn run publish
.deploy_defaults: &deploy_defaults
except:
- schedules
stage: deploy
script:
# Add ssh key
- mkdir -p ~/.ssh
- echo "${DEPLOY_KEY}" | tr -d '\r' > ~/.ssh/id_rsa
- chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa
- ssh-keyscan -t rsa "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
# Deploy
- cd toolkit-showcase
- dep deploy "${CI_ENVIRONMENT_NAME}"
- echo "Deployed to ${CI_ENVIRONMENT_URL}"
# Simple health check
- curl --max-time 10 --retry 3 --output /dev/null --silent --show-error --fail --location "${CI_ENVIRONMENT_URL}"
deploy_demo:
only:
refs:
- demo
environment:
name: demo
url: https://frontend-demo.tugraz.at/apps/demo
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
deploy_development:
only:
refs:
- master
environment:
name: development
url: https://mw-frontend-dev.tugraz.at/apps/demo
variables:
DEPLOY_HOST: mw01-dev.tugraz.at
DEPLOY_KEY: "$DEPLOY_SSH_KEY"
<<: *deploy_defaults
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", { "args": "none" }],
"semi": [2, "always"],
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param-type": 0,
"jsdoc/require-returns-description": 0
}
}
\ No newline at end of file
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
"scripts": { "scripts": {
"test": "lerna run test", "test": "lerna run test",
"build": "lerna run build", "build": "lerna run build",
"lint": "lerna run lint",
"publish": "lerna publish from-package --yes" "publish": "lerna publish from-package --yes"
}, },
"author": "", "author": "",
......
{ {
"env": { "extends": "./../../eslint.common.json"
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", { "args": "none" }],
"semi": [2, "always"],
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param-type": 0
}
} }
\ No newline at end of file
{ {
"name": "@dbp-toolkit/app-shell", "name": "@dbp-toolkit/app-shell",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/app-shell", "homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/app-shell",
"version": "0.1.4", "version": "0.1.5",
"main": "src/index.js", "main": "src/index.js",
"license": "LGPL-2.1-or-later", "license": "LGPL-2.1-or-later",
"repository": {
"type" : "git",
"url" : "https://gitlab.tugraz.at/dbp/web-components/toolkit.git",
"directory": "packages/app-shell"
},
"publishConfig": { "publishConfig": {
"registry": "https://registry.npmjs.org", "registry": "https://registry.npmjs.org",
"access": "public" "access": "public"
......
{ {
"env": { "extends": "./../../eslint.common.json"
"browser": true,
"es6": true,
"mocha": true
},
"extends": ["eslint:recommended", "plugin:jsdoc/recommended"],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", { "args": "none" }],
"semi": [2, "always"],
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-param-type": 0
}
} }
\ No newline at end of file
{ {
"name": "@dbp-toolkit/auth", "name": "@dbp-toolkit/auth",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/auth", "homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/auth",
"version": "0.1.3", "version": "0.1.4",
"main": "src/index.js", "main": "src/index.js",
"license": "LGPL-2.1-or-later", "license": "LGPL-2.1-or-later",
"repository": {
"type" : "git",
"url" : "https://gitlab.tugraz.at/dbp/web-components/toolkit.git",
"directory": "packages/auth"
},
"publishConfig": { "publishConfig": {
"registry": "https://registry.npmjs.org", "registry": "https://registry.npmjs.org",
"access": "public" "access": "public"
......
...@@ -52,6 +52,17 @@ let loginSVG = ` ...@@ -52,6 +52,17 @@ let loginSVG = `
</svg> </svg>
`; `;
let loggingInSVG = `
<svg
viewBox="0 0 100 100"
y="0px"
x="0px"
id="icon"
role="img"
version="1.1">
</svg>
`;
export class LoginButton extends ScopedElementsMixin(LitElement) { export class LoginButton extends ScopedElementsMixin(LitElement) {
constructor() { constructor() {
...@@ -77,6 +88,7 @@ export class LoginButton extends ScopedElementsMixin(LitElement) { ...@@ -77,6 +88,7 @@ export class LoginButton extends ScopedElementsMixin(LitElement) {
this._bus = new EventBus(); this._bus = new EventBus();
this._bus.subscribe('auth-update', (data) => { this._bus.subscribe('auth-update', (data) => {
console.log(data);
this._loginData = data; this._loginData = data;
}); });
} }
...@@ -153,7 +165,17 @@ export class LoginButton extends ScopedElementsMixin(LitElement) { ...@@ -153,7 +165,17 @@ export class LoginButton extends ScopedElementsMixin(LitElement) {
} }
render() { render() {
if (this._loginData.status === LoginStatus.LOGGED_IN) { if (this._loginData.status === LoginStatus.LOGGING_IN) {
// try to keep the layout the same to avoid layout shifts
return html`
<a href="#">
<div class="login-box login-button">
<div class="icon">${unsafeHTML(loggingInSVG)}</div>
<div class="label">&#8203;</div>
</div>
</a>
`;
} else if (this._loginData.status === LoginStatus.LOGGED_IN) {
return html` return html`
<a href="#" @click="${this._onLogoutClicked}"> <a href="#" @click="${this._onLogoutClicked}">
<div class="login-box login-button"> <div class="login-box login-button">
......
/vendor/**
/dist/**
/*.js
\ No newline at end of file
{
"extends": "./../../eslint.common.json"
}
\ No newline at end of file
# Check-in place select web component # Check-in place select web component
You can install this component via npm:
```bash
npm i @dbp-toolkit/check-in-place-select
```
## Usage ## Usage
```html ```html
<dbp-check-in-place-select></dbp-check-in-place-select> <dbp-check-in-place-select></dbp-check-in-place-select>
<script type="module" src="node_modules/@dbp-toolkit/check-in-place-select/dist/dbp-check-in-place-select.js"></script>
``` ```
## Attributes ## Attributes
......
...@@ -4,7 +4,11 @@ ...@@ -4,7 +4,11 @@
"version": "0.1.0", "version": "0.1.0",
"main": "src/index.js", "main": "src/index.js",
"license": "LGPL-2.1-or-later", "license": "LGPL-2.1-or-later",
"private": true, "repository": {
"type": "git",
"url": "https://gitlab.tugraz.at/dbp/web-components/toolkit.git",
"directory": "packages/check-in-place-select"
},
"publishConfig": { "publishConfig": {
"registry": "https://registry.npmjs.org", "registry": "https://registry.npmjs.org",
"access": "public" "access": "public"
...@@ -27,7 +31,9 @@ ...@@ -27,7 +31,9 @@
"rollup-plugin-copy": "^3.1.0", "rollup-plugin-copy": "^3.1.0",
"rollup-plugin-delete": "^2.0.0", "rollup-plugin-delete": "^2.0.0",
"rollup-plugin-serve": "^1.0.1", "rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^7.0.2" "rollup-plugin-terser": "^7.0.2",
"eslint": "^7.3.1",
"eslint-plugin-jsdoc": "^30.6.4"
}, },
"dependencies": { "dependencies": {
"@dbp-toolkit/auth": "^0.1.0", "@dbp-toolkit/auth": "^0.1.0",
...@@ -49,6 +55,7 @@ ...@@ -49,6 +55,7 @@
"watch": "npm run watch-local", "watch": "npm run watch-local",
"watch-local": "rollup -c --watch", "watch-local": "rollup -c --watch",
"watch-dev": "rollup -c --watch --environment BUILD:development", "watch-dev": "rollup -c --watch --environment BUILD:development",
"test": "npm run build-test && karma start --singleRun" "test": "npm run build-test && karma start --singleRun",
"lint": "eslint ."
} }
} }
import {findObjectInApiResults} from './utils.js'; import {findObjectInApiResults} from './utils.js';
import select2LangDe from './i18n/de/select2' import select2LangDe from './i18n/de/select2';
import select2LangEn from './i18n/en/select2' import select2LangEn from './i18n/en/select2';
import JSONLD from '@dbp-toolkit/common/jsonld'; import JSONLD from '@dbp-toolkit/common/jsonld';
import {css, html, LitElement} from 'lit-element'; import {css, html, LitElement} from 'lit-element';
import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import {ScopedElementsMixin} from '@open-wc/scoped-elements';
...@@ -124,6 +124,8 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(LitElement) { ...@@ -124,6 +124,8 @@ export class CheckInPlaceSelect extends ScopedElementsMixin(LitElement) {
/** /**
* Initializes the Select2 selector * Initializes the Select2 selector
*
* @param ignorePreset
*/ */
initSelect2(ignorePreset = false) { initSelect2(ignorePreset = false) {
const that = this; const that = this;
......
...@@ -6,7 +6,7 @@ import {AuthKeycloak, LoginButton} from '@dbp-toolkit/auth'; ...@@ -6,7 +6,7 @@ import {AuthKeycloak, LoginButton} from '@dbp-toolkit/auth';
import * as commonUtils from '@dbp-toolkit/common/utils'; import * as commonUtils from '@dbp-toolkit/common/utils';
import * as commonStyles from '@dbp-toolkit/common/styles'; import * as commonStyles from '@dbp-toolkit/common/styles';
class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) { export class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) {
constructor() { constructor() {
super(); super();
this.lang = 'de'; this.lang = 'de';
...@@ -15,9 +15,9 @@ class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) { ...@@ -15,9 +15,9 @@ class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) {
static get scopedElements() { static get scopedElements() {
return { return {
'dbp-auth-keycloak': AuthKeycloak,
'dbp-login-button': LoginButton, 'dbp-login-button': LoginButton,
'dbp-check-in-place-select': CheckInPlaceSelect, 'dbp-check-in-place-select': CheckInPlaceSelect,
'dbp-auth-keycloak': AuthKeycloak,
}; };
} }
...@@ -49,9 +49,11 @@ class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) { ...@@ -49,9 +49,11 @@ class CheckInPlaceSelectDemo extends ScopedElementsMixin(LitElement) {
} }
getAuthComponentHtml() { getAuthComponentHtml() {
return this.noAuth ? html`` : html` return this.noAuth ? html`<dbp-login-button lang="${this.lang}" show-image></dbp-login-button>` : html`
<div class="container"> <div class="container">
<dbp-auth-keycloak lang="${this.lang}" url="https://auth-dev.tugraz.at/auth" realm="tugraz" client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak> <dbp-auth-keycloak lang="${this.lang}" silent-check-sso-redirect-uri="/dist/silent-check-sso.html"
url="https://auth-dev.tugraz.at/auth" realm="tugraz"
client-id="auth-dev-mw-frontend-local" load-person try-login></dbp-auth-keycloak>
<dbp-login-button lang="${this.lang}" show-image></dbp-login-button> <dbp-login-button lang="${this.lang}" show-image></dbp-login-button>
</div> </div>
`; `;
......
...@@ -43,4 +43,4 @@ export default function () { ...@@ -43,4 +43,4 @@ export default function () {
return 'Entferne alle Gegenstände'; return 'Entferne alle Gegenstände';
} }
}; };
}; }
...@@ -47,4 +47,4 @@ export default function () { ...@@ -47,4 +47,4 @@ export default function () {
return 'Remove all items'; return 'Remove all items';
} }
}; };
}; }
{ {
"env": { "extends": "./../../eslint.common.json"
"browser": true,
"es6": true,
"mocha": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"rules": {
"no-unused-vars": ["error", { "args": "none" }],
"semi": [2, "always"],
"jsdoc/require-jsdoc": 0,
"jsdoc/require-param-description": 0,
"jsdoc/require-returns": 0,
"jsdoc/require-returns-description": 0,
"jsdoc/require-param-type": 0
}
} }
\ No newline at end of file
# Common Code # Common Code
You can install these components via npm:
```bash
npm i @dbp-toolkit/common
```
## Icon Web Component ## Icon Web Component
For valid icon names see: [LineIcons](https://lineicons.com/icons/) For valid icon names see: [LineIcons](https://lineicons.com/icons/)
......
{ {
"name": "@dbp-toolkit/common", "name": "@dbp-toolkit/common",
"homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/common", "homepage": "https://gitlab.tugraz.at/dbp/web-components/toolkit/-/tree/master/packages/common",
"version": "0.1.0", "version": "0.1.2",
"module": "index.js", "module": "index.js",
"license": "LGPL-2.1-or-later", "license": "LGPL-2.1-or-later",
"repository": {
"type" : "git",
"url" : "https://gitlab.tugraz.at/dbp/web-components/toolkit.git",
"directory": "packages/common"
},
"devDependencies": { "devDependencies": {
"@rollup/plugin-commonjs": "^16.0.0", "@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment