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

Updated readme for devquotes (moved to its own repo) #82

Merged
merged 5 commits into from
Nov 26, 2023
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ You are probably looking for the plugins which have been moved to their own repo
- [opa-backend](https://github.com/Parsifal-M/backstage-opa-backend#opa-backend)
- [opa-entity-checker](https://github.com/Parsifal-M/backstage-opa-entity-checker#opa-entity-checker)
- [opa-permissions-wrapper](https://github.com/Parsifal-M/backstage-opa-permissions-wrapper#opa-permissions-wrapper-for-backstage)
- [dev-quotes-homepage](./plugins/dev-quotes-homepage/README.md) (PENDING)
- [dev-quotes-homepage](https://github.com/Parsifal-M/backstage-dev-quotes)
- [gitlab-my-mr-card](./plugins/gitlab-my-mr-card/README.md) (WIP) (PENDING)
- [gitlab-runners](./plugins/gitlab-runners/README.md) (WIP) (PENDING)

Expand Down
2 changes: 1 addition & 1 deletion packages/app/src/components/catalog/EntityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const overviewContent = (
<Grid item md={6} xs={12}>
<EntityCatalogGraphCard variant="gridItem" height={400} />
</Grid>
<Grid item md={4} xs={12}>
<Grid item md={6} xs={12}>
<DevQuote />
</Grid>

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/plugins/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default async function createPlugin(
env: PluginEnvironment,
): Promise<Router> {
const opaClient = new OpaClient(env.config, env.logger);
const genericPolicyEvaluator = policyEvaluator(opaClient, env.config);
const genericPolicyEvaluator = policyEvaluator(opaClient);
class PermissionsHandler implements PermissionPolicy {
async handle(
request: PolicyQuery,
Expand Down
54 changes: 3 additions & 51 deletions plugins/dev-quotes-homepage/README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,7 @@
# dev-quotes-homepage

Hello! :wave:
Please be aware this plugin has moved to its own repository:

This is just a fun little plugin that I made to display some random coding/progamming related quotes on the Backstage homepage. Although to be honest the card can be used anywhere you like!
- [dev-quotes-homepage](https://github.com/Parsifal-M/backstage-dev-quotes)

## Pre-requisites (if you want to use it on the homepage)

If you do want to use it on the homepage, first make sure you look over the official docs on how to configure the homepage [here](https://backstage.io/docs/getting-started/homepage/#composing-your-homepage). There is also the [homepage plugin](https://github.com/backstage/backstage/tree/master/plugins/home#readme) which might be better to read first.

## Installation

```bash
yarn add --cwd packages/app @parsifal-m/plugin-dev-quotes-homepage
```

Then all you need to do is import the card as below, anywhere you like!

```tsx
import { DevQuote } from '@parsifal-m/plugin-dev-quotes-homepage';

const overviewContent = (
<Grid container spacing={3} alignItems="stretch">
{entityWarningContent}
<Grid item md={6}>
<EntityAboutCard variant="gridItem" />
</Grid>
<Grid item md={6} xs={12}>
<EntityCatalogGraphCard variant="gridItem" height={400} />
</Grid>
<Grid item md={4} xs={12}>
<DevQuote />
</Grid>

<Grid item md={6} xs={12}>
<OpaMetadataAnalysisCard />
</Grid>

<Grid item md={4} xs={12}>
<EntityLinksCard />
</Grid>
<Grid item md={8} xs={12}>
<EntityHasSubcomponentsCard variant="gridItem" />
</Grid>
</Grid>
);
```

## Would you like to contribute? or add more quotes?

Please do! I would love to see more quotes added to this plugin. If you would like to add some quotes, please open a pull request with your changes. If you would like to add a lot of quotes, please open an issue first so we can discuss it. And please keep them programming related, and keep it SFW.

## License

This project is released under the Apache 2.0 License.
Further development will happen there.
2 changes: 1 addition & 1 deletion plugins/dev-quotes-homepage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@parsifal-m/plugin-dev-quotes-homepage",
"version": "2.1.3",
"version": "3.0.0",
"main": "src/index.ts",
"types": "src/index.ts",
"license": "Apache-2.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import { Typography } from '@material-ui/core';
import { Typography, makeStyles } from '@material-ui/core';
import React from 'react';
import { quotes } from '../../quotes';

const useStyles = makeStyles(theme => ({
footer: {
width: '100%',
textAlign: 'center',
padding: theme.spacing(2),
},
}));

export const DevQuote = () => {
const classes = useStyles();
const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];

return (
<>
<footer className={classes.footer}>
<Typography variant="h6">{randomQuote.text}</Typography>
<Typography variant="subtitle2">{randomQuote.author}</Typography>
</>
</footer>
);
};
2 changes: 1 addition & 1 deletion plugins/dev-quotes-homepage/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './components/QuotesCardComponent';
export * from './components/QuotesComponent';
2 changes: 1 addition & 1 deletion plugins/dev-quotes-homepage/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const DevQuotesHomepage = devQuotesHomepage.provide(
createRoutableExtension({
name: 'DevQuotesHomepage',
component: () =>
import('./components/QuotesCardComponent').then(m => m.DevQuote),
import('./components/QuotesComponent').then(m => m.DevQuote),
mountPoint: rootRouteRef,
}),
);
19 changes: 18 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7936,7 +7936,24 @@ __metadata:
languageName: unknown
linkType: soft

"@parsifal-m/plugin-dev-quotes-homepage@^2.1.3, @parsifal-m/plugin-dev-quotes-homepage@workspace:plugins/dev-quotes-homepage":
"@parsifal-m/plugin-dev-quotes-homepage@npm:^2.1.3":
version: 2.1.3
resolution: "@parsifal-m/plugin-dev-quotes-homepage@npm:2.1.3"
dependencies:
"@backstage/core-components": ^0.13.5
"@backstage/core-plugin-api": ^1.6.0
"@backstage/theme": ^0.4.2
"@material-ui/core": ^4.12.2
"@material-ui/icons": ^4.9.1
"@material-ui/lab": 4.0.0-alpha.61
react-use: ^17.2.4
peerDependencies:
react: ^16.13.1 || ^17.0.0
checksum: 25e12ba5078e6ba28fe19b7a8c4da06c02619e33106f754884f7933c8840f970ab6d45607a99d9590c56d51b2a8928e938dfb58a891c1c9b570421d3d93c40d6
languageName: node
linkType: hard

"@parsifal-m/plugin-dev-quotes-homepage@workspace:plugins/dev-quotes-homepage":
version: 0.0.0-use.local
resolution: "@parsifal-m/plugin-dev-quotes-homepage@workspace:plugins/dev-quotes-homepage"
dependencies:
Expand Down