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

feat(delete-group): Delete application group #2947

Merged
merged 2 commits into from
Oct 16, 2019

Conversation

karthikjeeyar
Copy link
Contributor

@karthikjeeyar karthikjeeyar commented Oct 10, 2019

This PR contains the custom actions and modals to delete an application from the topology page.

  1. Added group actions available in the context menu
    deleteApplication
  2. Added group actions in the sidebar menu
    sidebar_group_action

contains tests for all the supported workloads in topology.

 PASS  packages/dev-console/src/utils/__tests__/application-utils.spec.ts
  ApplicationUtils 
    ✓ Should delete all the specific models related to deployment config (25ms)
    ✓ Should delete all the specific models related to knative deployments (4ms)
    ✓ Should delete all the specific models related to daemonsets (4ms)
    ✓ Should delete all the specific models related to statefulsets (4ms)

Fixes: https://jira.coreos.com/browse/ODC-1795 , https://jira.coreos.com/browse/ODC-846

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. component/dev-console Related to dev-console labels Oct 10, 2019
const name = values.name || values.image.selected;
values.name !== name && setFieldValue('name', name);
!values.application.name && setFieldValue('application.name', `${name}-app`);
setFieldValue('git.url', url);
setFieldValue('git.dir', dir);
setFieldValue('git.ref', ref);
setFieldValue('git.type', gitType);
setFieldTouched('git.url', true);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These above changes are added to address an existing bug in dev catalog flow (using Try sample option)

screenshot-localhost-9000-2019 10 10-12-06-18 (2)

@karthikjeeyar
Copy link
Contributor Author

/test e2e-aws-console-olm

1 similar comment
@karthikjeeyar
Copy link
Contributor Author

/test e2e-aws-console-olm

@sahil143
Copy link
Contributor

@karthikjeeyar I cant see the action dropdown in the sidebar. Am I missing something?
Screenshot from 2019-10-10 23-51-32

I can see the delete option while right-clicking on the group.

@sahil143
Copy link
Contributor

Question: What do we do about the leftover connects-to annotations?
If we have a node( with name nodejs) connected with one of the nodes(name nginx) in a group and later on that group is deleted. After deletion, we would have leftover connects-to annotation on nodejs pointing to nginx(which doesn't exist anymore). Should we also delete these annotations? If not, What if a new workload is created with the same name(nginx), as a side effect of leftover annotation we end up with a connector between newly created node(nginx) and old node(nodejs).

@@ -23,7 +24,9 @@ export class ActionProviders {
public getEdgeActions = (edgeId: string): KebabOption[] => null;

// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
Copy link
Contributor

Choose a reason for hiding this comment

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

This eslint-disable-next-line can be removed now.

@karthikjeeyar
Copy link
Contributor Author

karthikjeeyar commented Oct 11, 2019

Question: What do we do about the leftover connects-to annotations?
If we have a node( with name nodejs) connected with one of the nodes(name nginx) in a group and later on that group is deleted. After deletion, we would have leftover connects-to annotation on nodejs pointing to nginx(which doesn't exist anymore). Should we also delete these annotations? If not, What if a new workload is created with the same name(nginx), as a side effect of leftover annotation we end up with a connector between newly created node(nginx) and old node(nodejs).

I agree, we should remove/update the connects-to annotation in the other(connected) nodes as well, I will update the PR
cc: @christianvogt

Copy link
Member

@invincibleJai invincibleJai left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, will try it in a while

resource: K8sResourceKind,
workload: TopologyDataObject,
): Promise<K8sResourceKind[]> => {
// cleanup all the items for a workoad.
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we remove comments as function name is intuitive.


if (isKnativeResource) {
// delete knative resources
const knativeRoute = _.find(workload.resources.ksroutes, { kind: 'Route' });
Copy link
Member

Choose a reason for hiding this comment

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

it would be good to rely on knative services instead of routes if metadata.name is as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@invincibleJai Services are having generated names, looks like the only object to rely on to get the original name is ksroutes object.

Copy link
Member

@invincibleJai invincibleJai Oct 14, 2019

Choose a reason for hiding this comment

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

@karthikjeeyar got the issue, knative services are not available in resources. what you saw would be k8s resources.

I am filling a PR on this branch to handle it.

Copy link
Member

Choose a reason for hiding this comment

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

@karthikjeeyar
Copy link
Contributor Author

karthikjeeyar commented Oct 11, 2019

@karthikjeeyar I cant see the action dropdown in the sidebar. Am I missing something?
I can see the delete option while right-clicking on the group

@Sahil Pushed the changes

@karthikjeeyar karthikjeeyar force-pushed the group-actions branch 2 times, most recently from 3ef076a to 41cf98b Compare October 11, 2019 13:44
@debsmita1
Copy link
Contributor

@karthikjeeyar A scrollbar on the right appears when I click on the Actions dropdown
Scrollbar

@karthikjeeyar
Copy link
Contributor Author

@karthikjeeyar A scrollbar on the right appears when I click on the Actions dropdown

@debsmita1 This is PR is just to add actions to the sidebar. since the content of the sidebar is empty we are seeing the scrollbar. This PR will be integrated with the work @invincibleJai has done related to the content of the sidebar on #2947. I have tested integrating both the PR's and the scrollbar isn't showing up.

@openshift-ci-robot openshift-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. component/knative Related to knative-plugin component/shared Related to console-shared and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 14, 2019
@invincibleJai
Copy link
Member

@karthikjeeyar have verified it locally changes looks good to me. Thanks!!

@karthikjeeyar karthikjeeyar force-pushed the group-actions branch 2 times, most recently from 6c8c8ab to 0fe26d3 Compare October 14, 2019 10:59
const isValid = _.get(values, 'application.userInput') === initialApplication;
return (
<form onSubmit={handleSubmit} className="modal-content modal-content--no-inner-scroll">
<ModalTitle>Delete Application Group</ModalTitle>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
<ModalTitle>Delete Application Group</ModalTitle>
<ModalTitle>Delete Application</ModalTitle>

// so currently picking the first resource to do the rbac checks (might change in future)
const primaryResource = _.get(application.resources[0], ['resources', 'obj']);
return {
label: 'Delete Application Group',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
label: 'Delete Application Group',
label: 'Delete Application',

Comment on lines 44 to 45
This action cannot be undone. All associated Deployments, Routes, Builds, Pipelines,
Storage/PVC&#39;s, secrets, configmaps will be deleted.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This action cannot be undone. All associated Deployments, Routes, Builds, Pipelines,
Storage/PVC&#39;s, secrets, configmaps will be deleted.
Storage/PVC&#39;s, secrets, and configmaps will be deleted.

@jeff-phillips-18
Copy link
Member

/lgtm


import Spy = jasmine.Spy;

const spyAndReturn = (spy: Spy) => (returnValue: any) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can return value be typed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

spyAndReturn is a generic test helper method, which can take in any spy and will resolve any value that is passed to it. IMO, we cannot bound this to any particular type

@divyanshiGupta
Copy link
Contributor

@karthikjeeyar I pulled this PR and tried it locally but I can't see the delete option on right click as well as not in the the sidebar.

delete-option

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2019
@karthikjeeyar
Copy link
Contributor Author

@karthikjeeyar I pulled this PR and tried it locally but I can't see the delete option on right click as well as not in the the sidebar.

@divyanshiGupta It could be your browser cache, please try hard reloading.

@divyanshiGupta
Copy link
Contributor

@karthikjeeyar I pulled this PR and tried it locally but I can't see the delete option on right click as well as not in the the sidebar.

@divyanshiGupta It could be your browser cache, please try hard reloading.

Yes I did hard refresh a lot of times but it was not showing up but suddenly now it showed up :P It is working fine for me now.

@divyanshiGupta
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2019
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2019
@karthikjeeyar
Copy link
Contributor Author

/test e2e-aws-console-olm

2 similar comments
@karthikjeeyar
Copy link
Contributor Author

/test e2e-aws-console-olm

@karthikjeeyar
Copy link
Contributor Author

/test e2e-aws-console-olm

@divyanshiGupta
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 15, 2019
@divyanshiGupta
Copy link
Contributor

/test e2e-aws-console-olm

errorMessage: string;
};

const DeleteApplicationForm: React.FC<FormikProps<FormikValues> & DeleteApplicationModalProps> = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: We should ideally have one component per file. Otherwise looks good to me.

@rohitkrai03
Copy link
Contributor

/lgtm

@karthikjeeyar
Copy link
Contributor Author

/assign @christianvogt

@christianvogt
Copy link
Contributor

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: christianvogt, divyanshiGupta, jeff-phillips-18, karthikjeeyar, rohitkrai03

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 16, 2019
@openshift-merge-robot openshift-merge-robot merged commit bb544eb into openshift:master Oct 16, 2019
@spadgett spadgett added this to the v4.3 milestone Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/dev-console Related to dev-console component/knative Related to knative-plugin component/shared Related to console-shared lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.