-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rename supportSiteUrl to helpSiteUrl and change helpSiteUrl of acme
- Loading branch information
1 parent
11cc672
commit b474c70
Showing
15 changed files
with
155 additions
and
36 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
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,30 +1,23 @@ | ||
|
||
# show actions from entity manager | ||
#spring.jpa.show-sql=true | ||
#spring.jpa.properties.hibernate.format_sql=true | ||
|
||
# debug options | ||
logging.level.ch.puzzle.okr=DEBUG | ||
logging.level.org.springframework.security=DEBUG | ||
logging.level.org.flywaydb.core=DEBUG | ||
# logging.level.org.springframework.boot.autoconfigure: DEBUG | ||
|
||
# flyway fill database with data | ||
spring.flyway.locations=classpath:db/h2-db/database-h2-schema,classpath:db/h2-db/data-test-h2 | ||
|
||
# TENANT Configuration | ||
okr.tenant-ids=pitc,acme | ||
okr.datasource.driver-class-name=org.h2.Driver | ||
|
||
# security | ||
connect.src=http://localhost:8544 http://localhost:8545 | ||
|
||
# hibernate | ||
hibernate.connection.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1; | ||
hibernate.connection.username=user | ||
hibernate.connection.password=sa | ||
hibernate.multiTenancy=SCHEMA | ||
|
||
# pitc | ||
okr.tenants.pitc.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS okr_pitc | ||
okr.tenants.pitc.datasource.username=user | ||
|
@@ -34,7 +27,6 @@ [email protected],[email protected] | |
okr.tenants.pitc.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8544/realms/pitc/protocol/openid-connect/certs | ||
okr.tenants.pitc.security.oauth2.frontend.issuer-url=http://localhost:8544/realms/pitc | ||
okr.tenants.pitc.security.oauth2.frontend.client-id=pitc_okr_staging | ||
|
||
# acme | ||
okr.tenants.acme.datasource.url=jdbc:h2:mem:db;DB_CLOSE_DELAY=-1;INIT=CREATE SCHEMA IF NOT EXISTS okr_acme | ||
okr.tenants.acme.datasource.username=user | ||
|
@@ -44,22 +36,19 @@ [email protected],[email protected] | |
okr.tenants.acme.security.oauth2.resourceserver.jwt.jwk-set-uri=http://localhost:8544/realms/pitc/protocol/openid-connect/certs | ||
okr.tenants.acme.security.oauth2.frontend.issuer-url=http://localhost:8544/realms/pitc | ||
okr.tenants.acme.security.oauth2.frontend.client-id=acme_okr_staging | ||
|
||
# pit client customization | ||
okr.tenants.pitc.clientcustomization.logo=assets/images/okr-logo.svg | ||
okr.tenants.pitc.clientcustomization.triangles=assets/images/triangles-okr-header.svg | ||
okr.tenants.pitc.clientcustomization.background-logo=assets/images/puzzle-p.svg | ||
okr.tenants.pitc.clientcustomization.favicon=assets/favicon.png | ||
okr.tenants.pitc.clientcustomization.title=Puzzle OKR | ||
okr.tenants.pitc.clientcustomization.supportSiteUrl=https://wiki.puzzle.ch/Puzzle/OKRs | ||
|
||
okr.tenants.pitc.clientcustomization.helpSiteUrl=https://wiki.puzzle.ch/Puzzle/OKRs | ||
okr.tenants.pitc.clientcustomization.customstyles.okr-topbar-background-color=#1e5a96 | ||
|
||
# acme client customization | ||
okr.tenants.acme.clientcustomization.logo=assets/images/okr-logo-acme.svg | ||
okr.tenants.acme.clientcustomization.triangles=assets/images/triangles-okr-acme-header.svg | ||
okr.tenants.acme.clientcustomization.background-logo=assets/images/acme.svg | ||
okr.tenants.acme.clientcustomization.favicon=assets/favicon-acme.png | ||
okr.tenants.acme.clientcustomization.title=ACME OKR | ||
okr.tenants.acme.clientcustomization.supportSiteUrl=https://google.com | ||
okr.tenants.acme.clientcustomization.helpSiteUrl=https://en.wikipedia.org/wiki/Objectives_and_key_results | ||
okr.tenants.acme.clientcustomization.customstyles.okr-topbar-background-color=#738290 |
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
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
130 changes: 130 additions & 0 deletions
130
frontend/src/app/services/customization.service.spec.js
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 |
---|---|---|
@@ -0,0 +1,130 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var customization_service_1 = require("./customization.service"); | ||
var rxjs_1 = require("rxjs"); | ||
var CallRecorder = /** @class */ (function () { | ||
function CallRecorder() { | ||
this.calls = {}; | ||
} | ||
CallRecorder.prototype.add = function (key, value) { | ||
if (!this.calls[key]) { | ||
this.calls[key] = []; | ||
} | ||
this.calls[key].push(value); | ||
}; | ||
CallRecorder.prototype.getCallByIdx = function (key, index) { | ||
if (index === void 0) { index = 0; } | ||
return this.calls[key][index]; | ||
}; | ||
CallRecorder.prototype.getCallCount = function (key) { | ||
var _a, _b; | ||
return (_b = (_a = this.calls[key]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; | ||
}; | ||
CallRecorder.prototype.clear = function () { | ||
this.calls = {}; | ||
}; | ||
return CallRecorder; | ||
}()); | ||
describe('CustomizationService', function () { | ||
var body = { | ||
activeProfile: 'test', | ||
issuer: 'some-issuer.com', | ||
clientId: 'my-client-id', | ||
title: 'title', | ||
favicon: 'favicon', | ||
logo: 'logo', | ||
triangles: 'triangles', | ||
backgroundLogo: 'backgroundLogo', | ||
helpSiteUrl: 'https://wiki.puzzle.ch/Puzzle/OKRs', | ||
customStyles: { cssVar1: 'foo' }, | ||
}; | ||
var service; | ||
var configServiceMock; | ||
var documentMock; | ||
var callRecorder = new CallRecorder(); | ||
var configSubject; | ||
beforeEach(function () { | ||
configSubject = new rxjs_1.BehaviorSubject(body); | ||
configServiceMock = { config$: configSubject.asObservable() }; | ||
callRecorder.clear(); | ||
documentMock = { | ||
getElementById: function (id) { | ||
return { | ||
setAttribute: function () { | ||
callRecorder.add("".concat(id, "-setAttribute"), arguments); | ||
}, | ||
}; | ||
}, | ||
querySelector: function (selector) { | ||
return { | ||
set innerHTML(value) { | ||
callRecorder.add("".concat(selector, ".innerHTML"), arguments); | ||
}, | ||
get style() { | ||
return { | ||
setProperty: function () { | ||
callRecorder.add("".concat(selector, ".style.setProperty"), arguments); | ||
}, | ||
removeProperty: function () { | ||
callRecorder.add("".concat(selector, ".style.removeProperty"), arguments); | ||
}, | ||
}; | ||
}, | ||
}; | ||
}, | ||
}; | ||
service = new customization_service_1.CustomizationService(configServiceMock, documentMock); | ||
}); | ||
it('should call correct apis when config is ready', function () { | ||
var currentConfig = service.getCurrentConfig(); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.title).toBe(body.title); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.logo).toBe(body.logo); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.favicon).toBe(body.favicon); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.triangles).toBe(body.triangles); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.backgroundLogo).toBe(body.backgroundLogo); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.helpSiteUrl).toBe(body.helpSiteUrl); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.customStyles['cssVar1']).toBe(body.customStyles['cssVar1']); | ||
expect(callRecorder.getCallCount('title.innerHTML')).toBe(1); | ||
expect(callRecorder.getCallCount('favicon-setAttribute')).toBe(1); | ||
expect(callRecorder.getCallCount('html.style.setProperty')).toBe(1); | ||
expect(callRecorder.getCallCount('html.style.removeProperty')).toBe(0); | ||
expect(callRecorder.getCallByIdx('title.innerHTML', 0)[0]).toBe('title'); | ||
expect(callRecorder.getCallByIdx('favicon-setAttribute', 0)[0]).toBe('href'); | ||
expect(callRecorder.getCallByIdx('favicon-setAttribute', 0)[1]).toBe('favicon'); | ||
expect(callRecorder.getCallByIdx('html.style.setProperty', 0)[0]).toBe('--cssVar1'); | ||
expect(callRecorder.getCallByIdx('html.style.setProperty', 0)[1]).toBe('foo'); | ||
}); | ||
it('should update if config changed afterwards', function () { | ||
var bodySecond = { | ||
activeProfile: 'test-second', | ||
issuer: 'some-issuer.com-second', | ||
clientId: 'my-client-id-second', | ||
title: 'title-second', | ||
favicon: 'favicon-second', | ||
logo: 'logo-second', | ||
triangles: 'triangles-second', | ||
backgroundLogo: 'backgroundLogo-second', | ||
helpSiteUrl: 'https://wiki.puzzle.ch/Puzzle/OKRs', | ||
customStyles: { cssVarNew: 'bar' }, | ||
}; | ||
configSubject.next(bodySecond); | ||
var currentConfig = service.getCurrentConfig(); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.title).toBe(bodySecond.title); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.logo).toBe(bodySecond.logo); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.favicon).toBe(bodySecond.favicon); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.triangles).toBe(bodySecond.triangles); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.backgroundLogo).toBe(bodySecond.backgroundLogo); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.helpSiteUrl).toBe(bodySecond.helpSiteUrl); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.customStyles['cssVarNew']).toBe(bodySecond.customStyles['cssVarNew']); | ||
expect(currentConfig === null || currentConfig === void 0 ? void 0 : currentConfig.customStyles['cssVar1']).toBe(undefined); | ||
expect(callRecorder.getCallCount('title.innerHTML')).toBe(2); | ||
expect(callRecorder.getCallCount('favicon-setAttribute')).toBe(2); | ||
expect(callRecorder.getCallCount('html.style.setProperty')).toBe(2); | ||
expect(callRecorder.getCallCount('html.style.removeProperty')).toBe(1); | ||
expect(callRecorder.getCallByIdx('title.innerHTML', 1)[0]).toBe('title-second'); | ||
expect(callRecorder.getCallByIdx('favicon-setAttribute', 1)[0]).toBe('href'); | ||
expect(callRecorder.getCallByIdx('favicon-setAttribute', 1)[1]).toBe('favicon-second'); | ||
expect(callRecorder.getCallByIdx('html.style.setProperty', 1)[0]).toBe('--cssVarNew'); | ||
expect(callRecorder.getCallByIdx('html.style.setProperty', 1)[1]).toBe('bar'); | ||
}); | ||
}); |
Oops, something went wrong.