Skip to content

Commit 18f0ac4

Browse files
arunjaindevarunjaindev
authored andcommitted
feat: useSuperAdmin context for super admin
1 parent f1b8bea commit 18f0ac4

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

src/Shared/Components/CICDHistory/Artifacts.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
ClipboardButton,
2424
extractImage,
2525
DOCUMENTATION,
26+
useSuperAdmin,
2627
} from '../../../Common'
2728
import { ReactComponent as Download } from '../../../Assets/Icon/ic-download.svg'
2829
import { ReactComponent as MechanicalOperation } from '../../../Assets/Icon/ic-mechanical-operation.svg'
@@ -35,7 +36,6 @@ import noartifact from '../../../Assets/Img/no-artifact@2x.png'
3536
import { ArtifactType, CIListItemType, HistoryComponentType } from './types'
3637
import { TERMINAL_STATUS_MAP } from './constants'
3738
import { EMPTY_STATE_STATUS } from '../../constants'
38-
import { useMainContext } from '../../Providers'
3939

4040
const CIProgressView = (): JSX.Element => (
4141
<GenericEmptyState
@@ -136,7 +136,7 @@ const Artifacts = ({
136136
jobCIClass,
137137
renderCIListHeader,
138138
}: ArtifactType) => {
139-
const { isSuperAdmin } = useMainContext()
139+
const { isSuperAdmin } = useSuperAdmin()
140140

141141
const { triggerId, buildId } = useParams<{
142142
triggerId: string

src/Shared/Components/CICDHistory/CiPipelineSourceConfig.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import webhookIcon from '../../../Assets/Icon/ic-webhook.svg'
2222
import branchIcon from '../../../Assets/Icon/ic-branch.svg'
2323
import { ReactComponent as Info } from '../../../Assets/Icon/ic-info-outlined.svg'
2424
import regexIcon from '../../../Assets/Icon/ic-regex.svg'
25-
import { _buildHoverHtmlForWebhook } from './utils'
25+
import { buildHoverHtmlForWebhook } from './utils'
2626

2727
export interface CIPipelineSourceConfigInterface {
2828
sourceType
@@ -60,7 +60,7 @@ export const CiPipelineSourceConfig = ({
6060
const _webhookEvent = _res.result
6161
setSourceValueBase(_webhookEvent.name)
6262
setSourceValueAdv(
63-
_buildHoverHtmlForWebhook(
63+
buildHoverHtmlForWebhook(
6464
_webhookEvent.name,
6565
_sourceValueObj.condition,
6666
_webhookEvent.selectors,
@@ -110,7 +110,7 @@ export const CiPipelineSourceConfig = ({
110110
.then((_res) => {
111111
const _webhookEvent = _res.result
112112
setSourceValueBase(_webhookEvent.name)
113-
setSourceValueAdv(_buildHoverHtmlForWebhook(_webhookEvent.name, _condition, _webhookEvent.selectors))
113+
setSourceValueAdv(buildHoverHtmlForWebhook(_webhookEvent.name, _condition, _webhookEvent.selectors))
114114
setLoading(false)
115115
})
116116
.catch((error) => {

src/Shared/Components/CICDHistory/History.components.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
import Tippy from '@tippyjs/react'
1818
import { useEffect } from 'react'
1919
import { useLocation } from 'react-router'
20-
import { ClipboardButton, GenericEmptyState, extractImage, useKeyDown } from '../../../Common'
20+
import { ClipboardButton, GenericEmptyState, extractImage, useKeyDown, useSuperAdmin } from '../../../Common'
2121
import { EMPTY_STATE_STATUS } from '../../constants'
2222
import { ReactComponent as DropDownIcon } from '../../../Assets/Icon/ic-chevron-down.svg'
2323
import { GitChangesType, LogResizeButtonType, ScrollerType } from './types'
2424
import GitCommitInfoGeneric from '../GitCommitInfoGeneric/GitCommitInfoGeneric'
2525
import { CIListItem } from './Artifacts'
2626
import { ReactComponent as ZoomIn } from '../../../Assets/Icon/ic-fullscreen.svg'
2727
import { ReactComponent as ZoomOut } from '../../../Assets/Icon/ic-exit-fullscreen.svg'
28-
import { useMainContext } from '../../Providers'
2928

3029
export const LogResizeButton = ({ fullScreenView, setFullScreenView }: LogResizeButtonType): JSX.Element => {
3130
const { pathname } = useLocation()
@@ -117,7 +116,7 @@ export const GitChanges = ({
117116
selectedEnvironmentName,
118117
renderCIListHeader,
119118
}: GitChangesType) => {
120-
const { isSuperAdmin } = useMainContext()
119+
const { isSuperAdmin } = useSuperAdmin()
121120

122121
if (!ciMaterials?.length || !Object.keys(gitTriggers ?? {}).length) {
123122
return (

src/Shared/Components/CICDHistory/utils.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export const getParsedTriggerHistory = (result): DeploymentHistoryResultObject =
7373
return parsedResult
7474
}
7575

76-
export const _buildHoverHtmlForWebhook = (eventName, condition, selectors) => {
76+
export const buildHoverHtmlForWebhook = (eventName, condition, selectors) => {
7777
const _conditions = []
7878
Object.keys(condition).forEach((_selectorId) => {
7979
// eslint-disable-next-line eqeqeq

0 commit comments

Comments
 (0)