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

Feature/several small UI tweaks #1444

Merged
merged 4 commits into from
Dec 10, 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: 0 additions & 1 deletion docker-compose-local.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
oidc-provider:
ports:
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.override.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.8'

services:
oidc-provider:
build:
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
oidc-provider:
build:
Expand Down
1 change: 0 additions & 1 deletion e2e/docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
frontend:
volumes:
Expand Down
1 change: 0 additions & 1 deletion e2e/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '3.8'
services:
frontend:
build:
Expand Down
2 changes: 1 addition & 1 deletion e2e/test/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ import { DEV_USER } from '@utils/users.js';
test('Login', async ({ browser }) => {
const { page } = await login(browser, DEV_USER);

await expect(page).toHaveURL('https://localhost:1443/');
await expect(page).toHaveURL(/^https:\/\/localhost:1443.*/);
});
10 changes: 7 additions & 3 deletions frontend/src/components/SplitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ interface Props {
variant?: 'contained' | 'outlined';
hideSelectedOptionFromList?: boolean;
disableButtonSelection?: boolean;
hideButtonSelection?: boolean;
/** Functions to be triggered immediately when a menu item is clicked. Overrides default menu item selection logic. */
directOptionFunctions?: ((() => void) | null)[];
}
Expand All @@ -31,6 +32,7 @@ export function SplitButton({
variant = 'outlined',
hideSelectedOptionFromList,
disableButtonSelection,
hideButtonSelection,
directOptionFunctions,
}: Props) {
const [open, setOpen] = useState(false);
Expand Down Expand Up @@ -66,9 +68,11 @@ export function SplitButton({
<>
<ButtonGroup {...(cssProp && { css: cssProp })} variant={variant} ref={anchorRef}>
{renderButton(options[selectedIndex], selectedIndex)}
<Button disabled={disableButtonSelection} size="small" onClick={handleToggle}>
<ArrowDropDown />
</Button>
{!hideButtonSelection && (
<Button disabled={disableButtonSelection} size="small" onClick={handleToggle}>
<ArrowDropDown />
</Button>
)}
</ButtonGroup>
<Popper
css={css`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,13 @@ export function ModifyButton({
<>
<SplitButton
hideSelectedOptionFromList
disableButtonSelection={editing || splitButtonDisabled}
hideButtonSelection={editing}
disableButtonSelection={splitButtonDisabled}
cssProp={css`
margin-left: auto;
`}
variant={editing ? 'outlined' : 'contained'}
options={[tr('projectObjectView.modify'), tr('projectObjectView.moveToProject')]}
options={[tr('projectObjectView.modify'), tr('projectObjectView.moveToProjectButton')]}
directOptionFunctions={[null, () => setPopupOpen(true)]}
renderButton={(label, idx) => (
<Button
Expand Down Expand Up @@ -133,7 +134,8 @@ export function ModifyButton({
<>
<SplitButton
hideSelectedOptionFromList
disableButtonSelection={editing || splitButtonDisabled}
hideButtonSelection={editing}
disableButtonSelection={splitButtonDisabled}
cssProp={css`
margin-left: auto;
`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ export function ProjectObjectMoveView(props: Props) {
padding-bottom: 1rem;
`}
>
<DialogContentText>{tr('projectObjectView.moveToProject.contentText')}</DialogContentText>
<DialogContentText>
{tr('projectObjectView.moveToProject.contentText')}{' '}
{newProjectCandidates.data &&
newProjectCandidates.data.length > 0 &&
tr('projectObjectView.moveToProject.contentTextSap')}
</DialogContentText>
</DialogContent>
<DialogActions
css={css`
Expand Down Expand Up @@ -136,19 +141,31 @@ export function ProjectObjectMoveView(props: Props) {
)}
/>
) : (
<Typography>{tr('projectObjectView.moveToProject.noProjects')}</Typography>
<Typography color="error">
{tr('projectObjectView.moveToProject.noProjects')}
</Typography>
)}
<Box
css={css`
margin-left: auto;
display: flex;
gap: 10px;
`}
>
<Button onClick={props.handleClose} color="primary">
{tr('cancel')}
</Button>
<Button disabled={!isValid} type="submit" variant="contained">
{tr('projectObjectView.move')}
</Button>
{!newProjectCandidates.isLoading && newProjectCandidates.data?.length === 0 ? (
<Button onClick={props.handleClose} color="primary" variant="contained">
{tr('ok')}
</Button>
) : (
<>
<Button onClick={props.handleClose} color="primary">
{tr('cancel')}
</Button>
<Button disabled={!isValid} type="submit" variant="contained">
{tr('projectObjectView.move')}
</Button>
</>
)}
</Box>
</form>
</FormProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,16 @@ export function ProjectShiftView(props: Props) {
/>
<Box
css={css`
display: flex;
margin-left: auto;
gap: 10px;
`}
>
<Button onClick={props.handleClose} color="primary">
{tr('cancel')}
</Button>
<Button disabled={!isValid} type="submit" color="primary" variant="contained">
{tr('ok')}
{tr('move')}
</Button>
</Box>
</form>
Expand Down
26 changes: 15 additions & 11 deletions shared/src/language/fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ export const fi = {
'projectSearch.generateReport': 'Lataa raportti',
'projectSearch.reportFailed': 'Raportin luonti epäonnistui.',
'projectObjectView.modify': 'Muokkaa kohdetta',
'projectObjectView.moveToProjectButton': 'Siirrä kohde toiselle hankkeelle',
'projectObjectView.moveToProject': 'Siirretään kohde toiselle hankkeelle',
'projectObjectView.moveToProject.label': 'Kohteen uusi hanke',
'projectObjectView.moveToProject.contentText':
'Kohteen pystyy siirtämään toiselle investointihankkeelle, jonka toteutusväli sekä lautakuntavalinta mahdollistavat kohteen siirron. Kohteen mahdollinen SAP-rakenneosan tunniste poistetaan siirron yhteydessä.',
'projectObjectView.moveToProject.noProjects': 'Ei sopivia hankkeita.',
'Kohteen voi siirtää investointihankkeelle, jolla on sopiva toteutusväli sekä oikea lautakunta.',
'projectObjectView.moveToProject.contentTextSap':
'Kohteen mahdollinen SAP-rakenneosan tunniste poistetaan siirron yhteydessä.',
'projectObjectView.moveToProject.noProjects': 'Sopivia hankkeita ei ole.',
'projectObjectView.moveToProject.formError': 'Uusi hanke puuttuu.',
'projectObjectView.moveToProject.success': 'Kohde siirretty onnistuneesti.',
'projectObjectView.moveToProject.failed': 'Kohteen siirto epäonnistui.',
Expand Down Expand Up @@ -316,7 +319,7 @@ export const fi = {
'dateRange.endDate': 'Loppupäivä',
'budgetTable.year': 'Vuosi',
'budgetTable.yearHelp':
'Talousluvut osoitetaan vuosikohtaisina. Näkymässä tarjolla olevat vuodet johdetaan suoraan käyttäjän kirjaamasta toteutusvälistä (alku- ja loppupäivämäärä).',
'Talousluvut osoitetaan vuosikohtaisina. Näkymässä tarjolla olevat vuodet johdetaan suoraan käyttäjän kirjaamasta toteutusvälistä (alku- ja lopetusajankohta).',
'budgetTable.yearHelpOngoing':
'Toistaiseksi jatkuvan hankkeen talouslukuja on mahdollista raportoida viideksi vuodeksi eteenpäin.',
'budgetTable.yearHelpOngoingObject':
Expand Down Expand Up @@ -378,10 +381,10 @@ export const fi = {
'projectObject.objectUsageLabelShort': 'Käyttötarkoitus',
'projectObject.objectUsageTooltip': 'Valitse kohteen toiminnallinen käyttötarkoitus.',
'projectObject.committeeLabel': 'Lautakunta',
'projectObject.startDateLabel': 'Alkupäivämäärä',
'projectObject.startDateTooltip': 'Valitse kohteelle aloituspäivämäärä.',
'projectObject.endDateLabel': 'Loppupäivämäärä',
'projectObject.endDateTooltip': 'Valitse kohteen lopetuspäivämäärä.',
'projectObject.startDateLabel': 'Alkuajankohta',
'projectObject.startDateTooltip': 'Valitse kohteelle aloitusajankohta.',
'projectObject.endDateLabel': 'Loppuajankohta',
'projectObject.endDateTooltip': 'Valitse kohteen lopetusajankohta.',
'projectObject.sapWBSIdLabel': 'SAP-rakenneosa',
'projectObject.sapWBSIdTooltip': 'Valitse SAP-rakenneosa.',
'projectObject.sapWBSIdNoSAPProjectIdTooltip': 'Hankkeelle ei ole määritetty SAP-projektia.',
Expand Down Expand Up @@ -631,10 +634,10 @@ export const fi = {
'workTable.export.projectName': 'Hanke',
'workTable.export.objectName': 'Kohde',
'workTable.export.lifecycleState': 'Tila',
'workTable.export.projectStartDate': 'Hankkeen aloituspäivämäärä',
'workTable.export.projectEndDate': 'Hankkeen lopetuspäivämäärä',
'workTable.export.objectStartDate': 'Kohteen aloituspäivämäärä',
'workTable.export.objectEndDate': 'Kohteen lopetuspäivämäärä',
'workTable.export.projectStartDate': 'Hankkeen aloitusajankohta',
'workTable.export.projectEndDate': 'Hankkeen lopetusajankohta',
'workTable.export.objectStartDate': 'Kohteen aloitusajankohta',
'workTable.export.objectEndDate': 'Kohteen lopetusajankohta',
'workTable.export.objectType': 'Tyyppi',
'workTable.export.objectCategory': 'Omaisuusluokka',
'workTable.export.objectUsage': 'Käyttötarkoitus',
Expand Down Expand Up @@ -681,6 +684,7 @@ export const fi = {
'wholeMunicipalityMapInfoBoxButton.tooltip': 'Koko kunnan aluetta koskevat hankkeet',
'wholeMunicipalityMapInfoBoxButton.singleTooltip': 'Koko kunnan aluetta koskeva hanke',
'email.subject': 'Aihe',
move: 'Siirrä',
send: 'Lähetä',
clear: 'Tyhjennä',
ok: 'Ok',
Expand Down
Loading