-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat(ui): Added Last run status and error messages to check, tasks, and notification rules #16325
Conversation
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 PR makes a lot more functional changes than is expressed in the PR description. Every place we replace @influxdata/influx
with src/client
is a place where we are changing the behavior of the app. I would like for us to make these changes for each resource one by one in separate PRs, rather than as part of making Label types match. The @influxdata/influx
client adds default properties to labels so that the UI can rely on there existing a color and description property for each label by applying defaults if they don't exist even though they are not guaranteed by the API. oats returns values as they are provided by the API. I am not certain how we should go about replacing this functionality. One option is to add defaults to labels every time we fetch a resource? In this PR we are going in the direction of removing label defaults from resources that used to have them, rather than adding defaults to labels that don't currently have them and I'm not sure this is the direction to go.
Also, I think it's a bad idea for us to make API calls relating to a particular resource through more than one client. Clients have slightly different expectations/behaviors, and getting from one and posting with another is really difficult to reason about.
"status": "active" | ||
"status": "active", | ||
"latestCompleted": "0001-01-01T00:00:00Z", | ||
"latestScheduled": "0001-01-01T00:00:00Z" |
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.
I'm not sure- but would this not also include LastRunStatus and LastRunError ?
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.
I completely agree in that we need to test out the LastRunStatus
and LastRunError
. They should be included for tests that result in an error
import {Check, Label, AppState} from 'src/types' | ||
|
||
import {Check, AppState} from 'src/types' | ||
import {Label, Labels} from 'src/client' |
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.
Labels are going to be such a mess as we switch from @influxdata/influx
to oats!
name: telegrafConfigName, | ||
description: telegrafConfigDescription, | ||
plugins, | ||
const resp = await api.putTelegraf({ |
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.
Are you comparing this function from oats to the one you are replacing from the other client as you go and making sure they are entirely equivalent? It is making me really nervous that we are essentially rewriting the behavior of the app with these changes just to get label types to match. I would strongly prefer if we made these switches from one client to another each in a separate PR instead of one mega PR.
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.
Hey @ebb-tide , great question since the putTelegraf
was the only one that's been a question in my mind with respect to this refactor. I did use the generateRoutes
file in conjunction with the old apis to ensure that the endpoints, data, etc... were all the same:
https://raw.githubusercontent.com/influxdata/influxdb-client-js/master/src/api/api.ts
As I mentioned earlier, this putTelegraf
one was (and still is) a question mark since we currently don't require the addition of plugins
for putTelegraf
as part of the parameters. I'd love to discuss this if you're around today
@@ -296,7 +312,7 @@ export const updateTaskStatus = (task: Task) => async dispatch => { | |||
|
|||
export const updateTaskName = (task: Task) => async dispatch => { | |||
try { | |||
await client.tasks.update(task.id, task) | |||
await api.patchTask({taskID: task.id, data: task}) |
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.
These two functions are not equivalent. client.tasks.update has:
if (!!updates.cron) {
delete original.every
}
if (!!updates.every) {
delete original.cron
}
which we would have to do in the UI code if we are switching from one client to the other
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.
Great point, let me know if you're around to talk strategy on it
I totally hear where you're coming from and would agree with you in that this should've been compartmentalized. The issue kind of transformed itself into what it was based on resolving linter errors, hence the reason for its crazy scope. Once Tasks were transformed to update the type, there was a cascade of linter errors that had to be addressed that ran me down from tasks -> labels -> templates -> variables |
…sue and update API tests to account for lastRunStatus and lastRunError
be3f661
to
4f13d19
Compare
PostCheck, | ||
} from 'src/types' | ||
import {Label} from 'src/client' |
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.
if you're for serious about this, it'd be easier to just import the Label definition into 'src/types' instead
@@ -148,7 +144,7 @@ const EndpointCard: FC<Props> = ({ | |||
} | |||
const labelsComponent = ( | |||
<InlineLabels | |||
selectedLabels={endpoint.labels as Label[]} | |||
selectedLabels={endpoint.labels} |
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.
dope
@@ -16,7 +16,7 @@ import { | |||
updateView as updateViewAJAX, | |||
} from 'src/dashboards/apis' | |||
import {createDashboardFromTemplate as createDashboardFromTemplateAJAX} from 'src/templates/api' | |||
|
|||
import * as api from 'src/client' |
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.
be explicit here. it's a contract between modules
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.
but convention
@@ -3,13 +3,13 @@ import _ from 'lodash' | |||
|
|||
// Apis | |||
import {client} from 'src/utils/api' | |||
import * as api from 'src/client' |
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.
be explicit
Closes #15844
Closes #15838
Problem
check rules and notification rules would not receive relevant data from the API. The UI wasn't built out to display the data. Using the client library vs the generatedRoutes results in a lot of TS issues
Solution
Refactored a good chunk of the client library usage related to the ticket to utilize the generatedRoutes to resolve TS issues. Updated the UI to display newly returned data with the help of @alexpaxton