Skip to content

Commit

Permalink
Add pipeline credential management section to start pipeline modal
Browse files Browse the repository at this point in the history
  • Loading branch information
karthik committed Apr 13, 2020
1 parent 6af7521 commit 117f929
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.odc-pipeline-secret-section {
margin-top: calc(-1 * var(--pf-global--spacer--sm));
margin-top: var(--pf-global--spacer--sm);
padding-left: var(--pf-global--spacer--lg);
&__secret-form {
border: 1px dashed var(--pf-global--BorderColor--100);
padding: var(--pf-global--spacer--md);
}
&__secret-action {
margin-top: calc(-1 * var(--pf-global--spacer--sm));
margin-top: var(--pf-global--spacer--sm);
padding-left: 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const authTypes = {
};

const renderSecretForm = (
type: string,
type: SecretType,
stringData: {
[key: string]: any;
},
Expand Down Expand Up @@ -61,24 +61,22 @@ const SecretForm: React.FC<FormikValues> = ({
[SecretType.dockerconfigjson]: {},
});

const setValues = (type) => {
type === SecretType.dockerconfigjson
? setFieldValue(
'formData',
_.mapValues({ '.dockerconfigjson': stringData[type] }, JSON.stringify),
)
: setFieldValue('formData', stringData[type]);
const setValues = (type: SecretType) => {
if (type === SecretType.dockerconfigjson) {
setFieldValue(
'formData',
_.mapValues({ '.dockerconfigjson': stringData[type] }, JSON.stringify),
);
} else {
setFieldValue('formData', stringData[type]);
}
};

const onDataChanged = (event) => {
setStringData((prevState) => _.merge({}, prevState, { [values.type]: event }));
setValues(values.type);
};

const handleTypeChange = (type) => {
setValues(type);
};

return (
<div className="odc-secret-form">
<h1 className="odc-secret-form__title">Create Secret</h1>
Expand All @@ -103,7 +101,7 @@ const SecretForm: React.FC<FormikValues> = ({
label="Authentication Type"
items={authTypes}
title={authTypes[values.type]}
onChange={handleTypeChange}
onChange={(type: SecretType) => setValues(type)}
fullWidth
required
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
.odc-secrets-list {
&__secrets {
&--item {
margin-top: var(--pf-global--spacer--sm);
}
padding-bottom: var(--pf-global--spacer--md);
&__secretsItem {
margin-top: var(--pf-global--spacer--sm);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ type SecretsListProps = {
const secretTypes = [SecretType.dockerconfigjson, SecretType.basicAuth, SecretType.sshAuth];

const Secrets: React.FC<SecretsProps> = ({ secrets, serviceaccounts }) => {
const servicAccountSecrets = _.map(serviceaccounts.data.secrets, 'name');
const serviceAccountSecrets = _.map(serviceaccounts.data.secrets, 'name');
const filterData = _.filter(
secrets.data,
(secret) =>
_.includes(secretTypes, secret.type) &&
_.includes(servicAccountSecrets, secret.metadata.name),
_.includes(serviceAccountSecrets, secret.metadata.name),
);
const sortedFilterData = _.sortBy(filterData, (data) => data.metadata.name);

Expand All @@ -41,7 +41,7 @@ const Secrets: React.FC<SecretsProps> = ({ secrets, serviceaccounts }) => {
{sortedFilterData.map((secret) => {
return (
<ResourceLink
className="odc-secrets-list__secrets--item"
className="odc-secrets-list__secretsItem"
key={secret.metadata.uid}
kind={SecretModel.kind}
name={secret.metadata.name}
Expand Down
10 changes: 5 additions & 5 deletions frontend/public/module/k8s/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -612,12 +612,12 @@ export type Patch = {
export type RollingUpdate = { maxUnavailable?: number | string; maxSurge?: number | string };
export type DeploymentUpdateStrategy =
| {
type: 'Recreate';
}
type: 'Recreate';
}
| {
type: 'RollingUpdate';
rollingUpdate: RollingUpdate;
};
type: 'RollingUpdate';
rollingUpdate: RollingUpdate;
};

export type MachineDeploymentKind = {
spec: {
Expand Down

0 comments on commit 117f929

Please sign in to comment.