-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1606 from digitalfabrik/1571-import-stores-backend
1571: Import stores backend
- Loading branch information
Showing
32 changed files
with
680 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
type DimensionsType = { | ||
navigationBarHeight: number | ||
bottomBarHeight: number | ||
} | ||
|
||
const dimensions: DimensionsType = { | ||
navigationBarHeight: 50, | ||
bottomBarHeight: 70, | ||
} | ||
export default dimensions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
administration/src/bp-modules/stores/StoresImportAlert.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Checkbox } from '@blueprintjs/core' | ||
import React, { ReactElement } from 'react' | ||
import styled from 'styled-components' | ||
|
||
const StyledCheckbox = styled(Checkbox)` | ||
margin: 12px 0; | ||
align-self: center; | ||
` | ||
|
||
const CheckboxContainer = styled.div` | ||
padding: 0 12px; | ||
display: flex; | ||
` | ||
|
||
const DurationContainer = styled.div` | ||
margin-top: 12px; | ||
` | ||
|
||
type StoreImportAlertProps = { | ||
dryRun: boolean | ||
setDryRun: (value: boolean) => void | ||
storesCount: number | ||
} | ||
|
||
const STORES_COUNT_NOTE_THRESHOLD = 500 | ||
const STORES_IMPORT_PER_SECOND = 100 | ||
const StoresImportAlert = ({ dryRun, setDryRun, storesCount }: StoreImportAlertProps): ReactElement => { | ||
return ( | ||
<> | ||
{dryRun ? ( | ||
<span data-testid='dry-run-alert'> | ||
<b>Testlauf:</b> In diesem Testlauf wird nur simuliert, wie viele Akzeptanzpartner geändert oder gelöscht | ||
werden würden. Es werden noch keine Änderungen an der Datenbank vorgenommen. | ||
</span> | ||
) : ( | ||
<> | ||
<span data-testid='prod-run-alert'> | ||
<b>Achtung:</b> Akzeptanzpartner, welche aktuell in der Datenbank gespeichert, aber nicht in der Tabelle | ||
vorhanden sind, werden gelöscht! | ||
</span> | ||
<br /> | ||
{storesCount > STORES_COUNT_NOTE_THRESHOLD && ( | ||
<DurationContainer data-testid={'duration-alert'}> | ||
<b>Geschätzte Dauer des Imports:</b> {Math.ceil(storesCount / STORES_IMPORT_PER_SECOND / 60)} Minuten.{' '} | ||
<br /> | ||
Bitte schließen sie das Browserfenster nicht! | ||
</DurationContainer> | ||
)} | ||
</> | ||
)} | ||
<CheckboxContainer> | ||
<StyledCheckbox checked={dryRun} onChange={e => setDryRun(e.currentTarget.checked)} label='Testlauf' /> | ||
</CheckboxContainer> | ||
</> | ||
) | ||
} | ||
|
||
export default StoresImportAlert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
administration/src/bp-modules/stores/StoresImportDuplicates.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import React, { ReactElement } from 'react' | ||
import styled from 'styled-components' | ||
|
||
type StoresImportDuplicatesProps = { entries: number[][] } | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
` | ||
const StoresImportDuplicates = ({ entries }: StoresImportDuplicatesProps): ReactElement => { | ||
return ( | ||
<Container> | ||
Die CSV enthält doppelte Einträge: | ||
{entries.map(entry => { | ||
const entries = entry.join(', ') | ||
return <span key={entries}>Die Einträge {entries} sind identisch.</span> | ||
})} | ||
Bitte löschen Sie die doppelten Einträge. | ||
</Container> | ||
) | ||
} | ||
|
||
export default StoresImportDuplicates |
Oops, something went wrong.