diff --git a/CI/ESS/styles.scss b/CI/ESS/styles.scss index 7b352e20f..a80335d19 100644 --- a/CI/ESS/styles.scss +++ b/CI/ESS/styles.scss @@ -3,9 +3,6 @@ @use '~@angular/material' as mat; @use "./app/app-theme" as app; @use "./app/_layout/app-header/app-header-theme" as app-header; -@use "./app/_layout/login-header/login-header-theme" as login-header; -@use "./app/datasets/anonymous-details/anonymous-details-theme" as anonymous-details; -@use "./app/datasets/anonymous-details-dashboard/anonymous-details-dashboard-theme" as anonymous-details-dashboard; @use "./app/datasets/batch-view/batch-view-theme" as batch-view; @use "./app/datasets/dashboard/dashboard-theme" as dashboard; @use "./app/datasets/datafiles/datafiles-theme" as datafiles; @@ -255,9 +252,6 @@ $theme: custom-light-theme( @include mat.all-component-themes($theme); @include app.theme($theme); @include app-header.theme($theme); -@include login-header.theme($theme); -@include anonymous-details.theme($theme); -@include anonymous-details-dashboard.theme($theme); @include batch-view.theme($theme); @include dashboard.theme($theme); @include datafiles.theme($theme); diff --git a/CI/MAXIV/maxiv-theme.scss b/CI/MAXIV/maxiv-theme.scss index 90e9567c6..0a631a121 100644 --- a/CI/MAXIV/maxiv-theme.scss +++ b/CI/MAXIV/maxiv-theme.scss @@ -3,9 +3,6 @@ @use '~@angular/material' as mat; @use "./app/app-theme" as app; @use "./app/_layout/app-header/app-header-theme" as app-header; -@use "./app/_layout/login-header/login-header-theme" as login-header; -@use "./app/datasets/anonymous-details/anonymous-details-theme" as anonymous-details; -@use "./app/datasets/anonymous-details-dashboard/anonymous-details-dashboard-theme" as anonymous-details-dashboard; @use "./app/datasets/batch-view/batch-view-theme" as batch-view; @use "./app/datasets/dashboard/dashboard-theme" as dashboard; @use "./app/datasets/datafiles/datafiles-theme" as datafiles; @@ -301,9 +298,6 @@ $theme: custom-light-theme( @include mat.all-component-themes($theme); @include app.theme($theme); @include app-header.theme($theme); -@include login-header.theme($theme); -@include anonymous-details.theme($theme); -@include anonymous-details-dashboard.theme($theme); @include batch-view.theme($theme); @include dashboard.theme($theme); @include datafiles.theme($theme); diff --git a/CI/RFI/theme.scss b/CI/RFI/theme.scss index 7b352e20f..a80335d19 100644 --- a/CI/RFI/theme.scss +++ b/CI/RFI/theme.scss @@ -3,9 +3,6 @@ @use '~@angular/material' as mat; @use "./app/app-theme" as app; @use "./app/_layout/app-header/app-header-theme" as app-header; -@use "./app/_layout/login-header/login-header-theme" as login-header; -@use "./app/datasets/anonymous-details/anonymous-details-theme" as anonymous-details; -@use "./app/datasets/anonymous-details-dashboard/anonymous-details-dashboard-theme" as anonymous-details-dashboard; @use "./app/datasets/batch-view/batch-view-theme" as batch-view; @use "./app/datasets/dashboard/dashboard-theme" as dashboard; @use "./app/datasets/datafiles/datafiles-theme" as datafiles; @@ -255,9 +252,6 @@ $theme: custom-light-theme( @include mat.all-component-themes($theme); @include app.theme($theme); @include app-header.theme($theme); -@include login-header.theme($theme); -@include anonymous-details.theme($theme); -@include anonymous-details-dashboard.theme($theme); @include batch-view.theme($theme); @include dashboard.theme($theme); @include datafiles.theme($theme); diff --git a/cypress/integration/datasets-public.spec.js b/cypress/integration/datasets-public.spec.js index 879dc0bcb..2b641b931 100644 --- a/cypress/integration/datasets-public.spec.js +++ b/cypress/integration/datasets-public.spec.js @@ -27,8 +27,9 @@ describe("Datasets", () => { cy.wait("@fetch"); - cy.get(".mat-row") - .contains("Cypress Dataset") + cy.wait(5000); + + cy.contains(".mat-row", "Cypress Dataset") .click(); cy.wait("@fetch"); diff --git a/cypress/integration/users-login.spec.js b/cypress/integration/users-login.spec.js index 395dda8d2..e692b8c6f 100644 --- a/cypress/integration/users-login.spec.js +++ b/cypress/integration/users-login.spec.js @@ -9,7 +9,7 @@ describe("Users Login", () => { cy.visit("/"); - cy.url().should("include", "/anonymous/datasets"); + cy.url().should("include", "/datasets"); cy.wait(5000); @@ -37,7 +37,7 @@ describe("Users Login", () => { cy.visit("/"); - cy.url().should("include", "/anonymous/datasets"); + cy.url().should("include", "/datasets"); cy.wait(5000); diff --git a/src/app/_layout/anonymous-layout/anonymous-layout.component.scss b/src/app/_layout/anonymous-layout/anonymous-layout.component.scss deleted file mode 100644 index 2ef47f05c..000000000 --- a/src/app/_layout/anonymous-layout/anonymous-layout.component.scss +++ /dev/null @@ -1,4 +0,0 @@ -.main { - height: 95vh; - padding: 1.5em; -} diff --git a/src/app/_layout/anonymous-layout/anonymous-layout.component.spec.ts b/src/app/_layout/anonymous-layout/anonymous-layout.component.spec.ts deleted file mode 100644 index 2dc37e385..000000000 --- a/src/app/_layout/anonymous-layout/anonymous-layout.component.spec.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; - -import { AnonymousLayoutComponent } from "./anonymous-layout.component"; -import { NO_ERRORS_SCHEMA } from "@angular/core"; -import { LoginHeaderComponent } from "_layout/login-header/login-header.component"; -import { BreadcrumbModule } from "shared/modules/breadcrumb/breadcrumb.module"; -import { RouterTestingModule } from "@angular/router/testing"; -import { APP_CONFIG } from "app-config.module"; -import { Store } from "@ngrx/store"; -import { MockStore, MockActivatedRoute, MockRouter } from "shared/MockStubs"; -import { ActivatedRoute, Router } from "@angular/router"; - -describe("AnonymousLayoutComponent", () => { - let component: AnonymousLayoutComponent; - let fixture: ComponentFixture; - - beforeEach(waitForAsync(() => { - TestBed.configureTestingModule({ - schemas: [NO_ERRORS_SCHEMA], - declarations: [AnonymousLayoutComponent, LoginHeaderComponent], - imports: [BreadcrumbModule, RouterTestingModule] - }); - TestBed.overrideComponent(LoginHeaderComponent, { - set: { - providers: [{ provide: APP_CONFIG, useValue: { facility: "ESS" } }] - } - }); - TestBed.overrideComponent(AnonymousLayoutComponent, { - set: { - providers: [ - { provide: Store, useClass: MockStore }, - { provide: ActivatedRoute, useClass: MockActivatedRoute }, - { provide: Router, useClass: MockRouter } - ] - } - }); - TestBed.compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AnonymousLayoutComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it("should create", () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/_layout/anonymous-layout/anonymous-layout.component.ts b/src/app/_layout/anonymous-layout/anonymous-layout.component.ts deleted file mode 100644 index 1fe27c97d..000000000 --- a/src/app/_layout/anonymous-layout/anonymous-layout.component.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { Component } from "@angular/core"; - -@Component({ - selector: "app-anonymous-layout", - templateUrl: "./anonymous-layout.component.html", - styleUrls: ["./anonymous-layout.component.scss"] -}) -export class AnonymousLayoutComponent {} diff --git a/src/app/_layout/app-header/app-header.component.html b/src/app/_layout/app-header/app-header.component.html index 525dafe9b..e00b94288 100644 --- a/src/app/_layout/app-header/app-header.component.html +++ b/src/app/_layout/app-header/app-header.component.html @@ -1,12 +1,12 @@
@@ -17,61 +17,61 @@ - + - + - + @@ -96,29 +96,39 @@
>
- - - + +
+ + account_circle + Sign in + +
+ + + + + + + + + + + + + - - - - - - -
diff --git a/src/app/_layout/app-header/app-header.component.scss b/src/app/_layout/app-header/app-header.component.scss index 8618f64c9..341f0406f 100644 --- a/src/app/_layout/app-header/app-header.component.scss +++ b/src/app/_layout/app-header/app-header.component.scss @@ -5,12 +5,16 @@ z-index: 1000; mat-toolbar { - height: 7vh; + height: 3.5rem; - .logo { - height: 4vh; - margin-right: 1em; - padding-top: 0.5vh; + a { + height: 2.5rem; + padding: 0.5rem; + + .logo { + height: 100%; + margin-right: 0.5rem; + } } .spacer { @@ -18,7 +22,7 @@ } .toplink { - padding: 10px; + padding: 0.5rem 1rem; font: bold; font-size: 11pt; @@ -32,11 +36,11 @@ } .user-button { - font-size: 11px; - line-height: 20px; + font-size: 0.75rem; + line-height: 1rem; .user-image { - height: 3vh; + height: 2rem; } } } diff --git a/src/app/_layout/app-header/app-header.component.ts b/src/app/_layout/app-header/app-header.component.ts index f7f81046b..788f030c8 100644 --- a/src/app/_layout/app-header/app-header.component.ts +++ b/src/app/_layout/app-header/app-header.component.ts @@ -9,7 +9,8 @@ import { Subscription } from "rxjs"; import { getCurrentUserAccountType, getCurrentUser, - getProfile + getProfile, + getIsLoggedIn } from "state-management/selectors/user.selectors"; import { getDatasetsInBatch } from "state-management/selectors/datasets.selectors"; @@ -29,6 +30,7 @@ export class AppHeaderComponent implements OnInit, OnDestroy { inBatchPids: string[] = []; inBatchCount = 0; inBatchIndicator = ""; + loggedIn$ = this.store.pipe(select(getIsLoggedIn)); constructor( private store: Store, diff --git a/src/app/_layout/app-layout/app-layout.component.html b/src/app/_layout/app-layout/app-layout.component.html index e6cbb5b5e..5083841f1 100644 --- a/src/app/_layout/app-layout/app-layout.component.html +++ b/src/app/_layout/app-layout/app-layout.component.html @@ -1,10 +1,10 @@
-
diff --git a/src/app/_layout/app-layout/app-layout.component.scss b/src/app/_layout/app-layout/app-layout.component.scss index 2ef47f05c..8502f43e2 100644 --- a/src/app/_layout/app-layout/app-layout.component.scss +++ b/src/app/_layout/app-layout/app-layout.component.scss @@ -1,4 +1,4 @@ .main { - height: 95vh; - padding: 1.5em; + height: 100%; + min-height: calc(100vh - 3.5rem); } diff --git a/src/app/_layout/app-layout/app-layout.component.ts b/src/app/_layout/app-layout/app-layout.component.ts index 41a3e0498..8e96c2dba 100644 --- a/src/app/_layout/app-layout/app-layout.component.ts +++ b/src/app/_layout/app-layout/app-layout.component.ts @@ -1,6 +1,6 @@ import { Component, OnInit } from "@angular/core"; import { Store, select } from "@ngrx/store"; -import { getTheme } from "state-management/selectors/user.selectors"; +import {getIsLoggedIn, getTheme} from "state-management/selectors/user.selectors"; import { Observable } from "rxjs"; @Component({ @@ -11,6 +11,8 @@ import { Observable } from "rxjs"; export class AppLayoutComponent implements OnInit { darkTheme$: Observable = new Observable(); + loggedIn$ = this.store.pipe(select(getIsLoggedIn)); + constructor(private store: Store) {} ngOnInit() { diff --git a/src/app/_layout/anonymous-layout/anonymous-layout.component.html b/src/app/_layout/app-main-layout/app-main-layout.component.html similarity index 54% rename from src/app/_layout/anonymous-layout/anonymous-layout.component.html rename to src/app/_layout/app-main-layout/app-main-layout.component.html index 288d93eb2..cd4968108 100644 --- a/src/app/_layout/anonymous-layout/anonymous-layout.component.html +++ b/src/app/_layout/app-main-layout/app-main-layout.component.html @@ -1,5 +1,4 @@ - -
+
diff --git a/src/app/_layout/app-main-layout/app-main-layout.component.scss b/src/app/_layout/app-main-layout/app-main-layout.component.scss new file mode 100644 index 000000000..7db0bd823 --- /dev/null +++ b/src/app/_layout/app-main-layout/app-main-layout.component.scss @@ -0,0 +1,5 @@ +.main-app { + height: 100%; + min-height: calc(100vh - 3.5rem); + padding: 1.5rem; +} diff --git a/src/app/_layout/login-layout/login-layout.component.spec.ts b/src/app/_layout/app-main-layout/app-main-layout.component.spec.ts similarity index 60% rename from src/app/_layout/login-layout/login-layout.component.spec.ts rename to src/app/_layout/app-main-layout/app-main-layout.component.spec.ts index b73148841..f4eb90c39 100644 --- a/src/app/_layout/login-layout/login-layout.component.spec.ts +++ b/src/app/_layout/app-main-layout/app-main-layout.component.spec.ts @@ -1,31 +1,38 @@ import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; -import { LoginLayoutComponent } from "./login-layout.component"; +import { AppMainLayoutComponent } from "./app-main-layout.component"; import { NO_ERRORS_SCHEMA } from "@angular/core"; -import { LoginHeaderComponent } from "_layout/login-header/login-header.component"; import { BreadcrumbModule } from "shared/modules/breadcrumb/breadcrumb.module"; +import { AppHeaderComponent } from "_layout/app-header/app-header.component"; +import { RouterTestingModule } from "@angular/router/testing"; +import {MatMenuModule} from "@angular/material/menu"; import { MatToolbarModule } from "@angular/material/toolbar"; -import { APP_CONFIG } from "app-config.module"; import { Store } from "@ngrx/store"; -import { MockStore, MockActivatedRoute, MockRouter } from "shared/MockStubs"; import { ActivatedRoute, Router } from "@angular/router"; +import { APP_CONFIG } from "app-config.module"; +import { MockStore, MockActivatedRoute, MockRouter } from "shared/MockStubs"; -describe("LoginLayoutComponent", () => { - let component: LoginLayoutComponent; - let fixture: ComponentFixture; +describe("AppMainLayoutComponent", () => { + let component: AppMainLayoutComponent; + let fixture: ComponentFixture; beforeEach(waitForAsync(() => { TestBed.configureTestingModule({ schemas: [NO_ERRORS_SCHEMA], - declarations: [LoginLayoutComponent, LoginHeaderComponent], - imports: [BreadcrumbModule, MatToolbarModule] + declarations: [AppMainLayoutComponent, AppHeaderComponent], + imports: [ + BreadcrumbModule, + MatMenuModule, + MatToolbarModule, + RouterTestingModule + ] }); - TestBed.overrideComponent(LoginHeaderComponent, { + TestBed.overrideComponent(AppHeaderComponent, { set: { providers: [{ provide: APP_CONFIG, useValue: { facility: "ESS" } }] } }); - TestBed.overrideComponent(LoginLayoutComponent, { + TestBed.overrideComponent(AppMainLayoutComponent, { set: { providers: [ { provide: Store, useClass: MockStore }, @@ -38,7 +45,7 @@ describe("LoginLayoutComponent", () => { })); beforeEach(() => { - fixture = TestBed.createComponent(LoginLayoutComponent); + fixture = TestBed.createComponent(AppMainLayoutComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/_layout/app-main-layout/app-main-layout.component.ts b/src/app/_layout/app-main-layout/app-main-layout.component.ts new file mode 100644 index 000000000..e3e1931ad --- /dev/null +++ b/src/app/_layout/app-main-layout/app-main-layout.component.ts @@ -0,0 +1,8 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "app-main-app-layout", + templateUrl: "./app-main-layout.component.html", + styleUrls: ["./app-main-layout.component.scss"] +}) +export class AppMainLayoutComponent {} diff --git a/src/app/_layout/layout.module.ts b/src/app/_layout/layout.module.ts index c7b07a009..870050155 100644 --- a/src/app/_layout/layout.module.ts +++ b/src/app/_layout/layout.module.ts @@ -7,20 +7,17 @@ import { MatIconModule } from "@angular/material/icon"; import { MatMenuModule } from "@angular/material/menu"; import { MatToolbarModule } from "@angular/material/toolbar"; import { RouterModule } from "@angular/router"; -import { AnonymousLayoutComponent } from "./anonymous-layout/anonymous-layout.component"; import { AppLayoutComponent } from "./app-layout/app-layout.component"; -import { LoginHeaderComponent } from "./login-header/login-header.component"; -import { LoginLayoutComponent } from "./login-layout/login-layout.component"; +import { AppMainLayoutComponent } from "./app-main-layout/app-main-layout.component"; import { BatchCardModule } from "datasets/batch-card/batch-card.module"; import { BreadcrumbModule } from "shared/modules/breadcrumb/breadcrumb.module"; +import {UsersModule} from "../users/users.module"; @NgModule({ declarations: [ - AnonymousLayoutComponent, - AppHeaderComponent, AppLayoutComponent, - LoginHeaderComponent, - LoginLayoutComponent + AppHeaderComponent, + AppMainLayoutComponent, ], imports: [ CommonModule, @@ -31,7 +28,8 @@ import { BreadcrumbModule } from "shared/modules/breadcrumb/breadcrumb.module"; MatMenuModule, MatToolbarModule, RouterModule, - BreadcrumbModule + BreadcrumbModule, + UsersModule, ], exports: [] }) diff --git a/src/app/_layout/login-header/_login-header-theme.scss b/src/app/_layout/login-header/_login-header-theme.scss deleted file mode 100644 index a3012a969..000000000 --- a/src/app/_layout/login-header/_login-header-theme.scss +++ /dev/null @@ -1,20 +0,0 @@ -@use "sass:map"; -@use "~@angular/material" as mat; - -@mixin color($theme) { - $color-config: mat.get-color-config($theme); - $primary: map.get($color-config, "primary"); - - mat-toolbar { - a { - color: mat.get-color-from-palette($primary, "default-contrast"); - } - } -} - -@mixin theme($theme) { - $color-config: mat.get-color-config($theme); - @if $color-config != null { - @include color($theme); - } -} diff --git a/src/app/_layout/login-header/login-header.component.html b/src/app/_layout/login-header/login-header.component.html deleted file mode 100644 index 331e496d2..000000000 --- a/src/app/_layout/login-header/login-header.component.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - -

- {{ status }} -

-
- - - - -
- - help - Help - -
-
- - -
- - info - About - -
-
- -
- - account_circle - Sign in - -
-
-
diff --git a/src/app/_layout/login-header/login-header.component.scss b/src/app/_layout/login-header/login-header.component.scss deleted file mode 100644 index cb57d29e4..000000000 --- a/src/app/_layout/login-header/login-header.component.scss +++ /dev/null @@ -1,33 +0,0 @@ -mat-toolbar { - position: sticky; - position: -webkit-sticky; - top: 0; - z-index: 1000; - height: 7vh; - - .logo { - height: 4vh; - margin-right: 1em; - padding-top: 0.5vh; - } - - .spacer { - flex: 1 1 auto; - } - - .toplink { - padding: 10px; - font: bold; - font-size: 11pt; - - mat-icon { - vertical-align: middle; - } - } -} - -@media only screen and (max-width: 1279px) { - .large-screen-text { - display: none; - } -} diff --git a/src/app/_layout/login-header/login-header.component.spec.ts b/src/app/_layout/login-header/login-header.component.spec.ts deleted file mode 100644 index 563e6cfaf..000000000 --- a/src/app/_layout/login-header/login-header.component.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; - -import { LoginHeaderComponent } from "./login-header.component"; -import { NO_ERRORS_SCHEMA } from "@angular/core"; -import { MatToolbarModule } from "@angular/material/toolbar"; -import { APP_CONFIG } from "app-config.module"; -import { MatIconModule } from "@angular/material/icon"; - -describe("LoginHeaderComponent", () => { - let component: LoginHeaderComponent; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - schemas: [NO_ERRORS_SCHEMA], - declarations: [LoginHeaderComponent], - imports: [MatIconModule, MatToolbarModule], - }); - TestBed.overrideComponent(LoginHeaderComponent, { - set: { - providers: [{ provide: APP_CONFIG, useValue: { facility: "ESS" } }], - }, - }); - TestBed.compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(LoginHeaderComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it("should create", () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/_layout/login-header/login-header.component.ts b/src/app/_layout/login-header/login-header.component.ts deleted file mode 100644 index 633c4f164..000000000 --- a/src/app/_layout/login-header/login-header.component.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { Component, Inject } from "@angular/core"; -import { APP_CONFIG, AppConfig } from "app-config.module"; - -@Component({ - selector: "app-login-header", - templateUrl: "./login-header.component.html", - styleUrls: ["./login-header.component.scss"] -}) -export class LoginHeaderComponent { - facility: string; - status: string; - - constructor(@Inject(APP_CONFIG) public appConfig: AppConfig) { - this.facility = appConfig.facility ?? ""; - if (appConfig.production === true) { - this.status = ""; - } else { - this.status = "test"; - } - } -} diff --git a/src/app/_layout/login-layout/login-layout.component.html b/src/app/_layout/login-layout/login-layout.component.html deleted file mode 100644 index bf0ddd824..000000000 --- a/src/app/_layout/login-layout/login-layout.component.html +++ /dev/null @@ -1,4 +0,0 @@ - -
- -
diff --git a/src/app/_layout/login-layout/login-layout.component.scss b/src/app/_layout/login-layout/login-layout.component.scss deleted file mode 100644 index 7a7fbf430..000000000 --- a/src/app/_layout/login-layout/login-layout.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.main { - height: 93vh; - - background-image: url("../../../assets/images/site.png"); - background-repeat: no-repeat; - background-size: cover; - background-position: center; -} diff --git a/src/app/_layout/login-layout/login-layout.component.ts b/src/app/_layout/login-layout/login-layout.component.ts deleted file mode 100644 index f4d560999..000000000 --- a/src/app/_layout/login-layout/login-layout.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from "@angular/core"; - -@Component({ - selector: "app-login-layout", - templateUrl: "./login-layout.component.html", - styleUrls: ["./login-layout.component.scss"], -}) -export class LoginLayoutComponent { - constructor() {} -} diff --git a/src/app/about/about/about.component.spec.ts b/src/app/about/about/about.component.spec.ts index 1f843853d..079bcc964 100644 --- a/src/app/about/about/about.component.spec.ts +++ b/src/app/about/about/about.component.spec.ts @@ -20,7 +20,7 @@ describe("AboutComponent", () => { { provide: APP_CONFIG, useValue: { - facility: "ESS" + facility: "" } } ] @@ -38,4 +38,28 @@ describe("AboutComponent", () => { it("should create", () => { expect(component).toBeTruthy(); }); + + it("should create about for ESS", () => { + const compare = component.aboutText; + component.appConfig.facility = "ESS"; + component.ngOnInit(); + + expect(component.aboutText).not.toEqual(compare); + }); + + it("should create about for PSI", () => { + const compare = component.aboutText; + component.appConfig.facility = "PSI"; + component.ngOnInit(); + + expect(component.aboutText).not.toEqual(compare); + }); + + it("should create about for MAX IV", () => { + const compare = component.aboutText; + component.appConfig.facility = "MAX IV"; + component.ngOnInit(); + + expect(component.aboutText).not.toEqual(compare); + }); }); diff --git a/src/app/app-routing/app-routing.module.ts b/src/app/app-routing/app-routing.module.ts index 694affd96..bb42da8e6 100644 --- a/src/app/app-routing/app-routing.module.ts +++ b/src/app/app-routing/app-routing.module.ts @@ -2,45 +2,10 @@ import { NgModule } from "@angular/core"; import { RouterModule, Routes } from "@angular/router"; import { ErrorPageComponent } from "shared/modules/error-page/error-page.component"; -import { LoginLayoutComponent } from "_layout/login-layout/login-layout.component"; import { AppLayoutComponent } from "_layout/app-layout/app-layout.component"; -import { AnonymousLayoutComponent } from "_layout/anonymous-layout/anonymous-layout.component"; +import { AppMainLayoutComponent } from "_layout/app-main-layout/app-main-layout.component"; export const routes: Routes = [ - { - path: "", - component: AnonymousLayoutComponent, - children: [ - { - path: "", - redirectTo: "anonymous/datasets", - pathMatch: "full", - }, - { - path: "anonymous/datasets", - loadChildren: () => import("./lazy/public-datasets-routing/public-datasets.feature.module").then( m => m.PublicDatasetsFeatureModule) - }, - { - path: "anonymous/about", - loadChildren: () => import("./lazy/about-routing/about.feature.module").then( m => m.AboutFeatureModule) - }, - { - path: "anonymous/help", - loadChildren: () => import("./lazy/help-routing/help.feature.module").then( m => m.HelpFeatureModule) - }, - ], - }, - { - path: "", - component: LoginLayoutComponent, - children: [ - { path: "", redirectTo: "/login", pathMatch: "full" }, - { - path: "login", - loadChildren: () => import("./lazy/login-routing/login.feature.module").then( m => m.LoginFeatureModule) - }, - ], - }, { path: "", component: AppLayoutComponent, @@ -51,59 +16,70 @@ export const routes: Routes = [ pathMatch: "full", }, { - path: "datasets", - loadChildren: () => import("./lazy/private-datasets-routing/private-datasets.feature.module").then( m => m.PrivateDatasetsFeatureModule) - }, - { - path: "files", - loadChildren: () => import("./lazy/file-routing/file.feature.module").then( m => m.FileFeatureModule) - }, - { - path: "instruments", - loadChildren: () => import("./lazy/instruments-routing/instruments.feature.module").then( m => m.InstrumentsFeatureModule) - }, - { - path: "proposals", - loadChildren: () => import("./lazy/proposal-routing/proposal.feature.module").then( m => m.ProposalFeatureModule) - }, - { - path: "publishedDatasets", - loadChildren: () => import("./lazy/publisheddata-routing/publisheddata.feature.module").then( m => m.PublisheddataFeatureModule) - }, - { - path: "samples", - loadChildren: () => import("./lazy/samples-routing/samples.feature.module").then( m => m.SamplesFeatureModule) + path: "login", + loadChildren: () => import("./lazy/login-routing/login.feature.module").then(m => m.LoginFeatureModule) }, { - path: "policies", - loadChildren: () => import("./lazy/policies-routing/policies.feature.module").then( m => m.PoliciesFeatureModule) - }, + path: "", + component: AppMainLayoutComponent, + children: [ - { - path: "user", - loadChildren: () => import("./lazy/user-routing/user.feature.module").then( m => m.UsersFeatureModule) - }, - { - path: "about", - loadChildren: () => import("./lazy/about-routing/about.feature.module").then( m => m.AboutFeatureModule) - }, - { - path: "help", - loadChildren: () => import("./lazy/help-routing/help.feature.module").then( m => m.HelpFeatureModule) - }, - { - path: "logbooks", - loadChildren: () => import("./lazy/logbooks-routing/logbooks.feature.module").then( m => m.LogbooksFeatureModule) - }, - { - path: "error", - component: ErrorPageComponent, - data: { errorTitle: "Location Not Found"}, - }, - { - path: "404", - component: ErrorPageComponent, - data: { errorTitle: "404 Page not found" , message: "Sorry, the page you are trying to view doesn't exist"} + { + path: "datasets", + loadChildren: () => import("./lazy/private-datasets-routing/private-datasets.feature.module").then(m => m.PrivateDatasetsFeatureModule) + }, + { + path: "files", + loadChildren: () => import("./lazy/file-routing/file.feature.module").then(m => m.FileFeatureModule) + }, + { + path: "instruments", + loadChildren: () => import("./lazy/instruments-routing/instruments.feature.module").then(m => m.InstrumentsFeatureModule) + }, + { + path: "proposals", + loadChildren: () => import("./lazy/proposal-routing/proposal.feature.module").then(m => m.ProposalFeatureModule) + }, + { + path: "publishedDatasets", + loadChildren: () => import("./lazy/publisheddata-routing/publisheddata.feature.module").then(m => m.PublisheddataFeatureModule) + }, + { + path: "samples", + loadChildren: () => import("./lazy/samples-routing/samples.feature.module").then(m => m.SamplesFeatureModule) + }, + { + path: "policies", + loadChildren: () => import("./lazy/policies-routing/policies.feature.module").then(m => m.PoliciesFeatureModule) + }, + + { + path: "user", + loadChildren: () => import("./lazy/user-routing/user.feature.module").then(m => m.UsersFeatureModule) + }, + { + path: "about", + loadChildren: () => import("./lazy/about-routing/about.feature.module").then(m => m.AboutFeatureModule) + }, + { + path: "help", + loadChildren: () => import("./lazy/help-routing/help.feature.module").then(m => m.HelpFeatureModule) + }, + { + path: "logbooks", + loadChildren: () => import("./lazy/logbooks-routing/logbooks.feature.module").then(m => m.LogbooksFeatureModule) + }, + { + path: "error", + component: ErrorPageComponent, + data: {errorTitle: "Location Not Found"}, + }, + { + path: "404", + component: ErrorPageComponent, + data: {errorTitle: "404 Page not found", message: "Sorry, the page you are trying to view doesn't exist"} + }, + ], }, ], }, diff --git a/src/app/app-routing/datasets.guard.ts b/src/app/app-routing/datasets.guard.ts index f1e1e7bbb..12134d686 100644 --- a/src/app/app-routing/datasets.guard.ts +++ b/src/app/app-routing/datasets.guard.ts @@ -21,7 +21,7 @@ export class DatasetsGuard implements CanActivate { .getCurrent() .toPromise() .catch(() => { - this.router.navigateByUrl("/anonymous" + state.url); + this.router.navigateByUrl("" + state.url); return false; }) .then(() => true); diff --git a/src/app/app-routing/lazy/private-datasets-routing/private-datasets.routing.module.ts b/src/app/app-routing/lazy/private-datasets-routing/private-datasets.routing.module.ts index 6ab4e06c9..f831a2603 100644 --- a/src/app/app-routing/lazy/private-datasets-routing/private-datasets.routing.module.ts +++ b/src/app/app-routing/lazy/private-datasets-routing/private-datasets.routing.module.ts @@ -1,7 +1,6 @@ import { NgModule } from "@angular/core"; import { RouterModule, Routes } from "@angular/router"; import { AuthGuard } from "app-routing/auth.guard"; -import { DatasetsGuard } from "app-routing/datasets.guard"; import { LeavingPageGuard } from "app-routing/pending-changes.guard"; import { BatchViewComponent } from "datasets/batch-view/batch-view.component"; import { DashboardComponent } from "datasets/dashboard/dashboard.component"; @@ -14,7 +13,6 @@ const routes: Routes = [ { path: "", component: DashboardComponent, - canActivate: [AuthGuard], }, { path: "batch", @@ -29,13 +27,12 @@ const routes: Routes = [ { path: ":id", component: DatasetDetailsDashboardComponent, - canActivate: [DatasetsGuard], canDeactivate: [LeavingPageGuard] }, { path: ":id/datablocks", component: DatablocksComponent, - canActivate: [DatasetsGuard], + canActivate: [AuthGuard], }, ]; @NgModule({ diff --git a/src/app/app-routing/lazy/public-datasets-routing/public-datasets.feature.module.ts b/src/app/app-routing/lazy/public-datasets-routing/public-datasets.feature.module.ts deleted file mode 100644 index 4ded23ba9..000000000 --- a/src/app/app-routing/lazy/public-datasets-routing/public-datasets.feature.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from "@angular/core"; -import { DatasetsModule } from "datasets/datasets.module"; -import { PublicDatasetsRoutingModule } from "./public-datasets.routing.module"; - -@NgModule({ - imports: [ - DatasetsModule, - PublicDatasetsRoutingModule - ] -}) -export class PublicDatasetsFeatureModule {} diff --git a/src/app/app-routing/lazy/public-datasets-routing/public-datasets.routing.module.ts b/src/app/app-routing/lazy/public-datasets-routing/public-datasets.routing.module.ts deleted file mode 100644 index e7342e9e5..000000000 --- a/src/app/app-routing/lazy/public-datasets-routing/public-datasets.routing.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from "@angular/core"; -import { RouterModule, Routes } from "@angular/router"; -import { AnonymousDashboardComponent } from "datasets/anonymous-dashboard/anonymous-dashboard.component"; -import { AnonymousDetailsDashboardComponent } from "datasets/anonymous-details-dashboard/anonymous-details-dashboard.component"; - -const routes: Routes = [ - { - path: "", - component: AnonymousDashboardComponent, - }, - { - path: ":id", - component: AnonymousDetailsDashboardComponent, - }, -]; -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], - providers: [], -}) -export class PublicDatasetsRoutingModule {} diff --git a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.html b/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.html deleted file mode 100644 index eb100b390..000000000 --- a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.html +++ /dev/null @@ -1,25 +0,0 @@ - - -
-
- -
-
- -
-
-
- - - - -
diff --git a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.scss b/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.scss deleted file mode 100644 index 2277c386c..000000000 --- a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.scss +++ /dev/null @@ -1,22 +0,0 @@ -mat-sidenav-container { - height: 100vh; - - mat-sidenav-content { - padding: 0.5em; - background-color: #ffffff; - - .action-column { - margin-top: 4em; - margin-right: 1em; - } - - .table-column { - margin-top: 1.5em; - } - } - - mat-sidenav.mat-drawer-opened, - mat-sidenav.mat-drawer-opening { - box-shadow: 0 0 0 0 !important; - } -} diff --git a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.spec.ts b/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.spec.ts deleted file mode 100644 index f0739f8d0..000000000 --- a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.spec.ts +++ /dev/null @@ -1,162 +0,0 @@ -import { - ComponentFixture, - TestBed, - inject, - waitForAsync, -} from "@angular/core/testing"; - -import { AnonymousDashboardComponent } from "./anonymous-dashboard.component"; -import { NO_ERRORS_SCHEMA } from "@angular/core"; -import { BrowserAnimationsModule } from "@angular/platform-browser/animations"; -import { StoreModule, Store } from "@ngrx/store"; -import { ActivatedRoute, Router } from "@angular/router"; -import { MockActivatedRoute, MockStore } from "shared/MockStubs"; -import { provideMockStore } from "@ngrx/store/testing"; -import { getHasPrefilledFilters } from "state-management/selectors/datasets.selectors"; -import { TableColumn, Dataset } from "state-management/models"; -import { SelectColumnEvent } from "datasets/dataset-table-settings/dataset-table-settings.component"; -import { - selectColumnAction, - deselectColumnAction, -} from "state-management/actions/user.actions"; -import { MatSidenav, MatSidenavModule } from "@angular/material/sidenav"; -import { MatCheckboxChange } from "@angular/material/checkbox"; - -describe("AnonymousDashboardComponent", () => { - let component: AnonymousDashboardComponent; - let fixture: ComponentFixture; - - const router = { - navigateByUrl: jasmine.createSpy("navigateByUrl"), - }; - let store: MockStore; - let dispatchSpy; - - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - schemas: [NO_ERRORS_SCHEMA], - imports: [ - BrowserAnimationsModule, - MatSidenavModule, - StoreModule.forRoot({}), - ], - declarations: [AnonymousDashboardComponent, MatSidenav], - providers: [ - provideMockStore({ - selectors: [{ selector: getHasPrefilledFilters, value: true }], - }), - ], - }); - TestBed.overrideComponent(AnonymousDashboardComponent, { - set: { - providers: [ - { provide: ActivatedRoute, useClass: MockActivatedRoute }, - { provide: Router, useValue: router }, - ], - }, - }); - TestBed.compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(AnonymousDashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - beforeEach(inject([Store], (mockStore: MockStore) => { - store = mockStore; - })); - - afterEach(() => { - jasmine.clock().uninstall(); - fixture.destroy(); - }); - - it("should create", () => { - expect(component).toBeTruthy(); - }); - - describe("#onSettingsClick()", () => { - it("should toggle the sideNav", () => { - const toggleSpy = spyOn(component.sideNav, "toggle"); - - component.onSettingsClick(); - - expect(toggleSpy).toHaveBeenCalled(); - }); - }); - - describe("#onCloseClick()", () => { - it("should close the sideNav", () => { - const closeSpy = spyOn(component.sideNav, "close"); - - component.onCloseClick(); - - expect(closeSpy).toHaveBeenCalled(); - }); - }); - - describe("#onSelectColumn()", () => { - const column: TableColumn = { - name: "test", - order: 0, - type: "standard", - enabled: false, - }; - - it("should dispatch a selectColumnAction if checkBoxChange.checked is true", () => { - dispatchSpy = spyOn(store, "dispatch"); - - const checkBoxChange = { - checked: true, - } as MatCheckboxChange; - - const event: SelectColumnEvent = { - checkBoxChange, - column, - }; - - component.onSelectColumn(event); - - expect(dispatchSpy).toHaveBeenCalledTimes(1); - expect(dispatchSpy).toHaveBeenCalledWith( - selectColumnAction({ name: column.name, columnType: column.type }) - ); - }); - - it("should dispatch a deselectColumnAction if checkBoxChange.checked is false", () => { - dispatchSpy = spyOn(store, "dispatch"); - - const checkBoxChange = { - checked: false, - } as MatCheckboxChange; - - const event: SelectColumnEvent = { - checkBoxChange, - column, - }; - - component.onSelectColumn(event); - - expect(dispatchSpy).toHaveBeenCalledTimes(1); - expect(dispatchSpy).toHaveBeenCalledWith( - deselectColumnAction({ name: column.name, columnType: column.type }) - ); - }); - }); - - describe("#onRowClick()", () => { - it("should navigate to a dataset", () => { - const dataset = new Dataset(); - component.onRowClick(dataset); - - expect(router.navigateByUrl).toHaveBeenCalledTimes(1); - expect(router.navigateByUrl).toHaveBeenCalledWith( - "/anonymous/datasets/" + encodeURIComponent(dataset.pid) - ); - }); - }); -}); diff --git a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.ts b/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.ts deleted file mode 100644 index 0289239fd..000000000 --- a/src/app/datasets/anonymous-dashboard/anonymous-dashboard.component.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { Component, OnInit, ViewChild, OnDestroy } from "@angular/core"; -import { Store, select } from "@ngrx/store"; -import { ActivatedRoute, Router } from "@angular/router"; -import { getColumns } from "state-management/selectors/user.selectors"; -import { map, filter, distinctUntilChanged, take } from "rxjs/operators"; -import { - getHasPrefilledFilters, - getDatasets, - getAnonymousFilters, -} from "state-management/selectors/datasets.selectors"; -import { - fetchMetadataKeysAction, - fetchFacetCountsAction, - prefillFiltersAction, - fetchDatasetsAction, -} from "state-management/actions/datasets.actions"; -import { combineLatest, Subscription } from "rxjs"; - -import deepEqual from "deep-equal"; - -import { DatasetFilters, Dataset } from "state-management/models"; -import { SelectColumnEvent } from "datasets/dataset-table-settings/dataset-table-settings.component"; -import { - selectColumnAction, - deselectColumnAction, -} from "state-management/actions/user.actions"; -import { MatSidenav } from "@angular/material/sidenav"; - -@Component({ - selector: "anonymous-dashboard", - templateUrl: "./anonymous-dashboard.component.html", - styleUrls: ["./anonymous-dashboard.component.scss"], -}) -export class AnonymousDashboardComponent implements OnInit, OnDestroy { - private readyToFetch$ = this.store.pipe( - select(getHasPrefilledFilters), - filter((has) => has) - ); - datasets$ = this.store.pipe(select(getDatasets)); - tableColumns$ = this.store - .pipe(select(getColumns)) - .pipe( - map((columns) => columns.filter((column) => column.name !== "select")) - ); - filters$ = this.store.pipe(select(getAnonymousFilters)); - - clearColumnSearch = false; - - subscriptions: Subscription[] = []; - - @ViewChild(MatSidenav, { static: false }) sideNav!: MatSidenav; - - constructor( - private store: Store, - private route: ActivatedRoute, - private router: Router - ) {} - - onSettingsClick(): void { - this.sideNav.toggle(); - if (this.sideNav.opened) { - this.clearColumnSearch = false; - } else { - this.clearColumnSearch = true; - } - } - - onCloseClick(): void { - this.clearColumnSearch = true; - this.sideNav.close(); - } - - onSelectColumn(event: SelectColumnEvent): void { - const { checkBoxChange, column } = event; - if (checkBoxChange.checked) { - this.store.dispatch( - selectColumnAction({ name: column.name, columnType: column.type }) - ); - } else if (!checkBoxChange.checked) { - this.store.dispatch( - deselectColumnAction({ name: column.name, columnType: column.type }) - ); - } - } - - onRowClick(dataset: Dataset): void { - const pid = encodeURIComponent(dataset.pid); - this.router.navigateByUrl("/anonymous/datasets/" + pid); - } - - ngOnInit() { - this.store.dispatch(fetchMetadataKeysAction()); - - this.subscriptions.push( - combineLatest([this.filters$, this.readyToFetch$]) - .pipe( - map(([filters, _]) => filters), - distinctUntilChanged(deepEqual) - ) - .subscribe((filters) => { - this.store.dispatch(fetchDatasetsAction()); - this.store.dispatch(fetchFacetCountsAction()); - this.router.navigate([""], { - queryParams: { args: JSON.stringify(filters) }, - }); - }) - ); - - this.subscriptions.push( - this.route.queryParams - .pipe( - map((params) => params.args as string), - take(1), - map((args) => (args ? JSON.parse(args) as DatasetFilters: {})) - ) - .subscribe((filters) => - this.store.dispatch(prefillFiltersAction({ values: filters })) - ) - ); - } - - ngOnDestroy() { - this.subscriptions.forEach((subscription) => subscription.unsubscribe()); - } -} diff --git a/src/app/datasets/anonymous-details-dashboard/_anonymous-details-dashboard-theme.scss b/src/app/datasets/anonymous-details-dashboard/_anonymous-details-dashboard-theme.scss deleted file mode 100644 index c6e8ec05a..000000000 --- a/src/app/datasets/anonymous-details-dashboard/_anonymous-details-dashboard-theme.scss +++ /dev/null @@ -1,19 +0,0 @@ -@use "sass:map"; -@use "~@angular/material" as mat; - -@mixin color($theme) { - $color-config: mat.get-color-config($theme); - $header-3: map.get($color-config, "header-3"); - - .jupyter-button { - background-color: mat.get-color-from-palette($header-3, "defualt"); - color: mat.get-color-from-palette($header-3, "default-contrast"); - } -} - -@mixin theme($theme) { - $color-config: mat.get-color-config($theme); - @if $color-config != null { - @include color($theme); - } -} diff --git a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.html b/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.html deleted file mode 100644 index 7b61bacf0..000000000 --- a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.html +++ /dev/null @@ -1,65 +0,0 @@ - - - - - details Details - - - - - - - - - - cloud_download Datafiles - -
- - -
-

No datafiles linked to this dataset

-
-
-
- - - - loop Lifecycle - - - - -
-
- - - - diff --git a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.scss b/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.scss deleted file mode 100644 index ceacb6b89..000000000 --- a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.scss +++ /dev/null @@ -1,7 +0,0 @@ -.jupyter-button { - margin: 1em 0 0 1em; -} - -.datafiles-container { - margin: 5em 1em; -} diff --git a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.spec.ts b/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.spec.ts deleted file mode 100644 index 2e51e2be1..000000000 --- a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.spec.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - ComponentFixture, - TestBed, - inject, - waitForAsync, -} from "@angular/core/testing"; - -import { AnonymousDetailsDashboardComponent } from "./anonymous-details-dashboard.component"; -import { NO_ERRORS_SCHEMA } from "@angular/core"; -import { AppConfigModule, APP_CONFIG } from "app-config.module"; -import { SharedCatanieModule } from "shared/shared.module"; -import { StoreModule, Store } from "@ngrx/store"; -import { ActivatedRoute, Router } from "@angular/router"; -import { MockActivatedRoute, MockStore } from "shared/MockStubs"; -import { - clearFacetsAction, - addKeywordFilterAction, -} from "state-management/actions/datasets.actions"; -import { MatTabsModule } from "@angular/material/tabs"; -import { MatIconModule } from "@angular/material/icon"; -import { MatButtonModule } from "@angular/material/button"; - -describe("AnonymousDetailsDashboardComponent", () => { - let component: AnonymousDetailsDashboardComponent; - let fixture: ComponentFixture; - - const router = { - navigateByUrl: jasmine.createSpy("navigateByUrl"), - }; - let store: MockStore; - let dispatchSpy; - - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - schemas: [NO_ERRORS_SCHEMA], - declarations: [AnonymousDetailsDashboardComponent], - imports: [ - AppConfigModule, - MatButtonModule, - MatIconModule, - MatTabsModule, - SharedCatanieModule, - StoreModule.forRoot({}), - ], - }); - TestBed.overrideComponent(AnonymousDetailsDashboardComponent, { - set: { - providers: [ - { provide: Router, useValue: router }, - { provide: APP_CONFIG, useValue: { editMetadataEnabled: true } }, - { provide: ActivatedRoute, useClass: MockActivatedRoute }, - ], - }, - }); - TestBed.compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(AnonymousDetailsDashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - beforeEach(inject([Store], (mockStore: MockStore) => { - store = mockStore; - })); - - afterEach(() => { - fixture.destroy(); - }); - - it("should create", () => { - expect(component).toBeTruthy(); - }); - - describe("#onClickKeyword()", () => { - it("should update datasets keyword filter and navigate to datasets table", () => { - dispatchSpy = spyOn(store, "dispatch"); - const keyword = "test"; - component.onClickKeyword(keyword); - - expect(dispatchSpy).toHaveBeenCalledTimes(2); - expect(dispatchSpy).toHaveBeenCalledWith(clearFacetsAction()); - expect(dispatchSpy).toHaveBeenCalledWith( - addKeywordFilterAction({ keyword }) - ); - expect(router.navigateByUrl).toHaveBeenCalledWith("/anonymous/datasets"); - }); - }); -}); diff --git a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.ts b/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.ts deleted file mode 100644 index 38376b828..000000000 --- a/src/app/datasets/anonymous-details-dashboard/anonymous-details-dashboard.component.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { Component, OnInit, Inject, OnDestroy } from "@angular/core"; -import { Router, ActivatedRoute } from "@angular/router"; -import { Store, select } from "@ngrx/store"; -import { - fetchDatasetAction, - clearFacetsAction, - addKeywordFilterAction -} from "state-management/actions/datasets.actions"; -import { - getCurrentDataset, - getCurrentOrigDatablocks, - getCurrentAttachments -} from "state-management/selectors/datasets.selectors"; -import { APP_CONFIG, AppConfig } from "app-config.module"; -import { Subscription } from "rxjs"; -import { fetchSampleAction } from "state-management/actions/samples.actions"; -import { fetchProposalAction } from "state-management/actions/proposals.actions"; -import { getCurrentSample } from "state-management/selectors/samples.selectors"; -import { getCurrentProposal } from "state-management/selectors/proposals.selectors"; -import { getIsLoading } from "state-management/selectors/user.selectors"; - -@Component({ - selector: "anonymous-details-dashboard", - templateUrl: "./anonymous-details-dashboard.component.html", - styleUrls: ["./anonymous-details-dashboard.component.scss"] -}) -export class AnonymousDetailsDashboardComponent implements OnInit, OnDestroy { - dataset$ = this.store.pipe(select(getCurrentDataset)); - loading$ = this.store.pipe(select(getIsLoading)); - origDatablocks$ = this.store.pipe(select(getCurrentOrigDatablocks)); - attachments$ = this.store.pipe(select(getCurrentAttachments)); - proposal$ = this.store.pipe(select(getCurrentProposal)); - sample$ = this.store.pipe(select(getCurrentSample)); - - datasetSubscription: Subscription = new Subscription(); - - constructor( - @Inject(APP_CONFIG) public appConfig: AppConfig, - private route: ActivatedRoute, - private router: Router, - private store: Store - ) {} - - onClickKeyword(keyword: string): void { - this.store.dispatch(clearFacetsAction()); - this.store.dispatch(addKeywordFilterAction({ keyword })); - this.router.navigateByUrl("/anonymous/datasets"); - } - - ngOnInit() { - const pid = this.route.snapshot.params.id; - this.store.dispatch(fetchDatasetAction({ pid })); - - this.datasetSubscription = this.dataset$.subscribe(dataset => { - if (dataset) { - if ("proposalId" in dataset) { - this.store.dispatch( - fetchProposalAction({ proposalId: dataset["proposalId"] }) - ); - } - if ("sampleId" in dataset) { - this.store.dispatch( - fetchSampleAction({ sampleId: dataset["sampleId"] }) - ); - } - } - }); - } - - ngOnDestroy() { - this.datasetSubscription.unsubscribe(); - } -} diff --git a/src/app/datasets/anonymous-details/_anonymous-details-theme.scss b/src/app/datasets/anonymous-details/_anonymous-details-theme.scss deleted file mode 100644 index 4e3748a94..000000000 --- a/src/app/datasets/anonymous-details/_anonymous-details-theme.scss +++ /dev/null @@ -1,45 +0,0 @@ -@use "sass:map"; -@use "~@angular/material" as mat; - -@mixin color($theme) { - $color-config: mat.get-color-config($theme); - $primary: map.get($color-config, "primary"); - $header-1: map.get($color-config, "header-1"); - $accent: map.get($color-config, "accent"); - $header-2: map.get($color-config, "header-2"); - $header-3: map.get($color-config, "header-3"); - $header-4: map.get($color-config, "header-4"); - - mat-card { - .general-header { - background-color: mat.get-color-from-palette($primary, "lighter"); - } - - .creator-header { - background-color: mat.get-color-from-palette($header-1, "lighter"); - } - - .file-header { - background-color: mat.get-color-from-palette($accent, "lighter"); - } - - .related-header { - background-color: mat.get-color-from-palette($header-2, "lighter"); - } - - .derived-header { - background-color: mat.get-color-from-palette($header-3, "lighter"); - } - - .scientific-header { - background-color: mat.get-color-from-palette($header-4, "lighter"); - } - } -} - -@mixin theme($theme) { - $color-config: mat.get-color-config($theme); - @if $color-config != null { - @include color($theme); - } -} diff --git a/src/app/datasets/anonymous-details/anonymous-details.component.html b/src/app/datasets/anonymous-details/anonymous-details.component.html deleted file mode 100644 index e5d2f09d6..000000000 --- a/src/app/datasets/anonymous-details/anonymous-details.component.html +++ /dev/null @@ -1,227 +0,0 @@ -
-
- - -
- description -
- General Information -
- - - - - - - - - - - - - - - - - - - - - - - - - - -
Name{{ value }}
Description
PID{{ dataset.pid }}
Type{{ value }}
Creation Time{{ value | date: "yyyy-MM-dd HH:mm" }}
Keywords - - - {{ keyword }} - - -
-
- - - -
- person -
- Creator information -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Owner{{ value }}
Principal Investigator
Investigator{{ value }}
Orcid
Contact Email
Owner Group{{ value }}
Access Groups{{ value }}
-
- - - -
- folder -
- File information -
- - - - - - - - - - - - - - -
Source Folder{{ value }}
Size{{ value | filesize }}
Data Format{{ value }}
-
- - - -
- library_books -
- Related Documents -
- - - - - - - - - - - - - - - - - - - - - - -
Proposal{{ proposal.title }}
Sample{{ sample.description }}
Creation Location{{ value }}
Techniques -
- - {{ technique.name }} - - - , - -
-
Input Datasets - -
-
- - - -
- analytics -
- Derived Data -
- - - - - - - - - - - - - - -
Software Used{{ value }}
Job Parameters{{ value | json }}
Job Log Data{{ value }}
-
- - - -
- science -
- Scientific Metadata -
- - -
- - -
-
- - - - -
-
- -
- - - -

{{ da.caption }}

-
-
-
-
diff --git a/src/app/datasets/anonymous-details/anonymous-details.component.scss b/src/app/datasets/anonymous-details/anonymous-details.component.scss deleted file mode 100644 index 71dd6b148..000000000 --- a/src/app/datasets/anonymous-details/anonymous-details.component.scss +++ /dev/null @@ -1,29 +0,0 @@ -mat-card { - margin: 1em; - - .section-icon { - height: auto !important; - width: auto !important; - - mat-icon { - vertical-align: middle; - } - } - - table { - th { - min-width: 10em; - padding-right: 0.5em; - text-align: left; - } - - td { - width: 100%; - padding: 0.5em; - - mat-chip:hover { - cursor: pointer; - } - } - } -} diff --git a/src/app/datasets/anonymous-details/anonymous-details.component.spec.ts b/src/app/datasets/anonymous-details/anonymous-details.component.spec.ts deleted file mode 100644 index ffdc04615..000000000 --- a/src/app/datasets/anonymous-details/anonymous-details.component.spec.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ComponentFixture, TestBed, waitForAsync } from "@angular/core/testing"; - -import { AnonymousDetailsComponent } from "./anonymous-details.component"; -import { NO_ERRORS_SCHEMA } from "@angular/core"; -import { AppConfigModule } from "app-config.module"; -import { LinkyPipe } from "ngx-linky"; -import { SharedCatanieModule } from "shared/shared.module"; -import { MatCardModule } from "@angular/material/card"; -import { MatIconModule } from "@angular/material/icon"; -import { MatChipsModule } from "@angular/material/chips"; -import { NgxJsonViewerModule } from "ngx-json-viewer"; - -describe("AnonymousDetailsComponent", () => { - let component: AnonymousDetailsComponent; - let fixture: ComponentFixture; - - beforeEach( - waitForAsync(() => { - TestBed.configureTestingModule({ - schemas: [NO_ERRORS_SCHEMA], - declarations: [AnonymousDetailsComponent, LinkyPipe], - imports: [ - AppConfigModule, - MatCardModule, - MatChipsModule, - MatIconModule, - NgxJsonViewerModule, - SharedCatanieModule, - ], - }).compileComponents(); - }) - ); - - beforeEach(() => { - fixture = TestBed.createComponent(AnonymousDetailsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it("should create", () => { - expect(component).toBeTruthy(); - }); - - describe("#onClickKeyword()", () => { - it("should emit an event", () => { - spyOn(component.clickKeyword, "emit"); - - const keyword = "test"; - component.onClickKeyword(keyword); - - expect(component.clickKeyword.emit).toHaveBeenCalledTimes(1); - expect(component.clickKeyword.emit).toHaveBeenCalledWith(keyword); - }); - }); -}); diff --git a/src/app/datasets/anonymous-details/anonymous-details.component.ts b/src/app/datasets/anonymous-details/anonymous-details.component.ts deleted file mode 100644 index 5c684acbc..000000000 --- a/src/app/datasets/anonymous-details/anonymous-details.component.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { Component, Inject, Input, Output, EventEmitter } from "@angular/core"; -import { APP_CONFIG, AppConfig } from "app-config.module"; -import { Dataset, Attachment, Proposal, Sample } from "shared/sdk"; - -@Component({ - selector: "anonymous-details", - templateUrl: "./anonymous-details.component.html", - styleUrls: ["./anonymous-details.component.scss"] -}) -export class AnonymousDetailsComponent { - @Input() dataset: Dataset | undefined; - @Input() attachments: Attachment[] | null | undefined; - @Input() proposal: Proposal | null | undefined; - @Input() sample: Sample | null | undefined; - - @Output() clickKeyword = new EventEmitter(); - - constructor(@Inject(APP_CONFIG) public appConfig: AppConfig) {} - - onClickKeyword(keyword: string): void { - this.clickKeyword.emit(keyword); - } -} diff --git a/src/app/datasets/dashboard/dashboard.component.html b/src/app/datasets/dashboard/dashboard.component.html index edfc01147..0045cf1f3 100644 --- a/src/app/datasets/dashboard/dashboard.component.html +++ b/src/app/datasets/dashboard/dashboard.component.html @@ -1,27 +1,31 @@ +
+ + + add_circle + Create Dataset + - - add_circle - Create Dataset - - -
- -
+
+ +
+
- + + + { selectors: [ { selector: getSelectedDatasets, value: [] }, { selector: getColumns, value: [] }, + { selector: getIsLoggedIn, value: false }, ], }), ], @@ -118,6 +119,22 @@ describe("DashboardComponent", () => { expect(toggleSpy).toHaveBeenCalled(); }); + + it("should not clear the search column if sidenav is open", () => { + component.sideNav.opened = false; + // The opened status is toggled when onSettingsClick is called + component.onSettingsClick(); + + expect(component.clearColumnSearch).toEqual(false); + }); + + it("should clear the search column if sidenav is closed", () => { + component.sideNav.opened = true; + // The opened status is toggled when onSettingsClick is called + component.onSettingsClick(); + + expect(component.clearColumnSearch).toEqual(true); + }); }); describe("#onCloseClick()", () => { @@ -241,4 +258,30 @@ describe("DashboardComponent", () => { expect(dispatchSpy).toHaveBeenCalledWith(addDatasetAction({ dataset })); }); }); + + describe("#updateColumnSubscription()", () => { + it("should navigate to a dataset", () => { + const testColumn: TableColumn = { + name: "test", + order: 0, + type: "standard", + enabled: false, + }; + const selectColumn: TableColumn = { + name: "select", + order: 1, + type: "standard", + enabled: false, + }; + getColumns.setResult([testColumn, selectColumn]); + getIsLoggedIn.setResult(true); + component.updateColumnSubscription(); + + component.tableColumns$.subscribe(result => expect(result.length).toEqual(2)); + + getIsLoggedIn.setResult(false); + component.updateColumnSubscription(); + component.tableColumns$.subscribe(result => expect(result).toEqual([testColumn])); + }); + }); }); diff --git a/src/app/datasets/dashboard/dashboard.component.ts b/src/app/datasets/dashboard/dashboard.component.ts index 6e8604ebc..1313dce98 100644 --- a/src/app/datasets/dashboard/dashboard.component.ts +++ b/src/app/datasets/dashboard/dashboard.component.ts @@ -33,6 +33,7 @@ import { getProfile, getCurrentUser, getColumns, + getIsLoggedIn, } from "state-management/selectors/user.selectors"; import { Dataset, DerivedDataset } from "shared/sdk"; import { @@ -52,11 +53,13 @@ export class DashboardComponent implements OnInit, OnDestroy { select(getHasPrefilledFilters), filter((has) => has) ); + loggedIn$ = this.store.pipe(select(getIsLoggedIn)); selectedSets$ = this.store.pipe(select(getSelectedDatasets)); - tableColumns$ = this.store.pipe(select(getColumns)); - selectableColumns$ = this.tableColumns$.pipe( - map((columns) => columns.filter((column) => column.name !== "select")) - ); + tableColumns$ = this.store.pipe(select(getColumns)).pipe( + map((columns) => columns.filter((column) => column.name !== "select")) + ); + selectableColumns$ = this.store.pipe(select(getColumns)) + .pipe(map((columns) => columns.filter((column) => column.name !== "select"))); public nonEmpty$ = this.store.pipe( select(getDatasetsInBatch), map((batch) => batch.length > 0) @@ -149,21 +152,37 @@ export class DashboardComponent implements OnInit, OnDestroy { }); } + updateColumnSubscription(): void { + this.subscriptions.push( + this.loggedIn$.subscribe(status => { + if (!status) { + this.tableColumns$ = this.store.pipe(select(getColumns)).pipe( + map((columns) => columns.filter((column) => column.name !== "select")) + ); + } else { + this.tableColumns$ = this.store.pipe(select(getColumns)); + } + } + )); + } + ngOnInit() { this.store.dispatch(prefillBatchAction()); this.store.dispatch(fetchMetadataKeysAction()); + this.updateColumnSubscription(); + this.subscriptions.push( - combineLatest([this.filters$, this.readyToFetch$]) + combineLatest([this.filters$, this.readyToFetch$, this.loggedIn$]) .pipe( - map(([filters, _]) => filters), + map(([filters, _, loggedIn]) => [filters, loggedIn]), distinctUntilChanged(deepEqual) ) - .subscribe((filters) => { + .subscribe((obj) => { this.store.dispatch(fetchDatasetsAction()); this.store.dispatch(fetchFacetCountsAction()); this.router.navigate(["/datasets"], { - queryParams: { args: JSON.stringify(filters) }, + queryParams: { args: JSON.stringify(obj[0]) }, }); }) ); diff --git a/src/app/datasets/dataset-detail/dataset-detail.component.html b/src/app/datasets/dataset-detail/dataset-detail.component.html index de773fd26..694ef6c05 100644 --- a/src/app/datasets/dataset-detail/dataset-detail.component.html +++ b/src/app/datasets/dataset-detail/dataset-detail.component.html @@ -35,14 +35,14 @@ {{ keyword }} - cancel + cancel - + Add Keyword add @@ -156,20 +156,22 @@ - -
Proposal - {{ proposal.title }} + + {{ proposal.title }} + {{ proposal.title }}
Sample - {{ - sample.description - }} + + + {{ sample.description}} + + {{ sample.description}} edit @@ -247,19 +249,23 @@ - + +
+ + +
+
+ list View -
- - -
+ +
- + edit Edit @@ -285,8 +291,7 @@ >
- - + diff --git a/src/app/datasets/dataset-detail/dataset-detail.component.scss b/src/app/datasets/dataset-detail/dataset-detail.component.scss index dc67b8ba2..6a6b825b6 100644 --- a/src/app/datasets/dataset-detail/dataset-detail.component.scss +++ b/src/app/datasets/dataset-detail/dataset-detail.component.scss @@ -1,6 +1,11 @@ mat-card { margin: 1em; + .mat-card-header { + padding: 0.25rem 0.5rem; + margin: -0.5rem -0.5rem 0 -0.5rem; + } + .section-icon { height: auto !important; width: auto !important; @@ -12,17 +17,17 @@ mat-card { table { th { - min-width: 10em; - padding-right: 0.5em; + min-width: 10rem; + padding-right: 0.5rem; text-align: left; } td { width: 100%; - padding: 0.5em; + padding: 0.5rem; .sample-edit { - padding-left: 0.5em; + padding-left: 0.5rem; mat-icon { font-size: medium; @@ -44,7 +49,7 @@ mat-card { } .done-edit-button { - margin-left: 1em; + margin-left: 1rem; } } } diff --git a/src/app/datasets/dataset-detail/dataset-detail.component.ts b/src/app/datasets/dataset-detail/dataset-detail.component.ts index 8e80300dc..6c30e5026 100644 --- a/src/app/datasets/dataset-detail/dataset-detail.component.ts +++ b/src/app/datasets/dataset-detail/dataset-detail.component.ts @@ -24,6 +24,7 @@ export class DatasetDetailComponent { @Input() proposal: Proposal | null = null; @Input() sample: Sample | null = null; @Input() isPI = false; + @Input() editingAllowed = false; @Output() clickKeyword = new EventEmitter(); @Output() addKeyword = new EventEmitter(); diff --git a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.html b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.html index 19cb30d86..49814bd0a 100644 --- a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.html +++ b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.html @@ -32,9 +32,10 @@
- - - @@ -75,35 +68,37 @@

No datafiles linked to this dataset

- - - tune Reduce - - - + + + + tune Reduce + + + - - - insert_photo Attachments - + + + insert_photo Attachments + -
- -
-
+
+ +
+
- - - book Logbook - - - + + + book Logbook + + + +
diff --git a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts index b045e4b21..f9d8c89af 100644 --- a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts +++ b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.spec.ts @@ -96,6 +96,17 @@ describe("DetailsDashboardComponent", () => { }); describe("#isPI()", () => { + it("should return true if user username is admin", () => { + component.user = new User({ + username: "admin", + email: "test@email.com" + }); + + const isPI = component.isPI(); + + expect(isPI).toEqual(true); + }); + it("should return true if user email equals principalInvestigator of a raw dataset", () => { component.user = new User({ email: "test@email.com" }); component.dataset = new Dataset({ @@ -187,6 +198,14 @@ describe("DetailsDashboardComponent", () => { expect(isPI).toEqual(false); }); + + it("should return false if no user is provided", () => { + component.user = undefined; + + const isPI = component.isPI(); + + expect(isPI).toEqual(false); + }); }); describe("#onSlidePublic()", () => { @@ -222,6 +241,18 @@ describe("DetailsDashboardComponent", () => { }); describe("#onAddKeyword()", () => { + it("should add property keywords if it does not exist already", () => { + dispatchSpy = spyOn(store, "dispatch"); + + const keyword = "test"; + const pid = "testPid"; + component.dataset = new Dataset(); + component.dataset.pid = pid; + component.onAddKeyword(keyword); + + expect(component.dataset.keywords).toBeTruthy(); + }); + it("should do nothing if keyword already exists", () => { dispatchSpy = spyOn(store, "dispatch"); diff --git a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts index bf187e796..62e7f97f6 100644 --- a/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts +++ b/src/app/datasets/dataset-details-dashboard/dataset-details-dashboard.component.ts @@ -30,6 +30,7 @@ import { getCurrentUser, getProfile, getIsLoading, + getIsLoggedIn, } from "state-management/selectors/user.selectors"; import { ActivatedRoute, Router } from "@angular/router"; import { Subscription, Observable, fromEvent, combineLatest } from "rxjs"; @@ -90,6 +91,7 @@ export class DatasetDetailsDashboardComponent map((profile) => (profile ? profile.accessGroups : [])) ); loading$ = this.store.pipe(select(getIsLoading)); + loggedIn$ = this.store.pipe(select(getIsLoggedIn)); jwt$: Observable = new Observable(); dataset: Dataset | undefined; user: User | undefined; @@ -113,24 +115,26 @@ export class DatasetDetailsDashboardComponent } isPI(): boolean { - if (this.user.username === "admin") { - return true; - } - if (this.dataset.type === "raw") { - return ( - this.user.email.toLowerCase() === - ((this.dataset as unknown) as RawDataset)[ - "principalInvestigator" - ].toLowerCase() - ); - } - if (this.dataset.type === "derived") { - return ( - this.user.email.toLowerCase() === - ((this.dataset as unknown) as DerivedDataset)[ - "investigator" - ].toLowerCase() - ); + if (this.user) { + if (this.user.username === "admin") { + return true; + } + if (this.dataset.type === "raw") { + return ( + this.user.email.toLowerCase() === + ((this.dataset as unknown) as RawDataset)[ + "principalInvestigator" + ].toLowerCase() + ); + } + if (this.dataset.type === "derived") { + return ( + this.user.email.toLowerCase() === + ((this.dataset as unknown) as DerivedDataset)[ + "investigator" + ].toLowerCase() + ); + } } return false; } diff --git a/src/app/datasets/dataset-table-actions/dataset-table-actions.component.html b/src/app/datasets/dataset-table-actions/dataset-table-actions.component.html index 0c6795876..a8816ee9c 100644 --- a/src/app/datasets/dataset-table-actions/dataset-table-actions.component.html +++ b/src/app/datasets/dataset-table-actions/dataset-table-actions.component.html @@ -2,13 +2,13 @@ - + My Data - - Public Data + + All Public Data { let _method: string = "GET"; @@ -898,7 +898,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {any} id Dataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -993,7 +993,7 @@ export class DatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countTechniquesList(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1014,7 +1014,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {any} id Dataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1109,7 +1109,7 @@ export class DatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countSamples(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1130,7 +1130,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {any} id Dataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1225,7 +1225,7 @@ export class DatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countDatablocks(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1246,7 +1246,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {any} id Dataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1341,7 +1341,7 @@ export class DatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countOrigdatablocks(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1362,7 +1362,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {any} id Dataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1457,7 +1457,7 @@ export class DatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countAttachments(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1536,13 +1536,13 @@ export class DatasetApi extends BaseLoopBackApi { } /** - * Return facet counts relevant for the given selected subset of datasets. + * Return facet counts relevant for the given selected subset of datasets. * * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. * * @param {any} facets Defines list of field names, for which facet counts should be calculated * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1573,7 +1573,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {object} limits Define further query parameters like skip, limit, order * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1631,7 +1631,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {object} data Request data. * - * - `datasetId` – `{string}` - + * - `datasetId` – `{string}` - * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1654,37 +1654,6 @@ export class DatasetApi extends BaseLoopBackApi { return result; } - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `Dataset` object.) - * - */ - public anonymousquery(fields: any = {}, limits: any = {}, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() + - "/Datasets/anonymousquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== 'undefined' && fields !== null) _urlParams.fields = fields; - if (typeof limits !== 'undefined' && limits !== null) _urlParams.limits = limits; - let result = this.request(_method, _url, _routeParams, _urlParams, _postBody, null, customHeaders); - return result; - } - /** * Sends a post request for Dataset reduction to OpenWhisk * @@ -1716,7 +1685,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {object} data Request data. * - * - `id` – `{string}` - + * - `id` – `{string}` - * * - `fieldName` – `{string}` - Name of field to append data to * @@ -1753,7 +1722,7 @@ export class DatasetApi extends BaseLoopBackApi { * * @param {object} limits Define further query parameters like skip, limit, order * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1782,7 +1751,7 @@ export class DatasetApi extends BaseLoopBackApi { * (The remote method definition does not provide any description.) * * - * @param {string} id + * @param {string} id * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned diff --git a/src/app/shared/sdk/services/custom/DerivedDataset.ts b/src/app/shared/sdk/services/custom/DerivedDataset.ts index 301fafaf4..6cb8641e3 100644 --- a/src/app/shared/sdk/services/custom/DerivedDataset.ts +++ b/src/app/shared/sdk/services/custom/DerivedDataset.ts @@ -137,7 +137,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -257,7 +257,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -752,7 +752,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -782,7 +782,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -877,7 +877,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countHistoryList(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -898,7 +898,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -993,7 +993,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countTechniquesList(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1014,7 +1014,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1109,7 +1109,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countSamples(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1130,7 +1130,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1225,7 +1225,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countDatablocks(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1246,7 +1246,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1341,7 +1341,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countOrigdatablocks(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1362,7 +1362,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {any} id DerivedDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1457,7 +1457,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countAttachments(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1536,13 +1536,13 @@ export class DerivedDatasetApi extends BaseLoopBackApi { } /** - * Return facet counts relevant for the given selected subset of datasets. + * Return facet counts relevant for the given selected subset of datasets. * * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. * * @param {any} facets Defines list of field names, for which facet counts should be calculated * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1573,7 +1573,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {object} limits Define further query parameters like skip, limit, order * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1631,7 +1631,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {object} data Request data. * - * - `datasetId` – `{string}` - + * - `datasetId` – `{string}` - * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1654,37 +1654,6 @@ export class DerivedDatasetApi extends BaseLoopBackApi { return result; } - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `DerivedDataset` object.) - * - */ - public anonymousquery(fields: any = {}, limits: any = {}, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() + - "/DerivedDatasets/anonymousquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== 'undefined' && fields !== null) _urlParams.fields = fields; - if (typeof limits !== 'undefined' && limits !== null) _urlParams.limits = limits; - let result = this.request(_method, _url, _routeParams, _urlParams, _postBody, null, customHeaders); - return result; - } - /** * Sends a post request for Dataset reduction to OpenWhisk * @@ -1716,7 +1685,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {object} data Request data. * - * - `id` – `{string}` - + * - `id` – `{string}` - * * - `fieldName` – `{string}` - Name of field to append data to * @@ -1753,7 +1722,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * * @param {object} limits Define further query parameters like skip, limit, order * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1782,7 +1751,7 @@ export class DerivedDatasetApi extends BaseLoopBackApi { * (The remote method definition does not provide any description.) * * - * @param {string} id + * @param {string} id * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned diff --git a/src/app/shared/sdk/services/custom/RawDataset.ts b/src/app/shared/sdk/services/custom/RawDataset.ts index 6eb0f1fda..548ab6a30 100644 --- a/src/app/shared/sdk/services/custom/RawDataset.ts +++ b/src/app/shared/sdk/services/custom/RawDataset.ts @@ -138,7 +138,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -258,7 +258,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -474,7 +474,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -504,7 +504,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -813,7 +813,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {boolean} refresh + * @param {boolean} refresh * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -843,7 +843,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -938,7 +938,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countHistoryList(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -959,7 +959,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1054,7 +1054,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countTechniquesList(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1075,7 +1075,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1170,7 +1170,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countSamples(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1191,7 +1191,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1286,7 +1286,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countDatablocks(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1307,7 +1307,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1402,7 +1402,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countOrigdatablocks(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1423,7 +1423,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {any} id RawDataset id * - * @param {object} filter + * @param {object} filter * * @returns {object[]} An empty reference that will be * populated with the actual data once the response is returned @@ -1518,7 +1518,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * Data properties: * - * - `count` – `{number}` - + * - `count` – `{number}` - */ public countAttachments(id: any, where: any = {}, customHeaders?: Function): Observable { let _method: string = "GET"; @@ -1597,13 +1597,13 @@ export class RawDatasetApi extends BaseLoopBackApi { } /** - * Return facet counts relevant for the given selected subset of datasets. + * Return facet counts relevant for the given selected subset of datasets. * * @param {object} fields Define the filter conditions by specifying the name and values of fields. There ia also support for a `text` search to look for strngs anywhere in the dataset. * * @param {any} facets Defines list of field names, for which facet counts should be calculated * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1634,7 +1634,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {object} limits Define further query parameters like skip, limit, order * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1692,7 +1692,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {object} data Request data. * - * - `datasetId` – `{string}` - + * - `datasetId` – `{string}` - * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1715,37 +1715,6 @@ export class RawDatasetApi extends BaseLoopBackApi { return result; } - /** - * Return datasets fulfilling complex filter conditions, including from fields of joined models. - * - * @param {object} fields Define the filter conditions by specifying the name of values of fields requested. There ia also support for a `text` search to look for strings anywhere in the dataset. Skip and limit parameters allow for paging. - * - * @param {object} limits Define further query parameters like skip, limit, order - * - * @param {object} options - * - * @returns {object} An empty reference that will be - * populated with the actual data once the response is returned - * from the server. - * - * - * (The remote method definition does not provide any description. - * This usually means the response is a `RawDataset` object.) - * - */ - public anonymousquery(fields: any = {}, limits: any = {}, customHeaders?: Function): Observable { - let _method: string = "GET"; - let _url: string = LoopBackConfig.getPath() + "/" + LoopBackConfig.getApiVersion() + - "/RawDatasets/anonymousquery"; - let _routeParams: any = {}; - let _postBody: any = {}; - let _urlParams: any = {}; - if (typeof fields !== 'undefined' && fields !== null) _urlParams.fields = fields; - if (typeof limits !== 'undefined' && limits !== null) _urlParams.limits = limits; - let result = this.request(_method, _url, _routeParams, _urlParams, _postBody, null, customHeaders); - return result; - } - /** * Sends a post request for Dataset reduction to OpenWhisk * @@ -1777,7 +1746,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {object} data Request data. * - * - `id` – `{string}` - + * - `id` – `{string}` - * * - `fieldName` – `{string}` - Name of field to append data to * @@ -1814,7 +1783,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * * @param {object} limits Define further query parameters like skip, limit, order * - * @param {object} options + * @param {object} options * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned @@ -1843,7 +1812,7 @@ export class RawDatasetApi extends BaseLoopBackApi { * (The remote method definition does not provide any description.) * * - * @param {string} id + * @param {string} id * * @returns {object} An empty reference that will be * populated with the actual data once the response is returned diff --git a/src/app/state-management/actions/datasets.actions.ts b/src/app/state-management/actions/datasets.actions.ts index 4fe794a0b..163a8b3e6 100644 --- a/src/app/state-management/actions/datasets.actions.ts +++ b/src/app/state-management/actions/datasets.actions.ts @@ -177,7 +177,7 @@ export const setArchiveViewModeAction = createAction( ); export const setPublicViewModeAction = createAction( "[Dataset] Set Public View Mode", - props<{ isPublished: boolean }>() + props<{ isPublished: boolean | ""}>() ); export const prefillFiltersAction = createAction( diff --git a/src/app/state-management/models/index.ts b/src/app/state-management/models/index.ts index 7217e009f..cddf0e9bf 100644 --- a/src/app/state-management/models/index.ts +++ b/src/app/state-management/models/index.ts @@ -107,7 +107,7 @@ export interface DatasetFilters extends GenericFilters { keywords: string[]; mode: Record; scientific: ScientificCondition[]; - isPublished: boolean; + isPublished: boolean | ""; } export interface SampleFilters extends GenericFilters { diff --git a/src/app/state-management/selectors/datasets.selectors.spec.ts b/src/app/state-management/selectors/datasets.selectors.spec.ts index 6aabb1542..a36a10a2d 100644 --- a/src/app/state-management/selectors/datasets.selectors.spec.ts +++ b/src/app/state-management/selectors/datasets.selectors.spec.ts @@ -116,16 +116,6 @@ describe("test dataset selectors", () => { }); }); - describe("getAnonymousFilters", () => { - it("should get the dataset filters, isPublished excluded", () => { - const { isPublished, ...anonymousFilters } = initialDatasetState.filters; - - expect( - fromDatasetSelectors.getAnonymousFilters.projector(initialDatasetState) - ).toEqual(anonymousFilters); - }); - }); - describe("getTextFilter", () => { it("should get the text filter", () => { expect( diff --git a/src/app/state-management/selectors/datasets.selectors.ts b/src/app/state-management/selectors/datasets.selectors.ts index e02d5eab0..d8bcb937f 100644 --- a/src/app/state-management/selectors/datasets.selectors.ts +++ b/src/app/state-management/selectors/datasets.selectors.ts @@ -56,14 +56,6 @@ export const getFilters = createSelector( (state: DatasetState) => state.filters ); -export const getAnonymousFilters = createSelector( - getDatasetState, - (state: DatasetState) => { - const { isPublished, ...filters } = state.filters; - return filters; - } -); - export const getTextFilter = createSelector( getFilters, (filters) => filters.text || "" @@ -173,7 +165,6 @@ export const getFullqueryParams = createSelector(getFilters, (filter) => { limit, sortField, modeToggle, - isPublished, ...theRest } = filter; const limits = { skip, limit, order: sortField }; @@ -187,7 +178,6 @@ export const getFullfacetParams = createSelector(getFilters, (filter) => { limit, sortField, modeToggle, - isPublished, ...theRest } = filter; const fields = restrictFilter(theRest); diff --git a/src/app/state-management/selectors/user.selectors.ts b/src/app/state-management/selectors/user.selectors.ts index 65c8508a8..2a9123286 100644 --- a/src/app/state-management/selectors/user.selectors.ts +++ b/src/app/state-management/selectors/user.selectors.ts @@ -35,7 +35,7 @@ export const getIsAdmin = createSelector( getCurrentUserName, getCurrentUserAccountType, (name, type) => - (name && ["admin", "archiveManager"].indexOf(name) !== -1) + (name && ["admin", "archiveManager", "ingestor"].indexOf(name) !== -1) ); export const getCatamelToken = createSelector( diff --git a/src/app/state-management/state/datasets.store.ts b/src/app/state-management/state/datasets.store.ts index 58a197aeb..980bb23fd 100644 --- a/src/app/state-management/state/datasets.store.ts +++ b/src/app/state-management/state/datasets.store.ts @@ -57,7 +57,7 @@ export const initialDatasetState: DatasetState = { sortField: "creationTime:desc", keywords: [], scientific: [], - isPublished: false + isPublished: "" }, batch: [], diff --git a/src/app/users/login/login.component.html b/src/app/users/login/login.component.html index 420eaf08b..2b53333f6 100644 --- a/src/app/users/login/login.component.html +++ b/src/app/users/login/login.component.html @@ -1,12 +1,13 @@ -