Skip to content

Commit

Permalink
IJMP-1530-Incorrect-Warning-Message
Browse files Browse the repository at this point in the history
  • Loading branch information
ATsikhamirau committed Mar 13, 2024
1 parent 303bb5d commit 6d9e5de
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,35 +324,36 @@ class ExplorerPasteProvider : PasteProvider {

// conflicts end
// specific configs resolution
val ussToPdsWarnings = pasteDestinations
val ussOrLocalFileToPdsWarnings = pasteDestinations
.mapNotNull { destFile ->
val destAttributes = dataOpsManager.tryToGetAttributes(destFile)
if (destAttributes !is RemoteDatasetAttributes) null
else {
val sourceUssAttributes = sourceFiles
.filter { sourceFile ->
val sourceAttributes = dataOpsManager.tryToGetAttributes(sourceFile)
sourceAttributes is RemoteUssAttributes || sourceFile is VirtualFileImpl
sourceAttributes is RemoteUssAttributes || sourceFile.isInLocalFileSystem
}
sourceUssAttributes.map { Pair(destFile, it) }.ifEmpty { null }
}
}
.flatten()

if (
ussToPdsWarnings.isNotEmpty() &&
!showYesNoDialog(
"USS File To PDS Placing",
"You are about to place USS file to PDS. All lines exceeding the record length will be truncated.",
null,
"Ok",
"Skip This Files",
AllIcons.General.WarningDialog
)
) {
conflictsResolutions.addAll(
ussToPdsWarnings.map { ConflictResolution(it.second, it.first).apply { resolveBySkip() } }
)
if (ussOrLocalFileToPdsWarnings.isNotEmpty()) {
val isLocalFilesPresent = ussOrLocalFileToPdsWarnings.find { it.second.isInLocalFileSystem } != null
val fileTypesPattern = if (isLocalFilesPresent) "Local Files" else "USS Files"
if (!showYesNoDialog(
"$fileTypesPattern to PDS Placing",
"You are about to place $fileTypesPattern to PDS. All lines exceeding the record length will be truncated.",
null,
"Ok",
"Skip This Files",
AllIcons.General.WarningDialog
)) {
conflictsResolutions.addAll(
ussOrLocalFileToPdsWarnings.map { ConflictResolution(it.second, it.first).apply { resolveBySkip() } }
)
}
}
// specific conflicts resolution end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ class ExplorerPasteProviderTestSpec : WithApplicationShouldSpec({
every { mockedSourceAttributes.isDirectory } returns false
every { mockedSourceNodeData.node } returns mockedSourceNode
every { mockedSourceNodeData.file } returns mockedSourceFile
every { mockedSourceFile.isInLocalFileSystem } returns false
every { mockedSourceNodeData.attributes } returns mockedSourceAttributes

// children of target
Expand Down Expand Up @@ -394,6 +395,7 @@ class ExplorerPasteProviderTestSpec : WithApplicationShouldSpec({
val mockedSourceFile = mockk<MFVirtualFile>()
val mockedSourceAttributes = mockk<RemoteDatasetAttributes>()
every { mockedSourceFile.name } returns "TEST.FILE"
every { mockedSourceFile.isInLocalFileSystem } returns false
every { mockedSourceAttributes.name } returns "TEST.FILE"
every { mockedSourceAttributes.isPastePossible } returns false
every { mockedSourceAttributes.isDirectory } returns false
Expand Down Expand Up @@ -1251,6 +1253,7 @@ class ExplorerPasteProviderTestSpec : WithApplicationShouldSpec({
every { mockedSourceFile.name } returns fileName
every { mockedSourceFile.isDirectory } returns isDirectory
every { mockedSourceFile.parent } returns parent
every { mockedSourceFile.isInLocalFileSystem } returns false

val mockedSourceAttributes = if (sourceAttributes != null) {
sourceAttributes
Expand Down

0 comments on commit 6d9e5de

Please sign in to comment.