Skip to content

Commit

Permalink
Address pr coments
Browse files Browse the repository at this point in the history
  • Loading branch information
EMaksy committed Sep 27, 2023
1 parent 4228bc1 commit 0585125
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 21 deletions.
1 change: 1 addition & 0 deletions assets/js/components/HostDetails/HostDetailsPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function HostDetailsPage() {
if (!host) {
return <div>Not Found</div>;
}

return (
<HostDetails
agentVersion={host.agent_version}
Expand Down
2 changes: 1 addition & 1 deletion assets/js/components/SaptuneDetails/SaptuneDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const renderNotes = (notes) => {
const renderSolution = ({ id, notes, partial }) => (
<span>
{id} ({renderNotes(notes)}
{partial ? ' -> Partial' : ''})
{partial ? '-> Partial' : ''})
</span>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default {
description: 'Services',
},
staging: {
control: 'array',
control: 'object',
description: 'Staging',
},
tuningState: {
Expand Down
46 changes: 27 additions & 19 deletions assets/js/lib/test-utils/factories/hosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ export const slesSubscriptionFactory = Factory.define(() => ({

const sapNoteID = () => faker.number.int({ min: 100000, max: 999999 });

const sapNotesList = (count = 6) => Array(count).fill(sapNoteID());
const sapNotesList = (count = 6) =>
Array(count)
.fill(null)
.map(() => sapNoteID());

const saptuneServiceActiveEnum = () =>
faker.helpers.arrayElement(['enabled', 'disabled', null]);
Expand All @@ -60,9 +63,9 @@ const saptuneServiceFactory = Factory.define(() => ({
}));

const saptuneStagingFactory = Factory.define(() => ({
enabled: faker.datatype.boolean(),
notes: sapNotesList(),
solutions_ids: sapNotesList(),
enabled: true,
notes: sapNotesList(3),
solutions_ids: [saptuneSolutionNameEnum()],
}));

const saptuneNoteFactory = Factory.define(() => ({
Expand All @@ -76,22 +79,27 @@ const saptuneSolutionFactory = Factory.define(() => ({
partial: faker.datatype.boolean(),
}));

export const saptuneStatusFactory = Factory.define(() => ({
applied_notes: sapNotesList().map((id) => saptuneNoteFactory.build({ id })),
applied_solution: saptuneSolutionFactory.build(),
configured_version: faker.number.int({ min: 1, max: 3 }),
enabled_notes: sapNotesList().map((id) => saptuneNoteFactory.build({ id })),
enabled_solution: saptuneSolutionFactory.build(),
package_version: faker.system.semver(),
services: [
saptuneServiceFactory.build({ name: 'sapconf' }),
saptuneServiceFactory.build({ name: 'saptune' }),
saptuneServiceFactory.build({ name: 'tuned' }),
],
staging: saptuneStagingFactory.build(),
tuning_state: saptuneTuningStateEnum(),
}));
export const saptuneStatusFactory = Factory.define(() => {
const solution = saptuneSolutionFactory.build();
const { notes } = solution;
const allNotes = notes.map((id) => saptuneNoteFactory.build({ id }));

return {
applied_notes: allNotes,
applied_solution: solution,
configured_version: faker.number.int({ min: 1, max: 3 }),
enabled_notes: allNotes,
enabled_solution: solution,
package_version: faker.system.semver(),
services: [
saptuneServiceFactory.build({ name: 'sapconf' }),
saptuneServiceFactory.build({ name: 'saptune' }),
saptuneServiceFactory.build({ name: 'tuned' }),
],
staging: saptuneStagingFactory.build(3),
tuning_state: saptuneTuningStateEnum(),
};
});
export const hostFactory = Factory.define(({ params, sequence }) => {
const id = params.id || faker.string.uuid();

Expand Down

0 comments on commit 0585125

Please sign in to comment.