Comments (4)
Several years ago, I made a conscious decision to not clear the checked items when one selects a template that has less supported events.
I decided that because if one changes back to the original template, one as to remember what events were previously selected because that information is lost.
Since then, the logic in that edit webhook dialog has been completely re-written and is much more advanced. It is also Jquery unit tested!
I should be able to support one of the following scenarios:
-
Store (inside state in the webhook dialog), the original webhook config.
When the user changes to a new template, only check the events that were previously checked and are supported by the new template.
If the user changes to another template, do the same using the original selected events and so on.
If the user changes back to the original template, the original events should be re-instated.However, what logic is applied if the user deliberately checks or un-checks an event and then changes template?
-
Validate the available build events on the server side when the webhook is saved.
Only enable the ones that have an applicable event available in the template.
I'm leaning towards the first option, because that at least shows to the user what the intended configuration will be when they click the save button. Option two is easier to code ;-)
from tcwebhooks.
However, what logic is applied if the user deliberately checks or un-checks an event and then changes template?
Thinking about that, I can handle that case too. If a user intentionally modifies the set of checked/unchecked events, then save that to the stored state.
Any further changes to template will honour the same rules as above, but the state will have been updated to reflect the user action.
If the user wants to completely back out, they can just press Cancel
and no changes will be made.
It does reveal an interesting bug. What should the REST API or Controller logic do when a user selected a build event that the template does not support?
Obviously at the moment, it silently ignores that mis-match and allows the update to be written. This is why you can see these errors being thrown in the log.
I feel like an invalid update (PUT) should return 400 bad request when the list of requested events are not supported by the template.
from tcwebhooks.
@matt-richardson Which page URL are you using to edit webhooks?
The index page with the blurb on the right, or the edit project page?
from tcwebhooks.
A third option - you could inform the user "new template doesn't support x, y, and z - these have been de-selected."
A fourth option could be to do the same, but also have a "revert to previous template" option that puts you back in the previous state.
In terms of the REST API / Controller - I think it should return a bad request as you suggest 👍
@matt-richardson Which page URL are you using to edit webhooks?
The index page with the blurb on the right, or the edit project page?
I was using the edit project page.
from tcwebhooks.
Related Issues (20)
- Impossible to save WebHook configuration for non system admin users HOT 5
- Managing Webhooks from Top to Bottom HOT 6
- Investigate Mute or Fix Test callback HOT 6
- TeamCity server cpu and memory spike after enabling tcwebhooks HOT 9
- Calculate Queue and single Build Step Duration HOT 5
- Calculate Time To Restore HOT 7
- #substringBefore(${buildLog} and alternatives HOT 1
- Muted test webhook doesn't include test name HOT 16
- build.FinishDate is empty even build is finished HOT 5
- Send all parameters as valid json to elasticsearch HOT 12
- Legacy Webhook Build Failed Template wrong HOT 3
- Cannot format date HOT 10
- Get Information from Performance Monitor (BuildFeature) HOT 4
- Password field is in plan text HOT 3
- REST API returns 500 when editing webhook HOT 7
- Unexpected Error when accessing webhook search results HOT 9
- Cloud Profiles "Events" HOT 4
- Edited Discord template does not send notification. HOT 1
- TeamCity Webhook is removed if you are using versioned settings HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tcwebhooks.