Skip to content

Commit

Permalink
[sc-7934] warning when new nucliadb version is available (#1189)
Browse files Browse the repository at this point in the history
* Fix dropdown button style

* [sc-7934] Display the versions used in NucliaDB admin

  - Display NucliaDB and NucliaDB Admin version in the home page
  - Display a toast message when a newer version of NucliaDB or NucliaDB Admin is available

* Fix unit tests and search warning when no NUA

* Fix search options white space in resource list
  • Loading branch information
mpellerin42 authored Dec 12, 2023
1 parent f53d3d7 commit 5c5232e
Show file tree
Hide file tree
Showing 21 changed files with 401 additions and 195 deletions.
2 changes: 1 addition & 1 deletion apps/nucliadb-admin/src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'variables';
@import 'apps/nucliadb-admin/src/variables';

.version {
position: fixed;
Expand Down
1 change: 1 addition & 0 deletions apps/nucliadb-admin/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function createTranslateLoader(http: HttpBackend, config: BackendConfigur
RouterModule.forRoot(routes, routerOptions),
UploadModule,
PaIconModule,
PaIconModule,
],
providers: [TranslatePipe, { provide: APP_BASE_HREF, useValue: '/admin' }],
bootstrap: [AppComponent],
Expand Down
75 changes: 38 additions & 37 deletions apps/nucliadb-admin/src/app/home/home-page.component.html
Original file line number Diff line number Diff line change
@@ -1,38 +1,39 @@
<div class="home-container body-m">
<ng-container *ngIf="hasValidKey | async">
<p>
By using a NUA API Key you can utilize
<a
href="https://nuclia.cloud"
target="_blank">
Nuclia's Cloud Processing Engine
</a>
</p>
<p>Your data remains stored locally, but you have access to a dashboard for following your metrics and more.</p>
</ng-container>

<div *ngIf="(hasValidKey | async) === false">
<h1>
<pa-icon
name="warning"
size="xlarge"></pa-icon>
{{ errorMessage | async }}
</h1>
<p>
Provide your NUA API Key by using the environment variable
<code>NUA_API_KEY</code>
or the
<code>--nuclia-api-key</code>
cli flag.
</p>
<p>
If you don't have a NUA API Key follow this
<a
href="https://docs.nuclia.dev/docs/docs/getting-started/on-premise"
rel="noopener noreferrer"
target="_blank">
guide
</a>
</p>
</div>
<div class="home-page page-spacing">
@if (version | async; as versions) {
<div class="version-container container-box">
<strong>NucliaDB:</strong>
<div>
{{ versions.nucliadb.installed }}
</div>
<strong>NucliaDB Admin:</strong>
<div>
{{ versions['nucliadb-admin-assets'].installed }}
</div>
<strong>NUA API Key:</strong>
<div class="check-item">
@if (hasValidKey | async) {
<div>
<div>
<pa-icon
class="primary"
name="circle-check"></pa-icon>
<span [innerHTML]="'standalone.nua-key-status.valid.nua-allows-to' | translate"></span>
</div>
<div>{{ 'standalone.nua-key-status.valid.store-locally' | translate }}</div>
</div>
} @else {
<div>
<div>
<pa-icon
class="destructive"
name="warning"></pa-icon>
<strong>{{ errorMessage | async }}</strong>
</div>
<div [innerHTML]="'standalone.nua-key-status.invalid.provide-by' | translate"></div>
<div [innerHTML]="'standalone.nua-key-status.invalid.how-to-get-nua-key' | translate"></div>
</div>
}
</div>
</div>
}
</div>
41 changes: 39 additions & 2 deletions apps/nucliadb-admin/src/app/home/home-page.component.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
@import 'variables';
@import 'apps/nucliadb-admin/src/variables';

.home-page {
display: flex;
gap: rhythm(3);
align-items: flex-start;

.container-box {
background: $color-neutral-lightest;
border: 1px solid $color-neutral-light;
border-radius: rhythm(0.5);
padding: rhythm(2) rhythm(3);
}

.check-item {
display: flex;
gap: rhythm(1);
margin-top: calc(-1 * #{rhythm(0.25)});

& > strong {
padding-top: rhythm(0.25);
}
pa-icon {
margin-right: rhythm(0.5);
}
pa-icon.primary {
color: $color-primary-regular;
}
pa-icon.destructive {
color: $color-secondary-strong;
}
}

.version-container {
display: grid;
grid-template-columns: 1fr auto;
gap: rhythm(1);
}
}

.home-container {
align-items: center;
display: flex;
flex-direction: column;
height: calc(100vh - var(--app-topbar-height));
justify-content: center;

h1 {
Expand Down
1 change: 1 addition & 0 deletions apps/nucliadb-admin/src/app/home/home-page.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { StandaloneService } from '@flaps/common';
export class HomePageComponent {
hasValidKey = this.standaloneService.hasValidKey;
errorMessage = this.standaloneService.errorMessage;
version = this.standaloneService.version;

constructor(private standaloneService: StandaloneService) {}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div
class="upload-bar-container"
*ngIf="showBar | async">
<stf-upload-bar></stf-upload-bar>
</div>
@if (showBar | async) {
<div class="upload-bar-container">
<stf-upload-bar></stf-upload-bar>
</div>
}

<router-outlet></router-outlet>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import 'variables';
@import 'apps/nucliadb-admin/src/variables';

.upload-bar-container {
position: sticky;
Expand Down
Loading

0 comments on commit 5c5232e

Please sign in to comment.