Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions frontend/public/components/_secret.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.co-create-secret-form__textarea {
min-height: 300px;
width: 100%;
}
19 changes: 16 additions & 3 deletions frontend/public/components/secret.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { SecretData } from './configmap-and-secret-data';
import { Cog, ResourceCog, ResourceLink, ResourceSummary, detailsPage, navFactory, resourceObjPath } from './utils';
import { fromNow } from './utils/datetime';
import { registerTemplate } from '../yaml-templates';
import { SecretType } from './secrets/create-secret';

registerTemplate('v1.Secret', `apiVersion: v1
kind: Secret
Expand All @@ -18,8 +19,20 @@ stringData:

export const WebHookSecretKey = 'WebHookSecretKey';

// Edit in YAML if not editing a webhook secret with one key.
const editInYaml = obj => !_.has(obj, ['data', WebHookSecretKey]) || _.size(obj.data) !== 1;
// Edit in YAML if not editing:
// - source secrets
// - webhook secret with one key.
const editInYaml = obj => {
switch (obj.type) {
case SecretType.basicAuth:
case SecretType.sshAuth:
return false;
case SecretType.opaque:
return !_.has(obj, ['data', WebHookSecretKey]) || _.size(obj.data) !== 1;
default:
return true;
}
};

const menuActions = [
Cog.factory.ModifyLabels,
Expand Down Expand Up @@ -90,9 +103,9 @@ const filters = [{

const SecretsPage = props => {
const createItems = {
// source: 'Create Source Secret',
// image: 'Create Image Pull Secret',
// generic: 'Create Key/Value Secret',
source: 'Source Secret',
webhook: 'Webhook Secret',
yaml: 'Secret from YAML',
};
Expand Down
Loading