-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#234 | Better URL validation | Iframe board tests added (plus some refactor) #242
Conversation
@@ -31,7 +31,7 @@ | |||
<!--- Go over all the following points, and put an `x` in all the boxes that apply. --> | |||
<!--- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> | |||
|
|||
- [ ] My code follows the [code style](/CONTRIBUTING.md#coding-conventions) of this project. | |||
- [ ] My code follows the [code style](https://github.com/Cognifide/cogboard/blob/master/CONTRIBUTING.md#coding-conventions) of this project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This link did not worked
…ed' into cypress-tests-more-object-oriented
fun create( | ||
address: String, | ||
vertx: Vertx, | ||
configuration: Map<String, (JsonObject) -> String> | ||
): MessageConsumer<JsonObject> = vertx.eventBus() | ||
.consumer<JsonObject>(address) | ||
.handler { | ||
val body = it.body() | ||
configuration[body.getString("method")]?.let { method -> | ||
it.reply(method(body.getJsonObject("payload"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detekt fix
return if (this.isEmpty()) { | ||
-1 | ||
} else { | ||
Random.nextInt(0, this.size) | ||
val indexes = this.mapIndexed { index, _ -> index } | ||
.filter { i -> !usedIndexes.contains(i) } | ||
when { | ||
// If there is one index, there is no need to use random function | ||
indexes.size == 1 -> return indexes[0] | ||
indexes.isNotEmpty() -> indexes[Random.nextInt(0, indexes.size)] | ||
else -> Random.nextInt(0, this.size) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detekt fix
.filter { | ||
it.getString(version.getMetricKey()) != "alert_status" && | ||
it.getString(version.getMetricKey()) == metricName | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detekt fix
fun getVersion(version: String) = | ||
if (version == "5.x") V5x() | ||
else V7x() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Detekt fix
validator: () => | ||
string().matches( | ||
/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, | ||
{ message: vm.INVALID_URL(), excludeEmptyString: true } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better URL Validation - port number possible
validator: () => | ||
string().matches( | ||
/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, | ||
{ message: vm.INVALID_URL(), excludeEmptyString: true } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better URL Validation - port number possible
validator: () => | ||
string().matches( | ||
/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/, | ||
{ message: vm.INVALID_URL(), excludeEmptyString: true } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better URL Validation - port number possible
it('Logged user can add new iframe dashboard', () => { | ||
addIframeDashboard(); | ||
}); | ||
|
||
it('Logged user can choose iframe dashboard', () => { | ||
addIframeDashboard() | ||
.canBeSelected() | ||
.assertIframeExists(); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added tests for Iframe widget
Description
URL validation changed so we can use port numbers.
More Code refactoring and Iframe boards tests.
Types of changes
Checklist:
I hereby agree to the terms of the Cogboard Contributor License Agreement.