forked from janus-idp/backstage-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(janus-idp#1019): implemented feedback plugin (janus-idp#1045)
* feat(feedback): add feedback frontend and backend plugin Signed-off-by: Yash Oswal <[email protected]> * tests(feedback): fixed tests failing for entity page Signed-off-by: Yash Oswal <[email protected]> * feat(feedback-backend): add return statement before sending HTTP response This helps in preventing further code execution and improves the control flow. Signed-off-by: Yash Oswal <[email protected]> * feat(feedback): update readme files in feedback plugin - fixed build pipeline was failing. - fixed failing test cases Signed-off-by: Yash Oswal <[email protected]> * fix(feedback): add tsc script to package.json for feedback plugin Signed-off-by: Yash Oswal <[email protected]> * fix(feedback): removed duplicated code block - removed duplicated code from backend plugin - add janus-idp repo info to package.json Signed-off-by: Yash Oswal <[email protected]> * chore(feedback): add yarn.lock file with feedback plugin deps - updated frontend plugin to work isolated Signed-off-by: Yash Oswal <[email protected]> * chore(feedback): add OWNERS file to feedback plugins Signed-off-by: Yash Oswal <[email protected]> --------- Signed-off-by: Yash Oswal <[email protected]>
- Loading branch information
1 parent
da3d8fc
commit 34c312e
Showing
78 changed files
with
4,712 additions
and
32 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = require('@backstage/cli/config/eslint-factory')(__dirname); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
approvers: | ||
- yashoswalyo | ||
- riginoommen | ||
- deshmukhmayur | ||
reviewers: | ||
- yashoswalyo | ||
- riginoommen | ||
- deshmukhmayur |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Feedback Backend | ||
|
||
This is feedback-backend plugin which provides Rest API to create feedbacks. | ||
|
||
It is also repsonsible for creating JIRA tickets, | ||
|
||
## Getting started | ||
|
||
### Installation | ||
|
||
1. Install the backend plugin. | ||
|
||
```bash | ||
# From your backstage root directory | ||
yarn workspace backend add @janus-idp/backstage-plugin-feedback-backend | ||
``` | ||
|
||
2. Then create a new file `packages/backend/src/plugins/feedback.ts` and add the following: | ||
|
||
```ts | ||
import { Router } from 'express'; | ||
|
||
import { createRouter } from '@janus-idp/backstage-plugin-feedback-backend'; | ||
|
||
import { PluginEnvironment } from '../types'; | ||
|
||
export default async function createPlugin( | ||
env: PluginEnvironment, | ||
): Promise<Router> { | ||
return await createRouter({ | ||
logger: env.logger, | ||
config: env.config, | ||
discovery: env.discovery, | ||
}); | ||
} | ||
``` | ||
|
||
3. Next we wire this into overall backend router, edit `packages/backend/src/index.ts`: | ||
|
||
```ts | ||
import feedback from './plugins/feedback'; | ||
|
||
// ... | ||
async function main() { | ||
// ... | ||
const feedbackEnv = useHotMemoize(module, () => createEnv('feedback')); | ||
apiRouter.use('/feedback', await feedback(feedbackEnv)); | ||
} | ||
``` | ||
|
||
4. Now add below config in your `app-config.yaml` file. | ||
|
||
```yaml | ||
feedback: | ||
integrations: | ||
jira: | ||
# Under this object you can define multiple jira hosts | ||
- host: ${JIRA_HOST_URL} | ||
token: ${JIRA_TOKEN} | ||
|
||
email: | ||
## Email integration uses nodemailer to send emails | ||
host: ${EMAIL_HOST} | ||
port: ${EMAIL_PORT} # defaults to 587, if not found | ||
|
||
## Email address of sender | ||
from: ${EMAIL_FROM} | ||
|
||
## [optional] Authorization using user and password | ||
auth: | ||
user: ${EMAIL_USER} | ||
pass: ${EMAIL_PASS} | ||
|
||
# boolean | ||
secure: false | ||
|
||
# Path to ca certificate if required by mail server | ||
caCert: ${NODE_EXTRA_CA_CERTS} | ||
``` | ||
### Set up frontend plugin | ||
Follow instructions provided [feedback-plugin](../feedback/README.md) | ||
### API reference | ||
The API specifications file can be found at [docs/openapi3_0](./docs/openapi3_0.yaml) | ||
### Run | ||
1. Now run `yarn workspace @janus-idp/backstage-plugin-feedback-backedn start-backend`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
feedback: | ||
integrations: | ||
jira: | ||
# Under this object you can define multiple jira hosts | ||
- host: ${JIRA_HOST_URL} | ||
token: ${JIRA_TOKEN} | ||
|
||
email: | ||
## Email integration uses nodemailer to send emails | ||
host: ${EMAIL_HOST} | ||
port: ${EMAIL_PORT} # defaults to 587, if not found | ||
|
||
# Email address of sender | ||
from: ${EMAIL_FROM} | ||
|
||
## Authorization using user and password | ||
auth: | ||
user: ${EMAIL_USER} | ||
pass: ${EMAIL_PASS} | ||
|
||
# boolean | ||
secure: false | ||
|
||
# Path to ca certificate if required by mail server | ||
caCert: ${NODE_EXTRA_CA_CERTS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/** | ||
* Configuration options for the application. | ||
*/ | ||
export interface Config { | ||
feedback?: { | ||
integrations: { | ||
/** | ||
* Configuration options for JIRA integration. | ||
* It is an array, which can be used to set up multiple jira servers at the same time. | ||
*/ | ||
jira?: Array<{ | ||
/** | ||
* The hostname or URL of the JIRA organization. | ||
*/ | ||
host: string; | ||
|
||
/** | ||
* The access token for authenticating with JIRA. | ||
*/ | ||
token: string; | ||
}>; | ||
|
||
/** | ||
* Configuration options for email integration. | ||
*/ | ||
email?: { | ||
/** | ||
* The SMTP server's hostname or IP address. | ||
*/ | ||
host: string; | ||
|
||
/** | ||
* The port number to use for the SMTP server. | ||
*/ | ||
port: number; | ||
|
||
/** | ||
* Optional authentication settings for the SMTP server. | ||
*/ | ||
auth?: { | ||
/** | ||
* The username to use for SMTP server authentication. | ||
*/ | ||
user?: string; | ||
|
||
/** | ||
* The password to use for SMTP server authentication. | ||
* @visibility secret | ||
*/ | ||
pass?: string; | ||
}; | ||
|
||
/** | ||
* Set to `true` if you want to use SSL/TLS for the SMTP connection. | ||
* Default is `false`. | ||
*/ | ||
secure?: boolean; | ||
|
||
/** | ||
* The email address from which emails will be sent. | ||
*/ | ||
from?: string; | ||
|
||
/** | ||
* Path to a custom CA certificate file. | ||
*/ | ||
caCert?: string; | ||
}; | ||
}; | ||
}; | ||
} |
Oops, something went wrong.