Skip to content

Commit

Permalink
1.2.0 (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellizio authored Aug 16, 2024
2 parents 1437212 + a279de6 commit 3007db5
Show file tree
Hide file tree
Showing 13 changed files with 84 additions and 29 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

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
- Fixed tabs validation

## [1.1.0]
- odata-cli 0.3.1 support
- UI improvements and fixes
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,32 @@

---


## 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.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 |


## Usage

![](/img/step1.png)
![](/img/step2.png)
![](/img/step3.png)
![](/img/step4.png)


## 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)
14 changes: 8 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}

Expand Down Expand Up @@ -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"
]
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dotnet/Plugin.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<!-- See https://www.nuget.org/packages/JetBrains.ReSharper.SDK -->
<!-- Keep in sync with ProductVersion in gradle.properties -->
<SdkVersion>2023.3.0</SdkVersion>
<SdkVersion>2024.1.0</SdkVersion>

<Title>OData CLI UI</Title>
<Description>Description</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

<ItemGroup>
<PackageReference Include="JetBrains.Rider.SDK" Version="$(SdkVersion)" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Include="Microsoft.NETCore.Platforms" Version="5.0.0" />
<PackageReference Include="Microsoft.NETCore.Targets" Version="1.1.3" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
19 changes: 19 additions & 0 deletions src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/BaseDialog.kt
Original file line number Diff line number Diff line change
@@ -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<Container, Boolean> = 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 }
}
}
}
27 changes: 20 additions & 7 deletions src/rider/main/kotlin/ru/ellizio/odatacliui/dialogs/CliDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -76,6 +75,8 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) {
row {
cell(tabbedPane)
}.resizableRow()
}.apply {
registerPanelValidators(this)
}
}

Expand Down Expand Up @@ -117,10 +118,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")
Expand All @@ -134,14 +141,20 @@ 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)
.comment(UiBundle.text("cli.upper-camel-case.comment"), Int.MAX_VALUE)
.bindSelected(model.upperCamelCase)
}
}.apply {
registerValidators(disposable)
registerPanelValidators(this)
generationTabPanel = this
}

Expand All @@ -163,7 +176,7 @@ class CliDialog(private val model: CliDialogModel) : DialogWrapper(false) {
.validationOnApply(CliDialogValidators.proxyValidator())
}
}.apply {
registerValidators(disposable)
registerPanelValidators(this)
requestTabPanel = this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
Expand All @@ -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()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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? = {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/rider/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<name>OData CLI UI</name>
<version>_PLACEHOLDER_</version>
<vendor url="https://github.com/ellizio/odata-cli-ui">ellizio</vendor>
<idea-version since-build="_PLACEHOLDER_" until-build="_PLACEHOLDER_" />
<idea-version since-build="241" until-build="241.*" />
<depends>com.intellij.modules.rider</depends>
<depends>org.jetbrains.plugins.terminal</depends>
<resource-bundle>UiBundle</resource-bundle>
Expand Down
4 changes: 3 additions & 1 deletion src/rider/main/resources/UiBundle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 3007db5

Please sign in to comment.