-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(argocd): add permission support for argocd
- Loading branch information
1 parent
9bb8c47
commit 0265215
Showing
17 changed files
with
193 additions
and
3 deletions.
There are no files selected for viewing
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,11 @@ | ||
# argocd-common | ||
|
||
Welcome to the argocd-common plugin! | ||
|
||
This plugin contains common utilities for the argocd plugin. | ||
|
||
# Argocd plugin for Backstage | ||
|
||
The Argocd plugin displays the information about your argocd applications in your Backstage application. | ||
|
||
For more information about Argocd plugin, see the [Argocd plugin documentation](https://github.com/janus-idp/backstage-plugins/tree/main/plugins/argocd) on GitHub. |
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,49 @@ | ||
{ | ||
"name": "@janus-idp/backstage-plugin-argocd-common", | ||
"version": "0.1.0", | ||
"main": "src/index.ts", | ||
"types": "src/index.ts", | ||
"license": "Apache-2.0", | ||
"publishConfig": { | ||
"access": "public", | ||
"main": "dist/index.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"types": "dist/index.d.ts" | ||
}, | ||
"backstage": { | ||
"role": "common-library", | ||
"supported-versions": "1.26.5" | ||
}, | ||
"sideEffects": false, | ||
"scripts": { | ||
"build": "backstage-cli package build", | ||
"clean": "backstage-cli package clean", | ||
"lint": "backstage-cli package lint", | ||
"postpack": "backstage-cli packag e postpack", | ||
"prepack": "backstage-cli package prepack", | ||
"test": "backstage-cli package test --passWithNoTests --coverage", | ||
"tsc": "tsc" | ||
}, | ||
"dependencies": { | ||
"@backstage/plugin-permission-common": "^0.7.13" | ||
}, | ||
"devDependencies": { | ||
"@backstage/cli": "0.26.6" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/janus-idp/backstage-plugins", | ||
"directory": "plugins/argocd-common" | ||
}, | ||
"keywords": [ | ||
"support:production", | ||
"lifecycle:active", | ||
"backstage", | ||
"plugin" | ||
], | ||
"homepage": "https://red.ht/rhdh", | ||
"bugs": "https://github.com/janus-idp/backstage-plugins/issues" | ||
} |
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,7 @@ | ||
/** | ||
* Common functionalities for the argocd plugin. | ||
* | ||
* @packageDocumentation | ||
*/ | ||
|
||
export * from './permissions'; |
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,13 @@ | ||
import { createPermission } from '@backstage/plugin-permission-common'; | ||
|
||
export const argocdViewPermission = createPermission({ | ||
name: 'argocd.view.read', | ||
attributes: { | ||
action: 'read', | ||
}, | ||
}); | ||
|
||
/** | ||
* List of all permissions on permission polices. | ||
*/ | ||
export const argocdPermissions = [argocdViewPermission]; |
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,9 @@ | ||
{ | ||
"extends": "@backstage/cli/config/tsconfig.json", | ||
"include": ["src", "dev"], | ||
"exclude": ["node_modules"], | ||
"compilerOptions": { | ||
"outDir": "../../dist-types/plugins/argocd-common", | ||
"rootDir": "." | ||
} | ||
} |
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,9 @@ | ||
{ | ||
"extends": ["//"], | ||
"pipeline": { | ||
"tsc": { | ||
"outputs": ["../../dist-types/plugins/argocd-common/**"], | ||
"dependsOn": ["^tsc"] | ||
} | ||
} | ||
} |
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
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,14 @@ | ||
import React from 'react'; | ||
|
||
import { Alert, AlertTitle } from '@material-ui/lab'; | ||
|
||
const PermissionAlert = () => { | ||
return ( | ||
<Alert severity="warning" data-testid="no-permission-alert"> | ||
<AlertTitle>Permission required</AlertTitle> | ||
To view argocd plugin, contact your administrator to give you the | ||
argocd.view.read permission. | ||
</Alert> | ||
); | ||
}; | ||
export default PermissionAlert; |
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
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
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,11 @@ | ||
import { usePermission } from '@backstage/plugin-permission-react'; | ||
|
||
import { argocdViewPermission } from '@janus-idp/backstage-plugin-argocd-common'; | ||
|
||
export const useArgocdViewPermission = () => { | ||
const argocdViewPermissionResult = usePermission({ | ||
permission: argocdViewPermission, | ||
}); | ||
|
||
return argocdViewPermissionResult.allowed; | ||
}; |
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