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
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
140 commits
Select commit Hold shift + click to select a range
303cb7b
Add General setting section
Feb 26, 2020
f2195db
Swap out headings and sub headings
Feb 26, 2020
dedd697
Add checkboxes and provide alignment styles for Event feed and servic…
Feb 26, 2020
fb80a30
Restrict inputs to numbers, move save button to top, finish out Compl…
Feb 26, 2020
153c686
Alignment issues from mat-select, targeted where its coming from but …
Feb 26, 2020
370fa77
remove padding from dropdown that was causing alignment issues
Feb 27, 2020
787f0a4
WIP wiring up the event feed portion of the form
Feb 27, 2020
9053669
Revert control name
Feb 28, 2020
0bcef40
WIP - Serious form considerations to be made
Mar 5, 2020
0fabeb7
Changed all this.formBuilder to this.fb - just a personal preference …
Mar 5, 2020
de9e483
Rework patchDisable value to work with a nested formbuilder
Mar 5, 2020
6f823a4
Change enable/disable to hold formGroups to make it simpler
Mar 5, 2020
e3f95c6
rename patchInputValue to toggleInput
Mar 5, 2020
0325954
All inputs are now toggleable
Mar 5, 2020
9190937
Add temp print values button to see what the form is hosting, so far …
Mar 5, 2020
c88e3c1
Remove code that is no longer needed
Mar 5, 2020
90bc88a
WIP - Checkboxes mapped to group inside each form, may need to reconf…
Mar 6, 2020
1432aa9
Added some console logging
Mar 6, 2020
b620b7f
WIP - playing with the response coming back on getting jobs
Mar 10, 2020
3b707b3
WIP - lot going on here, finally have convertResponsesToJobSchedulerS…
Mar 10, 2020
bd14281
WIP - beginning to investigate how to update the form builder with th…
Mar 10, 2020
e3fa47f
Good progress getting user settings/InjestJobs back into the front en…
Mar 11, 2020
507e0aa
Note to self: follow up with Susan
Mar 11, 2020
fa3d508
WIP - Made good progress, going to branch off because I believe a bet…
Mar 11, 2020
b17cb9c
Full refactor of the front end and patching the forms to be enabled o…
Mar 11, 2020
72949c0
Refactor requests and models to accomodate new strucutre, added categ…
Mar 11, 2020
a9e347c
Updating forms, patchvalue is getting an object back right now, need …
Mar 11, 2020
3ec1918
Wired up infra, and compliance for initial ingest
Mar 11, 2020
e8907c8
All input wired up, little issue with one of the checkboxes not repor…
Mar 11, 2020
f2410c8
More refactoring of big switch statements
Mar 12, 2020
4f40894
WIP - pausing for today, getting ready to Apply changes of updated forms
Mar 12, 2020
c584f9f
Fixed error on checkboxes - needed to add value in the line
Mar 12, 2020
e29f60b
Fix up little form population error
Mar 12, 2020
556e373
WIP - need to think on how to structure the PUT call now that it's al…
Mar 12, 2020
1d7e675
Unfurling the Ingest Jobs to match the new PUT request, need to make …
Mar 13, 2020
ec04c77
Added optional nested attribute to Ingest...little wall to overcome, …
Mar 13, 2020
84ad13e
Clean up the conversion when building the API call
Mar 13, 2020
abd77db
Form is working, little bit of wonkiness still after saving the form,…
Mar 13, 2020
3e917ee
Fixed the retained disabled bug, First 2 client runs are not holding …
Mar 13, 2020
577eb6a
Change getting form values to use Raw Values
Mar 16, 2020
354667c
Fix Client runs retention hold
Mar 16, 2020
52a1830
Make service group health checks disabled to the user always
Mar 16, 2020
e44eeef
Update second service group item because API isn't set up for service…
Mar 16, 2020
0cef6fe
Test setup passing, hung up on formControlName not being on a standar…
Mar 16, 2020
6fa69d2
Fix first two tests by importing material modules and animations module
Mar 17, 2020
b914f66
Refactored unit tests for ToggleInput function
Mar 17, 2020
5ea28ac
Refactor two more tests, for null jobscheduler and noChanges button
Mar 17, 2020
ce2bbd7
Add First tests for updating form with ingest jobs
Mar 17, 2020
2436a5b
WIP - tiny values refactor
Mar 17, 2020
d538123
Added tests for updateForm with using
Mar 17, 2020
2cabd3b
Test coverage across automate-settings.component.ts but trouble creat…
Mar 17, 2020
23fb2b0
Troubleshooting 4 update forms, I believe its because of rxjs subscri…
Mar 17, 2020
e3c941c
Restrict frontend to positive integers, still need to implement valid…
Mar 18, 2020
1412765
Utilize distinctUntilKeyChanged for form update
Mar 18, 2020
30e935d
Temp hiding of client runs item 3 until figure out API issue
Mar 18, 2020
d993cc3
Update all routing and tests for routing to use data-lifecycle
Mar 18, 2020
848bf04
Got rid of noChanges() - was an unecessary function
Mar 18, 2020
4a2496a
WIP - to pull in master
Mar 18, 2020
96d2bfb
Add reminders
Mar 18, 2020
39e3cc1
Commented out effect that makes second get call, working great. Also…
Mar 18, 2020
4259f0d
Reset form to previously stored settings on failure
Mar 18, 2020
ee63eee
Subscriptions destroyed onDestroy
Mar 18, 2020
90baee6
Killed last subscription on destroy, callback is not a function types…
Mar 18, 2020
6ebe828
Move onChanges to into the update form to reset listening to the form
Mar 19, 2020
9f1e69a
Add positive integer regex and map path to validators using event feed
Mar 19, 2020
691954e
Move Notifications above Data Lifecycle on sidebar
Mar 19, 2020
d5b5141
Update days dropdown in client runs to only allow days
Mar 19, 2020
acfdeb6
add Zeros into validation, prevent negative on rest of inputs, move c…
Mar 19, 2020
52c2bed
Revert white space in file
Mar 19, 2020
56611f2
Sass linting fixes
Mar 19, 2020
0035380
Add saving and saving spinner
Mar 19, 2020
22cc945
Remove no longer needed validation, revert blank to 0s
Mar 19, 2020
594c733
Default to zero when a user does not enter a number
Mar 19, 2020
8268715
Remove effect no longer needed and add comments
Mar 19, 2020
0287aa8
Add strong typing to requests and populate nested
Mar 20, 2020
3bd82ed
Add strong typing and Enums to infra function
Mar 20, 2020
1b4832a
More reformatting and deleting no longer needed code
Mar 20, 2020
cf0a7a3
Delete more unneeded code
Mar 20, 2020
16986e6
Add more comments
Mar 20, 2020
c8b8956
Revert regex
Mar 20, 2020
bb43b15
Update css - make background of page white
Mar 20, 2020
ab64cea
Close as I can get right now to coloring and spacing, will need UX re…
Mar 20, 2020
df8686e
Add back keyboard navigation to dropdowns and inputs. Noticed check …
Mar 20, 2020
ce71743
Move Data feeds up in sidebar and into same category as Data Lifecycl…
Mar 20, 2020
5b6efda
Add tooltips to service group checkboxes
Mar 20, 2020
45def30
Sass lint fixes
Mar 20, 2020
f1316f7
Update deprecated routing test
Mar 24, 2020
c3c149a
Update comments in automate-settings model
Mar 24, 2020
f69bbd4
Updated environment retention URL
Mar 24, 2020
36e1498
Found why typescript is complaining about in requests and unfurljob, …
Mar 24, 2020
7f7101b
Changing type to any for now, but needs to be updated
Mar 24, 2020
2a1d82c
Follow chef-loading-spinner conventions
Mar 24, 2020
e1f446c
Fix up half of test issues to make stronger or easier to read
Mar 24, 2020
f1f2c1e
Remove string accessor values
Mar 24, 2020
de2c7d1
Simplify blocking of keys
Mar 24, 2020
8a51660
WIP - halfway through making default form data strictly typed
Mar 24, 2020
451714a
Add strong typing to default form data
Mar 25, 2020
f83bb0d
Organize Sass and correct full white background
Mar 25, 2020
0f0f8db
Correct typo in deprecated routes
Mar 25, 2020
d6f9d8c
Update deprecated routing redirect
Mar 25, 2020
e12bb14
Move subscription to changeConfiguration into the onInit and filter o…
Mar 25, 2020
ccea5a6
Add comments, move change subscription into ngOnInit
Mar 25, 2020
00c082c
Found the color value for the text on disabled dropdowns
Mar 25, 2020
abe46ba
Update Client Runs Remove Nodes to only allow days for right now, cod…
Mar 25, 2020
77a0eac
Finally have the factory functions workig in spec.ts
Mar 26, 2020
a97681a
Made factory function for non-nested jobs and found model should have…
Mar 26, 2020
a2c4f54
Test all forms
Mar 26, 2020
c8103db
Lint fixes
Mar 26, 2020
506c61d
Scss Lint fixes
Mar 26, 2020
90b5740
Make JobRequestComponent a model so that I can use it as a contstruct
Mar 26, 2020
9c216d1
Modified models and add check against undefined values in building th…
Mar 26, 2020
1447946
Update naming of taggle function to handleactivation
Mar 26, 2020
388b677
Add test against disabled form elements
Mar 26, 2020
b95ccb0
Move site level sass for material to styles.sass
Mar 26, 2020
a66820e
Update comment so that its easier to read
Mar 26, 2020
5ffd26b
lint fixes
Mar 26, 2020
4dd7d4d
Listen to form changes by pristine/dirty instead of formChanged
Mar 27, 2020
7809c8e
Update test for value that no longer exists
Mar 27, 2020
9db1cb9
Update retention api urls
Mar 31, 2020
40f5ba1
Add FormGroup as a type
Mar 31, 2020
65b7e1f
Add private function for disabing/enabling form controls
Mar 31, 2020
c869dd2
Shorten GetJobForm function, no type checking on it yet
Mar 31, 2020
69b3975
Add function signature to splitThreshold
Mar 31, 2020
411d631
Add function signature to getJobForm, created an interface for it as …
Mar 31, 2020
0da2ee4
Refactor getJobForm
Mar 31, 2020
275b462
Formatting to shrink up the html lines taken
Mar 31, 2020
8c6d7da
Update model to accept validators, add validation on to all text inputs
Mar 31, 2020
a77dae5
spelling
Apr 1, 2020
f8886b7
spelling
Apr 1, 2020
3749de4
Fix that grey background, turns out two elements needed to be white t…
Apr 1, 2020
67920a1
Lint fix
Apr 1, 2020
7d0735d
Spelling corrections
Apr 1, 2020
b2086c5
Spelling and comment corrections
Apr 1, 2020
f2b3b1d
Remove getJobForm function - only needed in one spot
Apr 1, 2020
b1bd7bf
Update tests to separate out nested and non-nested into separate tests
Apr 1, 2020
9695ee0
Add needed types in model
Apr 1, 2020
8844ef4
Adding console.errors in the strange case that a name didn't exist
Apr 1, 2020
2e72877
More commenting for clarity
Apr 1, 2020
ebbd42e
Update sentence for UX
Apr 2, 2020
3848132
Updated test for UX change
Apr 2, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion components/automate-ui/e2e/deprecated-routes.e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ describe('Deprecated routes redirect to the correct new route for backwards comp
// Note: This is "old path" -> "new path", and the new path will be checked
// using a regular expression: the string, anchored to the right by '$'.
[
['/admin/settings', '/settings/node-lifecycle'],
['/settings/node-lifecycle', '/settings/data-lifecycle'],
['/admin/settings', '/settings/data-lifecycle'],
['/admin/tokens', '/settings/tokens'],
['/admin/tokens/my-object', '/settings/tokens/my-object'],
['/admin/teams', '/settings/teams'],
Expand Down
9 changes: 7 additions & 2 deletions components/automate-ui/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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!

component: AutomateSettingsComponent
},
{
Expand Down Expand Up @@ -320,7 +320,12 @@ const routes: Routes = [
{
path: 'admin/settings',
pathMatch: 'full',
redirectTo: 'settings/node-lifecycle'
redirectTo: 'settings/data-lifecycle'
},
{
path: 'settings/node-lifecycle',
pathMatch: 'full',
redirectTo: 'settings/data-lifecycle'
},
{
path: 'admin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
icon="vpn_key" iconRotation="90">Node Credentials</chef-sidebar-entry>
</app-authorized>
<app-authorized #lifecycle [anyOf]="['/retention/nodes/status', 'get']">
<chef-sidebar-entry route="/settings/node-lifecycle" icon="storage">Node Lifecycle</chef-sidebar-entry>
<chef-sidebar-entry route="/settings/data-lifecycle" icon="storage">Data Lifecycle</chef-sidebar-entry>
</app-authorized>

<div class="group" *ngIf="users.visible || teams.visible || tokens.visible">Identity</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { map, mergeMap, catchError } from 'rxjs/operators';
import { forkJoin, of } from 'rxjs';
import { of } from 'rxjs';
import { Injectable } from '@angular/core';
import { Actions, Effect, ofType } from '@ngrx/effects';

Expand Down Expand Up @@ -32,18 +32,8 @@ export class AutomateSettingsEffects {
@Effect()
configureSettings$ = this.actions$.pipe(
ofType(AutomateSettingsActionTypes.CONFIGURE_SETTINGS),
mergeMap((action: ConfigureSettings) => {
const jobsRequests = [];
action.payload.jobs.forEach((job) => {
jobsRequests.push(this.requests.configureIngestJob(job));
});
return forkJoin(jobsRequests).pipe(
map((_resp) => new ConfigureSettingsSuccess({})),
catchError((error) => of(new ConfigureSettingsFailure(error))));
}));

@Effect()
configureSettingsSuccess$ = this.actions$.pipe(
ofType(AutomateSettingsActionTypes.CONFIGURE_SETTINGS_SUCCESS),
map((_action) => new GetSettings({})));
mergeMap((action: ConfigureSettings) => this.requests.configureIngestJobs(action.payload.jobs)),
map((_resp) => (new ConfigureSettingsSuccess({}))),
catchError((error) => of(new ConfigureSettingsFailure(error))
));
}
Original file line number Diff line number Diff line change
@@ -1,73 +1,186 @@
import { Validators } from '@angular/forms';

export class JobSchedulerStatus {
running: boolean;
jobs: IngestJob[];

constructor(running: boolean, ingestJobs: IngestJob[]) {
this.running = running;
constructor(ingestJobs: IngestJob[]) {
this.jobs = ingestJobs;
}

getJob(name: string): IngestJob {
return this.jobs.find((job: IngestJob) => job.name === name);
}
}

export interface ConfigureSettingsRequest {
jobs: IngestJob[];
}

export interface RespJob {
running: boolean;
name: string;
every: string;
nested_name?: string;
disabled: boolean;
recurrence: string;
threshold: string;
last_run: Date;
next_run: Date;
last_elapsed: Date;
started_on: Date;
purge_policies?: {
elasticsearch?: UnfurledJob[];
};
last_elapsed?: Date;
next_due_at?: Date;
last_enqueued_at?: Date;
last_started_at?: Date;
last_ended_at?: Date;
}

export interface RespJobSchedulerStatus {
running: boolean;
jobs: RespJob[];
infra: {
jobs: RespJob[];
};
compliance: {
jobs: RespJob[];
};
event_feed: {
jobs: RespJob[];
};
services: {
jobs: RespJob[];
};
}

// IngestJobs is an enum that defines the list of jobs that the
// JobScheduler has inside the ingest-service
export enum IngestJobs {
// MissingNodes: Checks when a node hasn't check-in
// for a period of time
MissingNodes = 'missing_nodes',
// EventFeed
EventFeedRemoveData = 'eventFeedRemoveData',
EventFeedServerActions = 'eventFeedServerActions',

// Service Groups
ServiceGroupNoHealthChecks = 'serviceGroupNoHealthChecks',
ServiceGroupRemoveServices = 'serviceGroupRemoveServices',

// Client Runs
ClientRunsRemoveData = 'clientRunsRemoveData',
ClientRunsLabelMissing = 'clientRunsLabelMissing',
ClientRunsRemoveNodes = 'clientRunsRemoveNodes',

// MissingNodesForDeletion: Checks when a node has been missing
// for a period of time
// Compliance
ComplianceRemoveReports = 'complianceRemoveReports',
ComplianceRemoveScans = 'complianceRemoveScans'
}

export enum JobCategories {
Infra = 'infra',
Compliance = 'compliance',
EventFeed = 'event_feed',
Services = 'services'
}

export enum InfraJobName {
MissingNodes = 'missing_nodes',
MissingNodesForDeletion = 'missing_nodes_for_deletion',
DeleteNodes = 'delete_nodes',
PeriodicPurgeTimeseries = 'periodic_purge_timeseries'
}

// DeleteNodes: Removes completely from elasticsearch nodes that
// have been marked for deletion
DeleteNodes = 'delete_nodes'
// Actions and ConvergeHistory are nested, but contained inside
// the InfraJobName of PeriodicPurgeTimeseries
export enum NestedJobName {
ComplianceReports = 'compliance-reports',
ComplianceScans = 'compliance-scans',
Feed = 'feed',
Actions = 'actions',
ConvergeHistory = 'converge-history'
}

export class IngestJob {
running: boolean;
category: JobCategories;
name: string;
nested_name?: string;
recurrence?: string;
threshold: string;
every?: string;
lastRun?: Date;
nextRun?: Date;
lastElapsed?: Date;
startedOn?: Date;
disabled: boolean;
purge_policies?: {
elasticsearch?: UnfurledJob[];
};
older_than_days?: number;
last_elapsed?: Date;
next_due_at?: Date;
last_enqueued_at?: Date;
last_started_at?: Date;
last_ended_at?: Date;

constructor(respJob: RespJob) {
constructor(category: JobCategories, respJob: RespJob) {
if (respJob !== null) {
this.running = respJob.running;
this.category = category;
this.name = respJob.name;
this.every = respJob.every;
this.nested_name = respJob.nested_name;
this.disabled = respJob.disabled;
this.recurrence = respJob.recurrence;
this.threshold = respJob.threshold;
this.lastRun = new Date(respJob.last_run);
this.nextRun = new Date(respJob.next_run);
this.lastElapsed = new Date(respJob.last_elapsed);
this.startedOn = new Date(respJob.started_on);
this.purge_policies = respJob.purge_policies;
this.last_elapsed = new Date(respJob.last_elapsed);
this.next_due_at = new Date(respJob.next_due_at);
this.last_enqueued_at = new Date(respJob.last_enqueued_at);
this.last_started_at = new Date(respJob.last_started_at);
this.last_ended_at = new Date(respJob.last_ended_at);
}
}
}

export class UnfurledJob {
disabled: boolean;
policy_name?: string;
older_than_days?: number;
name?: string;
threshold?: string;
}

// A JobRequestComponent is very flexible so that it may contain
// contain an older API Job object or a newer API Job Object
export class JobRequestComponent {
disabled?: boolean;
name?: string;
threshold?: string | number;
purge_policies?: {
elasticsearch?: UnfurledJob[];
};
}

export interface JobRequestBody {
infra: {
job_settings: JobRequestComponent[];
};
compliance: {
job_settings: JobRequestComponent[];
};
event_feed: {
job_settings: JobRequestComponent[];
};
// services has not yet been implemented so we will leave as optional for now
services?: {
job_settings: JobRequestComponent[];
};
}

export interface SingleDefaultForm {
category: JobCategories;
name?: string; // TODO; make stricter after services implemented
nested_name?: NestedJobName;
unit: {
value: string;
disabled: boolean;
};
threshold: [{
value: string;
disabled: boolean;
}, Validators];
disabled: boolean;
}

export interface DefaultFormData {
eventFeedRemoveData: SingleDefaultForm;
eventFeedServerActions: SingleDefaultForm;
serviceGroupNoHealthChecks: SingleDefaultForm;
serviceGroupRemoveServices: SingleDefaultForm;
clientRunsRemoveData: SingleDefaultForm;
clientRunsLabelMissing: SingleDefaultForm;
clientRunsRemoveNodes: SingleDefaultForm;
complianceRemoveReports: SingleDefaultForm;
complianceRemoveScans: SingleDefaultForm;
}
Loading