Skip to content

Commit

Permalink
Merge branch 'zowe-release/v1.1.2-223' into zowe-release/v1.1.2-231
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 eaca4c7 + 9646942 commit d98a07c
Show file tree
Hide file tree
Showing 25 changed files with 365 additions and 155 deletions.
107 changes: 54 additions & 53 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,56 +58,57 @@ jobs:
path: ./build/distributions/


deploy:
needs: build

runs-on: XBY_IJMP_machine

concurrency: built-plugin
environment:
name: built-plugin
url: http://178.172.233.157/plugin-builds/${{steps.extract_branch.outputs.BRANCH_NAME}}/${{ steps.generate_file_name.outputs.NEW_FILE_NAME }}

steps:
- name: Extract branch name
id: extract_branch
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT

- name: Check current directory
shell: bash
run: pwd && ls -la

- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: builtPlugin
path: ./build/distributions/

- name: Check plugin built availability
shell: bash
run: ls -la ./build/distributions

- name: Get name of build plugin archive
id: getting_file_name
shell: bash
run: >
CURRENT_FILE_NAME_PATH=$(echo $(find build -name "zowe-explorer*")) &&
echo "Name of current file: $CURRENT_FILE_NAME_PATH" &&
echo "CURRENT_FILE_NAME_PATH=$CURRENT_FILE_NAME_PATH" >> $GITHUB_OUTPUT
- name: Generate new name for built plugin
id: generate_file_name
shell: bash
run: >
TEMP_VAR=${{ steps.getting_file_name.outputs.CURRENT_FILE_NAME_PATH }}
NEW_FILE_NAME="$(echo ${TEMP_VAR%.zip*})."$(date +"%Y-%m-%dT%H:%M:%S%:z" | tr ':' _)".zip" &&
NEW_FILE_NAME=${NEW_FILE_NAME##*/} &&
echo "Name of new file: $NEW_FILE_NAME" &&
echo "NEW_FILE_NAME=$NEW_FILE_NAME" >> $GITHUB_OUTPUT
- name: Move built plugin to destination folder
shell: bash
run: >
mkdir -p /var/www/plugin-builds/${{ steps.extract_branch.outputs.BRANCH_NAME }} &&
mv ${{ steps.getting_file_name.outputs.CURRENT_FILE_NAME_PATH }} /var/www/plugin-builds/${{ steps.extract_branch.outputs.BRANCH_NAME }}/${{ steps.generate_file_name.outputs.NEW_FILE_NAME }}
# deploy:
# needs: build

# runs-on: XBY_IJMP_machine

# concurrency: built-plugin
# environment:
# name: built-plugin
# TODO: use secrets!
# url: http://178.172.233.157/plugin-builds/${{steps.extract_branch.outputs.BRANCH_NAME}}/${{ steps.generate_file_name.outputs.NEW_FILE_NAME }}

# steps:
# - name: Extract branch name
# id: extract_branch
# shell: bash
# run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT

# - name: Check current directory
# shell: bash
# run: pwd && ls -la

# - name: Download artifacts
# uses: actions/download-artifact@v3
# with:
# name: builtPlugin
# path: ./build/distributions/

# - name: Check plugin built availability
# shell: bash
# run: ls -la ./build/distributions

# - name: Get name of build plugin archive
# id: getting_file_name
# shell: bash
# run: >
# CURRENT_FILE_NAME_PATH=$(echo $(find build -name "zowe-explorer*")) &&
# echo "Name of current file: $CURRENT_FILE_NAME_PATH" &&
# echo "CURRENT_FILE_NAME_PATH=$CURRENT_FILE_NAME_PATH" >> $GITHUB_OUTPUT

# - name: Generate new name for built plugin
# id: generate_file_name
# shell: bash
# run: >
# TEMP_VAR=${{ steps.getting_file_name.outputs.CURRENT_FILE_NAME_PATH }}
# NEW_FILE_NAME="$(echo ${TEMP_VAR%.zip*})."$(date +"%Y-%m-%dT%H:%M:%S%:z" | tr ':' _)".zip" &&
# NEW_FILE_NAME=${NEW_FILE_NAME##*/} &&
# echo "Name of new file: $NEW_FILE_NAME" &&
# echo "NEW_FILE_NAME=$NEW_FILE_NAME" >> $GITHUB_OUTPUT

# - name: Move built plugin to destination folder
# shell: bash
# run: >
# mkdir -p /var/www/plugin-builds/${{ steps.extract_branch.outputs.BRANCH_NAME }} &&
# mv ${{ steps.getting_file_name.outputs.CURRENT_FILE_NAME_PATH }} /var/www/plugin-builds/${{ steps.extract_branch.outputs.BRANCH_NAME }}/${{ steps.generate_file_name.outputs.NEW_FILE_NAME }}
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™ Explorer plug-in for IntelliJ IDEA™ 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
31 changes: 14 additions & 17 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ apply(plugin = "org.jetbrains.intellij")
apply(from = "gradle/sonar.gradle")

group = "org.zowe"
version = "1.1.1-231"
val remoteRobotVersion = "0.11.19"
val okHttp3Version = "4.10.0"
version = "1.1.2-231"
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 @@ -96,8 +96,33 @@ class ZoweOldConfigConvertPreloadingActivity : PreloadingActivity() {
}
}

/**
* Replace config storage name with old one if new config file doesn't exist
*/
private fun replaceConfigStorageName() {
val oldConfigStorageName = "org.zowe.explorer.config.OldConfigService"
val newConfigStorageName = "org.zowe.explorer.config.ConfigService"
val oldConfigName = "zowe_explorer_intellij_config.xml"
val newConfigName = "zowe_explorer_intellij_config_v2.xml"
val configPathDir = Paths.get(PathManager.getConfigPath(), PathManager.OPTIONS_DIRECTORY)
val oldConfigFile = File(Paths.get(configPathDir.pathString, oldConfigName).pathString)
val newConfigFile = File(Paths.get(configPathDir.pathString, newConfigName).pathString)
if (oldConfigFile.exists() && !newConfigFile.exists()) {
val charset = Charsets.UTF_8
runCatching {
val newContent =
oldConfigFile
.readText(charset)
.replace(newConfigStorageName.toRegex(), oldConfigStorageName)
Files.write(oldConfigFile.toPath(), newContent.toByteArray(charset))
service<IComponentStore>().reloadState(OldConfigServiceImpl::class.java)
}
}
}

override suspend fun execute() {
convertOldVersionConfig()
replaceConfigStorageName()
super.execute()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,8 @@ class ConnectionConfig : ConnectionConfigBase {
if (url != other.url) return false
if (isAllowSelfSigned != other.isAllowSelfSigned) return false
if (zoweConfigPath != other.zoweConfigPath) return false
// TODO: uncomment next 2 lines when the task https://jira.ibagroup.eu/browse/IJMP-1412 will be completed.
// if (zVersion != other.zVersion) return false
// if (owner != other.owner) return false
if (zVersion != other.zVersion) return false
if (owner != other.owner) return false

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ class DocumentedSyncProvider(
it.write(content)
}
loadNewContent(content)
getDocument()?.addDocumentListener(DocumentChangeListener())
}.onFailure {
isInitialContentSet.set(false)
}
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,9 +37,10 @@ class FileEditorEventsListener : FileEditorManagerListener {
* @param file the file that was opened.
*/
override fun fileOpened(source: FileEditorManager, file: VirtualFile) {
val editor = source.selectedTextEditor as? EditorEx

editor?.addFocusListener(focusListener)
if (file is MFVirtualFile) {
val editor = source.selectedTextEditor as? EditorEx
editor?.addFocusListener(focusListener)
}
super.fileOpened(source, file)
}
}
Expand All @@ -58,24 +59,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 @@ -89,7 +91,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 @@ -102,7 +104,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
Loading

0 comments on commit d98a07c

Please sign in to comment.