-
Notifications
You must be signed in to change notification settings - Fork 142
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
Add Notification Providers #2677
Conversation
9ec0319
to
9dfeb66
Compare
ui/components/ChipGroup.tsx
Outdated
@@ -17,6 +17,7 @@ function ChipGroup({ className, chips = [], onChipRemove, onClearAll }: Props) { | |||
return ( | |||
<Flex className={className} wide align start> | |||
{_.map(chips, (chip, index) => { | |||
if (chip.slice(-1) === ":") chip += " -"; |
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.
Why is this line required? Does it add -
to any chip text ending with :
?
@joshri so, we do not have a Settings page at the |
ui/components/DataTable.tsx
Outdated
if (typeof f.value === "string") { | ||
return f.value === colName; | ||
fields.forEach((field) => { | ||
if (field.textSearchable) { |
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.
You could try adding
if (!field.textSearchable) {
return;
}
at the beginning to remove this large if
wrapping the whole code. It should make forEach
move to the next element, but please check it. 🙂
ui/components/DataTable.tsx
Outdated
return f.value === colName; | ||
fields.forEach((field) => { | ||
if (field.textSearchable) { | ||
let value; |
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.
An empty line before this line might make the code more readable.
ui/components/DataTable.tsx
Outdated
|
||
if (f.sortValue) { | ||
return f.sortValue(row) === value; | ||
for (let i = 0; i < textFilters.length; i++) { |
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.
And an empty line before this line would make reading the code easier.
@@ -78,20 +78,19 @@ const FilterSection = ({ | |||
</Text> | |||
</ListItem> | |||
{options.sort().map((option: string, index: number) => { |
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.
You can use a shorter form here, because you are only returning the ListItem without using any local variables:
{options.sort().map((option: string, index: number) => (
<ListItem key={index}>
<ListItemIcon>
<FormCheckbox
label=""
name={`${header}${filterSeparator}${option}`}
/>
</ListItemIcon>
<Text color="neutral40" size="small">
{_.toString(option) || "-"}
</Text>
</ListItem>
))}
@opudrovs try using this yaml to get some providers going. Ripped it from the flux docs here https://fluxcd.io/flux/components/notification/provider apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
name: slack
namespace: default
spec:
type: slack
channel: general
address: https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK
proxy: https://proxy.corp:8080
secretRef:
name: webhook-url apiVersion: notification.toolkit.fluxcd.io/v1beta1
kind: Provider
metadata:
name: msteams
namespace: flux-system
spec:
type: msteams
address: <webhook-url> |
@opudrovs in regards to the applications tab still being highlighted - the mui tabs component must always have a valid active tab value otherwise you get long console errors. I can look into overriding this more if it's a big issue |
Thanks, will try it.
I would prefer nothing to be selected/highlighted in the sidebar if there is no Notifications item there, because it might look misleading to the user (like they are still in the Applications page). But if it's hard to do it's not a big issue, we can wait until someone actually complains. @ozamosi do you agree or would you prefer to have all sidebar items deselected while we are at the Notifications page? |
Yeah, sounds good. All else being equal I'd not highlight it, but I can also make up excuses for why this behaviour is technically correct (the notifications relates to your flux resources e.g. applications/sources, so we highlight that section header). |
67aa0f0
to
f03dee9
Compare
@joshri clicking on an added chip with |
Please consider adding tests for filtering with chips with hyphens/undefined values, if it's technically possible. |
I don't think that it is related to this PR directly but the chips when they appear slightly push content down (no matter if FilterDialog pushes content to the left or is displayed over it). I think some space should be reserved for chips: chips.mov |
f03dee9
to
062d78e
Compare
Inability to remove chips with '-' was bc I changed the value of the actual chip in ChipGroup. Added the filterSeparator. The long channel string included the filterSeparator which was I also added the filterSeparator variable to all the tests so we can actually change it without breaking everything. |
Could we please pause and take a step back. We should be able to filter by empty value. This is a really good change. However, this seems like a separate enhancement, so we can make sure it works well together with e.g. tenants. Among these filtering fixes there's also an important regression fix. This would also be good to have outside of this PR, so we can call it out in our changelog (i.e. "filtering fixes" as a bug fix PR that calls out the regression - not several bug fix PRs). As for how to filter by empty value, it seems to me that the quick solution didn't work, and we need to solve the problem by structuring the data, so that the representation doesn't matter - as in, if a chip had a property "field" and a property "value", then whether it's rendered as "field:value" or "value@field" or even "I'm feeling lucky" wouldn't matter, because when determining what filter to remove we'd be able to just read the properties. |
0738c2b
to
ba3a316
Compare
…s in the frontend, and allow for undefined values as - in filters
… called filter-undefined
3c3cfd1
to
6040aaa
Compare
As discussed in standup: Filtering changes removed from this branch - this leaves some bugs with search and filtering remaining (searching does not work due to ListObjects object restructuring in Sources and Notifications tables, filterDialog displays nothing for undefined values but has a working(?) checkbox). I moved the work I had done on these into the branch The Applications tab being highlighted on Notifications is also something I don't want to address in this PR. The only ways I can see to override the required @opudrovs @ozamosi take another look at the code and the notifications table locally for me and make sure I didn't break it with my lovely interactive rebase THANKS |
Can we add delays to the tooltip in
|
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.
LGTM! 🎉
Tested it, works fine, I didn't test filtering because it will be added in the another PR. |
Yep that exists as a prop in the mui component as |
@joshri I guess |
Closes #2564
As always, it was a little more complicated than just adding providers as a resource. Channel is an optional value of the Provider spec, and if it wasn't set, I would expect users to be able to filter by undefined, or
-
. Allowing for undefined values in the DataTable and filtering by-
led me to discover that searching by text was not working as expected in Sources and the new Notifications tables (possibly due to the restructuring of objects in the ListObjects request). When I dove into that code...it didn't click with me - we were checking every field before even checking if thetextSearchable
boolean was true! I rewrote it in a way that clicks with my brain. The tests for text search also were testing for OR values in filtering rather than AND, as in all text filters didn't have to apply for a row to be included, so I rewrote that test to match as well.Also - a couple props were removed from the Page component as they were unused