-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Files storage: allow specifying max files (#3585)
* Map: renamed altitude into elevation * survey files: get max space from DB * prepare editing * added item edit button bar * max files size editor * files size formatting: use power of 1024 by default * updated arena-server version * code cleanup --------- Co-authored-by: Stefano Ricci <[email protected]> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1ab3608
commit 7e8145a
Showing
28 changed files
with
439 additions
and
233 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { Objects } from '@openforis/arena-core' | ||
|
||
const areaUnits = { | ||
squareMeter: 'squareMeter', | ||
squareFoot: 'squareFoot', | ||
acre: 'acre', | ||
hectare: 'hectare', | ||
} | ||
|
||
const areaUnitToSquareMetersConversionFactor = { | ||
[areaUnits.acre]: 4046.85642199999983859016, | ||
[areaUnits.hectare]: 10000, | ||
[areaUnits.squareMeter]: 1, | ||
[areaUnits.squareFoot]: 0.09290304, | ||
} | ||
|
||
const lengthUnits = { | ||
meter: 'meter', | ||
foot: 'foot', | ||
} | ||
|
||
const lengthUnitToMetersConversionFactor = { | ||
[lengthUnits.meter]: 1, | ||
[lengthUnits.foot]: 0.3048, | ||
} | ||
|
||
const abbreviationByUnit = { | ||
[areaUnits.squareMeter]: 'm²', | ||
[areaUnits.squareFoot]: 'ft²', | ||
[areaUnits.acre]: 'ac', | ||
[areaUnits.hectare]: 'ha', | ||
[lengthUnits.meter]: 'm', | ||
[lengthUnits.foot]: 'ft', | ||
} | ||
|
||
const dataStorageUnits = { | ||
byte: 'byte', | ||
MB: 'MB', | ||
GB: 'GB', | ||
} | ||
|
||
const dataStorageUnitToBytesConversionFactor = { | ||
[dataStorageUnits.byte]: 1, | ||
[dataStorageUnits.MB]: Math.pow(1024, 2), | ||
[dataStorageUnits.GB]: Math.pow(1024, 3), | ||
} | ||
|
||
const squareMetersToUnit = (unit) => (value) => | ||
Objects.isNil(value) ? NaN : Number(value) / areaUnitToSquareMetersConversionFactor[unit] | ||
|
||
const metersToUnit = (unit) => (value) => | ||
Objects.isNil(value) ? NaN : Number(value) / lengthUnitToMetersConversionFactor[unit] | ||
|
||
const dataStorageBytesToUnit = (unit) => (bytes) => | ||
Objects.isNil(bytes) ? NaN : Number(bytes) / dataStorageUnitToBytesConversionFactor[unit] | ||
|
||
const dataStorageValueToBytes = (unit) => (value) => | ||
Objects.isNil(value) ? NaN : Number(value) * dataStorageUnitToBytesConversionFactor[unit] | ||
|
||
const dataStorageValueToUnit = (unitFrom, unitTo) => (value) => { | ||
const bytes = dataStorageValueToBytes(unitFrom)(value) | ||
return dataStorageBytesToUnit(unitTo)(bytes) | ||
} | ||
|
||
export const NumberConversionUtils = { | ||
areaUnits, | ||
lengthUnits, | ||
abbreviationByUnit, | ||
metersToUnit, | ||
squareMetersToUnit, | ||
dataStorageUnits, | ||
dataStorageBytesToUnit, | ||
dataStorageValueToBytes, | ||
dataStorageValueToUnit, | ||
} |
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,3 @@ | ||
export const configKeys = { | ||
filesTotalSpace: 'filesTotalSpace', // total space to store files (in MB) | ||
} |
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
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
Oops, something went wrong.