Skip to content

Commit

Permalink
Minor fixes in the OCS Installation and Independent Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
bipuladh committed May 27, 2020
1 parent 6004e58 commit be97450
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 18 deletions.
Expand Up @@ -18,7 +18,7 @@ const k8sResources: FirehoseResource[] = [
{
kind: referenceForModel(OCSServiceModel),
namespaced: true,
isList: false,
isList: true,
namespace: 'openshift-storage',
prop: 'ocs',
},
Expand Down
@@ -1,9 +1,11 @@
.upload-component {
display: inline-flex;
cursor: grab;
}

.input-btn {
display: inline-flex;
cursor: grab;
}

.custom-input-btn {
Expand All @@ -22,3 +24,7 @@
.upload-component__textInput {
color: var(--pf-global--Color--dark-200);
}

#inputButton::-webkit-file-upload-button {
cursor: grab;
}
Expand Up @@ -4,12 +4,13 @@

.im-install-page {
margin-top: var(--pf-global--spacer--lg);
margin-left: var(--pf-global--spacer--lg);
margin-right: var(--pf-global--spacer--lg);
margin-bottom: var(--pf-global--spacer--md);
&--error {
color: var(--pf-chart-global--danger--Color--100);
}
&--margin-top {
margin-top: var(--pf-global--spacer--sm);
}
}

.im-install-page__form {
Expand All @@ -36,5 +37,7 @@

.im-install-page__text-box {
min-height: 15em;
color: var(--pf-global--palette--black-700);
color: var(--pf-global--palette--black-500);
background-color: var(--pf-global--BackgroundColor--light-100) !important;
border: var(--pf-global--BorderWidth--sm) solid var(--pf-global--BorderColor--100) !important;
}
Expand Up @@ -10,7 +10,6 @@ import {
k8sGet,
k8sCreate,
referenceForModel,
k8sKill,
apiVersionForModel,
} from '@console/internal/module/k8s';
import { ClusterServiceVersionModel } from '@console/operator-lifecycle-manager';
Expand Down Expand Up @@ -109,8 +108,6 @@ const InstallExternalCluster = withHandlePromise((props: InstallExternalClusterP
.catch((e) => {
// eslint-disable-next-line no-console
console.error(e);
// Remove secret if cluster creation was not possible
handlePromise(k8sKill(SecretModel, secret));
});
};

Expand All @@ -133,16 +130,17 @@ const InstallExternalCluster = withHandlePromise((props: InstallExternalClusterP
<Title size="lg" headingLevel="h5" className="nb-bs-page-title__main">
<div className="im-install-page-sub-header__title">Connect to external cluster</div>
</Title>
<p className="im--light">
Run metadata exporter script to obtain metadata needed for connecting to the external
cluster.{' '}
<p className="im--light im-install-page--margin-top">
Download <code>ceph-external-cluster-details-exporter.py</code> script and run on the
RHCS cluster, the upload the results(JSON) in the External cluster metadata field.{' '}
{downloadFile && (
<a
id="downloadAnchorElem"
href={downloadFile}
download="exporter.py"
download="ceph-external-cluster-details-exporter.py"
target="_blank"
rel="noopener noreferrer"
className=""
>
Download Script
</a>
Expand All @@ -167,6 +165,7 @@ const InstallExternalCluster = withHandlePromise((props: InstallExternalClusterP
aria-label="Upload JSON File"
value="Upload Credentials file"
className="im-install-page__input-box"
isDisabled
/>
<FileUpload onUpload={onUpload} />
</InputGroup>
Expand All @@ -177,6 +176,7 @@ const InstallExternalCluster = withHandlePromise((props: InstallExternalClusterP
className="im-install-page__text-box"
isValid={!dataError}
aria-label="JSON data"
disabled
/>
</FormGroup>
<ButtonBar errorMessage={dataError || errorMessage} inProgress={inProgress}>
Expand Down
Expand Up @@ -36,7 +36,7 @@ export const checkError = (
_.isEmpty(item.data?.adminKey) &&
base64ErrorKeys.push(item.name ?? 'Unrecognized key');
try {
atob(item.data?.userKey);
atob(item.data?.userKey ?? item.data?.adminKey);
} catch (e) {
base64ErrorKeys.push(item.name ?? 'Unrecognized key');
}
Expand Down
Expand Up @@ -123,7 +123,7 @@ export const CreateOCSServiceForm = withHandlePromise<
<Form className="co-m-pane__body-group">
<FormGroup fieldId="select-nodes" label="Nodes">
<p>
Selected nodes will be labeled with
Selected nodes will be labeled with{' '}
<code>cluster.ocs.openshift.io/openshift-storage=&quot;&quot;</code> to create the OCS
Service.
</p>
Expand Down
Expand Up @@ -50,7 +50,11 @@ const InstallCluster: React.FC<InstallClusterProps> = ({ match }) => {
);
setIndependentReqdKeys({ configMaps, secrets, storageClasses });
setDownloadFile(
createDownloadFile(getAnnotations(clusterServiceVersionObj)?.['externalClusterScript']),
createDownloadFile(
getAnnotations(clusterServiceVersionObj)?.[
'external.features.ocs.openshift.io/export-script'
],
),
);
}

Expand Down
Expand Up @@ -123,14 +123,29 @@ const NodeTable: React.FC<NodeTableProps> = (props) => {
if (rowIndex === -1) {
if (isSelected) {
const uniqueUIDs = _.uniq([...visibleUIDs, ...selectedUIDs]);
setSelectedNodes(visibleRows.filter((node) => uniqueUIDs.includes(node.metadata.uid)));
setSelectedNodes(
_.uniqBy(
[...visibleRows, ...selectedNodes].filter((node) =>
uniqueUIDs.includes(node.metadata.uid),
),
(n) => n.metadata.uid,
),
);
} else {
const uniqueUIDs = _.xor(visibleUIDs, selectedUIDs);
setSelectedNodes(visibleRows.filter((node) => uniqueUIDs.includes(node.metadata.uid)));
setSelectedNodes(
_.uniqBy(
selectedNodes.filter((node) => !visibleUIDs.includes(node.metadata.uid)),
(n) => n.metadata.uid,
),
);
}
} else {
const uniqueUIDs = _.xor(selectedUIDs, [rowData.props.id]);
setSelectedNodes(visibleRows.filter((node) => uniqueUIDs.includes(node.metadata.uid)));
const data = _.uniqBy(
[...visibleRows, ...selectedNodes].filter((node) => uniqueUIDs.includes(node.metadata.uid)),
(n) => n.metadata.uid,
);
setSelectedNodes(data);
}
};

Expand Down

0 comments on commit be97450

Please sign in to comment.