Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
amundsen_dev
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Surendar Reddy Mangannagari
amundsen_dev
Commits
560b89db
Unverified
Commit
560b89db
authored
Sep 16, 2019
by
Tamika Tannis
Committed by
GitHub
Sep 16, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Truncate the column type (#297)
* Truncate the column type * Update truncation method * Cleanup logic
parent
e31e280e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
1 deletion
+54
-1
_popovers.scss
amundsen_application/static/css/_popovers.scss
+5
-0
index.tsx
...omponents/TableDetail/DetailList/DetailListItem/index.tsx
+45
-1
styles.scss
...ponents/TableDetail/DetailList/DetailListItem/styles.scss
+4
-0
No files found.
amundsen_application/static/css/_popovers.scss
View file @
560b89db
...
@@ -61,3 +61,8 @@
...
@@ -61,3 +61,8 @@
width
:
24px
;
width
:
24px
;
margin
:
auto
;
margin
:
auto
;
}
}
.column-type-popover
{
max-width
:
552px
;
// arbitrary 2x default
word-break
:
break-word
;
}
amundsen_application/static/js/components/TableDetail/DetailList/DetailListItem/index.tsx
View file @
560b89db
import
*
as
React
from
'react'
;
import
*
as
React
from
'react'
;
import
moment
from
'moment-timezone'
;
import
moment
from
'moment-timezone'
;
import
{
OverlayTrigger
,
Popover
}
from
'react-bootstrap'
;
import
ColumnDescEditableText
from
'components/TableDetail/ColumnDescEditableText'
;
import
ColumnDescEditableText
from
'components/TableDetail/ColumnDescEditableText'
;
import
{
logClick
}
from
'ducks/utilMethods'
;
import
{
logClick
}
from
'ducks/utilMethods'
;
import
{
TableColumn
}
from
'interfaces'
;
import
{
TableColumn
}
from
'interfaces'
;
...
@@ -49,6 +51,48 @@ class DetailListItem extends React.Component<DetailListItemProps, DetailListItem
...
@@ -49,6 +51,48 @@ class DetailListItem extends React.Component<DetailListItemProps, DetailListItem
return
moment
(
unixEpochSeconds
*
1000
).
format
(
"MMM DD, YYYY"
);
return
moment
(
unixEpochSeconds
*
1000
).
format
(
"MMM DD, YYYY"
);
};
};
renderColumnType
=
(
columnIndex
:
number
,
type
:
string
)
=>
{
const
truncatedTypes
:
string
[]
=
[
'array'
,
'struct'
,
'map'
];
let
shouldTrucate
=
false
;
const
fullText
=
type
.
toLowerCase
();
let
text
=
fullText
;
truncatedTypes
.
forEach
((
truncatedType
)
=>
{
if
(
type
.
startsWith
(
truncatedType
)
&&
type
!==
truncatedType
)
{
shouldTrucate
=
true
;
text
=
`
${
truncatedType
}
<...>`
;
return
;
};
})
if
(
shouldTrucate
)
{
const
popoverHover
=
(
<
Popover
className=
'column-type-popover'
id=
{
`column-type-popover:${columnIndex}`
}
>
{
fullText
}
</
Popover
>
);
const
stopPropagation
=
(
event
)
=>
{
event
.
stopPropagation
();
}
return
(
<
OverlayTrigger
trigger=
{
[
'click'
]
}
placement=
'right'
overlay=
{
popoverHover
}
rootClose=
{
true
}
>
<
a
className=
'column-type'
href=
"JavaScript:void(0)"
onClick=
{
stopPropagation
}
>
{
text
}
</
a
>
</
OverlayTrigger
>
)
}
return
(<
div
className=
'column-type'
>
{
text
}
</
div
>);
};
render
()
{
render
()
{
const
metadata
=
this
.
props
.
data
;
const
metadata
=
this
.
props
.
data
;
const
isExpandable
=
metadata
.
stats
&&
metadata
.
stats
.
length
>
0
;
const
isExpandable
=
metadata
.
stats
&&
metadata
.
stats
.
length
>
0
;
...
@@ -75,7 +119,7 @@ class DetailListItem extends React.Component<DetailListItemProps, DetailListItem
...
@@ -75,7 +119,7 @@ class DetailListItem extends React.Component<DetailListItemProps, DetailListItem
<
div
className=
'title-section'
>
<
div
className=
'title-section'
>
<
div
className=
'title-row'
>
<
div
className=
'title-row'
>
<
div
className=
'name title-2'
>
{
metadata
.
name
}
</
div
>
<
div
className=
'name title-2'
>
{
metadata
.
name
}
</
div
>
<
div
className=
'column-type'
>
{
metadata
.
type
?
metadata
.
type
.
toLowerCase
()
:
'null'
}
</
div
>
{
this
.
renderColumnType
(
this
.
props
.
index
,
metadata
.
type
)
}
</
div
>
</
div
>
</
div
>
</
div
>
{
{
...
...
amundsen_application/static/js/components/TableDetail/DetailList/DetailListItem/styles.scss
View file @
560b89db
...
@@ -47,6 +47,10 @@
...
@@ -47,6 +47,10 @@
margin-top
:
4px
;
margin-top
:
4px
;
max-width
:
15%
;
max-width
:
15%
;
}
}
a
.column-type
{
text-decoration
:
none
;
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment