Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:devtron-labs/dashboard into feat…
Browse files Browse the repository at this point in the history
…/build-cache
  • Loading branch information
Elessar1802 committed Dec 24, 2024
2 parents 4bcd7d4 + b03cca1 commit 344be94
Show file tree
Hide file tree
Showing 28 changed files with 445 additions and 295 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ FEATURE_BULK_RESTART_WORKLOADS_FROM_RB=deployment,rollout,daemonset,statefulset
FEATURE_DEFAULT_MERGE_STRATEGY=
FEATURE_CLUSTER_MAP_ENABLE=true
FEATURE_DEFAULT_LANDING_RB_ENABLE=false
FEATURE_ACTION_AUDIOS_ENABLE=true
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ src/components/common/DatePickers/DayPickerRangeController.tsx
src/components/common/DeprecatedUpdateWarn.tsx
src/components/common/Description/GenericDescription.tsx
src/components/common/DynamicTabs/__tests__/DynamicTabs.test.tsx
src/components/common/ExportToCsv/ExportToCsv.tsx
src/components/common/FloatingVariablesSuggestions/FloatingVariablesSuggestions.tsx
src/components/common/FloatingVariablesSuggestions/SuggestionItem.tsx
src/components/common/FloatingVariablesSuggestions/Suggestions.tsx
Expand Down
1 change: 1 addition & 0 deletions config.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,6 @@
| TRIGGER_API_TIMEOUT | 60000 | Default timeout for all API requests for Trigger calls (Deploy artifacts, charts) in DASHBOARD |
| FEATURE_STEP_WISE_LOGS_ENABLE | true | Would segregate logs into tasks |
| FEATURE_HIDE_USER_DIRECT_PERMISSIONS_FOR_NON_SUPER_ADMINS | "true" | Would hide the user direct permissions for non-super admin users in User Permissions |
| FEATURE_ACTION_AUDIOS_ENABLE | true | Would enable audios in dashboard |

# DASHBOARD CONFIG SECRET
2 changes: 1 addition & 1 deletion 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": "1.3.2-beta-3",
"@devtron-labs/devtron-fe-common-lib": "1.3.5",
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
"@rjsf/core": "^5.13.3",
"@rjsf/utils": "^5.13.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

import moment from 'moment'
import { Moment12HourExportFormat } from '../../../../../config'
import { getFormattedUTCTimeForExport, UserTypeToFetchType } from '@devtron-labs/devtron-fe-common-lib'
import { ExportToCsvProps } from '@Components/common/ExportToCsv/types'

import { UserPermissionListHeaderProps } from './types'
import ExportToCsv from '../../../../../components/common/ExportToCsv/ExportToCsv'
Expand All @@ -26,6 +26,11 @@ import { LAST_LOGIN_TIME_NULL_STATE } from '../constants'
import { importComponentFromFELibrary } from '../../../../../components/common'

const getStatusExportText = importComponentFromFELibrary('getStatusExportText', null, 'function')
const getUserExportToCsvConfiguration = importComponentFromFELibrary(
'getUserExportToCsvConfiguration',
null,
'function',
)
const showStatus = !!getStatusExportText

const ExportUserPermissionsToCsv = ({
Expand All @@ -37,8 +42,8 @@ const ExportUserPermissionsToCsv = ({
/**
* Returns the list of users which have permission to devtron applications
*/
const getUsersDataToExport = async () => {
const { users } = await getDataToExport()
const getUsersDataToExport: ExportToCsvProps<UserTypeToFetchType>['apiPromise'] = async (selectedConfig) => {
const { users } = await getDataToExport(selectedConfig)
const userList = users.reduce((_usersList, _user) => {
let isRowAdded = false

Expand All @@ -51,19 +56,25 @@ const ExportUserPermissionsToCsv = ({
isRowAdded = true
}

const updatedOn = getFormattedUTCTimeForExport(_user.updatedOn)

const _userData = {
emailId: _user.emailId,
userId: _user.id,
...(showStatus
? {
status: getStatusExportText(_user.userStatus, _user.timeToLive),
permissionStatus: '-',
createdOn: getFormattedUTCTimeForExport(_user.createdOn),
updatedOn,
deletedOn: _user.isDeleted ? updatedOn : '-',
isDeleted: _user.isDeleted,
}
: {}),
lastLoginTime:
_user.lastLoginTime === LAST_LOGIN_TIME_NULL_STATE
? _user.lastLoginTime
: `${moment.utc(_user.lastLoginTime).format(Moment12HourExportFormat)} (UTC)`,
: getFormattedUTCTimeForExport(_user.lastLoginTime),
superAdmin: _user.superAdmin,
group: '-',
project: '-',
Expand Down Expand Up @@ -106,6 +117,10 @@ const ExportUserPermissionsToCsv = ({
},
)
}

if (!isRowAdded) {
_pushToUserList(_userData)
}
}

return _usersList
Expand All @@ -115,7 +130,15 @@ const ExportUserPermissionsToCsv = ({
}

return (
<ExportToCsv disabled={disabled} apiPromise={getUsersDataToExport} fileName={FILE_NAMES.Users} showOnlyIcon />
<ExportToCsv
disabled={disabled}
apiPromise={getUsersDataToExport}
fileName={FILE_NAMES.Users}
showOnlyIcon
{...(getUserExportToCsvConfiguration && {
configuration: getUserExportToCsvConfiguration(),
})}
/>
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,14 @@ import { User } from '../../types'
import { getIsAdminOrSystemUser, parseSearchParams } from '../utils'
import UserPermissionContainer from './UserPermissionContainer'
import { BulkSelectionModalConfig, BulkSelectionModalTypes } from '../../Shared/components/BulkSelection'
import { UserListFilter } from './types'
import { UserListFilter, UserPermissionContainerProps } from './types'

const StatusHeaderCell = importComponentFromFELibrary('StatusHeaderCell', null, 'function')
const getUserTypeToFetchFromSelectedConfigOptions = importComponentFromFELibrary(
'getUserTypeToFetchFromSelectedConfigOptions',
null,
'function',
)

const showStatus = !!StatusHeaderCell

Expand Down Expand Up @@ -102,14 +107,17 @@ const UserPermissionList = () => {

const showLoadingState = isLoading || getIsRequestAborted(error)

const getUserDataForExport = () =>
const getUserDataForExport: UserPermissionContainerProps['getUserDataForExport'] = (selectedConfig) =>
getUserList({
...filterConfig,
showAll: true,
offset: null,
size: null,
sortBy: UserListSortableKeys.email,
sortOrder: SortingOrder.ASC,
...(getUserTypeToFetchFromSelectedConfigOptions && {
typeToFetch: getUserTypeToFetchFromSelectedConfigOptions(selectedConfig),
}),
})

const getSelectAllDialogStatus = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ export const userListLoading: User[] = Array.from(Array(DEFAULT_SHIMMER_LOADING_
userRoleGroups: [],
userGroups: [],
superAdmin: false,
createdOn: '',
updatedOn: '',
isDeleted: false,
...getDefaultUserStatusAndTimeout(),
}))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ import {
UserListSortableKeys,
UserStatus,
UseUrlFiltersReturnType,
UserTypeToFetchType,
} from '@devtron-labs/devtron-fe-common-lib'
import { ExportToCsvProps } from '@Components/common/ExportToCsv/types'
import { getUserList } from '../../authorization.service'
import { BulkSelectionActionWidgetProps, BulkSelectionModalConfig } from '../../Shared/components/BulkSelection'
import { User } from '../../types'
Expand All @@ -42,7 +44,9 @@ export interface UserPermissionListHeaderProps {
showStatus: boolean
handleSearch: SearchBarProps['handleEnter']
initialSearchText: SearchBarProps['initialSearchText']
getDataToExport: () => ReturnType<typeof getUserList>
getDataToExport: (
...params: Parameters<ExportToCsvProps<UserTypeToFetchType>['apiPromise']>
) => ReturnType<typeof getUserList>
status: UserStatus[]
handleStatusFilterChange: (status: UserStatus[]) => void
}
Expand Down
21 changes: 20 additions & 1 deletion src/Pages/GlobalConfigurations/Authorization/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ export interface UserDto {
timeoutWindowExpression?: string
}[]
userGroups: UserGroupDTO[]
/**
* Denotes the time when the user was created
*
* Note: Enterprise only
*/
createdOn: string
/**
* Denotes the time when the user was last updated
*
* Note: Enterprise only
*/
updatedOn: string
/**
* Denotes is the user is deleted
*
* Note: Enterprise only
*/
isDeleted: boolean
}

export interface User
Expand Down Expand Up @@ -160,7 +178,8 @@ export type UserCreateOrUpdateParamsType = Pick<
userGroups: Pick<UserGroupType, 'name' | 'userGroupId'>[]
}

export interface UserCreateOrUpdatePayloadType extends Omit<UserDto, 'userGroups'> {
export interface UserCreateOrUpdatePayloadType
extends Omit<UserDto, 'userGroups' | 'createdOn' | 'updatedOn' | 'isDeleted'> {
userGroups: Pick<UserGroupDTO, 'identifier'>[]
}

Expand Down
6 changes: 6 additions & 0 deletions src/Pages/GlobalConfigurations/Authorization/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ export const transformUserResponse = (_user: UserDto): User => {
userRoleGroups,
roleFilters,
userGroups,
isDeleted,
createdOn,
updatedOn,
...user
} = _user
const timeToLive = getFormattedTimeToLive(timeoutWindowExpression)
Expand Down Expand Up @@ -128,6 +131,9 @@ export const transformUserResponse = (_user: UserDto): User => {
) ?? [],
roleFilters: transformRoleFilters(roleFilters),
userGroups: getParsedUserGroupList(userGroups),
createdOn: createdOn && createdOn !== ZERO_TIME_STRING ? moment(createdOn).format(Moment12HourFormat) : '',
updatedOn: updatedOn && updatedOn !== ZERO_TIME_STRING ? moment(updatedOn).format(Moment12HourFormat) : '',
isDeleted: isDeleted ?? false,
}
}

Expand Down
19 changes: 0 additions & 19 deletions src/assets/icons/ic-play-media.svg

This file was deleted.

3 changes: 3 additions & 0 deletions src/assets/icons/ic-play-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 0 additions & 21 deletions src/assets/icons/misc/arrow-solid-right.svg

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,14 @@ import {
RuntimePluginVariables,
uploadCDPipelineFile,
UploadFileProps,
Button,
ComponentSizeType,
AnimatedDeployButton,
} from '@devtron-labs/devtron-fe-common-lib'
import { useHistory, useLocation } from 'react-router-dom'
import { ReactComponent as Close } from '@Icons/ic-cross.svg'
import { ReactComponent as DeployIcon } from '@Icons/ic-nav-rocket.svg'
import { ReactComponent as PlayIcon } from '@Icons/ic-play-medium.svg'
import { ReactComponent as PlayIcon } from '@Icons/ic-play-outline.svg'
import { ReactComponent as Error } from '@Icons/ic-warning.svg'
import { ReactComponent as UnAuthorized } from '@Icons/ic-locked.svg'
import { ReactComponent as Tag } from '@Icons/ic-tag.svg'
Expand Down Expand Up @@ -846,29 +849,23 @@ export default function BulkCDTrigger({
}

const renderFooterSection = (): JSX.Element => {
const isDeployButtonDisabled: boolean = isDeployDisabled()
return (
<div className="dc__border-top flex right bcn-0 pt-16 pr-20 pb-16 pl-20 dc__position-fixed dc__bottom-0 env-modal-width">
<div className="dc__position-rel tippy-over">
<button
className="cta flex h-36"
data-testid="deploy-button"
onClick={onClickStartDeploy}
disabled={isDeployDisabled()}
type="button"
>
{isLoading ? (
<Progressing />
) : (
<>
{stage === DeploymentNodeType.CD ? (
<DeployIcon className="icon-dim-16 dc__no-svg-fill mr-8" />
) : (
<PlayIcon className="icon-dim-16 dc__no-svg-fill scn-0 mr-8" />
)}
{BUTTON_TITLE[stage]}
</>
)}
</button>
{!isDeployButtonDisabled && stage === DeploymentNodeType.CD && !isLoading ? (
<AnimatedDeployButton onButtonClick={onClickStartDeploy} isVirtualEnvironment={false} />
) : (
<Button
dataTestId="deploy-button"
text={BUTTON_TITLE[stage]}
startIcon={stage === DeploymentNodeType.CD ? <DeployIcon /> : <PlayIcon />}
isLoading={isLoading}
size={ComponentSizeType.large}
onClick={onClickStartDeploy}
disabled={isDeployButtonDisabled}
/>
)}
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import {
import Tippy from '@tippyjs/react'
import { getCIPipelineURL, getParsedBranchValuesForPlugin, importComponentFromFELibrary } from '../../../common'
import { ReactComponent as Close } from '../../../../assets/icons/ic-close.svg'
import { ReactComponent as PlayIcon } from '../../../../assets/icons/misc/arrow-solid-right.svg'
import { ReactComponent as PlayIcon } from '@Icons/ic-play-outline.svg'
import { ReactComponent as Warning } from '../../../../assets/icons/ic-warning.svg'
import { ReactComponent as ICError } from '../../../../assets/icons/ic-alert-triangle.svg'
import { ReactComponent as Storage } from '../../../../assets/icons/ic-storage.svg'
Expand Down
Loading

0 comments on commit 344be94

Please sign in to comment.