forked from epam/cloud-pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'gui-issue-#493_Setting-of-the-tool-icon-size' of https:…
…//github.com/AleksandrGorodetskii/cloud-pipeline into gui-issue-#493_Setting-of-the-tool-icon-size GUI ISSUE epam#493 fixed. If getPreferenceValue from setting is possible, we get 'maximumFileSize' from this.props.preferences.getPreferenceValue('misc.max.tool.icon.size.kb') instead from DEFAULT_VALUE in <Tool> component. And compare this value with image.size.
- Loading branch information
Showing
1 changed file
with
6 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -347,7 +347,9 @@ export default class Tool extends localization.LocalizedReactComponent { | |
} | ||
|
||
const doUpload = (file) => { | ||
const maximumFileSize = this.props.preferences.getPreferenceValue('misc.max.tool.icon.size.kb'); | ||
const MAX_FILE_SIZE_KB = 50; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
const maximumFileSize = this.props.preferences.getPreferenceValue('misc.max.tool.icon.size.kb') | ||
This comment has been minimized.
Sorry, something went wrong.
rodichenko
|
||
? this.props.preferences.getPreferenceValue('misc.max.tool.icon.size.kb') : MAX_FILE_SIZE_KB; | ||
if (file.type.toLowerCase().indexOf('png') === -1) { | ||
message.error('Only PNG image files are supported', 5); | ||
return false; | ||
|
@@ -373,7 +375,9 @@ export default class Tool extends localization.LocalizedReactComponent { | |
} else { | ||
try { | ||
const json = JSON.parse(request.response); | ||
if (json.status === 'ERROR') { | ||
if (json.status === 'ERROR' && json.message.includes('Icon uploaded is too large:')) { | ||
This comment has been minimized.
Sorry, something went wrong. |
||
message.error(`Maximum file size is ${maximumFileSize}kb`, 5); | ||
} else { | ||
message.error(json.message, 5); | ||
} | ||
} catch (__) {} | ||
|
Please define this constant outside of the component (at the beginning of the file, for example)