Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MD] Add initial credential management CRUD pages #2040

Merged
Show file tree
Hide file tree
Changes from 5 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
27 changes: 0 additions & 27 deletions src/plugins/credential_management/.eslintrc.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/plugins/credential_management/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
*/

export const PLUGIN_ID = 'credentialManagement';
export const PLUGIN_NAME = 'credentialManagement';
export const PLUGIN_NAME = 'credential_management';
noCharger marked this conversation as resolved.
Show resolved Hide resolved
7 changes: 3 additions & 4 deletions src/plugins/credential_management/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"id": "credentialManagement",
"version": "1.0.0",
"opensearchDashboardsVersion": "opensearchDashboards",
"version": "opensearchDashboards",
"server": true,
noCharger marked this conversation as resolved.
Show resolved Hide resolved
"ui": true,
"requiredPlugins": ["navigation"],
"optionalPlugins": []
"requiredPlugins": ["management"],
"requiredBundles": ["opensearchDashboardsReact"]
}
28 changes: 0 additions & 28 deletions src/plugins/credential_management/public/application.tsx

This file was deleted.

124 changes: 0 additions & 124 deletions src/plugins/credential_management/public/components/app.tsx

This file was deleted.

40 changes: 40 additions & 0 deletions src/plugins/credential_management/public/components/breadcrumbs.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';
import { CredentialEditPageItem } from './types';

export function getListBreadcrumbs() {
return [
{
text: i18n.translate('credentialManagement.credentials.listBreadcrumb', {
defaultMessage: 'Credentials',
}),
href: `/`,
},
];
}

export function getCreateBreadcrumbs() {
return [
...getListBreadcrumbs(),
{
text: i18n.translate('credentialManagement.credentials.createBreadcrumb', {
defaultMessage: 'Create credentials',
}),
href: `/create`,
},
];
}

export function getEditBreadcrumbs(credentials: CredentialEditPageItem) {
return [
...getListBreadcrumbs(),
{
text: credentials.title,
href: `/${credentials.id}`,
},
];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

// @ts-ignore
noCharger marked this conversation as resolved.
Show resolved Hide resolved
import { euiColorAccent } from '@elastic/eui/dist/eui_theme_light.json';
import React from 'react';
import * as H from 'history';
noCharger marked this conversation as resolved.
Show resolved Hide resolved

import { EuiButton } from '@elastic/eui';
import { FormattedMessage } from '@osd/i18n/react';

interface Props {
history: H.History;
}

export const CreateButton = ({ history }: Props) => {
return (
<EuiButton
data-test-subj="createCredentialButton"
fill={true}
onClick={() => history.push('/create')}
iconType="plusInCircle"
>
<FormattedMessage
id="credentialManagement.credentialsTable.createBtn"
defaultMessage="Save your credential"
/>
</EuiButton>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export { CreateButton } from './create_button';
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import React from 'react';

import { EuiBetaBadge, EuiSpacer, EuiTitle, EuiText, EuiCode, EuiLink } from '@elastic/eui';

import { i18n } from '@osd/i18n';
import { FormattedMessage } from '@osd/i18n/react';
import { DocLinksStart } from 'opensearch-dashboards/public';
import { useOpenSearchDashboards } from '../../../../../../opensearch_dashboards_react/public';
import { CredentialManagementContext } from '../../../../types';
export const Header = ({
isBeta = true,
noCharger marked this conversation as resolved.
Show resolved Hide resolved
docLinks,
}: {
isBeta?: boolean;
docLinks: DocLinksStart;
}) => {
const changeTitle = useOpenSearchDashboards<CredentialManagementContext>().services.chrome
.docTitle.change;
const createCredentialHeader = i18n.translate('credentialManagement.createIndexPatternHeader', {
defaultMessage: 'Save Your Credential',
});

changeTitle(createCredentialHeader);

return (
<div>
<EuiTitle>
<h1>
{createCredentialHeader}
{isBeta ? (
<>
{' '}
noCharger marked this conversation as resolved.
Show resolved Hide resolved
<EuiBetaBadge
label={i18n.translate('credentialManagement.createCredential.betaLabel', {
defaultMessage: 'Beta',
})}
/>
</>
) : null}
</h1>
</EuiTitle>
<EuiSpacer size="s" />
<EuiText>
<p>
<FormattedMessage
id="credentialManagement.createCredential.description"
defaultMessage="A credential can be attached to multiple sources. For example, {credential} can be attached to two data sources {first} and {second}."
values={{
credential: <EuiCode>username-password-credential</EuiCode>,
first: <EuiCode>os-service-log</EuiCode>,
second: <EuiCode>os-application-log</EuiCode>,
}}
/>
<br />
<EuiLink
href={docLinks.links.noDocumentation.indexPatterns.introduction}
target="_blank"
external
>
<FormattedMessage
id="credentialManagement.createCredential.documentation"
defaultMessage="Read documentation"
/>
</EuiLink>
</p>
</EuiText>
noCharger marked this conversation as resolved.
Show resolved Hide resolved
{prompt ? (
<>
<EuiSpacer size="m" />
{prompt}
</>
) : null}
</div>
);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export { Header } from './header';
Loading