From 01b115e2b840c3fb4ae17d3579edb35ddfda30e3 Mon Sep 17 00:00:00 2001 From: ellizio Date: Mon, 8 Jul 2024 21:40:29 +0300 Subject: [PATCH 1/6] Fixed command line options --- .../ru/ellizio/odatacliui/dialogs/CliDialog.kt | 18 +++++++++++++++--- .../odatacliui/models/CliDialogModel.kt | 10 +++++++--- src/rider/main/resources/UiBundle.properties | 4 +++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt b/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt index 9c1dac7..a0783ab 100644 --- a/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt +++ b/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt @@ -117,10 +117,16 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) { .bindText(model.excludedSchemaTypes) } row { - checkBox("--internal") + checkBox("--enable-internal") .align(AlignX.FILL) - .comment(UiBundle.text("cli.internal.comment"), Int.MAX_VALUE) - .bindSelected(model.internal) + .comment(UiBundle.text("cli.enable-internal.comment"), Int.MAX_VALUE) + .bindSelected(model.enableInternal) + } + row { + checkBox("--omit-versioning-info") + .align(AlignX.FILL) + .comment(UiBundle.text("cli.omit-versioning-info.comment"), Int.MAX_VALUE) + .bindSelected(model.omitVersioningInfo) } row { checkBox("--multiple-files") @@ -134,6 +140,12 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) { .comment(UiBundle.text("cli.ignore-unexpected-elements.comment"), Int.MAX_VALUE) .bindSelected(model.ignoreUnexpectedElements) } + row { + checkBox("--enable-tracking") + .align(AlignX.FILL) + .comment(UiBundle.text("cli.enable-tracking.comment"), Int.MAX_VALUE) + .bindSelected(model.enableTracking) + } row { checkBox("--upper-camel-case") .align(AlignX.FILL) diff --git a/src/rider/main/kotlin/ru/ellizio/odatacliui/models/CliDialogModel.kt b/src/rider/main/kotlin/ru/ellizio/odatacliui/models/CliDialogModel.kt index 2acbc82..2e42e43 100644 --- a/src/rider/main/kotlin/ru/ellizio/odatacliui/models/CliDialogModel.kt +++ b/src/rider/main/kotlin/ru/ellizio/odatacliui/models/CliDialogModel.kt @@ -40,9 +40,11 @@ class CliDialogModel(project: Project, private val actionMetadata: ActionMetadat val excludedOperationImports = MutableProperty("") val excludedBoundOperations = MutableProperty("") val excludedSchemaTypes = MutableProperty("") - val internal = MutableProperty(false) + val enableInternal = MutableProperty(false) + val omitVersioningInfo = MutableProperty(false) val multipleFiles = MutableProperty(false) val ignoreUnexpectedElements = MutableProperty(false) + val enableTracking = MutableProperty(false) val upperCamelCase = MutableProperty(true) val customHeaders = MutableProperty("") @@ -65,10 +67,12 @@ class CliDialogModel(project: Project, private val actionMetadata: ActionMetadat .withParameter("--excluded-operation-imports", excludedOperationImports.get()) .withParameter("--excluded-bound-operations", excludedBoundOperations.get()) .withParameter("--excluded-schema-types", excludedSchemaTypes.get()) - .withFlag("--upper-camel-case", upperCamelCase.get()) - .withFlag("--internal", internal.get()) + .withFlag("--enable-internal", enableInternal.get()) + .withFlag("--omit-versioning-info", omitVersioningInfo.get()) .withFlag("--multiple-files", multipleFiles.get()) .withFlag("--ignore-unexpected-elements", ignoreUnexpectedElements.get()) + .withFlag("--enable-tracking", enableTracking.get()) + .withFlag("--upper-camel-case", upperCamelCase.get()) .withParameter("--outputdir", getOutputDirectory()) .build() diff --git a/src/rider/main/resources/UiBundle.properties b/src/rider/main/resources/UiBundle.properties index a11e576..aff2d93 100644 --- a/src/rider/main/resources/UiBundle.properties +++ b/src/rider/main/resources/UiBundle.properties @@ -20,9 +20,11 @@ cli.excluded-bound-operations.empty-text=Example: BoundOperation1, BoundOperatio cli.excluded-bound-operations.comment=Comma-separated list of the names of bound operations to exclude from the generated code cli.excluded-schema-types.empty-text=Example: EntityType1, EntityType2, EntityType3 cli.excluded-schema-types.comment=Comma-separated list of the names of entity types to exclude from the generated code -cli.internal.comment=Applies the internal class modifier on generated classes instead of public thereby making them invisible outside the assembly +cli.enable-internal.comment=Applies the internal class modifier on generated classes instead of public thereby making them invisible outside the assembly +cli.omit-versioning-info.comment=Omit runtime version and code generation timestamp from the generated files cli.multiple-files.comment=Split the generated classes into separate files instead of generating all the code in a single file cli.ignore-unexpected-elements.comment=This flag indicates whether to ignore unexpected elements and attributes in the metadata document and generate the client code if any +cli.enable-tracking.comment=Enable entity and property tracking cli.upper-camel-case.comment=Transforms names (class and property names) to upper camel-case so that to better conform with C# naming conventions cli.custom-headers.empty-text=Example: Header1:HeaderValue, Header2:HeaderValue cli.custom-headers.comment=Headers that will get sent along with the request when fetching the metadata document from the service From 3ecb1802f0c0366b7f4851b5131cf6d38bfc8630 Mon Sep 17 00:00:00 2001 From: ellizio Date: Tue, 30 Jul 2024 11:30:09 +0300 Subject: [PATCH 2/6] Compatibility table --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 4fda33b..f52623a 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,22 @@ --- + +## Compatibility + +| Plugin ver. | odata-cli ver. | +|-------------|----------------| +| 1.1.0 | 0.3.1, 0.3.0 | +| 1.0.1 | 0.2.1 | +| 1.0.0 | 0.2.1 | + + ## Installation 1. Install plugin from [Marketplace](https://plugins.jetbrains.com/plugin/24117-odata-cli-ui) or download from [Releases page](https://github.com/ellizio/odata-cli-ui/releases) and install manually 2. Install the latest version of the OData CLI tool with the command `dotnet tool install -g Microsoft.OData.Cli` + ## Usage ![](/img/step1.png) @@ -22,6 +33,7 @@ ![](/img/step3.png) ![](/img/step4.png) + ## Additional References - [Changelog](https://github.com/ellizio/odata-cli-ui/blob/master/CHANGELOG.md) From 7f28beff627c2645dff940ff10344a2b450231a9 Mon Sep 17 00:00:00 2001 From: ellizio Date: Tue, 30 Jul 2024 11:31:13 +0300 Subject: [PATCH 3/6] Update table --- README.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index f52623a..3ae6720 100644 --- a/README.md +++ b/README.md @@ -11,21 +11,21 @@ --- -## Compatibility - -| Plugin ver. | odata-cli ver. | -|-------------|----------------| -| 1.1.0 | 0.3.1, 0.3.0 | -| 1.0.1 | 0.2.1 | -| 1.0.0 | 0.2.1 | - - ## Installation 1. Install plugin from [Marketplace](https://plugins.jetbrains.com/plugin/24117-odata-cli-ui) or download from [Releases page](https://github.com/ellizio/odata-cli-ui/releases) and install manually 2. Install the latest version of the OData CLI tool with the command `dotnet tool install -g Microsoft.OData.Cli` +## Compatibility + +| Plugin version | odata-cli version | +|----------------|-------------------| +| 1.1.0 | 0.3.1, 0.3.0 | +| 1.0.1 | 0.2.1 | +| 1.0.0 | 0.2.1 | + + ## Usage ![](/img/step1.png) From 16e187818fd9c9856554503ab646df553c450866 Mon Sep 17 00:00:00 2001 From: ellizio Date: Thu, 15 Aug 2024 10:50:50 +0300 Subject: [PATCH 4/6] bump to 1.2.0 --- build.gradle | 14 ++++++++------ gradle.properties | 4 ++-- src/dotnet/Plugin.props | 2 +- .../ReSharperPlugin.ODataCliUi.Rider.csproj | 2 +- .../odatacliui/actions/OpenCliDialogAction.kt | 3 --- src/rider/main/resources/META-INF/plugin.xml | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index 528dfeb..6f01eb0 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { id 'java' id 'org.jetbrains.kotlin.jvm' version '1.8.10' id 'org.jetbrains.intellij' version '1.13.3' // See https://github.com/JetBrains/gradle-intellij-plugin/releases - id 'com.jetbrains.rdgen' version '2023.3.2' // See https://github.com/JetBrains/rd/releases + id 'com.jetbrains.rdgen' version '2024.1.1' // See https://github.com/JetBrains/rd/releases id 'me.filippov.gradle.jvm.wrapper' version '0.14.0' } @@ -209,11 +209,13 @@ prepareSandbox { runPluginVerifier { ideVersions = [ - "RD-2023.3", - "RD-2023.3.1", - "RD-2023.3.2", - "RD-2023.3.3", - "RD-2023.3.4" + "RD-2024.1", + "RD-2024.1.1", + "RD-2024.1.2", + "RD-2024.1.3", + "RD-2024.1.4", + "RD-2024.1.5", + "RD-2024.1.6" ] } diff --git a/gradle.properties b/gradle.properties index e44b451..ef3cea1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ DotnetPluginId=ReSharperPlugin.ODataCliUi DotnetSolution=ReSharperPlugin.ODataCliUi.sln RiderPluginId=ru.ellizio.odatacliui -PluginVersion=1.1.0 +PluginVersion=1.2.0 BuildConfiguration=Debug @@ -17,7 +17,7 @@ PublishToken="_PLACEHOLDER_" # Release: 2020.2 # EAP: 2020.3-EAP2-SNAPSHOT # Nightly: 2020.3-SNAPSHOT -ProductVersion=2023.3 +ProductVersion=2024.1 # Kotlin 1.4 will bundle the stdlib dependency by default, causing problems with the version bundled with the IDE # https://blog.jetbrains.com/kotlin/2020/07/kotlin-1-4-rc-released/#stdlib-default diff --git a/src/dotnet/Plugin.props b/src/dotnet/Plugin.props index bced717..133ef71 100644 --- a/src/dotnet/Plugin.props +++ b/src/dotnet/Plugin.props @@ -3,7 +3,7 @@ - 2023.3.0 + 2024.1.0 OData CLI UI Description diff --git a/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj b/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj index f16d427..58f0290 100644 --- a/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj +++ b/src/dotnet/ReSharperPlugin.ODataCliUi/ReSharperPlugin.ODataCliUi.Rider.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/rider/main/kotlin/ru/ellizio/odatacliui/actions/OpenCliDialogAction.kt b/src/rider/main/kotlin/ru/ellizio/odatacliui/actions/OpenCliDialogAction.kt index dcb7336..2470caa 100644 --- a/src/rider/main/kotlin/ru/ellizio/odatacliui/actions/OpenCliDialogAction.kt +++ b/src/rider/main/kotlin/ru/ellizio/odatacliui/actions/OpenCliDialogAction.kt @@ -30,9 +30,6 @@ class OpenCliDialogAction : AnAction() { val dialogModel = CliDialogModel(project, actionMetadata) - // launchOnUi is available since 233.11799.241 - // RD-2023.3 has build number 233.11799.261 - @Suppress("MissingRecentApi") project.lifetime.launchOnUi { val dialog = CliDialog(dialogModel) if (dialog.showAndGet()) { diff --git a/src/rider/main/resources/META-INF/plugin.xml b/src/rider/main/resources/META-INF/plugin.xml index 9806712..6455d35 100644 --- a/src/rider/main/resources/META-INF/plugin.xml +++ b/src/rider/main/resources/META-INF/plugin.xml @@ -3,7 +3,7 @@ OData CLI UI _PLACEHOLDER_ ellizio - + com.intellij.modules.rider org.jetbrains.plugins.terminal UiBundle From a226fc24359d11903cc3510ad05a17e63f1c068d Mon Sep 17 00:00:00 2001 From: ellizio Date: Thu, 15 Aug 2024 10:55:56 +0300 Subject: [PATCH 5/6] Updated readme --- CHANGELOG.md | 3 +++ README.md | 1 + 2 files changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b77dd0..5e335e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +## [1.2.0] +- Added missing odata-cli options + ## [1.1.0] - odata-cli 0.3.1 support - UI improvements and fixes diff --git a/README.md b/README.md index 3ae6720..fd74fb4 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ | Plugin version | odata-cli version | |----------------|-------------------| +| 1.2.0 | 0.3.1, 0.3.0 | | 1.1.0 | 0.3.1, 0.3.0 | | 1.0.1 | 0.2.1 | | 1.0.0 | 0.2.1 | From bba53b1b67b636189bc17b25db2bd27e5178f29f Mon Sep 17 00:00:00 2001 From: ellizio Date: Fri, 16 Aug 2024 11:56:55 +0300 Subject: [PATCH 6/6] Fixed tabs validation --- CHANGELOG.md | 1 + README.md | 2 +- .../ellizio/odatacliui/dialogs/BaseDialog.kt | 19 +++++++++++++++++++ .../ellizio/odatacliui/dialogs/CliDialog.kt | 9 +++++---- .../models/validators/CliDialogValidators.kt | 7 ++++--- 5 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/BaseDialog.kt diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e335e6..911e9ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ## [1.2.0] - Added missing odata-cli options +- Fixed tabs validation ## [1.1.0] - odata-cli 0.3.1 support diff --git a/README.md b/README.md index fd74fb4..3a184ab 100644 --- a/README.md +++ b/README.md @@ -37,5 +37,5 @@ ## Additional References -- [Changelog](https://github.com/ellizio/odata-cli-ui/blob/master/CHANGELOG.md) +- [Changelog](CHANGELOG.md) - [OData CLI](https://learn.microsoft.com/en-us/odata/odatacli/getting-started) diff --git a/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/BaseDialog.kt b/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/BaseDialog.kt new file mode 100644 index 0000000..e904f94 --- /dev/null +++ b/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/BaseDialog.kt @@ -0,0 +1,19 @@ +package ru.ellizio.odatacliui.dialogs + +import com.intellij.openapi.ui.DialogPanel +import com.intellij.openapi.ui.DialogWrapper +import java.awt.Container + +abstract class BaseDialog(canBeParent: Boolean) : DialogWrapper(canBeParent) { + private val panelsStates: MutableMap = mutableMapOf() + + protected fun registerPanelValidators(panel: DialogPanel) { + if (panelsStates.put(panel, true) != null) + throw Exception("Panel validators are already registered") + + panel.registerValidators(disposable) { validations -> + panelsStates[panel] = validations.all { it.value.okEnabled } + isOKActionEnabled = panelsStates.all { it.value } + } + } +} \ No newline at end of file diff --git a/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt b/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt index a0783ab..ff308f3 100644 --- a/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt +++ b/src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt @@ -2,7 +2,6 @@ package ru.ellizio.odatacliui.dialogs import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory import com.intellij.openapi.ui.DialogPanel -import com.intellij.openapi.ui.DialogWrapper import com.intellij.ui.components.JBTabbedPane import com.intellij.ui.dsl.builder.* import ru.ellizio.odatacliui.Constants @@ -13,7 +12,7 @@ import ru.ellizio.odatacliui.models.CliDialogModel import ru.ellizio.odatacliui.models.validators.CliDialogValidators import javax.swing.JComponent -class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) { +class CliDialog(private val model: CliDialogModel) : BaseDialog(false) { private lateinit var generationTabPanel: DialogPanel private lateinit var requestTabPanel: DialogPanel @@ -76,6 +75,8 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) { row { cell(tabbedPane) }.resizableRow() + }.apply { + registerPanelValidators(this) } } @@ -153,7 +154,7 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) { .bindSelected(model.upperCamelCase) } }.apply { - registerValidators(disposable) + registerPanelValidators(this) generationTabPanel = this } @@ -175,7 +176,7 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) { .validationOnApply(CliDialogValidators.proxyValidator()) } }.apply { - registerValidators(disposable) + registerPanelValidators(this) requestTabPanel = this } } \ No newline at end of file diff --git a/src/rider/main/kotlin/ru/ellizio/odatacliui/models/validators/CliDialogValidators.kt b/src/rider/main/kotlin/ru/ellizio/odatacliui/models/validators/CliDialogValidators.kt index f157e1f..37254a3 100644 --- a/src/rider/main/kotlin/ru/ellizio/odatacliui/models/validators/CliDialogValidators.kt +++ b/src/rider/main/kotlin/ru/ellizio/odatacliui/models/validators/CliDialogValidators.kt @@ -7,6 +7,7 @@ import javax.swing.JTextField object CliDialogValidators { private val serviceNameRegex = Regex("^[0-9a-zA-Z_\\-. ]+\$") + private val namespacePrefixRegex = Regex("^[a-zA-Z]\\w*(\\.[a-zA-Z]\\w*)*\$") private val proxyRegex = Regex("^(\\w+\\\\\\w+(:\\w+)?@)?\\w+:\\d+\$") fun serviceNameValidator(): ValidationInfoBuilder.(JTextField) -> ValidationInfo? = { @@ -30,14 +31,14 @@ object CliDialogValidators { } fun namespacePrefixValidator(): ValidationInfoBuilder.(JTextField) -> ValidationInfo? = { - if (it.text.contains(' ')) - error("Namespace prefix must not contain spaces") + if (it.text.isNotEmpty() && !namespacePrefixRegex.matches(it.text)) + error("Namespace prefix must be in a valid format") else null } fun proxyValidator(): ValidationInfoBuilder.(JTextField) -> ValidationInfo? = { - if (!proxyRegex.matches(it.text)) + if (it.text.isNotEmpty() && !proxyRegex.matches(it.text)) error("Proxy must be in a valid format") else null