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

UI: 'Services' > 'Is managed by' #67

Merged
merged 1 commit into from
Apr 20, 2023

Conversation

carma12
Copy link
Collaborator

@carma12 carma12 commented Mar 24, 2023

image

Description

The 'Is managed by' section provides a way to manage the entities by which a host from a specific Service can be managed. In this case, it refers to the hosts managed by other hosts.

Data type and initial data

Since the data type used (Host) was already defined in the globalDataTypes.ts file, there is no extra step to do here.

export interface Host {
  id: string;
  hostName: string;
  dnsZone: string;
  class: string;
  ipAddress: string;
  description: string;
  enrolled: boolean;
}

Also, the initial data is taken from the service data that is passed to the ServicesManagedBy component via props.

'Add' and 'Delete' modals

The 'Is managed by' section is using the existing components ManagedByAddModal and ManagedByDeleteModal for adding and deleting elements from a modal in the table:

Table and Toolbar components

Similar to the modals, the 'Is managed by' is using the existing toolbar and table components (ManagedByToolbar and ManagedByTable respectively) to provide the functionality.

Signed-off-by: Carla Martinez [email protected]

@carma12 carma12 added the WIP Work in Progress (do not merge) label Mar 24, 2023
@carma12 carma12 requested review from pvoborni and miskopo March 24, 2023 13:58
@carma12 carma12 changed the title 'Services' > 'Is managed by' UI: 'Services' > 'Is managed by' Mar 24, 2023
@carma12
Copy link
Collaborator Author

carma12 commented Mar 24, 2023

This PR depends on this one to be merged. Until then, it is expected the tests to fail.

@carma12 carma12 removed the WIP Work in Progress (do not merge) label Apr 5, 2023
The 'Services' > 'Is managed by' section should
contain those entities that are allowed to
manage the hosts of a selected service. That will be
defined as part of the settings, alongside with
the 'Is a member of' section.

Signed-off-by: Carla Martinez <[email protected]>
@carma12 carma12 force-pushed the services-managed-by branch from bfda60a to 179ac01 Compare April 20, 2023 08:48
Copy link
Member

@pvoborni pvoborni left a comment

Choose a reason for hiding this comment

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

It is working, it follows the same practices as in other parts of code. Thus approving.

But same comment I had as in the other PRs. We will need to enhance it in a future:

  • a lot of stuff will need to be rewritten when we will start using real data and will need to work only with subset of data related to this context - i.e. also loading the right data at right time (when they are needed).
  • adjust some of the other components like ManagedByToolbar or ManagedByAddModal to do a single concern.

i.e. something mentioned in the 2 comments.

const getFullHostInformation = (hostNameList: string[]) => {
const fullHostList: Host[] = [];

availableHostsData.map((host) => {
Copy link
Member

Choose a reason for hiding this comment

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

Future warning: when we will be playing with real data, you might find out that we don't always have all the Host which are mention in an association (e.g. this service's managed_by_host list).

Imagine that there is 10 000 host entries in the FreeIPA server and the service is managed by 1 host and some group of users. For this, we will probably not load all 10K of hosts to select the one which we want to display in the table.

So these places will (in the future) either need to load details of the related hosts, or we will need to be satisfied with the info returned in the service's managed_by_host attribute.

</PageSection>
<>
{showAddModal && (
<ManagedByAddModal
Copy link
Member

Choose a reason for hiding this comment

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

Interface of the ManagedByAddModal is kinda hard to understand when we don't know the implementation.

E.g. I'd expect to have something like:

<AssociationAddModal
   chosenEntries={managedByHosts}, // containing list of { key: host.uid, value: hostName }
   availableEntriesLoader={functionToProvidePromiseOfListOfAvailableHosts} // promise would return same data structure as ^^
   onSelectionChange={callback(selectedEntries)}
   title="string"     
/>

This would be usable for all the simple associations.

@carma12
Copy link
Collaborator Author

carma12 commented Apr 20, 2023

Thanks for the review and the feedback provided in the comments! I agree, some components' logic and structure can be improved and this can be done at some point in the future. Merging this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants