Skip to content

Commit

Permalink
Release v1.1.2 preparation
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Jan 18, 2024
2 parents 93075bc + 7a141fc commit 082e5c8
Show file tree
Hide file tree
Showing 19 changed files with 219 additions and 73 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

All notable changes to the Zowe IntelliJ Plugin will be documented in this file.

## `1.1.2 (2024-01-22)`

* Bugfix: Sync action does not work after file download ([bfb125d7](https://github.com/zowe/zowe-explorer-intellij/commit/bfb125d7))
* Bugifx: "Skip This Files" doesn't work when uploading local file to PDS ([749b2d4b](https://github.com/zowe/zowe-explorer-intellij/commit/749b2d4b))
* Bugifx: "Use new name" doesn't work for copying partitioned dataset to USS folder ([26d865be](https://github.com/zowe/zowe-explorer-intellij/commit/26d865be))
* Bugifx: "Use new name" doesn't work for copying sequential dataset to partitioned dataset ([349c02e9](https://github.com/zowe/zowe-explorer-intellij/commit/349c02e9))
* Bugfix: "Use new name" doesn't work when uploading local file to PDS ([26d865be](https://github.com/zowe/zowe-explorer-intellij/commit/26d865be))
* Bugfix: Editing two members with the same name does not update the content for one of the members ([25606368](https://github.com/zowe/zowe-explorer-intellij/commit/25606368))
* Bugfix: Topics handling ([25606368](https://github.com/zowe/zowe-explorer-intellij/commit/25606368))
* Bugfix: Zowe config v2 handling ([fd79b908](https://github.com/zowe/zowe-explorer-intellij/commit/fd79b908))
* Bugfix: JES Explorer bug when ABEND job is being displayed ([614aa6cf](https://github.com/zowe/zowe-explorer-intellij/commit/614aa6cf))
* Bugfix: GitHub issue #167: Zowe explorer config is not converted ([b5eae7a2](https://github.com/zowe/zowe-explorer-intellij/commit/b5eae7a2))

## `1.1.1 (2023-11-23)`

* Bugfix: Dataset color does not change when
Expand Down
29 changes: 13 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ apply(from = "gradle/sonar.gradle")

group = "org.zowe"
version = "1.1.2-221"
val remoteRobotVersion = "0.11.19"
val okHttp3Version = "4.10.0"
val remoteRobotVersion = "0.11.21"
val okHttp3Version = "4.12.0"
val kotestVersion = "5.6.2"

repositories {
Expand Down Expand Up @@ -71,7 +71,7 @@ dependencies {
implementation("org.jgrapht:jgrapht-core:1.5.1")
implementation("com.starxg:java-keytar:1.0.0")
implementation("org.zowe.sdk:zowe-kotlin-sdk:0.4.0")
implementation("com.ibm.mq:com.ibm.mq.allclient:9.3.3.0")
implementation("com.ibm.mq:com.ibm.mq.allclient:9.3.4.1")
testImplementation("io.mockk:mockk:1.13.5")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.2")
testImplementation("io.kotest:kotest-assertions-core:$kotestVersion")
Expand Down Expand Up @@ -108,19 +108,16 @@ tasks {
<br>
<b>Fixed bugs:</b>
<ul>
<li>Dataset color does not change when cutting</li>
<li>Spelling error in reload/convert dialog</li>
<li>Incorrect error messages when allocating dataset</li>
<li>Incorrect message if create connection with connection url ending with 2 slashes</li>
<li>Sync action is not working during indexing process in 221 and 222</li>
<li>Mask cannot be created when the other connection is selected</li>
<li>Copy and cut error message if skip for all or overwrite for all is selected</li>
<li>Strange behaviour of zowe config creds</li>
<li>Strange behaviour of zowe config synchronization</li>
<li>GitHub issue #139: Can't allocate a dataset with record format U</li>
<li>GitHub issue #143: Incorrect behaviour of TSO CLI</li>
<li>GitHub issue #161: Conflict between Zowe Explorer and For Mainframe</li>
<li>GitHub issue #162: Sync does not work on files and datasets in autosync</li>
<li>Sync action does not work after file download</li>
<li>"Skip This Files" doesn't work when uploading local file to PDS</li>
<li>"Use new name" doesn't work for copying partitioned dataset to USS folder</li>
<li>"Use new name" doesn't work for copying sequential dataset to partitioned dataset</li>
<li>"Use new name" doesn't work when uploading local file to PDS</li>
<li>Editing two members with the same name does not update the content for one of the members</li>
<li>Topics handling</li>
<li>Zowe config v2 handling</li>
<li>JES Explorer bug when ABEND job is being displayed</li>
<li>GitHub issue #167: Zowe explorer config is not converted</li>
</ul>"""
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ abstract class AbstractPdsToUssFolderMover(val dataOpsManager: DataOpsManager) :
var throwable: Throwable? = null

if (sourceFileFetchProvider.isCacheValid(sourceQuery)) {
val destinationPath = "${destinationAttributes.path}/${sourceAttributes.name}"
val newName = operation.newName ?: sourceAttributes.name
val destinationPath = "${destinationAttributes.path}/${newName}"

if (operation.forceOverwriting) {
log.info("Overwriting directory $destinationPath")
Expand All @@ -137,7 +138,7 @@ abstract class AbstractPdsToUssFolderMover(val dataOpsManager: DataOpsManager) :

val response = api<DataAPI>(destConnectionConfig).createUssFile(
authorizationToken = destConnectionConfig.authToken,
filePath = FilePath(destinationAttributes.path + "/" + sourceAttributes.name),
filePath = FilePath(destinationPath),
body = CreateUssFile(FileType.DIR, destinationAttributes.fileMode ?: FileMode(7, 7, 7))
).cancelByIndicator(progressIndicator).execute()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ class CrossSystemMemberOrUssFileOrSequentialToUssDirMover(val dataOpsManager: Da
contentSynchronizer.synchronizeWithRemote(syncProvider, progressIndicator)

val contentMode = XIBMDataType(XIBMDataType.Type.BINARY)
val pathToFile = destAttributes.path + "/" + op.source.name

val newName = op.newName ?: op.source.name
val pathToFile = destAttributes.path + "/" + newName
progressIndicator.text = "Uploading file '$pathToFile'"
val response = apiWithBytesConverter<DataAPI>(destConnectionConfig).writeToUssFile(
authorizationToken = destConnectionConfig.authToken,
Expand All @@ -99,7 +101,7 @@ class CrossSystemMemberOrUssFileOrSequentialToUssDirMover(val dataOpsManager: Da
}.execute()

if (!response.isSuccessful) {
throw CallException(response, "Cannot upload data to ${op.destination.path}${op.source.name}")
throw CallException(response, "Cannot upload data to ${op.destination.path}${newName}")
} else {
setUssFileTag(op.source.charset.name(), pathToFile, destConnectionConfig)
if (op.isMove) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class CrossSystemMemberOrUssFileToPdsMover(val dataOpsManager: DataOpsManager) :
contentSynchronizer?.synchronizeWithRemote(syncProvider, progressIndicator)
}

var memberName = sourceFile.name.filter { it.isLetterOrDigit() }.take(8)
var memberName = operation.newName ?: sourceFile.name.filter { it.isLetterOrDigit() }.take(8)
if (memberName.isEmpty()) {
memberName = "empty"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class SequentialToPdsMover(val dataOpsManager: DataOpsManager) : AbstractFileMov
val destinationAttributes = operation.destinationAttributes as RemoteDatasetAttributes
var memberName: String
val dataset = (operation.sourceAttributes as RemoteDatasetAttributes).also {
memberName = it.name.split(".").last()
memberName = operation.newName ?: it.name.split(".").last()
}
val response = api<DataAPI>(
url = connectionConfig.url,
Expand All @@ -83,7 +83,8 @@ class SequentialToPdsMover(val dataOpsManager: DataOpsManager) : AbstractFileMov
memberName = memberName
).cancelByIndicator(progressIndicator).execute()

if (!response.isSuccessful && response.errorBody()?.string()?.contains("data set is empty") == true) {
// Proceed with deletion of source dataset in case of successful response or dataset was empty, throw exception otherwise
if (response.isSuccessful || response.errorBody()?.string()?.contains("data set is empty") == true) {
if (operation.isMove) {
val deleteResponse = api<DataAPI>(
url = connectionConfig.url,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,23 @@ class FileEditorEventsListener : FileEditorManagerListener {
* @param file the file that was opened.
*/
override fun fileOpened(source: FileEditorManager, file: VirtualFile) {
val editor = source.selectedTextEditor as? EditorEx
if (file is MFVirtualFile) {
val editor = source.selectedTextEditor as? EditorEx

// TODO: remove in v1.*.*-223 and greater
if (editor != null) {
editor.addFocusListener(focusListener)
val isDumbMode = ActionUtil.isDumbMode(editor.project)
if (isDumbMode) {
editor.document.setReadOnly(true)
editor.isViewer = true
// TODO: remove in v1.*.*-223 and greater
if (editor != null) {
editor.addFocusListener(focusListener)
val isDumbMode = ActionUtil.isDumbMode(editor.project)
if (isDumbMode) {
editor.document.setReadOnly(true)
editor.isViewer = true
}
}
super.fileOpened(source, file)
}

// TODO: use in v1.*.*-223 and greater
//editor?.addFocusListener(focusListener)
//super.fileOpened(source, file)
// TODO: use in v1.*.*-223 and greater
//editor?.addFocusListener(focusListener)
}
super.fileOpened(source, file)
}
}

Expand All @@ -70,24 +71,25 @@ class FileEditorBeforeEventsListener : FileEditorManagerListener.Before {
* @param file the file to be checked and synchronized
*/
override fun beforeFileClosed(source: FileEditorManager, file: VirtualFile) {
val project = source.project
val configService = service<ConfigService>()
val syncProvider = DocumentedSyncProvider(file, SaveStrategy.default(source.project))
val syncProvider = DocumentedSyncProvider(file, SaveStrategy.default(project))
val attributes = dataOpsManager.tryToGetAttributes(file)
if (file is MFVirtualFile && file.isWritable && attributes != null) {
val contentSynchronizer = service<DataOpsManager>().getContentSynchronizer(file)
val currentContent = runReadActionInEdtAndWait { syncProvider.retrieveCurrentContent() }
val previousContent = contentSynchronizer?.successfulContentStorage(syncProvider)
val needToUpload = contentSynchronizer?.isFileUploadNeeded(syncProvider) == true
if (!(currentContent contentEquals previousContent) && needToUpload) {
val incompatibleEncoding = !checkEncodingCompatibility(file, source.project)
val incompatibleEncoding = !checkEncodingCompatibility(file, project)
if (!configService.isAutoSyncEnabled) {
if (showSyncOnCloseDialog(file.name, source.project)) {
if (showSyncOnCloseDialog(file.name, project)) {
if (incompatibleEncoding && !showSaveAnywayDialog(file.charset)) {
return
}
runModalTask(
title = "Syncing ${file.name}",
project = source.project,
project = project,
cancellable = true
) {
runWriteActionInEdtAndWait {
Expand All @@ -101,7 +103,7 @@ class FileEditorBeforeEventsListener : FileEditorManagerListener.Before {
return
}
runWriteActionInEdtAndWait { syncProvider.saveDocument() }
sendTopic(AutoSyncFileListener.AUTO_SYNC_FILE, DataOpsManager.instance.componentManager).sync(file)
sendTopic(AutoSyncFileListener.AUTO_SYNC_FILE, project).sync(file)
}
}
}
Expand All @@ -114,7 +116,9 @@ class FileEditorBeforeEventsListener : FileEditorManagerListener.Before {
* @param file the file that opens
*/
override fun beforeFileOpened(source: FileEditorManager, file: VirtualFile) {
file.putUserData()
if (file is MFVirtualFile) {
putUserDataInFile(file)
}
super.beforeFileOpened(source, file)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FileEditorFocusListener: FocusChangeListener {
return
}
runWriteActionInEdtAndWait { syncProvider.saveDocument() }
sendTopic(AutoSyncFileListener.AUTO_SYNC_FILE, DataOpsManager.instance.componentManager).sync(file)
sendTopic(AutoSyncFileListener.AUTO_SYNC_FILE, project).sync(file)
}
}
}
Expand Down
14 changes: 5 additions & 9 deletions src/main/kotlin/org/zowe/explorer/editor/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,11 @@ val MF_VIRTUAL_FILE = Key.create<Boolean>(MF_VIRTUAL_FILE_KEY_NAME)
val USS_VIRTUAL_FILE = Key.create<Boolean>(USS_VIRTUAL_FILE_KEY_NAME)

/** Puts user data in file. */
fun VirtualFile.putUserData() {
val file = this
if (file is MFVirtualFile) {
file.putUserData(MF_VIRTUAL_FILE, true)
val attributes = DataOpsManager.instance.tryToGetAttributes(file)
if (attributes is RemoteUssAttributes) {
file.putUserData(USS_VIRTUAL_FILE, true)
}
}
fun putUserDataInFile(file: MFVirtualFile) {
file.putUserData(MF_VIRTUAL_FILE, true)
DataOpsManager.instance.tryToGetAttributes(file)
?.takeIf { it is RemoteUssAttributes }
?.let { file.putUserData(USS_VIRTUAL_FILE, true) }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SubmitJobAction : AnAction() {
), it
).also { result ->
e.project?.let { project ->
sendTopic(JOB_ADDED_TOPIC).submitted(project, requestData.second, submitFilePath, result)
sendTopic(JOB_ADDED_TOPIC, project).submitted(project, requestData.second, submitFilePath, result)
}
}
}.onSuccess {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class SubmitJobToolbarAction: AnAction() {
progressIndicator = it
).also { result ->
e.project?.let { project ->
sendTopic(JOB_ADDED_TOPIC).submitted(project, connectionConfig, file.parent.path, result)
sendTopic(JOB_ADDED_TOPIC, project).submitted(project, connectionConfig, file.parent.path, result)
}
}
}.onFailure {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class ViewJobAction : AnAction() {
dataOpsManager.tryToGetAttributes(virtualFile)?.clone() as RemoteJobAttributes

val project = e.project ?: return
sendTopic(JOB_ADDED_TOPIC).viewed(
sendTopic(JOB_ADDED_TOPIC, project).viewed(
project,
attributes.requesters[0].connectionConfig,
virtualFile.filenameInternal,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,19 +426,19 @@ class ExplorerPasteProvider : PasteProvider {

val listOfAllConflicts = pasteDestinations
.mapNotNull { destFile ->
val destAttributes = dataOpsManager.tryToGetAttributes(destFile)
destFile.children
?.map conflicts@{ destChild ->
val filteredSourceFiles = sourceFiles.filter { source ->
val sourceAttributes = dataOpsManager.tryToGetAttributes(source)
val destAttributes = dataOpsManager.tryToGetAttributes(destChild)
if (
destAttributes is RemoteMemberAttributes &&
destAttributes is RemoteDatasetAttributes &&
(sourceAttributes is RemoteUssAttributes || source is VirtualFileImpl)
) {
val memberName = source.name.filter { it.isLetterOrDigit() }.take(8).uppercase()
if (memberName.isNotEmpty()) memberName == destChild.name else "EMPTY" == destChild.name
} else if (
destAttributes is RemoteMemberAttributes &&
destAttributes is RemoteDatasetAttributes &&
sourceAttributes is RemoteDatasetAttributes
) {
sourceAttributes.name.split(".").last() == destChild.name
Expand Down Expand Up @@ -550,12 +550,17 @@ class ExplorerPasteProvider : PasteProvider {
allConflicts.forEach { conflict ->
var copyIndex = 1
val sourceName = conflict.second.name
val isSourceDirectory = conflict.second.isDirectory
var newName: String
val destAttributes = dataOpsManager.tryToGetAttributes(conflict.first)

val sourceAttributes = dataOpsManager.tryToGetAttributes(conflict.second)
do {
newName = if (destAttributes is RemoteDatasetAttributes) {
newName = if (destAttributes is RemoteDatasetAttributes && sourceAttributes is RemoteDatasetAttributes) {
"${sourceAttributes.name.split(".").last().take(7)}$copyIndex"
} else if (destAttributes is RemoteDatasetAttributes) {
if (sourceName.length >= 8) "${sourceName.take(7)}$copyIndex" else "$sourceName$copyIndex"
} else if (isSourceDirectory || sourceAttributes is RemoteDatasetAttributes) {
"${sourceName}_(${copyIndex})"
} else {
val extension = if (sourceName.contains(".")) sourceName.substringAfterLast(".") else null
val newNameWithoutExtension = "${sourceName.substringBeforeLast(".")}_(${copyIndex})"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ abstract class ExplorerTreeView<Connection: ConnectionConfigBase, U : WorkingSet
},
disposable = this
)
//TODO: is the functionality needed?
subscribe(
componentManager = dataOpsManager.componentManager,
topic = AttributesService.FILE_CONTENT_CHANGED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ class ExplorerWindowFactory : ToolWindowFactory, DumbAware {
}

override fun init(toolWindow: ToolWindow) {
subscribe(AutoSyncFileListener.AUTO_SYNC_FILE, object: AutoSyncFileListener {
subscribe(
project = toolWindow.project,
topic = AutoSyncFileListener.AUTO_SYNC_FILE,
handler = object: AutoSyncFileListener {
override fun sync(file: VirtualFile) {
val dataOpsManager = service<DataOpsManager>()
if (dataOpsManager.isSyncSupported(file)) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/org/zowe/explorer/explorer/ui/JobNode.kt
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ class JobNode(
*/
private fun isErrorReturnCode(returnCode : String?) : Boolean {
if (returnCode != null) {
return if (!returnCode.startsWith("CANCELED")) {
val numberedRC = returnCode.split(" ")[1].toIntOrNull()
return if (!returnCode.contains(Regex("ERR|ABEND|CANCEL|FAIL"))) {
val numberedRC = returnCode.split(" ").getOrNull(1)?.toIntOrNull()
if (numberedRC != null) {
numberedRC > 0
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ class JobsWindowFactory: ToolWindowFactory {

override fun init(toolWindow: ToolWindow) {
subscribe(
JOB_ADDED_TOPIC,
object: JobHandler {
project = toolWindow.project,
topic = JOB_ADDED_TOPIC,
handler = object: JobHandler {
override fun submitted(project: Project, connectionConfig: ConnectionConfig, mfFilePath: String, jobRequest: SubmitJobRequest) {
addJobBuildContentTab(project, toolWindow, connectionConfig, mfFilePath, jobRequest.jobid, jobRequest.jobname)
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/kotlin/org/zowe/explorer/editor/EditorTestSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ class EditorTestSpec : WithApplicationShouldSpec({
every { virtualFileMock.charset } returns charsetMock

var isSynced = false
val sendTopicRef: (Topic<AutoSyncFileListener>, ComponentManager) -> AutoSyncFileListener = ::sendTopic
val sendTopicRef: (Topic<AutoSyncFileListener>, Project) -> AutoSyncFileListener = ::sendTopic
mockkStatic(sendTopicRef as KFunction<*>)
every { sendTopic(AutoSyncFileListener.AUTO_SYNC_FILE, any<ComponentManager>()) } answers {
every { sendTopic(AutoSyncFileListener.AUTO_SYNC_FILE, any<Project>()) } answers {
isSynced = true
val autoSyncFileListenerMock = mockk<AutoSyncFileListener>()
every { autoSyncFileListenerMock.sync(virtualFileMock) } returns Unit
Expand Down
Loading

0 comments on commit 082e5c8

Please sign in to comment.