Skip to content

Commit

Permalink
UI: Add branding support
Browse files Browse the repository at this point in the history
Fixes: https://github.com/aquarist-labs/s3gw/issues/552

Signed-off-by: Volker Theile <vtheile@suse.com>
  • Loading branch information
votdev committed Jun 5, 2023
1 parent 4bf2d12 commit f797503
Show file tree
Hide file tree
Showing 27 changed files with 1,008 additions and 786 deletions.
10 changes: 9 additions & 1 deletion src/frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"src/styles.scss"
],
"stylePreprocessorOptions": {
"includePaths": ["src"]
"includePaths": ["src/scss/themes/default"]
},
"scripts": []
},
Expand Down Expand Up @@ -84,6 +84,11 @@
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"longhorn": {
"stylePreprocessorOptions": {
"includePaths": ["src/scss/themes/longhorn"]
}
}
},
"defaultConfiguration": "production"
Expand All @@ -100,6 +105,9 @@
},
"development": {
"browserTarget": "s3gw-ui:build:development"
},
"longhorn": {
"browserTarget": "s3gw-ui:build:development,longhorn"
}
},
"defaultConfiguration": "development"
Expand Down
1,177 changes: 612 additions & 565 deletions src/frontend/package-lock.json

Large diffs are not rendered by default.

25 changes: 14 additions & 11 deletions src/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"start:longhorn": "ng serve --configuration development,longhorn",
"build": "ng build",
"build:prod": "ng build --configuration production --verbose",
"build:prod:longhorn": "ng build --configuration production,longhorn --verbose",
"test": "ng test --no-cache --watch",
"test:ci": "ng test --no-cache",
"e2e": "start-test http://localhost:4200 'cypress open'",
Expand All @@ -19,7 +21,8 @@
"fix": "run-p -csl --aggregate-output fix:*",
"i18n": "npm run i18n:extract && npm run i18n:pull && npm run i18n:convert",
"i18n:extract": "transloco-keys-manager extract --sort --replace",
"upgrade": "ncu -u --target minor"
"upgrade": "ncu -u --target minor",
"upgrade:patch": "ncu --upgrade --target patch"
},
"private": true,
"dependencies": {
Expand All @@ -38,16 +41,16 @@
"@mdi/font": "^7.2.96",
"@ng-bootstrap/ng-bootstrap": "^14.2.0",
"@ngneat/transloco": "^4.2.7",
"aws-sdk": "^2.1385.0",
"bootstrap": "5.2.3",
"aws-sdk": "^2.1388.0",
"bootstrap": "~5.2.3",
"crypto-js": "^4.1.1",
"dayjs": "^1.11.7",
"dayjs": "^1.11.8",
"file-saver": "^2.0.5",
"lodash": "^4.17.21",
"ngx-toastr": "^15.2.2",
"nunjucks": "^3.2.4",
"rxjs": "~7.4.0",
"tslib": "^2.5.2",
"rxjs": "~7.8.1",
"tslib": "^2.5.3",
"validator": "^13.9.0",
"zone.js": "~0.13.0"
},
Expand All @@ -66,11 +69,11 @@
"@types/file-saver": "^2.0.5",
"@types/jest": "~28.1.8",
"@types/lodash": "^4.14.195",
"@types/node": "^16.18.33",
"@types/node": "^16.18.34",
"@types/nunjucks": "^3.2.2",
"@types/validator": "^13.7.17",
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.59.8",
"cypress": "^12.13.0",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
Expand All @@ -88,8 +91,8 @@
"npm-run-all": "^4.1.5",
"prettier": "^2.8.8",
"start-server-and-test": "^2.0.0",
"stylelint": "^15.6.2",
"stylelint": "^15.6.3",
"stylelint-config-standard-scss": "~9.0.0",
"typescript": "4.9.5"
"typescript": "~4.9.5"
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
@use 'src/scss/defaults/colors' as dc;
@use 'theme/colors' as tc;

.wrapper {
position: fixed;
top: 0;
left: 0;
background: dc.$s3gw-color-transparent-black;
background: tc.$s3gw-color-transparent-black;
z-index: 30000; // Must be > than Bootstraps $zindex-sticky
cursor: wait;

Expand All @@ -18,9 +18,9 @@
.spinner {
animation: spinner-animation 1s infinite linear;
box-sizing: border-box;
border: 5px solid dc.$s3gw-color-cerulean-900;
border: 5px solid tc.$s3gw-color-cerulean-900;
border-radius: 50%;
border-top-color: dc.$s3gw-color-cerulean-500;
border-top-color: tc.$s3gw-color-cerulean-500;
height: 80px;
width: 80px;
margin: 0 auto;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use 'src/scss/defaults/colors' as dc;
@use 'theme/colors' as tc;

th.sortable {
cursor: pointer;
Expand All @@ -18,17 +18,17 @@ td {

&.btn:hover,
&.btn:focus {
background-color: rgba(dc.$s3gw-color-magical-merlin, 0.15);
background-color: rgba(tc.$s3gw-color-magical-merlin, 0.15);
}
}
}

tbody > tr {
&.selected {
background-color: dc.$s3gw-color-table-selected-background;
background-color: tc.$s3gw-color-table-selected-bg;

&:hover > * {
--bs-table-accent-bg: dc.$s3gw-color-table-selected-background;
--bs-table-accent-bg: tc.$s3gw-color-table-selected-bg;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
@use 'src/scss/defaults/colors' as dc;
@use 'theme/colors' as tc;

li {
background-color: var(--s3gw-navbar-item-bg);
color: var(--s3gw-navbar-item-color);
cursor: pointer;

a,
a:hover {
color: dc.$s3gw-color-menu-item-text;
a {
color: unset;
}

&:hover {
background-color: dc.$s3gw-color-menu-item-hover-background;
background-color: var(--s3gw-navbar-item-hover-bg);
color: var(--s3gw-navbar-item-hover-color);
}

&.selected {
background-color: dc.$s3gw-color-menu-item-selected-background;
background-color: var(--s3gw-navbar-item-selected-bg);
color: var(--s3gw-navbar-item-selected-color);
}

a,
a:hover {
color: dc.$s3gw-color-menu-item-selected-text;
}
&:hover, &.selected {
border-right: 4px solid var(--s3gw-navbar-item-border-color);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
:host {
background-color: var(--s3gw-navbar-bg);
color: var(--s3gw-navbar-color);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@use 'src/scss/defaults/variables' as dv;
@use 'theme/variables' as tv;

:host {
background-color: var(--bs-body-bg);
Expand All @@ -8,5 +8,5 @@

.toolbar {
border-bottom: 1px solid var(--bs-border-color);
height: dv.$s3gw-site-header-height;
height: tv.$s3gw-site-header-height;
}
154 changes: 79 additions & 75 deletions src/frontend/src/app/shared/components/top-bar/top-bar.component.html
Original file line number Diff line number Diff line change
@@ -1,85 +1,89 @@
<div class="wrapper h-100 d-flex flex-row justify-content-start align-items-center">
<button class="btn btn-simple rounded-0 toggle"
title="{{ 'Toggle navigation' | transloco }}"
(click)="onToggleNavigation($event)">
<i class="mdi mdi-menu"></i>
</button>
<div>
<img class="mx-2 logo"
src="./assets/images/logo.svg"
alt="logo">
</div>
<div class="flex-fill"></div>
<ng-container *ngIf="isAdmin">
<div class="form-check form-switch me-2">
<input class="form-check-input"
type="checkbox"
role="switch"
id="viewMode"
ngbTooltip="{{ viewMode === viewModes.admin ? 'Turn off administration view' : 'Turn on administration view' | transloco }}"
[checked]="viewMode === viewModes.admin"
(change)="onToggleViewMode($event)">
<label class="form-check-label"
for="viewMode">
{{ 'Administration' | transloco }}
</label>
</div>
<div class="ms-3 vr"></div>
</ng-container>
<button class="btn btn-simple mx-2"
title="{{ 'Notifications' | transloco }}"
(click)="onToggleNotifications($event)">
<i [class]="icons.bell"></i>
</button>
<div ngbDropdown>
<button class="btn btn-simple ms-2"
title="{{ 'Help' | transloco }}"
ngbDropdownToggle>
<i [class]="icons.help"></i>
<div class="wrapper d-flex h-100">
<div class="navigation-actions d-flex justify-content-start align-items-center">
<button class="btn btn-simple rounded-0 toggle"
title="{{ 'Toggle navigation' | transloco }}"
(click)="onToggleNavigation($event)">
<i class="mdi mdi-menu"></i>
</button>
<div ngbDropdownMenu>
<a ngbDropdownItem
href="https://s3gw.io/"
target="_blank">
<div>
<i class="mdi mdi-web mr-1"></i>
<span>{{ "Website" | transloco }}</span>
</div>
</a>
<a ngbDropdownItem
href="https://github.com/aquarist-labs/s3gw"
target="_blank">
<div>
<i class="mdi mdi-github mr-1"></i>
<span>{{ "GitHub" | transloco }}</span>
</div>
</a>
<div class="logo h-100">
<img class="m-2"
src="./assets/images/logo.svg"
alt="logo">
</div>
</div>
<div ngbDropdown
display="dynamic"
placement="bottom-right">
<div class="flex-fill"></div>
<div class="actions d-flex align-items-center ps-3">
<ng-container *ngIf="isAdmin">
<div class="form-check form-switch switch-danger me-2">
<input class="form-check-input"
type="checkbox"
role="switch"
id="viewMode"
ngbTooltip="{{ viewMode === viewModes.admin ? 'Turn off administration view' : 'Turn on administration view' | transloco }}"
[checked]="viewMode === viewModes.admin"
(change)="onToggleViewMode($event)">
<label class="form-check-label"
for="viewMode">
{{ 'Administration' | transloco }}
</label>
</div>
<div class="ms-3 vr"></div>
</ng-container>
<button class="btn btn-simple mx-2"
title="{{ 'Profile' | transloco }}"
ngbDropdownToggle>
<i [class]="icons.user"></i>
title="{{ 'Notifications' | transloco }}"
(click)="onToggleNotifications($event)">
<i [class]="icons.bell"></i>
</button>
<div ngbDropdownMenu>
<div ngbDropdownItem
disabled>
<i class="mr-1"
[class]="icons.user">
</i>
<span>
{{ 'Logged in as' | transloco }} {{ userId }}
</span>
<div ngbDropdown>
<button class="btn btn-simple ms-2"
title="{{ 'Help' | transloco }}"
ngbDropdownToggle>
<i [class]="icons.help"></i>
</button>
<div ngbDropdownMenu>
<a ngbDropdownItem
href="https://s3gw.io/"
target="_blank">
<div>
<i class="mdi mdi-web mr-1"></i>
<span>{{ "Website" | transloco }}</span>
</div>
</a>
<a ngbDropdownItem
href="https://github.com/aquarist-labs/s3gw"
target="_blank">
<div>
<i class="mdi mdi-github mr-1"></i>
<span>{{ "GitHub" | transloco }}</span>
</div>
</a>
</div>
<div class="dropdown-divider"></div>
<button ngbDropdownItem
(click)="onLogout()">
<i class="mdi mdi-logout mr-1"></i>
<span>{{ "Log out" | transloco }}</span>
</div>
<div ngbDropdown
display="dynamic"
placement="bottom-right">
<button class="btn btn-simple mx-2"
title="{{ 'Profile' | transloco }}"
ngbDropdownToggle>
<i [class]="icons.user"></i>
</button>
<div ngbDropdownMenu>
<div ngbDropdownItem
disabled>
<i class="mr-1"
[class]="icons.user">
</i>
<span>
{{ 'Logged in as' | transloco }} {{ userId }}
</span>
</div>
<div class="dropdown-divider"></div>
<button ngbDropdownItem
(click)="onLogout()">
<i class="mdi mdi-logout mr-1"></i>
<span>{{ "Log out" | transloco }}</span>
</button>
</div>
</div>
</div>
</div>
Loading

0 comments on commit f797503

Please sign in to comment.