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

Delete Modal #45

Merged
merged 2 commits into from
Sep 6, 2024
Merged

Delete Modal #45

merged 2 commits into from
Sep 6, 2024

Conversation

jasonmadigan
Copy link
Member

@jasonmadigan jasonmadigan commented Sep 5, 2024

Implements #16

  • Added a delete action to the DropdownWithKebab
  • Used some componentry from @patternfly/react-core/next for a new Modal
  • Modal has a confirm action before delete
  • Made some tweaks to AllPoliciesListPage - combined the useK8sWatchResource hooks into a single array mapping for sanity

Testing:

Create a test resource, for example a TLSPolicy:

kubectl apply -f - <<EOF
apiVersion: gateway.networking.k8s.io/v1
kind: Gateway
metadata:
  name: jm-hypergateway
  namespace: jmadigan-test
spec:
  gatewayClassName: istio
  listeners:
  - allowedRoutes:
      namespaces:
        from: All
    name: api
    hostname: "*.jm.hcpapps.net"
    port: 443
    protocol: HTTPS
    tls:
      mode: Terminate
      certificateRefs:
        - name: apps-hcpapps-tls
          kind: Secret
EOF


kubectl apply -f - <<EOF
apiVersion: kuadrant.io/v1alpha1
kind: TLSPolicy
metadata:
  name: jm-hypergateway-tls-policy
  namespace: jmadigan-test
spec:
  targetRef:
    name: jm-hypergateway
    group: gateway.networking.k8s.io
    kind: Gateway
  issuerRef:
    group: cert-manager.io
    kind: ClusterIssuer
    name: not-found
EOF

Signed-off-by: Jason Madigan <[email protected]>
@jasonmadigan jasonmadigan linked an issue Sep 5, 2024 that may be closed by this pull request
src/components/KuadrantPoliciesPage.tsx Show resolved Hide resolved
src/components/KuadrantPoliciesPage.tsx Outdated Show resolved Hide resolved
src/components/KuadrantPoliciesPage.tsx Outdated Show resolved Hide resolved
src/components/KuadrantPoliciesPage.tsx Outdated Show resolved Hide resolved
@david-martin
Copy link
Member

👍

Would be best to limit width of modal
image

Signed-off-by: Jason Madigan <[email protected]>
@jasonmadigan
Copy link
Member Author

@david-martin good spot, done. Added some i18n strings too.

const onSelect = (_event: React.MouseEvent<Element, MouseEvent> | undefined, value: string | number | undefined) => {
// eslint-disable-next-line no-console
console.log('selected', value);
const getModelFromResource = (obj: K8sResourceCommon): K8sModel => {
Copy link
Member

Choose a reason for hiding this comment

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

I'll likely move this out for reuse after merge.

@david-martin david-martin merged commit b568787 into Kuadrant:main Sep 6, 2024
2 checks passed
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.

Policy deletion
2 participants