Skip to content

Commit 21ef021

Browse files
committed
fix: initialize colors from instance config
* all color variables are now initialized by the script * removed creation of css variables during runtime * removed unused classes in styles.scss for all apps * formated styles.scss for all apps
1 parent 0df39c2 commit 21ef021

File tree

18 files changed

+1044
-1964
lines changed

18 files changed

+1044
-1964
lines changed

apps/admin-gui/src/_styles.scss

Lines changed: 444 additions & 1034 deletions
Large diffs are not rendered by default.

apps/admin-gui/src/app/app.component.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
<ng-template [ngIf]="!isLoginScreenShow && !isServiceAccess && isLoggedIn() && !isMfaWindowOpen">
77
<perun-web-apps-header
88
(sidenavToggle)="sidenav.toggle()"
9-
[ngStyle]="{'top': getNavMenuTop(), 'background': navBackgroundColor}"
9+
[ngStyle]="{'top': getNavMenuTop()}"
1010
[otherApp]="otherApp"
1111
[showNotifications]="true"
12-
id="nav-menu"
13-
class="mat-elevation-z3"></perun-web-apps-header>
12+
class="nav-menu mat-elevation-z3"></perun-web-apps-header>
1413
<mat-sidenav-container
1514
autosize="true"
1615
[ngStyle]="{'margin-top': getSideNavMarginTop(),'min-height': getSideNavMinHeight()}">
@@ -19,16 +18,14 @@
1918
[fixedInViewport]="true"
2019
[mode]="sidebarMode"
2120
[fixedTopGap]="getTopGap()"
22-
[ngStyle]="{'border-color': sideBarBorderColor, 'background': sideMenubackgroundColor}"
23-
[opened]="!isMobile()">
21+
[opened]="!isMobile()"
22+
class="side-nav">
2423
<ng-scrollbar>
2524
<app-side-menu [sideNav]="sidenav"></app-side-menu>
2625
</ng-scrollbar>
2726
</mat-sidenav>
2827

29-
<mat-sidenav-content
30-
[ngStyle]="{'background-color': contentBackgroundColor}"
31-
id="content-inner">
28+
<mat-sidenav-content class="side-nav-content">
3229
<div [ngStyle]="{'min-height' : contentInnerMinHeight}" id="content-wrap">
3330
<router-outlet></router-outlet>
3431
</div>

apps/admin-gui/src/app/app.component.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ export class AppComponent implements OnInit, AfterViewInit {
4141
isServiceAccess: boolean;
4242

4343
principal: PerunPrincipal;
44-
theme = this.store.getProperty('theme');
45-
navBackgroundColor = this.theme.nav_bg_color;
46-
sideBarBorderColor = this.theme.sidemenu_border_color;
47-
contentBackgroundColor = this.theme.content_bg_color;
48-
sideMenubackgroundColor = this.theme.sidemenu_bg_color;
4944

5045
displayWarning: boolean = this.store.getProperty('display_warning');
5146
warningMessage: string = this.store.getProperty('warning_message');

apps/admin-gui/src/app/core/services/common/admin-gui-config.service.ts

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
InitAuthService,
55
MfaHandlerService,
66
} from '@perun-web-apps/perun/services';
7-
import { AppConfigService, ColorConfig, EntityColorConfig } from '@perun-web-apps/config';
7+
import { AppConfigService } from '@perun-web-apps/config';
88
import { AuthzResolverService } from '@perun-web-apps/perun/openapi';
99
import { MatDialog } from '@angular/material/dialog';
1010
import { Location } from '@angular/common';
@@ -20,84 +20,6 @@ import { firstValueFrom } from 'rxjs';
2020
providedIn: 'root',
2121
})
2222
export class AdminGuiConfigService {
23-
entityColorConfigs: EntityColorConfig[] = [
24-
{
25-
entity: 'vo',
26-
configValue: 'vo_color',
27-
cssVariable: '--vo-color',
28-
},
29-
{
30-
entity: 'group',
31-
configValue: 'group_color',
32-
cssVariable: '--group-color',
33-
},
34-
{
35-
entity: 'user',
36-
configValue: 'user_color',
37-
cssVariable: '--user-color',
38-
},
39-
{
40-
entity: 'member',
41-
configValue: 'member_color',
42-
cssVariable: '--member-color',
43-
},
44-
{
45-
entity: 'facility',
46-
configValue: 'facility_color',
47-
cssVariable: '--facility-color',
48-
},
49-
{
50-
entity: 'resource',
51-
configValue: 'resource_color',
52-
cssVariable: '--resource-color',
53-
},
54-
{
55-
entity: 'admin',
56-
configValue: 'admin_color',
57-
cssVariable: '--admin-color',
58-
},
59-
{
60-
entity: 'service',
61-
configValue: 'service_color',
62-
cssVariable: '--service-color',
63-
},
64-
];
65-
66-
colorConfigs: ColorConfig[] = [
67-
{
68-
configValue: 'sidemenu_hover_color',
69-
cssVariable: '--side-root-item-hover',
70-
},
71-
{
72-
configValue: 'sidemenu_active_color',
73-
cssVariable: '--side-root-item-active',
74-
},
75-
{
76-
configValue: 'sidemenu_submenu_active_color',
77-
cssVariable: '--side-link-active',
78-
},
79-
{
80-
configValue: 'sidemenu_submenu_hover_color',
81-
cssVariable: '--side-link-hover',
82-
},
83-
{
84-
configValue: 'sidemenu_hover_text_color',
85-
cssVariable: '--side-root-item-text-hover',
86-
},
87-
{
88-
configValue: 'sidemenu_active_text_color',
89-
cssVariable: '--side-root-item-text-active',
90-
},
91-
{
92-
configValue: 'sidemenu_submenu_active_text_color',
93-
cssVariable: '--side-link-text-active',
94-
},
95-
{
96-
configValue: 'sidemenu_submenu_hover_text_color',
97-
cssVariable: '--side-link-text-hover',
98-
},
99-
];
100-
10123
constructor(
10224
private initAuthService: InitAuthService,
10325
private appConfigService: AppConfigService,
@@ -113,9 +35,6 @@ export class AdminGuiConfigService {
11335
.loadAppDefaultConfig()
11436
.then(() => this.appConfigService.loadAppInstanceConfig())
11537
.then(() => this.appConfigService.setApiUrl())
116-
.then(() =>
117-
this.appConfigService.initializeColors(this.entityColorConfigs, this.colorConfigs)
118-
)
11938
.then(() => this.appConfigService.setInstanceFavicon())
12039
.then(() => this.initAuthService.verifyAuth())
12140
.catch((err) => {
Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +0,0 @@
1-
.side-menu-item {
2-
a {
3-
padding: 0.5rem 0.5rem 0.5rem 1rem;
4-
cursor: pointer;
5-
text-decoration: none;
6-
7-
&:hover {
8-
background: var(--side-root-item-hover) !important;
9-
color: var(--side-root-item-text-hover) !important;
10-
}
11-
}
12-
}
13-
14-
.side-menu-item-label {
15-
display: flex;
16-
flex-direction: row;
17-
align-items: center;
18-
word-break: break-word;
19-
text-decoration: none;
20-
}
21-
22-
.side-menu-link {
23-
a {
24-
padding: 0.25rem 0.25rem 0.25rem 2rem;
25-
text-decoration: none;
26-
color: #ffffff;
27-
font-size: 1rem;
28-
display: block;
29-
30-
&:hover {
31-
background: var(--side-link-hover) !important;
32-
color: var(--side-link-text-hover) !important;
33-
}
34-
}
35-
}
36-
37-
.header-activated {
38-
background: var(--side-root-item-active) !important;
39-
color: var(--side-root-item-text-active) !important;
40-
}

apps/admin-gui/src/assets/config/defaultConfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@
123123
"profile_label_en": "Profile",
124124
"logo": "<svg\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:cc=\"http://creativecommons.org/ns#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:svg=\"http://www.w3.org/2000/svg\"\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n version=\"1.1\"\n id=\"Vrstva_1\"\n x=\"0px\"\n y=\"0px\"\n viewBox=\"0 0 127.33567 32\"\n xml:space=\"preserve\"\n sodipodi:docname=\"perun_logo-white.svg\"\n width=\"127.33567\"\n height=\"32\"\n inkscape:version=\"0.92.4 (f8dce91, 2019-08-02)\"><metadata\n id=\"metadata3987\"><rdf:RDF><cc:Work\n rdf:about=\"\"><dc:format>image/svg+xml</dc:format><dc:type\n rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n id=\"defs3985\" /><sodipodi:namedview\n pagecolor=\"#ffffff\"\n bordercolor=\"#666666\"\n borderopacity=\"1\"\n objecttolerance=\"10\"\n gridtolerance=\"10\"\n guidetolerance=\"10\"\n inkscape:pageopacity=\"0\"\n inkscape:pageshadow=\"2\"\n inkscape:window-width=\"1855\"\n inkscape:window-height=\"1012\"\n id=\"namedview3983\"\n showgrid=\"false\"\n fit-margin-top=\"0\"\n fit-margin-left=\"0\"\n fit-margin-right=\"0\"\n fit-margin-bottom=\"0\"\n inkscape:zoom=\"1.7355372\"\n inkscape:cx=\"-38.079799\"\n inkscape:cy=\"16\"\n inkscape:window-x=\"65\"\n inkscape:window-y=\"32\"\n inkscape:window-maximized=\"1\"\n inkscape:current-layer=\"Vrstva_1\" />\n<style\n type=\"text/css\"\n id=\"style3972\">\n\t.st0{fill:#FFFFFF;}\n</style>\n<path\n class=\"st0\"\n d=\"m 127.22491,24.415225 h -5.20415 V 10.851211 l -4.81661,0.05536 v 13.508651 h -5.14879 l 0.0554,-16.775087 h 5.14879 v 0.608997 c 1.21799,-0.16609 2.38062,-0.276817 3.59861,-0.387543 1.49481,-0.16609 2.65744,-0.276817 3.65398,-0.276817 1.88235,0 2.82353,0.66436 2.82353,2.048443 z m -19.26643,0 h -5.14879 v -0.608997 c -1.16263,0.16609 -2.38062,0.276817 -3.59862,0.442907 -1.43944,0.16609 -2.65744,0.221453 -3.59861,0.221453 -1.88236,0 -2.82353,-0.66436 -2.82353,-2.103806 l 0.0554,-14.782007 h 5.09343 v 13.619377 l 4.87197,-0.05536 V 7.640138 h 5.14879 z M 90.90657,14.67128 h -5.09342 v -3.820069 l -4.09689,0.05536 v 13.508651 h -5.14879 l 0.0554,-16.775087 h 5.14879 v 0.608997 c 1.0519,-0.16609 2.1038,-0.276817 3.15571,-0.442907 1.27335,-0.16609 2.32526,-0.221453 3.21107,-0.221453 1.88235,0 2.82353,0.66436 2.82353,2.048443 z M 67.54325,14.449827 v -3.986159 h -4.81661 v 3.986159 z m 4.92734,7.861592 c 0,1.384083 -0.99654,2.048443 -2.93426,2.048443 h -8.91349 c -1.93772,0 -2.8789,-0.66436 -2.8789,-2.048443 V 9.688581 c 0,-1.384083 0.99654,-2.048443 2.93426,-2.048443 h 8.9135 c 1.93771,0 2.87889,0.66436 2.87889,2.048443 v 6.145329 l -1.43945,1.051903 h -8.35986 v 4.705883 h 4.81661 v -2.768167 h 4.92733 z M 49.0519,14.00692 V 6.089965 l -4.816606,0.05536 v 9.079584 h 3.211073 c 1.051903,0 1.605533,-0.387543 1.605533,-1.217993 z m 5.20416,0.99654 c 0,1.384083 -0.66436,2.32526 -1.99308,2.878893 -0.94118,0.387543 -2.43599,0.608996 -4.373707,0.608996 -0.442906,0 -1.107266,0 -1.882353,-0.05536 -0.830449,0 -1.384083,-0.05536 -1.771626,-0.05536 v 6.034602 h -5.148789 l 0.05536,-21.536332 h 5.148789 v 0.608996 c 1.217993,-0.110726 2.380623,-0.276816 3.598616,-0.387543 1.49481,-0.16609 2.71281,-0.276817 3.59862,-0.276817 1.88235,0 2.82353,0.66436 2.82353,2.048443 z\"\n id=\"path3974\"\n inkscape:connector-curvature=\"0\"\n style=\"fill:#ffffff;stroke-width:0.55363321\" />\n<g\n id=\"g3980\"\n transform=\"scale(0.55363322)\">\n\t<polygon\n class=\"st0\"\n points=\"31.1,36.7 41.6,34.8 22.5,54.3 29.9,57.8 53.1,46.4 58.4,20.7 42.8,1.3 32.8,17.7 43.8,15.9 \"\n id=\"polygon3976\"\n style=\"fill:#ffffff\" />\n\t<polygon\n class=\"st0\"\n points=\"18.9,20.1 26.6,0 15.8,0 0,20.6 6.2,46.4 19.4,52.7 25.3,37.6 17.7,38.9 26.2,18.9 \"\n id=\"polygon3978\"\n style=\"fill:#ffffff\" />\n</g>\n</svg>",
125125
"theme": {
126-
"content_bg_color": "",
126+
"content_bg_color": "#f2f2f2",
127127
"back_button_color": "#000000",
128128
"nav_bg_color": "#102027",
129129
"nav_text_color": "#ffffff",
@@ -140,6 +140,7 @@
140140
"sidemenu_active_color": "#465258",
141141
"sidemenu_active_text_color": "#ffffff",
142142
"sidemenu_text_color": "#ffffff",
143+
"sidemenu_item_icon_color": "#ffffff",
143144
"sidemenu_submenu_bg_color": "#1b2428",
144145
"sidemenu_submenu_hover_color": "#566268",
145146
"sidemenu_submenu_hover_text_color": "#ffffff",

0 commit comments

Comments
 (0)