Skip to content

Commit

Permalink
Full content of the .gitconfig (#1271)
Browse files Browse the repository at this point in the history
* feat: show full content of .gitconfig

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>

* chore: re-generate list of licenses

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>

* fixup! feat: show full content of .gitconfig

* fixup! chore: re-generate list of licenses

* fixup! fixup! feat: show full content of .gitconfig

---------

Signed-off-by: Oleksii Kurinnyi <okurinny@redhat.com>
  • Loading branch information
akurinnoy authored Dec 10, 2024
1 parent b5e6780 commit 7e3b827
Show file tree
Hide file tree
Showing 22 changed files with 794 additions and 278 deletions.
4 changes: 2 additions & 2 deletions .deps/EXCLUDED/prod.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ This file lists dependencies that do not need CQs or auto-detection does not wor
| `blueimp-md5@2.19.0` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/blueimp-md5/2.19.0) |
| `codemirror@5.65.16` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/codemirror/5.65.16) |
| `cookie-signature@1.2.1` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/cookie-signature/1.2.1) |
| `ecc-jsbn@0.1.2` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/ecc-jsbn/0.1.2) |
| `elliptic@6.6.1` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/elliptic/6.6.1) |
| `fast-uri@2.4.0` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/fast-uri/2.4.0) |
| `fastify@4.28.1` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/fastify/4.28.1) |
| `jsep@1.3.9` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/jsep/1.3.9) |
| `real-require@0.2.0` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/real-require/0.2.0) |
| `light-my-request@5.14.0` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/light-my-request/5.14.0) |
| `real-require@0.2.0` | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/real-require/0.2.0) |
16 changes: 8 additions & 8 deletions .deps/prod.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@
| [`domutils@3.1.0`](git://github.com/fb55/domutils.git) | BSD-2-Clause | #8391 |
| [`duplexify@4.1.3`](git://github.com/mafintosh/duplexify) | MIT | clearlydefined |
| `eastasianwidth@0.2.0` | MIT | clearlydefined |
| [`ecc-jsbn@0.1.2`](https://github.com/quartzjer/ecc-jsbn.git) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/ecc-jsbn/0.1.2) |
| [`elliptic@6.6.1`](git@github.com:indutny/elliptic) | MIT | clearlydefined |
| [`ecc-jsbn@0.1.2`](https://github.com/quartzjer/ecc-jsbn.git) | MIT | #17389 |
| [`elliptic@6.6.1`](git@github.com:indutny/elliptic) | MIT | [clearlydefined](https://clearlydefined.io/definitions/npm/npmjs/-/elliptic/6.6.1) |
| [`emoji-regex@8.0.0`](https://github.com/mathiasbynens/emoji-regex.git) | MIT | clearlydefined |
| [`emoji-regex@9.2.2`](https://github.com/mathiasbynens/emoji-regex.git) | MIT | clearlydefined |
| `encoding@0.1.13` | MIT | #1016 |
Expand Down Expand Up @@ -326,20 +326,20 @@
| `micromark-factory-space@2.0.0` | MIT | clearlydefined |
| `micromark-factory-title@2.0.0` | MIT | clearlydefined |
| `micromark-factory-whitespace@2.0.0` | MIT | clearlydefined |
| `micromark-util-character@2.1.0` | MIT | clearlydefined |
| `micromark-util-character@2.1.0` | MIT | #17409 |
| `micromark-util-chunked@2.0.0` | MIT | clearlydefined |
| `micromark-util-classify-character@2.0.0` | MIT | clearlydefined |
| `micromark-util-combine-extensions@2.0.0` | MIT | clearlydefined |
| `micromark-util-decode-numeric-character-reference@2.0.1` | MIT | clearlydefined |
| `micromark-util-decode-string@2.0.0` | MIT | clearlydefined |
| `micromark-util-encode@2.0.0` | MIT | clearlydefined |
| `micromark-util-encode@2.0.0` | MIT | #17395 |
| `micromark-util-html-tag-name@2.0.0` | MIT | clearlydefined |
| `micromark-util-normalize-identifier@2.0.0` | MIT | clearlydefined |
| `micromark-util-resolve-all@2.0.0` | MIT | clearlydefined |
| `micromark-util-sanitize-uri@2.0.0` | MIT | clearlydefined |
| `micromark-util-sanitize-uri@2.0.0` | MIT | #17416 |
| `micromark-util-subtokenize@2.0.1` | MIT | clearlydefined |
| `micromark-util-symbol@2.0.0` | MIT | clearlydefined |
| `micromark-util-types@2.0.0` | MIT | clearlydefined |
| `micromark-util-symbol@2.0.0` | MIT | #17394 |
| `micromark-util-types@2.0.0` | MIT | #17405 |
| `micromark@4.0.0` | MIT | clearlydefined |
| [`miller-rabin@4.0.1`](git@github.com:indutny/miller-rabin) | MIT | clearlydefined |
| `mime-db@1.52.0` | MIT | clearlydefined |
Expand Down Expand Up @@ -559,6 +559,6 @@
| [`wrappy@1.0.2`](https://github.com/npm/wrappy) | ISC | clearlydefined |
| [`yallist@4.0.0`](git+https://github.com/isaacs/yallist.git) | ISC | clearlydefined |
| [`yallist@5.0.0`](git+https://github.com/isaacs/yallist.git) | BlueOak-1.0.0 | clearlydefined |
| [`yaml@2.6.0`](https://eemeli.org/yaml/) | ISC | clearlydefined |
| [`yaml@2.6.0`](https://eemeli.org/yaml/) | ISC | #17714 |
| `yocto-queue@0.1.0` | MIT | clearlydefined |
| `zwitch@2.0.4` | MIT | clearlydefined |
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2018-2024 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

import React from 'react';

import { Props } from '@/components/BasicViewer';

export class BasicViewer extends React.PureComponent<Props> {
public render(): React.ReactNode {
const { id, value } = this.props;

return (
<div>
Mock Basic Viewer
<span data-testid="basic-viewer-id">{id}</span>
<span data-testid="basic-viewer-value">{value}</span>
</div>
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`BasicViewer snapshot 1`] = `
<div
className="basicViewer"
>
<div
id="basic-viewer-id"
/>
</div>
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright (c) 2018-2024 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

import React from 'react';

import { BasicViewer } from '@/components/BasicViewer';
import getComponentRenderer, { screen } from '@/services/__mocks__/getComponentRenderer';

const { createSnapshot, renderComponent } = getComponentRenderer(getComponent);

describe('BasicViewer', () => {
test('snapshot', () => {
const snapshot = createSnapshot('line 1\nline 2\nline 3');
expect(snapshot.toJSON()).toMatchSnapshot();
});

test('handle content change', () => {
const { reRenderComponent } = renderComponent('line 1\nline 2\nline 3');

const textbox = screen.getByRole('textbox');

// no new line character
expect(textbox).toHaveTextContent('line 1line 2line 3');

reRenderComponent('line 4\nline 5\nline 6');

// no new line character
expect(textbox).toHaveTextContent('line 4line 5line 6');
});
});

function getComponent(value: string): React.ReactElement {
return <BasicViewer id="basic-viewer-id" value={value} />;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright (c) 2018-2024 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

.basicViewer {
overflow: auto;
width: 100%;
height: 100%;
}

.basicViewer > div {
overflow: auto;
height: 100%;
border: 1px solid var(--pf-global--BorderColor--100);
}
66 changes: 66 additions & 0 deletions packages/dashboard-frontend/src/components/BasicViewer/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* Copyright (c) 2018-2024 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

import { defaultHighlightStyle, syntaxHighlighting } from '@codemirror/language';
import { EditorState } from '@codemirror/state';
import { EditorView } from '@codemirror/view';
import React from 'react';

import styles from '@/components/BasicViewer/index.module.css';

export type Props = {
value: string;
id: string;
};

export class BasicViewer extends React.PureComponent<Props> {
private editor: EditorView | undefined;

public componentDidMount(): void {
const parent = window.document.querySelector(`#${this.props.id}`);
if (parent) {
const state = this.getEditorState();
this.editor = new EditorView({
state,
parent,
});
}
}

public componentWillUnmount(): void {
if (this.editor) {
this.editor.destroy();
}
}

componentDidUpdate(prevProps: Readonly<Props>): void {
if (this.editor && this.props.value !== prevProps.value) {
const state = this.getEditorState();
this.editor.setState(state);
}
}

private getEditorState(): EditorState {
return EditorState.create({
doc: this.props.value,
extensions: [syntaxHighlighting(defaultHighlightStyle), EditorState.readOnly.of(true)],
});
}

public render(): React.ReactElement {
return (
<div className={styles.basicViewer}>
<div id={this.props.id}></div>
</div>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ import { Button, Flex, Form, PageSection, PageSectionVariants } from '@patternfl
import React, { FormEvent } from 'react';

import { GitConfigSectionUser } from '@/pages/UserPreferences/GitConfig/Form/SectionUser';
import * as GitConfigStore from '@/store/GitConfig';
import { GitConfig } from '@/store/GitConfig';

export type Props = {
isLoading: boolean;
gitConfig: GitConfigStore.GitConfig;
onSave: (gitConfig: GitConfigStore.GitConfig) => Promise<void>;
gitConfig: GitConfig;
onSave: (gitConfig: GitConfig) => Promise<void>;
onReload: () => Promise<void>;
};
export type State = {
isValid: boolean;
nextGitConfig: GitConfigStore.GitConfig | undefined;
nextGitConfig: GitConfig | undefined;
};

export class GitConfigForm extends React.PureComponent<Props, State> {
Expand Down Expand Up @@ -62,7 +62,7 @@ export class GitConfigForm extends React.PureComponent<Props, State> {
}
}

private handleChangeConfig(gitConfig: GitConfigStore.GitConfig, isValid: boolean): void {
private handleChangeConfig(gitConfig: GitConfig, isValid: boolean): void {
this.setState({
nextGitConfig: gitConfig,
isValid,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018-2024 Red Hat, Inc.
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Red Hat, Inc. - initial API and implementation
*/

import React from 'react';

import { Props } from '@/pages/UserPreferences/GitConfig/Toolbar';

export class GitConfigToolbar extends React.PureComponent<Props> {
render() {
const { mode, onAdd, onChangeMode } = this.props;
const nextMode = mode === 'form' ? 'viewer' : 'form';
return (
<div>
Mock Git Config Toolbar
<span data-testid="toolbar-mode">{mode}</span>
<button data-testid="toolbar-on-add" onClick={onAdd}>
Add
</button>
<button data-testid="toolbar-on-change-mode" onClick={() => onChangeMode(nextMode)}>
Switch Mode
</button>
</div>
);
}
}
Loading

0 comments on commit 7e3b827

Please sign in to comment.