Skip to content

Merge ILL branch #1794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/OutputDatasetObsoleteDto_fix.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import "@scicatproject/scicat-sdk-ts-angular";

// Extend the existing interface
declare module "@scicatproject/scicat-sdk-ts-angular" {
interface OutputDatasetObsoleteDto {
/**
* IDs of the instruments where the data was created.
*/
instrumentIds?: Array<string>;
}
}
20 changes: 20 additions & 0 deletions src/app/_layout/app-header/app-header.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,26 @@ <h3>{{ status }}</h3>

<span class="spacer"></span>

<span *ngIf="isDatasetDetailPage">
<button
mat-icon-button
matTooltip="Nomad Logs"
(click)="openNomadLogs()"
class="icon-button"
>
<mat-icon>subject</mat-icon>
</button>

<button
mat-icon-button
matTooltip="Nomad Charts"
(click)="openNomadCharts()"
class="icon-button"
>
<mat-icon>bar_chart</mat-icon>
</button>
</span>

<span>
<h6>
<a class="toplink" [routerLink]="['/help']">
Expand Down
38 changes: 35 additions & 3 deletions src/app/_layout/app-header/app-header.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DOCUMENT } from "@angular/common";
import { Component, OnInit, Inject } from "@angular/core";
import { Component, OnInit, Inject, OnDestroy } from "@angular/core";
import { APP_CONFIG, AppConfig } from "app-config.module";
import { Store } from "@ngrx/store";
import {
Expand All @@ -13,14 +13,19 @@ import {
} from "state-management/selectors/user.selectors";
import { selectDatasetsInBatchIndicator } from "state-management/selectors/datasets.selectors";
import { AppConfigService, OAuth2Endpoint } from "app-config.service";
import { Router } from "@angular/router";
import { Router, NavigationEnd } from "@angular/router";
import { NomadViewerService } from "shared/services/nomad-buttons-service";
import { filter, Subscription } from "rxjs";

@Component({
selector: "app-app-header",
templateUrl: "./app-header.component.html",
styleUrls: ["./app-header.component.scss"],
})
export class AppHeaderComponent implements OnInit {
export class AppHeaderComponent implements OnInit, OnDestroy {
private subscriptions: Subscription[] = [];
isDatasetDetailPage = false;

config = this.appConfigService.getConfig();
facility = this.config.facility ?? "";
status = this.appConfig.production ? "" : "test";
Expand All @@ -38,6 +43,7 @@ export class AppHeaderComponent implements OnInit {
@Inject(APP_CONFIG) public appConfig: AppConfig,
private store: Store,
@Inject(DOCUMENT) public document: Document,
private nomadViewerService: NomadViewerService,
) {}

logout(): void {
Expand All @@ -58,5 +64,31 @@ export class AppHeaderComponent implements OnInit {
ngOnInit() {
this.store.dispatch(fetchCurrentUserAction());
this.oAuth2Endpoints = this.config.oAuth2Endpoints;
this.isDatasetDetailPage = /\/datasets\/[^/]+(?:\/.*)?$/.test(
this.router.url,
);

this.subscriptions.push(
this.router.events
.pipe(filter((event) => event instanceof NavigationEnd))
.subscribe((event: NavigationEnd) => {
this.isDatasetDetailPage = /\/datasets\/[^/]+(?:\/.*)?$/.test(
event.url,
);
}),
);
}

ngOnDestroy() {
// existing cleanup code
this.subscriptions.forEach((sub) => sub.unsubscribe());
}

openNomadLogs(): void {
this.nomadViewerService.openNomadLogs();
}

openNomadCharts(): void {
this.nomadViewerService.openNomadCharts();
}
}
2 changes: 2 additions & 0 deletions src/app/_layout/layout.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { AppMainLayoutComponent } from "./app-main-layout/app-main-layout.compon
import { BatchCardModule } from "datasets/batch-card/batch-card.module";
import { BreadcrumbModule } from "shared/modules/breadcrumb/breadcrumb.module";
import { UsersModule } from "../users/users.module";
import { MatTooltipModule } from "@angular/material/tooltip";

@NgModule({
declarations: [
Expand All @@ -27,6 +28,7 @@ import { UsersModule } from "../users/users.module";
MatIconModule,
MatMenuModule,
MatToolbarModule,
MatTooltipModule,
RouterModule,
BreadcrumbModule,
UsersModule,
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { TranslateLoader, TranslateModule } from "@ngx-translate/core";
import { CustomTranslateLoader } from "shared/loaders/custom-translate.loader";
import { DATE_PIPE_DEFAULT_OPTIONS } from "@angular/common";
import { RouteTrackerService } from "shared/services/route-tracker.service";
import { SearchService } from "./datasets/services/search.service";

const appConfigInitializerFn = (appConfig: AppConfigService) => {
return () => appConfig.loadAppConfig();
Expand Down Expand Up @@ -143,6 +144,7 @@ const apiConfigurationFn = (
deps: [AuthService, AppConfigService],
multi: false,
},
SearchService,
],
bootstrap: [AppComponent],
})
Expand Down
Loading
Loading