Skip to content

Commit

Permalink
Do some #1939 related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tiggles committed Nov 9, 2020
1 parent 344cbde commit c900dd7
Show file tree
Hide file tree
Showing 19 changed files with 66 additions and 65 deletions.
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Applications/Run.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import {
WithAppInvocation,
WithAppMetadata
} from ".";
import {PRODUCT_NAME} from "../../site.config.json";
import CONF from "../../site.config.json";
import {AppHeader} from "./View";
import {Parameter} from "./Widgets/Parameter";
import {RangeRef} from "./Widgets/RangeParameters";
Expand Down Expand Up @@ -1191,7 +1191,7 @@ export function importParameterDialog(importParameters: (file: File) => void, sh
/>
</Button>
<Button mt="6px" fullWidth onClick={() => (dialogStore.success(), showFileSelector())}>
Select file from {PRODUCT_NAME}
Select file from {CONF.PRODUCT_NAME}
</Button>
</div>
<Flex mt="20px">
Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Core.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ import {OutgoingApplications} from "Project/Grant/OutgoingApplications";
import {ProjectBrowser} from "Project/Grant/ProjectBrowser";
import {LandingPage} from "Project/Grant/LandingPage";
import Products from "Products/Products";
import {DEV_SITE} from "../site.config.json";
import CONF from "../site.config.json";

const NotFound = (): JSX.Element => (<MainContainer main={<div><h1>Not found.</h1></div>} />);

Expand All @@ -66,7 +66,7 @@ const Core = (): JSX.Element => (
<ErrorBoundary>
<Switch>
<Route exact path="/login" component={LoginPage} />
{inDevEnvironment() || window.location.host === DEV_SITE ?
{inDevEnvironment() || window.location.host === CONF.DEV_SITE ?
<Route exact path="/login/selection" component={LoginSelection} /> :
<Route exact path="/login/selection" component={LoginPage} />
}
Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Files/FileOperations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from "Utilities/FileUtilities";
import {addStandardDialog} from "UtilityComponents";
import * as UF from "UtilityFunctions";
import {PREVIEW_MAX_SIZE} from "../../site.config.json";
import CONF from "../../site.config.json";
import {
explainPersonalRepo,
promptDeleteRepository,
Expand Down Expand Up @@ -210,7 +210,7 @@ export const defaultFileOperations: FileOperation[] = [
if (!UF.isExtPreviewSupported(UF.extensionFromPath(files[0].path))) return true;
else if (!cb.permissions.requireForAll(files, AccessRight.READ)) return true;
else if (isAnyMockFile(files)) return true;
else if (!UF.inRange({status: files[0].size ?? 0, min: 1, max: PREVIEW_MAX_SIZE})) return true;
else if (!UF.inRange({status: files[0].size ?? 0, min: 1, max: CONF.PREVIEW_MAX_SIZE})) return true;
return false;
},
icon: "preview"
Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Files/FilePreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
isExtPreviewSupported,
ExtensionType,
} from "UtilityFunctions";
import {PREVIEW_MAX_SIZE} from "../../site.config.json";
import CONF from "../../site.config.json";
import SyntaxHighlighter from "react-syntax-highlighter";
import {BreadCrumbs} from "ui-components/Breadcrumbs";
import {useAsyncCommand, useAsyncWork} from "Authentication/DataHook";
Expand Down Expand Up @@ -59,7 +59,7 @@ function useFileContent(): {
snackbarStore.addFailure("Directories cannot be previewed.", false);
setError("Preview for folders not supported");
setDownloadButton(true);
} else if (stat.size! > PREVIEW_MAX_SIZE) {
} else if (stat.size! > CONF.PREVIEW_MAX_SIZE) {
snackbarStore.addFailure("File size too large. Download instead.", false);
setError("File size too large to preview.");
setDownloadButton(true);
Expand Down
6 changes: 3 additions & 3 deletions frontend-web/webclient/app/Files/LowLevelFileTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import * as FUtils from "Utilities/FileUtilities";
import * as UF from "UtilityFunctions";
import {buildQueryString} from "Utilities/URIUtilities";
import {addStandardDialog, FileIcon, ConfirmCancelButtons, shareDialog} from "UtilityComponents";
import {PREVIEW_MAX_SIZE} from "../../site.config.json";
import CONF from "../../site.config.json";
import {ListRow} from "ui-components/List";
import {
createRepository, isRepository, renameRepository, getProjectNames, isAdminOrPI, updatePermissionsPrompt
Expand Down Expand Up @@ -706,7 +706,7 @@ export const LowLevelFileTable: React.FunctionComponent<LowLevelFileTableProps>
)}
{!(props.previewEnabled && FUtils.isFilePreviewSupported(f)) ? null :
f.size != null
&& UF.inRange({status: f.size, max: PREVIEW_MAX_SIZE, min: 1}) ? (
&& UF.inRange({status: f.size, max: CONF.PREVIEW_MAX_SIZE, min: 1}) ? (
<Tooltip
wrapperOffsetLeft="0"
wrapperOffsetTop="4px"
Expand Down Expand Up @@ -943,7 +943,7 @@ const NameBox: React.FunctionComponent<NameBoxProps> = props => {
{fileName}
</BaseLink>
) : props.previewEnabled && FUtils.isFilePreviewSupported(props.file) && !beingRenamed &&
UF.inRange({status: props.file.size ?? 0, min: 1, max: PREVIEW_MAX_SIZE}) ?
UF.inRange({status: props.file.size ?? 0, min: 1, max: CONF.PREVIEW_MAX_SIZE}) ?
<Link to={FUtils.filePreviewQuery(props.file.path)}>{fileName}</Link> : fileName
}

Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Files/QuickLaunch.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ApplicationMetadata} from "Applications";
import {QUICK_LAUNCH_PRODUCT} from "../../site.config.json";
import CONF from "../../site.config.json";
import {Client} from "Authentication/HttpClientInstance";
import {History} from "history";
import {setLoading} from "Navigation/Redux/StatusActions";
Expand Down Expand Up @@ -48,7 +48,7 @@ export async function quickLaunchCallback(
}],
numberOfNodes: 1,
peers: [],
reservation: QUICK_LAUNCH_PRODUCT,
reservation: CONF.QUICK_LAUNCH_PRODUCT,
type: "start",
name: null,
parameters: {}
Expand Down
6 changes: 3 additions & 3 deletions frontend-web/webclient/app/Login/BG1.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from "react";
import {LOGIN_PRODUCT_NAME, VERSION_TEXT, PRODUCT_NAME} from "../../site.config.json";
import CONF from "../../site.config.json";

export function BG1(props: {selection?: boolean}): JSX.Element {
return (
Expand Down Expand Up @@ -50,10 +50,10 @@ export function BG1(props: {selection?: boolean}): JSX.Element {
</g>
<path d="M368.231,274.126l171.842,99.213l171.841,-99.213l1583.39,0l0,2300l-2295.31,0l0,-2300l368.231,0Z" fill="url(#_Linear11)" />
<text pointerEvents="none" x="722.462px" y="247.713px" fontFamily="'IBMPlexSans', 'IBM Plex Sans', sans-serif" fontSize={props.selection ? "80px" : "200px"} fill="#fff">
{props.selection ? LOGIN_PRODUCT_NAME : PRODUCT_NAME}
{props.selection ? CONF.LOGIN_PRODUCT_NAME : CONF.PRODUCT_NAME}
</text>
<text pointerEvents="none" x="1420px" y="350.713px" fontFamily="'IBMPlexSans', 'IBM Plex Sans', sans-serif" fontSize="80px" fill="#ff0024">
{VERSION_TEXT}
{CONF.VERSION_TEXT}
</text>
<defs>
<linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(85.7479,-26.9821,26.9821,85.7479,434.129,99.833)">
Expand Down
18 changes: 9 additions & 9 deletions frontend-web/webclient/app/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {TextSpan} from "ui-components/Text";
import {getQueryParamOrElse, RouterLocationProps, getQueryParam} from "Utilities/URIUtilities";
import {errorMessageOrDefault, preventDefault} from "UtilityFunctions";
import {Instructions} from "WebDav/Instructions";
import {PRODUCT_NAME, SITE_DOCUMENTATION_URL, SUPPORT_EMAIL, LOGIN_PAGE_PRODUCTS} from "../../site.config.json";
import CONF from "../../site.config.json";
import {BG1} from "./BG1";
import * as Heading from "ui-components/Heading";

Expand Down Expand Up @@ -254,7 +254,7 @@ export const LoginPage: React.FC<RouterLocationProps & {initialState?: any}> = p

{!isWebDav ? null : (
<LoginBox mb={32}>
You must re-authenticate with {PRODUCT_NAME} to use your files locally.
You must re-authenticate with {CONF.PRODUCT_NAME} to use your files locally.
</LoginBox>
)}
{enabledWayf && !challengeId && !isPasswordReset ? (
Expand Down Expand Up @@ -527,22 +527,22 @@ function LoginWrapper(props: React.PropsWithChildren<{selection?: boolean}>): JS
return (<>
<Absolute right="1em" top=".5em">
{props.selection ? <div>
{!SUPPORT_EMAIL ? null : (
{!CONF.SUPPORT_EMAIL ? null : (
<ClickableDropdown
width="224px"
top="36px"
right="5px"
colorOnHover={false}
trigger={<LoginIcon mr={"1em"} name="suggestion" />}
>
<ExternalLink href={`mailto:${SUPPORT_EMAIL}`}>
<ExternalLink href={`mailto:${CONF.SUPPORT_EMAIL}`}>
Need help?
{" "}<b>{SUPPORT_EMAIL}</b>
{" "}<b>{CONF.SUPPORT_EMAIL}</b>
</ExternalLink>
</ClickableDropdown>
)}
{!SITE_DOCUMENTATION_URL ? null : (
<LoginExternalLink href={SITE_DOCUMENTATION_URL}>
{!CONF.SITE_DOCUMENTATION_URL ? null : (
<LoginExternalLink href={CONF.SITE_DOCUMENTATION_URL}>
<LoginIcon name="docs" /> Docs
</LoginExternalLink>
)}
Expand Down Expand Up @@ -577,7 +577,7 @@ export function LoginSelection(): JSX.Element {
<LoginWrapper selection>
<Flex justifyContent="center">
<CenteredGrid>
{LOGIN_PAGE_PRODUCTS.map(product => (
{CONF.LOGIN_PAGE_PRODUCTS.map(product => (
<Card
key={product.name}
width={1}
Expand Down Expand Up @@ -609,4 +609,4 @@ const CenteredGrid = styled.div`
grid-template-columns: 345px 345px;
grid-template-rows: 110px;
grid-gap: 16px;
`;
`;
14 changes: 7 additions & 7 deletions frontend-web/webclient/app/Navigation/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import {
shouldHideSidebarAndHeader,
stopPropagationAndPreventDefault
} from "UtilityFunctions";
import {DEV_SITE, STAGING_SITE, PRODUCT_NAME, STATUS_PAGE, VERSION_TEXT} from "../../site.config.json";
import CONF from "../../site.config.json";
import {ContextSwitcher} from "Project/ContextSwitcher";
import {NewsPost} from "Dashboard/Dashboard";
import {AutomaticGiftClaim} from "Gifts/AutomaticGiftClaim";
Expand All @@ -50,7 +50,7 @@ interface HeaderProps extends HeaderStateToProps, HeaderOperations {
toggleTheme(): void;
}

const DevelopmentBadge = (): JSX.Element | null => [DEV_SITE, STAGING_SITE].includes(window.location.host) ||
const DevelopmentBadge = (): JSX.Element | null => [CONF.DEV_SITE, CONF.STAGING_SITE].includes(window.location.host) ||
inDevEnvironment() ? <DevelopmentBadgeBase>{window.location.host}</DevelopmentBadgeBase> : null;

export function NonAuthenticatedHeader(): JSX.Element {
Expand Down Expand Up @@ -139,10 +139,10 @@ function Header(props: HeaderProps): JSX.Element | null {
left="-180%"
trigger={<ui.Flex>{Client.isLoggedIn ? <UserAvatar avatar={props.avatar} mx={"8px"} /> : null}</ui.Flex>}
>
{!STATUS_PAGE ? null : (
{!CONF.STATUS_PAGE ? null : (
<>
<ui.Box>
<ui.ExternalLink color="black" href={STATUS_PAGE}>
<ui.ExternalLink color="black" href={CONF.STATUS_PAGE}>
<ui.Flex color="black">
<ui.Icon name="favIcon" mr="0.5em" my="0.2em" size="1.3em" />
<TextSpan>Site status</TextSpan>
Expand Down Expand Up @@ -240,15 +240,15 @@ const Logo = (): JSX.Element => (
>
<ui.Flex alignItems="center" ml="15px">
<ui.Icon name="logoEsc" size="38px" />
<ui.Text color="headerText" fontSize={4} ml="8px">{PRODUCT_NAME}</ui.Text>
{!VERSION_TEXT ? null : (
<ui.Text color="headerText" fontSize={4} ml="8px">{CONF.PRODUCT_NAME}</ui.Text>
{!CONF.VERSION_TEXT ? null : (
<LogoText
ml="4px"
mt={-7}
color="red"
fontSize={17}
>
{VERSION_TEXT}
{CONF.VERSION_TEXT}
</LogoText>
)}
</ui.Flex>
Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Navigation/Redux/StatusReducer.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {initStatus, StatusReduxObject} from "DefaultObjects";
import {PRODUCT_NAME} from "../../../site.config.json";
import CONF from "../../../site.config.json";
import {StatusActions} from "./StatusActions";

export const UPDATE_PAGE_TITLE = "UPDATE_PAGE_TITLE";
Expand All @@ -9,7 +9,7 @@ export const SET_STATUS_LOADING = "SET_STATUS_LOADING";
const status = (state: StatusReduxObject = initStatus(), action: StatusActions): StatusReduxObject => {
switch (action.type) {
case UPDATE_PAGE_TITLE:
document.title = `${PRODUCT_NAME} | ${action.payload.title}`;
document.title = `${CONF.PRODUCT_NAME} | ${action.payload.title}`;
return {...state, ...action.payload};
case SET_STATUS_LOADING:
case SET_ACTIVE_PAGE:
Expand Down
6 changes: 3 additions & 3 deletions frontend-web/webclient/app/Products/Products.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {useCloudAPI} from "Authentication/DataHook";
import {emptyPage} from "DefaultObjects";
import {MainContainer} from "MainContainer/MainContainer";
import {List} from "Pagination";
import {Card, Box, Flex, Icon, List as UIList, Text, ContainerForText} from "ui-components";
import {Card, Box, Flex, Icon, Text, ContainerForText} from "ui-components";
import * as React from "react";
import {capitalized} from "UtilityFunctions";
import * as Heading from "ui-components/Heading";
Expand All @@ -16,7 +16,7 @@ import styled from "styled-components";
import * as ReactModal from "react-modal";
import {defaultModalStyle} from "Utilities/ModalUtilities";
import {Spacer} from "ui-components/Spacer";
import {PRODUCT_NAME} from "../../site.config.json";
import CONF from "../../site.config.json";

function Products(): JSX.Element {
const main = (
Expand Down Expand Up @@ -178,7 +178,7 @@ function MachineView({area}: {area: string}): JSX.Element {

function Description(): JSX.Element {
return (<>
Below is the available SKUs on the {PRODUCT_NAME} platform.
Below is the available SKUs on the {CONF.PRODUCT_NAME} platform.
They are divided into different product areas, i.e. storage SKUs and compute SKUs.
The prices for compute will be visible when starting a job.
</>);
Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/Project/Grant/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {useProjectManagementStatus} from "Project";
import * as Heading from "ui-components/Heading";
import {Box, Button, DataList, Flex, Grid, Icon, Input, Label, Text, TextArea} from "ui-components";
import ClickableDropdown from "ui-components/ClickableDropdown";
import {wayfIdps} from "./wayf-idps.json";
import WAYF from "./wayf-idps.json";
import {snackbarStore} from "Snackbar/SnackbarStore";
import Table, {TableCell, TableHeaderCell, TableRow} from "ui-components/Table";
import {ConfirmCancelButtons} from "UtilityComponents";
Expand Down Expand Up @@ -67,7 +67,7 @@ export async function uploadProjectLogo(props: UploadLogoProps): Promise<boolean
});
}

const wayfIdpsPairs = wayfIdps.map(it => ({value: it, content: it}));
const wayfIdpsPairs = WAYF.wayfIdps.map(it => ({value: it, content: it}));

export const LogoAndDescriptionSettings: React.FunctionComponent = () => {
const {projectId} = useProjectManagementStatus({isRootComponent: false});
Expand Down
4 changes: 2 additions & 2 deletions frontend-web/webclient/app/UserSettings/Sessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import * as Heading from "ui-components/Heading";
import {invalidateAllSessions, listUserSessions, UserSession} from "UserSettings/api";
import {dateToString} from "Utilities/DateUtilities";
import {addStandardDialog} from "UtilityComponents";
import {PRODUCT_NAME} from "../../site.config.json";
import CONF from "../../site.config.json";

export interface SessionsProps {
setLoading: (loading: boolean) => void;
Expand Down Expand Up @@ -84,7 +84,7 @@ export const Sessions: React.FunctionComponent<SessionsProps> = props => {
const onInvalidateSessions = useCallback(() => {
addStandardDialog({
title: "Invalidate all sessions",
message: `This will log you out of ${PRODUCT_NAME} on ALL devices. Are you sure you wish to do this?`,
message: `This will log you out of ${CONF.PRODUCT_NAME} on ALL devices. Are you sure you wish to do this?`,
onConfirm: async () => {
await invokeCommand(invalidateAllSessions());
HttpClient.clearTokens();
Expand Down
Loading

0 comments on commit c900dd7

Please sign in to comment.