Skip to content

Commit

Permalink
Merge branch 'main' into chore/rb-list
Browse files Browse the repository at this point in the history
  • Loading branch information
Elessar1802 committed May 8, 2024
2 parents 9521f48 + 3da3de4 commit ea3f311
Show file tree
Hide file tree
Showing 416 changed files with 12,979 additions and 10,777 deletions.
5 changes: 5 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ SIDEBAR_DT_LOGO=
USE_V2=
ENABLE_EXTERNAL_ARGO_CD=false
API_BATCH_SIZE=20
SERVICE_WORKER_TIMEOUT='1'
ENABLE_RESOURCE_SCAN=false
FEATURE_USER_DEFINED_GITOPS_REPO_ENABLE=false
ENABLE_RESOURCE_SCAN_V2=false
ENABLE_GITOPS_BITBUCKET_SOURCE=false
26 changes: 0 additions & 26 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,6 @@ vite.config.ts

# The following files have eslint errors/warningssrc/App.tsx
src/App.tsx
src/Pages/GlobalConfigurations/Authorization/APITokens/GroupPermission.tsx
src/Pages/GlobalConfigurations/Authorization/APITokens/index.ts
src/Pages/GlobalConfigurations/Authorization/APITokens/validationRules.ts
src/Pages/GlobalConfigurations/Authorization/PermissionGroups/AddEdit/index.ts
src/Pages/GlobalConfigurations/Authorization/PermissionGroups/List/index.ts
src/Pages/GlobalConfigurations/Authorization/PermissionGroups/index.ts
src/Pages/GlobalConfigurations/Authorization/SSOLoginServices/SSOLogin.component.tsx
src/Pages/GlobalConfigurations/Authorization/SSOLoginServices/index.ts
src/Pages/GlobalConfigurations/Authorization/UserPermissions/AddEdit/UserForm.tsx
src/Pages/GlobalConfigurations/Authorization/UserPermissions/AddEdit/index.ts
src/Pages/GlobalConfigurations/Authorization/UserPermissions/List/UserPermissionRow.tsx
src/Pages/GlobalConfigurations/Authorization/UserPermissions/List/index.ts
src/Pages/GlobalConfigurations/Authorization/UserPermissions/SSONotConfiguredState.tsx
src/Pages/GlobalConfigurations/Authorization/UserPermissions/index.ts
src/Pages/GlobalConfigurations/Authorization/index.ts
src/Pages/GlobalConfigurations/Authorization/shared/components/AppPermissions.tsx
src/Pages/GlobalConfigurations/Authorization/shared/components/FilterEmptyState/index.ts
src/Pages/GlobalConfigurations/Authorization/shared/components/K8sObjectPermissions/K8sListItemCard.tsx
src/Pages/GlobalConfigurations/Authorization/shared/components/K8sObjectPermissions/K8sPermission.component.tsx
src/Pages/GlobalConfigurations/Authorization/shared/components/K8sObjectPermissions/K8sPermissionModal.tsx
src/Pages/GlobalConfigurations/Authorization/shared/components/K8sObjectPermissions/K8sPermissions.utils.ts
src/Pages/GlobalConfigurations/Authorization/shared/components/K8sObjectPermissions/K8sPermissons.tsx
src/Pages/GlobalConfigurations/Authorization/shared/components/SuperAdminInfoBar/index.ts
src/Pages/GlobalConfigurations/Authorization/shared/components/userGroups/UserGroup.tsx
src/Pages/GlobalConfigurations/Authorization/shared/components/userGroups/userGroups.types.ts
src/components/AppSelector/AppSelector.tsx
src/components/AppSelector/AppSelectorUtil.tsx
src/components/AppSelector/ChartSelector.tsx
Expand Down Expand Up @@ -111,7 +86,6 @@ src/components/ConfigMapSecret/ConfigMap/ConfigMapList.tsx
src/components/ConfigMapSecret/ConfigMapSecret.components.tsx
src/components/ConfigMapSecret/ConfigMapSecretDataEditorContainer.tsx
src/components/ConfigMapSecret/ConfigMapSecretForm.tsx
src/components/ConfigMapSecret/InfoIconWithTippy.tsx
src/components/ConfigMapSecret/Secret/SecretList.tsx
src/components/ConfigMapSecret/Secret/secret.utils.tsx
src/components/ConfigMapSecret/Types.ts
Expand Down
5 changes: 2 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
'jsx-a11y/no-static-element-interactions': 'off',
'jsx-a11y/no-noninteractive-element-interactions': 'off',
'no-underscore-dangle': 'off',
'no-restricted-exports': 'off',
'import/no-extraneous-dependencies': [
'warn',
{
Expand Down Expand Up @@ -89,9 +90,7 @@ module.exports = {
tsx: 'never',
},
],
// Turning off as ESLint 6.x doesn't support optional chaining.
// FIXME: Remove once ESLint is upgraded to latest version
'dot-notation': 'off',
'import/prefer-default-export': 'off',
},
overrides: [
{
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
.env.development.local
.env.test.local
.env.production.local
.vscode/

src/setupProxy.js

Expand All @@ -35,3 +34,5 @@ env-config.js
/playwright/.cache/
playwright/.auth/
.npmrc

package-lock.json
5 changes: 0 additions & 5 deletions .huskyrc.js

This file was deleted.

23 changes: 23 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"recommendations": [
"formulahendry.auto-rename-tag",
"chouzz.vscode-better-align",
"aaron-bond.better-comments",
"streetsidesoftware.code-spell-checker",
"pranaygp.vscode-css-peek",
"usernamehw.errorlens",
"dbaeumer.vscode-eslint",
"dsznajder.es7-react-js-snippets",
"naumovs.color-highlight",
"github.vscode-pull-request-github",
"eamodio.gitlens",
"vincaslt.highlight-matching-tag",
"oderwat.indent-rainbow",
"davidanson.vscode-markdownlint",
"esbenp.prettier-vscode",
"gencer.html-slim-scss-css-class-completion",
"simonsiefke.svg-preview",
"shardulm94.trailing-spaces",
"chakrounanas.turbo-console-log"
]
}
24 changes: 24 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescriptreact]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": false,
"editor.codeActionsOnSave": [
"source.fixAll.eslint"
],
"eslint.validate": [
"typescript",
"typescriptreact"
],
"prettier.requireConfig": true,
"[scss]": {
"editor.defaultFormatter": "vscode.css-language-features"
},
}
6 changes: 4 additions & 2 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
| HOTJAR_ENABLED | "false" | Hotjar integration status |
| POSTHOG_ENABLED | "true" | PostHog integration status |
| POSTHOG_TOKEN | XXXXXXXX | PostHog API token |
| SENTRY_ENABLED | "false" | Sentry integration status |
| SENTRY_ENV | stage | Sentry environment |
| SENTRY_ERROR_ENABLED | false | To send uncaught errors to sentry |
| SENTRY_PERFORMANCE_ENABLED | false | To send persormance sentry |
Expand All @@ -31,4 +30,7 @@
| TRIGGER_API_TIMEOUT | 60000 | Default timeout for all API requests for Trigger calls (Deploy artifacts, charts) in DASHBOARD |
| LOGIN_DT_LOGO | "" | Devtron logo for login page |
| SIDEBAR_DT_LOGO | "" | Devtron logo for sidebar |
# DASHBOARD CONFIG SECRET
| SERVICE_WORKER_TIMEOUT | "1" | Timeout value (in minutes) to fetch update for dashboard, change it cautiously as might hamper your update cycle |
| ENABLE_RESOURCE_SCAN | false | Enable image scan for resources |
| ENABLE_RESOURCE_SCAN_V2 | true | Enable image scan for resources (v2) |
# DASHBOARD CONFIG SECRET
25 changes: 12 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"homepage": "/dashboard",
"dependencies": {
"@devtron-labs/devtron-fe-common-lib": "0.0.68",
"@devtron-labs/devtron-fe-common-lib": "0.0.81",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand All @@ -19,11 +19,8 @@
"ansi_up": "^5.2.1",
"command-line-parser": "^0.2.10",
"compute-histogram": "^0.9.11",
"dompurify": "^3.0.2",
"fast-json-patch": "^3.1.1",
"flexsearch": "^0.6.32",
"http-proxy-middleware": "^2.0.6",
"marked": "4.3.0",
"dayjs": "^1.11.8",
"moment": "^2.29.4",
"monaco-editor": "0.45.0",
Expand All @@ -48,20 +45,22 @@
"rxjs": "^7.5.4",
"sockjs-client": "1.6.1",
"tippy.js": "^6.3.7",
"vite": "^4.5.0",
"vite": "^4.5.3",
"vite-plugin-require-transform": "1.0.21",
"vite-plugin-svgr": "^2.4.0",
"xterm": "^4.19.0",
"xterm-addon-fit": "^0.5.0",
"xterm-addon-search": "^0.9.0",
"xterm-webfont": "^2.0.0",
"yaml": "^1.7.2"
"yaml": "^2.4.1",
"marked": "4.3.0",
"dompurify": "^3.0.2"
},
"scripts": {
"prepare": "husky install",
"lint": "tsc --noEmit && NODE_OPTIONS=--max_old_space_size=8192 eslint 'src/**/*.{js,jsx,ts,tsx}' --max-warnings 0",
"lint-fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix",
"start": "vite",
"start": "vite --open",
"build": "NODE_OPTIONS=--max_old_space_size=8192 vite build",
"serve": "vite preview",
"build-light": "GENERATE_SOURCEMAP=false NODE_OPTIONS=--max_old_space_size=8192 vite build",
Expand Down Expand Up @@ -93,9 +92,9 @@
"@types/react-transition-group": "^4.4.4",
"@types/recharts": "^1.8.23",
"@types/recompose": "^0.30.10",
"env-cmd": "10.1.0",
"@typescript-eslint/eslint-plugin": "^6.17.0",
"@typescript-eslint/parser": "^6.17.0",
"env-cmd": "10.1.0",
"eslint": "^8.56.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -116,15 +115,15 @@
"ts-jest": "^27.1.3",
"ts-node": "^10.7.0",
"typescript": "^4.6.2",
"vitest": "^0.33.0",
"vite-plugin-pwa": "0.17.4",
"worker-loader": "3.0.8",
"workbox-window": "7.0.0",
"vitest": "^0.33.0",
"workbox-core": "^7.0.0",
"workbox-navigation-preload": "7.0.0",
"workbox-precaching": "^7.0.0",
"workbox-routing": "^7.0.0",
"workbox-navigation-preload": "7.0.0",
"workbox-strategies": "7.0.0"
"workbox-strategies": "7.0.0",
"workbox-window": "7.0.0",
"worker-loader": "3.0.8"
},
"jest": {
"collectCoverageFrom": [
Expand Down
21 changes: 13 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
ToastBody3 as UpdateToast,
ErrorBoundary,
importComponentFromFELibrary,
getApprovalModalTypeFromURL,
} from './components/common'
import { URLS } from './config'
import Hotjar from './components/Hotjar/Hotjar'
Expand Down Expand Up @@ -97,11 +98,7 @@ export default function App() {

const redirectToDirectApprovalNotification = (): void => {
setValidating(false)
if (location.pathname && location.pathname.includes('deployment')) {
setApprovalType(APPROVAL_MODAL_TYPE.DEPLOYMENT)
} else {
setApprovalType(APPROVAL_MODAL_TYPE.CONFIG)
}
setApprovalType(getApprovalModalTypeFromURL(location.pathname))

const queryString = new URLSearchParams(location.search)
const token = queryString.get('token')
Expand Down Expand Up @@ -164,6 +161,16 @@ export default function App() {
}
}, [])

const serviceWorkerTimeout = (()=> {
const parsedTimeout = parseInt(window._env_.SERVICE_WORKER_TIMEOUT, 10)

if (parsedTimeout) {
return parsedTimeout
}

return 1
})()

const {
needRefresh: [needRefresh],
updateServiceWorker,
Expand All @@ -183,7 +190,7 @@ export default function App() {
})

if (resp?.status === 200) await r.update()
}, 1000 * 60)
}, serviceWorkerTimeout * 1000 * 60)
},
onRegisterError(error) {
console.log('SW registration error', error)
Expand All @@ -192,8 +199,6 @@ export default function App() {

function update() {
updateServiceWorker(true)
// Trigger page reload
window.location.reload()
}

useEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import moment from 'moment'
import React, { useState } from 'react'
import { useHistory } from 'react-router-dom'
import { TippyCustomized, TippyTheme, GenericEmptyState } from '@devtron-labs/devtron-fe-common-lib'
import { GenericEmptyState, InfoIconTippy } from '@devtron-labs/devtron-fe-common-lib'
import { DOCUMENTATION, MomentDateFormat } from '../../../../config'
import { ReactComponent as Key } from '../../../../assets/icons/ic-key-bulb.svg'
import { ReactComponent as Edit } from '../../../../assets/icons/ic-pencil.svg'
import { ReactComponent as Trash } from '../../../../assets/icons/ic-delete-interactive.svg'
import { APITokenListType, TokenListType } from './authorization.type'
import { isTokenExpired } from './authorization.utils'
import { APITokenListType, TokenListType } from './apiToken.type'
import { isTokenExpired } from './apiToken.utils'
import DeleteAPITokenModal from './DeleteAPITokenModal'
import NoResults from '../../../../assets/img/[email protected]'
import './apiToken.scss'
import { ReactComponent as Question } from '../../../../assets/icons/ic-help-outline.svg'
import { ReactComponent as QuestionFilled } from '../../../../assets/icons/ic-help.svg'
import { EMPTY_STATE_STATUS } from '../../../../config/constantMessaging'

const APITokenList = ({ tokenList, renderSearchToken, reload }: APITokenListType) => {
Expand All @@ -24,31 +22,20 @@ const APITokenList = ({ tokenList, renderSearchToken, reload }: APITokenListType
history.push(id ? `${key}/${id}` : key)
}

// eslint-disable-next-line @typescript-eslint/no-shadow
const handleDeleteButton = (tokenList) => {
setSelectedToken(tokenList)
const handleDeleteButton = (_tokenList) => {
setSelectedToken(_tokenList)
setDeleteConfirmation(true)
}

const handleQuestion = () => {
return (
<TippyCustomized
theme={TippyTheme.white}
className="w-300 h-100 fcv-5"
placement="right"
Icon={QuestionFilled}
<InfoIconTippy
heading="API tokens"
infoText="Tokens you have generated that can be used to access the Devtron API."
showCloseButton
trigger="click"
interactive
documentationLink={DOCUMENTATION.WEBHOOK_API_TOKEN}
documentationLinkText="View Documentation"
>
<div className="icon-dim-16 fcn-9 ml-8 cursor">
<Question />
</div>
</TippyCustomized>
iconClassName="icon-dim-16 fcn-9 ml-4"
/>
)
}

Expand Down Expand Up @@ -109,8 +96,7 @@ const APITokenList = ({ tokenList, renderSearchToken, reload }: APITokenListType
? noMatchingResults()
: tokenList.map((list, index) => (
<div
// eslint-disable-next-line react/no-array-index-key
key={`api_${index}`}
key={`api_${list.id}`}
data-testid="api-list-row"
className="api-list__row api-list-row flex-align-center fw-4 cn-9 fs-13 pr-20 pl-20"
style={{ height: '45px' }}
Expand Down Expand Up @@ -147,26 +133,26 @@ const APITokenList = ({ tokenList, renderSearchToken, reload }: APITokenListType
</>
)}
</div>
<div className="api__row-actions flex right">
<div className="api__row-actions flex right dc__gap-8">
<button
type="button"
className="dc__transparent mr-12"
className="dc__transparent flex p-4"
data-index={index}
data-testid="api-token-edit-button"
onClick={handleEditRowAction}
aria-label="Edit api token"
>
<Edit className="icon-dim-20" />
<Edit className="scn-6 icon-dim-16" />
</button>
<button
type="button"
className="dc__transparent"
className="dc__transparent flex p-4 icon-delete"
data-index={index}
data-testid="api-token-delete-button"
onClick={handleDelete}
aria-label="Delete api token"
>
<Trash className="scn-6 icon-dim-20" />
<Trash className="scn-6 icon-dim-16" />
</button>
</div>
</div>
Expand Down
Loading

0 comments on commit ea3f311

Please sign in to comment.