Skip to content
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

Merged
merged 140 commits into from
Apr 2, 2020
Merged

Conversation

SEAjamieD
Copy link
Contributor

@SEAjamieD SEAjamieD commented Mar 19, 2020

🔩 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

Screen Shot 2020-03-19 at 11 38 57 AM

@SEAjamieD SEAjamieD requested a review from susanev March 19, 2020 18:40
@SEAjamieD
Copy link
Contributor Author

Please note this PR is only currently ready for UX review

@SEAjamieD SEAjamieD force-pushed the jamie/2523-data-lifecycle-refactor branch 2 times, most recently from 152890d to 2780332 Compare March 19, 2020 23:05
@SEAjamieD SEAjamieD mentioned this pull request Mar 20, 2020
4 tasks
@SEAjamieD SEAjamieD requested review from a team March 20, 2020 01:02
@SEAjamieD
Copy link
Contributor Author

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.

Comment on lines 102 to 124
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
};
}
}


Copy link
Contributor Author

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

Comment on lines 119 to 139
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);
}
Copy link
Contributor Author

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.

Comment on lines 252 to 300
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);
});
Copy link
Contributor Author

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

@SEAjamieD SEAjamieD self-assigned this Mar 20, 2020
@susanev susanev mentioned this pull request Mar 20, 2020
4 tasks
Copy link
Contributor

@susanev susanev left a 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.

@susanev
Copy link
Contributor

susanev commented Mar 20, 2020

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.

@susanev
Copy link
Contributor

susanev commented Mar 20, 2020

following up, lets move data feeds up to the general settings section, so notifications, data feeds, data lifecycle for the order

@SEAjamieD
Copy link
Contributor Author

Came across some a11y issues today for keyboard navigation, adding to list of items to remedy

@SEAjamieD
Copy link
Contributor Author

SEAjamieD commented Mar 20, 2020

@susanev

✅ 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.

@SEAjamieD SEAjamieD requested a review from a team March 20, 2020 19:15
Copy link
Contributor

@msorens msorens left a 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',
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kagarmoe / @mjingle - Making sure I don't step on any toes here, is this part of documentation or is this a change that I should handle?

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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!

@susanev
Copy link
Contributor

susanev commented Mar 21, 2020

@SEAjamieD heres a video of the save button stuff I mentioned
data-lifecycle-save-button

Copy link
Contributor

@msorens msorens left a 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.

@susanev susanev mentioned this pull request Mar 22, 2020
12 tasks
@susanev
Copy link
Contributor

susanev commented Mar 22, 2020

@SEAjamieD

  • theres an rgba(0, 0, 0, 0.38); on the dropdown when its disabled, so i think thats why the text color appears lighter than the numerical input
  • gray background, still appears at the very bottom of the page, we may be able to leverage whatever they did on the applications page to stop this from happening, but this is super low priority so if its not quick to fix dont worry about it
    background-woes

if (jobForm.threshold === null) {
job.threshold = '0' + jobForm.unit;
} else {
job.threshold = jobForm.threshold + jobForm.unit;
Copy link
Contributor

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.

Copy link
Contributor Author

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 asjob.packed_threshold = jobForm.threshold + jobForm.unit` or something like that - maybe that would be easier to read?

Copy link
Contributor

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.)

seajamied added 11 commits March 30, 2020 19:51
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]>
Copy link
Contributor

@msorens msorens left a 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.

Copy link
Contributor

@susanev susanev left a 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!!!

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');
Copy link
Contributor

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

Suggested change
.toEqual('All settings have been updated successfully');
.toEqual('Settings saved.');

Copy link
Contributor Author

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]>
@SEAjamieD SEAjamieD merged commit 2bfded1 into master Apr 2, 2020
@chef-expeditor chef-expeditor bot deleted the jamie/2523-data-lifecycle-refactor branch April 2, 2020 15:53
@susanev susanev mentioned this pull request Apr 23, 2020
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants