Skip to content

Commit

Permalink
Cert Manager should display tooltip about the pre-requisite. (#721)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanmydell authored Jul 27, 2023
1 parent 8a18e98 commit ec1baef
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 4 deletions.
12 changes: 9 additions & 3 deletions content/docs/deployment/csminstallationwizard/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,16 @@
</div>
</div>

<div class="row mb-4 cert-manager">
<div class="row mb-4 col-sm-11 cert-manager">
<div class="col-sm-12">
<input class="form-check-input" type="checkbox" id="cert-manager-enabled" value="">
<label for="cert-manager-enabled" class="form-check-label ms-2 text-dark" data-bs-toggle="tooltip" data-bs-placement="right" title="Enable/Disable Cert Manager feature">Cert Manager</label>
<input class="form-check-input" type="checkbox" id="certmanager" value="" onchange="onCertManagerChange(certmanagerNote)" checked>
<label for="certmanager" class="form-check-label ms-2 text-dark" data-bs-toggle="tooltip" data-bs-placement="right" title="Enable/Disable Cert Manager feature">Cert Manager</label>
</div>
<div class="row child-level-one" id="certmanager-note-wrapper">
<div class="mt-3 py-2 note">
<i class="icon dds__icon dds__icon--alert-info-cir"></i>
<span class="h6" id="certmanager-note"></span>
</div>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ var command3 = 'kubectl create -f values.yaml';
var nodeSelectorNote = 'For the pod to be eligible to run on a node, the node must have the indicated key-value pair as label';

const snapshotNote = 'If Snapshot is enabled, ensure the Snapshot CRDs are installed';
const certmanagerNote = 'If cert-manager is enabled, ensure the cert-manager CRDs are installed';
const veleroNote = 'If Velero is enabled, please add the respective credentials and configurations in the YAML file.';
const podmonNote = 'Uncomment tolerations under node property, if CSM for Resiliency and CSI Driver pods monitor are enabled in the generated YAML';
const authorizationNote = 'Only the Authorization sidecar is enabled by the CSM Installation Wizard. The Proxy Server has to be installed and configured separately';
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ function setValues(csmMapValues, CONSTANTS_PARAM) {
DriverValues.storageCapacity = $("#storage-capacity").prop('checked') ? true : false;
DriverValues.authorizationSkipCertValidation = $("#authorization-skip-cert-validation").prop('checked') ? true : false;
DriverValues.authorizationProxyHost = document.getElementById("authorization-proxy-host").value || '""';
DriverValues.certManagerEnabled = $("#cert-manager-enabled").prop('checked') ? true : false;
DriverValues.certManagerEnabled = $("#certmanager").prop('checked') ? true : false;
observabilityEnabled = DriverValues.observability;
authorizationEnabled = DriverValues.authorization;
replicationEnabled = DriverValues.replication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const {
onResiliencyChange,
onOperatorResiliencyChange,
onSnapshotChange,
onCertManagerChange,
onVSphereChange,
onNodeSelectorChange,
onCopyButtonClickHandler,
Expand Down Expand Up @@ -191,6 +192,26 @@ describe("GIVEN onSnapshotChange function", () => {
});
});

describe("GIVEN onCertManagerChange function", () => {
test("SHOULD hide cert-manager components when option not checked", () => {
document.body.innerHTML = `
<input type="checkbox" id="certmanager">
<div id="certmanager-note-wrapper" style="display:">
`;
onCertManagerChange("Temp cert-manager note");
expect($("div#certmanager-note-wrapper").css("display")).toEqual("none");
});

test("SHOULD show cert-manager components when option checked", () => {
document.body.innerHTML = `
<input type="checkbox" id="certmanager" checked>
<div id="certmanager-note-wrapper" style="display:none">
`;
onCertManagerChange("Temp cert-manager note");
expect($("div#certmanager-note-wrapper").css("display")).not.toEqual("none");
});
});

describe("GIVEN onVSphereChange function", () => {
test("SHOULD hide Observability Metrics components when option not checked", () => {
document.body.innerHTML = `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function onArrayChange() {
onAuthorizationChange();
onResiliencyChange(podmonNote);
onSnapshotChange(snapshotNote, driver, CONSTANTS);
onCertManagerChange(certmanagerNote);
onVSphereChange();
validateInput(validateForm, CONSTANTS);
});
Expand Down Expand Up @@ -95,6 +96,15 @@ function onSnapshotChange(snapshotNoteValue, driverName, CONSTANTS_PARAM) {
}
}

function onCertManagerChange(certmanagerNoteValue) {
if ($("#certmanager").prop('checked') === true) {
$('div#certmanager-note-wrapper').show();
$("#certmanager-note").html(certmanagerNoteValue);
} else {
$('div#certmanager-note-wrapper').hide();
}
}

function onVSphereChange() {
if ($("#vSphere").prop('checked') === true) {
$('div#vSphere-wrapper').show();
Expand Down Expand Up @@ -350,6 +360,7 @@ if (typeof exports !== 'undefined') {
onResiliencyChange,
onOperatorResiliencyChange,
onSnapshotChange,
onCertManagerChange,
onVSphereChange,
onNodeSelectorChange,
onCopyButtonClickHandler,
Expand Down

0 comments on commit ec1baef

Please sign in to comment.