-
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
#346 | Refresh every APP state after save event #357
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
02ff17a
Bump version number after failed release workflow
a6f7d01
Merge branch 'master' of github.com:wttech/cogboard
d911a70
Merge branch 'master' of github.com:wttech/cogboard
6057448
Merge branch 'master' of github.com:wttech/cogboard
331f3bc
Merge branch 'master' of github.com:wttech/cogboard
736bab9
Merge branch 'master' of github.com:wttech/cogboard
e08ee50
Big CogboardConstants.kt refactor
d4e0ea8
Saving will now trigger event that will refresh all Cogboard instances
1499e1d
CR Fixes + new init config provided by Grzegorz
9e0528b
Saving will now trigger event that will refresh all Cogboard instance…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
cogboard-app/src/main/kotlin/com/cognifide/cogboard/config/CredentialsConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
package com.cognifide.cogboard.config | ||
|
||
import com.cognifide.cogboard.CogboardConstants | ||
import com.cognifide.cogboard.CogboardConstants.Props | ||
|
||
class CredentialsConfig { | ||
|
||
companion object { | ||
const val CREDENTIALS_ARRAY = CogboardConstants.PROP_CREDENTIALS | ||
const val CREDENTIAL_ID_PROP = CogboardConstants.PROP_ID | ||
const val CREDENTIAL_ID_PREFIX = CogboardConstants.PROP_CREDENTIAL | ||
const val CREDENTIAL_LABEL_PROP = CogboardConstants.PROP_LABEL | ||
const val CREDENTIALS_ARRAY = Props.CREDENTIALS | ||
const val CREDENTIAL_ID_PROP = Props.ID | ||
const val CREDENTIAL_ID_PREFIX = Props.CREDENTIAL | ||
const val CREDENTIAL_LABEL_PROP = Props.LABEL | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
cogboard-app/src/main/kotlin/com/cognifide/cogboard/config/EndpointsConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package com.cognifide.cogboard.config | ||
|
||
import com.cognifide.cogboard.CogboardConstants | ||
import com.cognifide.cogboard.CogboardConstants.Props | ||
|
||
class EndpointsConfig { | ||
|
||
companion object { | ||
const val ENDPOINTS_ARRAY = CogboardConstants.PROP_ENDPOINTS | ||
const val ENDPOINT_ID_PROP = CogboardConstants.PROP_ID | ||
const val ENDPOINT_ID_PREFIX = CogboardConstants.PROP_ENDPOINT | ||
const val ENDPOINT_LABEL_PROP = CogboardConstants.PROP_LABEL | ||
const val CREDENTIALS_PROP = CogboardConstants.PROP_CREDENTIALS | ||
const val ENDPOINTS_ARRAY = Props.ENDPOINTS | ||
const val ENDPOINT_ID_PROP = Props.ID | ||
const val ENDPOINT_ID_PREFIX = Props.ENDPOINT | ||
const val ENDPOINT_LABEL_PROP = Props.LABEL | ||
const val CREDENTIALS_PROP = Props.CREDENTIALS | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 6 additions & 16 deletions
22
cogboard-app/src/main/kotlin/com/cognifide/cogboard/config/controller/ConfirmationSender.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,24 @@ | ||
package com.cognifide.cogboard.config.controller | ||
|
||
import com.cognifide.cogboard.CogboardConstants | ||
import com.cognifide.cogboard.CogboardConstants.Event | ||
import com.cognifide.cogboard.CogboardConstants.EventType | ||
import com.cognifide.cogboard.CogboardConstants.Props | ||
import io.vertx.core.Vertx | ||
import io.vertx.core.json.JsonObject | ||
import io.vertx.core.logging.Logger | ||
import io.vertx.core.logging.LoggerFactory | ||
|
||
class ConfirmationSender(private val vertx: Vertx) { | ||
|
||
fun sendOk() { | ||
vertx.eventBus().send(CogboardConstants.EVENT_SEND_MESSAGE_TO_WEBSOCKET, | ||
JsonObject().message(OK_MESSAGE)) | ||
} | ||
|
||
fun sendError(body: JsonObject) { | ||
LOGGER.error("$ERROR_MESSAGE \nconfig:\n$body") | ||
vertx.eventBus().send(CogboardConstants.EVENT_SEND_MESSAGE_TO_WEBSOCKET, | ||
JsonObject().message(ERROR_MESSAGE)) | ||
vertx.eventBus().send(Event.SEND_MESSAGE_TO_WEBSOCKET, JsonObject().message(OK_MESSAGE)) | ||
} | ||
|
||
private fun JsonObject.message(message: String): JsonObject { | ||
return this | ||
.put(CogboardConstants.PROP_EVENT_TYPE, PROP_EVENT_TYPE_NOTIFICATION_CONFIG_SAVE) | ||
.put("message", message) | ||
.put(Props.EVENT_TYPE, EventType.CONFIG_SAVED) | ||
.put("message", message) | ||
} | ||
|
||
companion object { | ||
private val LOGGER: Logger = LoggerFactory.getLogger(ConfirmationSender::class.java) | ||
private const val OK_MESSAGE = "Configuration saved" | ||
private const val ERROR_MESSAGE = "Configuration not saved - wrong configuration" | ||
private const val PROP_EVENT_TYPE_NOTIFICATION_CONFIG_SAVE = "notification-config-save" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Moved to separate objects...