Skip to content

Instantly share code, notes, and snippets.

@rottencandy
Last active August 30, 2023 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rottencandy/33f9962c16fcc650d100e08aa7b6ab4f to your computer and use it in GitHub Desktop.
Save rottencandy/33f9962c16fcc650d100e08aa7b6ab4f to your computer and use it in GitHub Desktop.
diff --git a/config/remotePlugin.js b/config/remotePlugin.js
index 22de4455..2deb2da0 100644
--- a/config/remotePlugin.js
+++ b/config/remotePlugin.js
@@ -458,6 +458,20 @@ const routeExtensions = [
},
},
+ {
+ type: 'core.page/route',
+ properties: {
+ path: '/application-pipeline/workspaces/:workspaceName/secretform',
+ exact: true,
+ component: {
+ $codeRef: 'SecretsPage',
+ },
+ },
+ flags: {
+ required: ['SIGNUP'],
+ },
+ },
+
// 404 route
{
type: 'core.page/route',
@@ -500,6 +514,7 @@ module.exports = {
FlagUtils: resolve(__dirname, '../src/utils/flag-utils'),
Redirect: resolve(__dirname, '../src/pages/RedirectPage'),
NotFound: resolve(__dirname, '../src/pages/NotFoundPage'),
+ SecretsPage: resolve(__dirname, '../src/components/Secrets/SecretsPage'),
},
},
extensions: [
diff --git a/src/components/Secrets/SecretsPage.tsx b/src/components/Secrets/SecretsPage.tsx
new file mode 100644
index 00000000..f758ea8e
--- /dev/null
+++ b/src/components/Secrets/SecretsPage.tsx
@@ -0,0 +1,77 @@
+import React from 'react';
+import { Form, PageSection, PageSectionVariants } from '@patternfly/react-core';
+import { Formik } from 'formik';
+import { HeadTitle } from '../HeadTitle';
+import NamespacedPage from '../NamespacedPage/NamespacedPage';
+import PageLayout from '../PageLayout/PageLayout';
+import { ImagePullSecretForm } from './ImagePullSecretForm';
+import { KeyValueSecretForm } from './KeyValueSecretForm';
+import { SecretTarget, SecretTypeSubForm } from './SecretTypeSubForm';
+import { SourceSecretForm } from './SourceSecretForm';
+
+const SecretsPage = () => (
+ <NamespacedPage>
+ <HeadTitle>Add secret</HeadTitle>
+ <Formik
+ initialValues={{
+ target: SecretTarget.Build,
+ imageAuthType: 'Image registry credentials',
+ sourceAuthType: 'Basic authentication',
+ component: 'All components',
+ environment: 'All environments',
+ keyValues: [{ key: '', value: '' }],
+ imageRegistryCreds: [
+ {
+ registry: '',
+ username: '',
+ password: '',
+ email: '',
+ },
+ ],
+ }}
+ onSubmit={() => {}}
+ >
+ <PageLayout
+ breadcrumbs={[
+ { path: '/secrets', name: 'Secrets' },
+ { path: '#', name: 'Add secret' },
+ ]}
+ title="Add secret"
+ description="Add a new secret to secure any of your environments."
+ >
+ <PageSection variant={PageSectionVariants.light} isFilled isWidthLimited>
+ <Form style={{ maxWidth: '50%' }}>
+ <SecretTypeSubForm
+ secretTypes={[
+ {
+ key: 'key-value',
+ label: 'Key/value secret',
+ targets: [SecretTarget.Build, SecretTarget.Deployment],
+ component: <KeyValueSecretForm />,
+ },
+ {
+ key: 'image-pull',
+ label: 'Image pull secret',
+ targets: [SecretTarget.Build],
+ component: <ImagePullSecretForm />,
+ },
+ {
+ key: 'source',
+ label: 'Source secret',
+ targets: [SecretTarget.Build],
+ component: <SourceSecretForm />,
+ },
+ ]}
+ buildSecrets={[
+ { key: 'snyk', value: 'snyk' },
+ { key: 'tidelift', value: 'tidelift' },
+ ]}
+ />
+ </Form>
+ </PageSection>
+ </PageLayout>
+ </Formik>
+ </NamespacedPage>
+);
+
+export default SecretsPage;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment