Skip to content

Commit 17cdac4

Browse files
authored
Merge pull request #890 from amitamrutiya/pass-container
pass the container resource in the useResourceCleanData function
2 parents 4abaca4 + a3063bc commit 17cdac4

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

src/custom/ResourceDetailFormatters/Formatter.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import {
3535
StyledEnvironmentVariablesCode,
3636
StyledEnvironmentVariablesPre,
3737
StyledTitle,
38+
TextValue,
3839
Wrap
3940
} from './styles';
4041
import {
@@ -201,7 +202,7 @@ export const OperatorDynamicFormatter: React.FC<OperatorDynamicFormatterProps> =
201202
return (
202203
<>
203204
<ElementData>
204-
{data}
205+
<TextValue>{data}</TextValue>
205206
{regex.test(data) && <CopyToClipboard data={data} />}
206207
</ElementData>
207208
</>

src/custom/ResourceDetailFormatters/styles.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const Title = styled('span')({
5252
fontFamily: 'Qanelas Soft, sans-serif'
5353
});
5454

55-
export const ElementData = styled('span')({
55+
export const ElementData = styled('div')({
5656
display: 'flex',
5757
alignItems: 'center',
5858
justifyContent: 'space-between',
@@ -184,14 +184,21 @@ export const EnvironmentVariableValue = styled('span')({
184184
export const CodeFormatterPre = styled('pre')(({ theme }) => ({
185185
backgroundColor: theme.palette.mode === 'light' ? '#e9eff1' : '#212121',
186186
color: theme.palette.text.primary,
187-
width: '100%',
188187
wordWrap: 'break-word',
189188
overflowWrap: 'break-word',
190189
wordBreak: 'break-all',
191190
margin: 0,
192-
padding: '0.5rem'
191+
padding: '0.5rem',
192+
maxWidth: '-moz-available'
193193
}));
194194

195+
export const TextValue = styled(Box)({
196+
whiteSpace: 'nowrap',
197+
textOverflow: 'ellipsis',
198+
width: 'inherit',
199+
overflow: 'hidden'
200+
});
201+
195202
export const CodeFormatterCode = styled('code')(({ theme }) => ({
196203
backgroundColor: theme.palette.mode === 'light' ? '#e9eff1' : '#212121',
197204
color: theme.palette.text.primary,

src/custom/ResourceDetailFormatters/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -264,4 +264,5 @@ export interface GetResourceCleanDataProps {
264264
dispatchMsgToEditor?: (msg: any) => void;
265265
activeLabels?: string[];
266266
showStatus?: boolean;
267+
container?: any;
267268
}

src/custom/ResourceDetailFormatters/useResourceCleanData.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ export const useResourceCleanData = () => {
6767
resource,
6868
activeLabels,
6969
dispatchMsgToEditor,
70-
showStatus = true
70+
showStatus = true,
71+
container
7172
}: GetResourceCleanDataProps) => {
7273
const parsedStatus = resource?.status?.attribute && JSON.parse(resource?.status?.attribute);
7374
const parsedSpec = resource?.spec?.attribute && JSON.parse(resource?.spec.attribute);
7475
const numberStates = structureNumberStates(parsedStatus, parsedSpec);
7576
const kind = resource?.kind ?? resource?.component?.kind;
7677
const cleanData = {
78+
container: container,
7779
age: getAge(resource?.metadata?.creationTimestamp),
7880
kind: kind,
7981
status: showStatus && getStatus(parsedStatus),

0 commit comments

Comments
 (0)