Skip to content

Commit

Permalink
Merge pull request #492 from SciCatProject/SWAP-3282-make-configurati…
Browse files Browse the repository at this point in the history
…on-injectable-into-backend

feat: use json instead of ts files for frontend configuration and theme
  • Loading branch information
nitrosx authored May 12, 2023
2 parents 14645c1 + 3c1aae3 commit 6222a30
Show file tree
Hide file tree
Showing 9 changed files with 171 additions and 168 deletions.
2 changes: 1 addition & 1 deletion src/admin/admin.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { getModelToken } from "@nestjs/mongoose";
import { Test, TestingModule } from "@nestjs/testing";
import { AdminService } from "./admin.service";
import config from "../config/frontend.config";
import config from "../config/frontend.config.json";

const mockConfig: Record<string, unknown> = config;

Expand Down
4 changes: 2 additions & 2 deletions src/admin/admin.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from "@nestjs/common";
import config from "../config/frontend.config";
import theme from "../config/frontend.theme";
import config from "../config/frontend.config.json";
import theme from "../config/frontend.theme.json";

@Injectable()
export class AdminService {
Expand Down
2 changes: 1 addition & 1 deletion src/auth/strategies/ldap.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as Strategy from "passport-ldapauth";
import Strategy from "passport-ldapauth";
import { Injectable, InternalServerErrorException } from "@nestjs/common";
import { PassportStrategy } from "@nestjs/passport";
import { ConfigService } from "@nestjs/config";
Expand Down
136 changes: 136 additions & 0 deletions src/config/frontend.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
{
"accessTokenPrefix": "Bearer ",
"addDatasetEnabled": true,
"archiveWorkflowEnabled": false,
"datasetReduceEnabled": true,
"editDatasetSampleEnabled": true,
"editMetadataEnabled": true,
"editPublishedData": false,
"editSampleEnabled": true,
"externalAuthEndpoint": "/api/v3/auth/msad",
"facility": "ESS",
"loginFacilityLabel": "ESS",
"loginLdapLabel": "Ldap",
"loginLocalLabel": "Local",
"loginFacilityEnabled": true,
"loginLdapEnabled": true,
"loginLocalEnabled": true,
"facilityLoginLabel": "ESS",
"localLoginLabel": "Local",
"fileColorEnabled": true,
"fileDownloadEnabled": true,
"gettingStarted": null,
"ingestManual": null,
"jobsEnabled": true,
"jsonMetadataEnabled": true,
"jupyterHubUrl": "https://jupyterhub.esss.lu.se/",
"landingPage": "doi.ess.eu/detail/",
"lbBaseURL": "",
"localColumns": [
{
"name": "select",
"order": 0,
"type": "standard",
"enabled": true
},
{
"name": "pid",
"order": 1,
"type": "standard",
"enabled": true
},
{
"name": "datasetName",
"order": 2,
"type": "standard",
"enabled": true
},
{
"name": "runNumber",
"order": 3,
"type": "standard",
"enabled": true
},
{
"name": "sourceFolder",
"order": 4,
"type": "standard",
"enabled": true
},
{
"name": "size",
"order": 5,
"type": "standard",
"enabled": true
},
{
"name": "creationTime",
"order": 6,
"type": "standard",
"enabled": true
},
{
"name": "type",
"order": 7,
"type": "standard",
"enabled": true
},
{
"name": "image",
"order": 8,
"type": "standard",
"enabled": true
},
{
"name": "metadata",
"order": 9,
"type": "standard",
"enabled": false
},
{
"name": "proposalId",
"order": 10,
"type": "standard",
"enabled": true
},
{
"name": "ownerGroup",
"order": 11,
"type": "standard",
"enabled": false
},
{
"name": "dataStatus",
"order": 12,
"type": "standard",
"enabled": false
}
],
"logbookEnabled": true,
"loginFormEnabled": true,
"maxDirectDownloadSize": 5000000000,
"metadataPreviewEnabled": true,
"metadataStructure": "",
"multipleDownloadAction": "https://scicatfileserver.esss.dk/zip",
"multipleDownloadEnabled": true,
"oAuth2Endpoints": [
{
"authURL": "api/v3/auth/oidc",
"displayText": "ESS One Identity"
}
],
"policiesEnabled": true,
"retrieveDestinations": [],
"riotBaseUrl": "http://scichat.esss.lu.se",
"scienceSearchEnabled": true,
"scienceSearchUnitsEnabled": true,
"searchPublicDataEnabled": true,
"searchSamples": true,
"sftpHost": "login.esss.dk",
"shareEnabled": true,
"shoppingCartEnabled": true,
"shoppingCartOnHeader": true,
"tableSciDataEnabled": true,
"datasetDetailsShowMissingProposalId": false,
"notificationInterceptorEnabled": true
}
135 changes: 0 additions & 135 deletions src/config/frontend.config.ts

This file was deleted.

12 changes: 6 additions & 6 deletions src/config/frontend.theme.ts → src/config/frontend.theme.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export default {
name: "light",
properties: {
{
"name": "light",
"properties": {
"--theme-primary-default": "#0099c8",
"--theme-primary-default-contrast": "#ffffff",
"--theme-primary-lighter": "#99d5e9",
Expand Down Expand Up @@ -54,6 +54,6 @@ export default {
"--theme-hover-lighter": "#e5e5e5",
"--theme-hover-lighter-contrast": "#000000",
"--theme-hover-darker": "#b2b2b2",
"--theme-hover-darker-contrast": "#000000",
},
};
"--theme-hover-darker-contrast": "#000000"
}
}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as session from "express-session";
import session from "express-session";
import { json } from "body-parser";
import { NestFactory } from "@nestjs/core";
import {
Expand Down
2 changes: 1 addition & 1 deletion test/jest-e2e-tests/accessGroups.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as request from "supertest";
import request from "supertest";
import { Test } from "@nestjs/testing";
import { INestApplication } from "@nestjs/common";
import { AppModule } from "src/app.module";
Expand Down
44 changes: 23 additions & 21 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictPropertyInitialization": false,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true
}
}
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"strictPropertyInitialization": false,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"target": "es2017",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"resolveJsonModule": true,
"esModuleInterop": true
}
}

0 comments on commit 6222a30

Please sign in to comment.