-
Notifications
You must be signed in to change notification settings - Fork 114
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
Jamie/2523 data lifecycle refactor #3158
Conversation
Please note this PR is only currently ready for UX review |
152890d
to
2780332
Compare
This is now open for review to all - thanks! @msorens - please note: I have not yet changed the name of the component to something more specific. This components was already in the system and a search on it linked me to ~152 files. I'd like to separate that out as a separate ticket so as not to hold this one back. |
components/automate-ui/src/app/entities/automate-settings/automate-settings.effects.ts
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
private unfurlIngestJob(job: IngestJob, nested: boolean = false): UnfurledJob { | ||
if (nested) { | ||
return { | ||
policy_name: job.nested_name, | ||
older_than_days: parseInt(job.threshold, 10), | ||
disabled: job.disabled | ||
}; | ||
} else { | ||
return { | ||
name: job.name, | ||
threshold: job.threshold, | ||
disabled: job.disabled | ||
}; | ||
} | ||
} | ||
|
||
|
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 function is taking the job, and placing in the required format based on whether or not it is nested in the API Calls
private convertResponseToJobSchedulerStatus( | ||
respJobSchedulerStatus: RespJobSchedulerStatus): JobSchedulerStatus { | ||
const jobs = respJobSchedulerStatus.jobs.map((respJob: RespJob) => new IngestJob(respJob)); | ||
return new JobSchedulerStatus(respJobSchedulerStatus.running, jobs); | ||
|
||
const allJobs = []; | ||
|
||
Object.keys(respJobSchedulerStatus).forEach((category: string) => { | ||
if (respJobSchedulerStatus[category]) { | ||
const catJobs = respJobSchedulerStatus[category].jobs | ||
.map((respJob: RespJob) => new IngestJob(category, respJob)); | ||
allJobs.push(...catJobs); | ||
} | ||
}); | ||
|
||
return new JobSchedulerStatus(allJobs); | ||
} |
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 functions purpose is to take the response we get back when requesting the configurations, and untangling it so that we can place it back in the form for the user to see. I had to start by separating them by category, infra
, compliance
, services
, event_feed
.
describe('when user applyChanges()', () => { | ||
it('saves settings', () => { | ||
component.updateForm(mockJobSchedulerStatus); | ||
component.applyChanges(); | ||
expect(component.formChanged).toEqual(false); | ||
|
||
// expect(component.notificationVisible).toBe(true); | ||
expect(component.notificationType).toEqual('info'); | ||
expect(component.notificationMessage) | ||
.toEqual('All settings have been updated successfully'); | ||
expect(component.notificationVisible).toEqual(true); | ||
.toEqual('All settings have been updated successfully'); | ||
expect(component.formChanged).toEqual(false); | ||
// expect(component.saving).toEqual(false); | ||
}); |
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 is a testing issue that I'm not yet sure how to resolve and could use some help. Visually this is working as expected and i've located the reason why the test is failing but not sure how to resolve yet
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.
really great work!! these are a few things I noticed...
-
im noticing some weird behaviour with the save changes button, when first navigating to the page the button is enabled, but it should be disabled since I haven't made any changes yet.
-
any chance we could add a tooltip over the applications checkboxes that says something like
Changing this setting in the UI is not supported.
or similar? -
there's 24 px of space between the nested ones, can we reduce that to 12px?
-
the numbered inputs get a darker gray color when they are disabled can we do the same for the dropdowns?
-
can you remove all the margins from that save changes button?
-
if there's anyway we can remove this gray background on this page, that would be rad. but not critical.
this is totally my fault, but I think notifications and data feeds belong in the same section in the left nav. I've got a question out to the belfast team to figure out if they are best to be in general settings or in node management and ill follow up with their answer tomorrow. |
following up, lets move data feeds up to the general settings section, so notifications, data feeds, data lifecycle for the order |
Came across some a11y issues today for keyboard navigation, adding to list of items to remedy |
✅ Tooltip over services checkboxes --> let me know if you'd like me to change anything about these ✅ there's 24 px of space between the nested ones, can we reduce that to 12px? ✅ darken disabled dropdown color --> is the disabled dropdown text lighter than input or are my eyes bad? ✅ can you remove all the margins from that save changes button? ✅ if there's anyway we can remove this gray background on this page, that would be rad. but not critical. ✅ Rearrange Sidebar Can you give me another look on the Save Button being enabled on enter? This is working on my computer reliably and curious if its still happening. |
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.
About half-way through--looking very good!
@@ -73,7 +73,7 @@ const routes: Routes = [ | |||
component: SettingsLandingComponent | |||
}, | |||
{ | |||
path: 'node-lifecycle', | |||
path: 'data-lifecycle', |
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 change in nomenclature warrants changes to node-lifecycle.md and/or data-lifecycle.md.
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.
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 think this is being taken care of already? We're removing any instance of node-lifecycle in the docs per #3170
Also, I'm pretty sure that we're deleting node-lifecycle.md and creating data-lifecycle.md in its place.
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.
data lifecycle docs page already existed, but yah deleting the node lifecycle page.. with a redirect.
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.
ok great - thats the info I was looking for. Thank you!
components/automate-ui/src/app/entities/automate-settings/automate-settings.effects.ts
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.model.ts
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.model.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.model.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
@SEAjamieD heres a video of the save button stuff I mentioned |
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.
A few more observations.
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.html
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.scss
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.spec.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.spec.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.spec.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.spec.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.html
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
if (jobForm.threshold === null) { | ||
job.threshold = '0' + jobForm.unit; | ||
} else { | ||
job.threshold = jobForm.threshold + jobForm.unit; |
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.
Ah, finally found it. I saw splitThreshold
and figured out you were packing a value and unit together so this is where that happens. Is there a reason you cannot use a structure comprised of two properties value
and unit
? That would obviate the need for the somewhat obfuscatory pack and split.
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 is one of those cases that is needed because of the difference between the older pieces of the API and the newer pieces of the API.
The older pieces of the API store/read the threshold value as a string with both the unit and threshold values. For example, if the value is "4 days", the threshold on this portion of the api is stored as "4d".
The newer portions of the API are only storing the value for the amount of days to between retention. and they are storing them as a number. ie. numeric 4.
From how i'm looking at it, we can't really avoid packing and splitting. But if theres some other way that i'm not seeing - i'm all ears.
If possibly you're suggesting simply renaming job.threshold
to something like 'job.packed_thresholdso that ultimately that line would read as
job.packed_threshold = jobForm.threshold + jobForm.unit` or something like that - maybe that would be easier to read?
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.
Roger that; sounds like you do have justification for the pack/split. ✔️
Your rename idea is probably a good thought, though. (IIRC you were using the variable threshold
in some places to be the unpacked value and in others to be the packed value, which is a bit confusing.)
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
…well, could not use formgroup because its actually the value i'm returning Signed-off-by: seajamied <[email protected]>
This refactor makes the function more clear so that it is actually returning just the form as the name implies. We now extract the raw values after the form is returned. Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
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 work! Just a few vestigial items.
Let me know if you have any outstanding questions on your end.
components/automate-ui/src/app/entities/automate-settings/automate-settings.model.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.model.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/entities/automate-settings/automate-settings.requests.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.spec.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.spec.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Show resolved
Hide resolved
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
…o ensure Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
Signed-off-by: seajamied <[email protected]>
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.
one small ask, everything else looks great.. thank you!!!
components/automate-ui/src/app/pages/automate-settings/automate-settings.component.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: seajamied <[email protected]>
expect(component.notificationType).toEqual('info'); | ||
expect(component.notificationMessage) | ||
.toEqual('All settings have been updated successfully'); | ||
expect(component.notificationVisible).toEqual(true); | ||
.toEqual('All settings have been updated successfully'); |
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.
sorry, shoulda commented on the test too
.toEqual('All settings have been updated successfully'); | |
.toEqual('Settings saved.'); |
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.
nah, that's not your responsibility - that was on me. I pushed up and went to bed without checking the tests. Sorry about that!
Signed-off-by: seajamied <[email protected]>
🔩 Description: What code changed, and why?
This branch updates the Node Lifecycles Page to now be named Data Lifecycles, and will allow the user more options in controlling their data retention choices through the UI
⛓️ Related Resources
Finishes: #1208
Makes use of: #2157
UX Design File: https://app.abstract.com/share/47da49f4-55df-4be0-be66-018952857ae3?mode=design&sha=84902a48f104fe6bb5f4cefa3754cc83a72ccbe0
👍 Definition of Done
User now has the ability to update all areas available through the API. Currently this includes Event Feed, Service Groups, Compliance, and will soon include Services Groups
👟 How to Build and Test the Change
build components/automate-ui-devproxy && start_all_services
make serve
navigate to https://a2-dev.test/settings/data-lifecycle
make any changes you wish to see in the form and submit - see a "success" notification at top of screen.
You should not:
Be able to enter any negative numbers into inputs
Be allowed to submit the form until there has been some sort of change made at least once
✅ Checklist
📷 Screenshots, if applicable