Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Custom website names, and capture logo and aspect ratio in Kubernetes #1062

Merged
merged 6 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions kubernetes/loculus/templates/_common-metadata.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ fields:
{{/* Generate website config from passed config object */}}
{{- define "loculus.generateWebsiteConfig" }}
name: {{ $.Values.name }}
logo: {{ $.Values.logo | toYaml | nindent 6 }}
accessionPrefix: {{ $.Values.accessionPrefix }}
{{- $commonMetadata := (include "loculus.commonMetadata" . | fromYaml).fields }}
instances:
Expand Down
4 changes: 4 additions & 0 deletions kubernetes/loculus/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ disablePreprocessing: false
siloImportLimitSeconds: 3600
accessionPrefix: "LOC_"
name: "Loculus"
logo:
url: "/favicon.svg"
width: 100
height: 100
instances:
dummy-organism:
schema:
Expand Down
2 changes: 1 addition & 1 deletion website/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function getConfigDir(): string {
return configDir;
}

function getWebsiteConfig(): WebsiteConfig {
export function getWebsiteConfig(): WebsiteConfig {
if (_config === null) {
_config = readTypedConfigFile('website_config.json', websiteConfig);
}
Expand Down
16 changes: 14 additions & 2 deletions website/src/layouts/BaseLayout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
import '../styles/base.scss';
import Navigation from '../components/Navigation/Navigation.astro';
import OrganismSelector from '../components/Navigation/OrganismSelector.astro';
import { getWebsiteConfig } from '../config';
import { navigationItems } from '../routes';
const websiteConfig = getWebsiteConfig();
const { name: websiteName, logo } = websiteConfig;

interface Props {
title: string;
Expand All @@ -26,8 +29,17 @@ const { title } = Astro.props;
<div class='flex justify-start'>
<div class='flex flex-col'>
<div class='flex flex-row pb-3'>
<a href='/'><img class='h-8 mr-4' src='/favicon.svg' alt='icon' /></a>
<a href='/' class='fancytitle mr-4'>Loculus</a>
<a href='/'
><img
fengelniederhammer marked this conversation as resolved.
Show resolved Hide resolved
class='h-8 mr-4'
src={logo.url}
theosanderson marked this conversation as resolved.
Show resolved Hide resolved
alt='icon'
style={{
aspectRatio: `${logo.width}/${logo.height}`,
}}
/></a
>
<a href='/' class='fancytitle mr-4'>{websiteName}</a>
</div>
<OrganismSelector />
</div>
Expand Down
8 changes: 8 additions & 0 deletions website/src/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,15 @@ export const instanceConfig = z.object({
});
export type InstanceConfig = z.infer<typeof instanceConfig>;

const logoConfig = z.object({
url: z.string(),
width: z.number(),
height: z.number(),
});

export const websiteConfig = z.object({
instances: z.record(instanceConfig),
name: z.string(),
logo: logoConfig,
});
export type WebsiteConfig = z.infer<typeof websiteConfig>;
2 changes: 2 additions & 0 deletions website/src/types/runtimeConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { z } from 'zod';

export const name = z.string().min(1);

const serviceUrls = z.object({
backendUrl: z.string(),
lapisUrls: z.record(z.string(), z.string()),
Expand Down
Loading