Skip to content

Commit 17966f9

Browse files
fix: handle rbac
1 parent e282371 commit 17966f9

File tree

3 files changed

+56
-36
lines changed

3 files changed

+56
-36
lines changed

src/components/app/details/appDetails/appDetails.scss

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
box-shadow: 1px 2px 3px rgba(0, 0, 0, 0.1);
174174
}
175175

176-
.event-block > div {
176+
.event-block>div {
177177
display: inline-block;
178178
vertical-align: middle;
179179
}
@@ -187,7 +187,7 @@
187187
border-left: solid 6px white;
188188
}
189189

190-
.event-labels > div {
190+
.event-labels>div {
191191
display: inline-block;
192192
vertical-align: middle;
193193
text-transform: capitalize;
@@ -246,9 +246,9 @@ table.pod__table td:last-child {
246246
}
247247

248248
.no-pod {
249-
display: flex;
250-
align-items: center;
251-
justify-content: center;
249+
// display: flex;
250+
// align-items: center;
251+
// justify-content: center;
252252
width: 100%;
253253
height: 100%;
254254
flex-direction: column;
@@ -341,6 +341,7 @@ table.pod__table td:last-child {
341341
position: sticky;
342342
top: 0;
343343
background: white;
344+
344345
&:hover {
345346
background: white;
346347
}
@@ -380,7 +381,7 @@ table.pod__table td:last-child {
380381
}
381382
}
382383

383-
& > div {
384+
&>div {
384385
flex: 0 0 50%;
385386
justify-content: flex-start;
386387

@@ -412,6 +413,7 @@ table.pod__table td:last-child {
412413
}
413414

414415
&.detailed {
416+
415417
.services-info,
416418
.status-info {
417419
flex-basis: 50%;
@@ -749,6 +751,7 @@ table.pod__table td:last-child {
749751
}
750752

751753
.app-summary__status-name {
754+
752755
&.f-healthy,
753756
&.f-scalingreplicasetdown {
754757
color: var(--green);
@@ -1245,11 +1248,11 @@ table.pod__table td:last-child {
12451248
align-items: center;
12461249
justify-items: start;
12471250

1248-
& > span:first-child {
1251+
&>span:first-child {
12491252
padding-left: 20px;
12501253
}
12511254

1252-
& > span:last-child {
1255+
&>span:last-child {
12531256
padding-right: 20px;
12541257
}
12551258

@@ -1390,7 +1393,7 @@ table.pod__table td:last-child {
13901393
margin-bottom: 8px;
13911394
}
13921395

1393-
& > div {
1396+
&>div {
13941397
overflow: auto;
13951398
position: relative;
13961399
}
@@ -1817,18 +1820,22 @@ table.resource-tree {
18171820
.app-details-info-card {
18181821
.app-summary__status-name {
18191822
text-transform: none !important;
1823+
18201824
&.f-succeeded {
18211825
color: var(--green);
18221826
}
1827+
18231828
&.f-inprogress {
18241829
color: #ff7e5b;
18251830
}
1831+
18261832
&.f-failed,
18271833
&.f-timed_out,
18281834
&.f-unable_to_fetch {
18291835
color: var(--R500);
18301836
}
18311837
}
1838+
18321839
.timer-icon {
18331840
path {
18341841
stroke: var(--N600);
@@ -1845,6 +1852,7 @@ table.resource-tree {
18451852
left: 18px;
18461853
width: 5px;
18471854
}
1855+
18481856
.deployment-status-breakdown-row {
18491857
display: flex;
18501858
align-items: center;
@@ -1881,6 +1889,7 @@ table.resource-tree {
18811889
grid-template-columns: 150px 200px 150px auto;
18821890
grid-column-gap: 16px;
18831891
}
1892+
18841893
.resource-list {
18851894
.app-status-row {
18861895
&:hover {
@@ -1895,7 +1904,7 @@ table.resource-tree {
18951904
}
18961905
}
18971906

1898-
.deployment-approval-container + .deployment-status-breakdown-container {
1907+
.deployment-approval-container+.deployment-status-breakdown-container {
18991908
padding-top: 0px;
19001909
}
19011910

@@ -2009,4 +2018,4 @@ table.resource-tree {
20092018
}
20102019
}
20112020
}
2012-
}
2021+
}

src/components/app/details/cicdHistory/TriggerDetails.tsx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,23 @@ const WorkerStatus = React.memo(
155155
</div>
156156
)}
157157
</div>
158-
{message && (
159-
<Tippy
160-
theme={TippyTheme.black}
161-
className="default-tt"
162-
arrow={false}
163-
placement="bottom-start"
164-
animation="shift-toward-subtle"
165-
content={message}
166-
>
167-
<div className="fs-12 cn-7 dc__ellipsis-right__2nd-line">{message}</div>
168-
</Tippy>
169-
)}
170-
</div>
171-
</>
172-
)
173-
})
158+
{message && (
159+
<Tippy
160+
theme={TippyTheme.black}
161+
className="default-tt"
162+
arrow={false}
163+
placement="bottom-start"
164+
animation="shift-toward-subtle"
165+
content={message}
166+
>
167+
<div className="fs-12 cn-7 dc__ellipsis-right__2nd-line">{message}</div>
168+
</Tippy>
169+
)}
170+
</div>
171+
</>
172+
)
173+
},
174+
)
174175

175176
const ProgressingStatus = React.memo(
176177
({ status, message, podStatus, stage, type, finishedOn, workerPodName }: ProgressingStatusType): JSX.Element => {

src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetail.component.tsx

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,17 @@ function NodeDetailComponent({
102102

103103
const getContainersFromManifest = async () => {
104104
try {
105-
const nullCaseName = (isResourceBrowserView && params.nodeType==='pod') ? params.node: ""
105+
const nullCaseName = isResourceBrowserView && params.nodeType === 'pod' ? params.node : ''
106106
const { result } = await getManifestResource(
107107
appDetails,
108108
params.node,
109109
params.nodeType,
110110
isResourceBrowserView,
111-
{...selectedResource, name: selectedResource.name ? selectedResource.name : nullCaseName },
111+
{
112+
...selectedResource,
113+
name: selectedResource.name ? selectedResource.name : nullCaseName,
114+
namespace: selectedResource.namespace ? selectedResource.namespace : 'devtron-ci',
115+
},
112116
)
113117
const _resourceContainers = []
114118
if (result?.manifest?.spec) {
@@ -131,7 +135,6 @@ function NodeDetailComponent({
131135
})),
132136
)
133137
}
134-
135138
}
136139

137140
if (result?.ephemeralContainers) {
@@ -154,8 +157,14 @@ function NodeDetailComponent({
154157
setResourceDeleted(false)
155158
}
156159
} catch (err) {
160+
// when resource is deleted
157161
if (Array.isArray(err['errors']) && err['errors'].some((_err) => _err.code === '404')) {
158162
setResourceDeleted(true)
163+
// when user is not authorized to view resource
164+
} else if (err['code'] === 403) {
165+
166+
setResourceDeleted(true)
167+
showError(err)
159168
} else {
160169
showError(err)
161170

@@ -322,12 +331,13 @@ function NodeDetailComponent({
322331
</>
323332
)}
324333
</div>
325-
{isResourceBrowserView && (
326-
<span className="flex left fw-6 cr-5 ml-16 fs-12 cursor" onClick={toggleDeleteDialog}>
327-
<DeleteIcon className="icon-dim-16 mr-5 scr-5" />
328-
{CLUSTER_NODE_ACTIONS_LABELS.delete}
329-
</span>
330-
)}
334+
{isResourceBrowserView &&
335+
!isResourceDeleted && ( // hide delete button if resource is deleted or user is not authorized
336+
<span className="flex left fw-6 cr-5 ml-16 fs-12 cursor" onClick={toggleDeleteDialog}>
337+
<DeleteIcon className="icon-dim-16 mr-5 scr-5" />
338+
{CLUSTER_NODE_ACTIONS_LABELS.delete}
339+
</span>
340+
)}
331341
</div>
332342
{renderPodTerminal()}
333343

0 commit comments

Comments
 (0)