Brijesh619 commented on code in PR #728:
URL: https://github.com/apache/atlas/pull/728#discussion_r3923561538
##########
dashboard/src/views/DashboardOverview/__tests__/LatestEntitiesList.test.tsx:
##########
@@ -185,11 +185,9 @@ describe('LatestEntitiesList', () => {
/>
</MemoryRouter>,
)
- const row = screen.getByText('X').closest('li')
+ const row = screen.getByText('X').closest('li') as HTMLElement
expect(row).toBeTruthy()
- expect(
- within(row as HTMLElement).getByText(/^Created /),
- ).toBeInTheDocument()
+ expect(within(row).getByText(/ago/)).toBeInTheDocument()
Review Comment:
Fixed in commit. Updated the test assertions in LatestEntitiesList.test.tsx
on lines 190, 331, 537, and 603 back to /^Created / to ensure strict regression
coverage for the restored "Created " timestamp prefix.
##########
dashboard/src/views/DashboardOverview/__tests__/LatestEntitiesList.test.tsx:
##########
@@ -624,4 +622,68 @@ describe('LatestEntitiesList', () => {
)
expect(screen.getByText('Created today')).toBeInTheDocument()
})
+
+ it('renders fallback Typography when detailHref is absent (no guid)',
() => {
+ render(
+ <MemoryRouter>
+ <LatestEntitiesList
+ entities={[
+ {
+ name:
'EntityWithoutGuid',
+ typeName: 'T',
+ attributes: {
__timestamp: Date.now() },
+ },
+ ]}
+ />
+ </MemoryRouter>,
+ )
+ const fallbackText = screen.getByText('EntityWithoutGuid')
+ expect(fallbackText).toBeInTheDocument()
+ expect(fallbackText.tagName).toBe('SPAN')
+
expect(fallbackText).toHaveClass('latest-entities-entity-name-fallback')
+ })
+
+
+ it('renders extremely long entity name without crashing', () => {
+ const longName = 'A'.repeat(500)
+ render(
+ <MemoryRouter>
+ <LatestEntitiesList
+ entities={[
+ {
+ guid: 'g1',
+ name: longName,
+ typeName: 'T',
+ attributes: {
__timestamp: Date.now() },
+ },
+ ]}
+ />
+ </MemoryRouter>,
+ )
+ const link = screen.getByRole('link', { name: longName })
+ expect(link).toBeInTheDocument()
+ expect(link.textContent).toBe(longName)
+
+ const span = link.parentElement
+ expect(span).toHaveStyle('overflow: hidden')
+ expect(span).toHaveStyle('text-overflow: ellipsis')
+ expect(span).toHaveStyle('white-space: nowrap')
+ })
+
+ it('renders gracefully when typeName is missing', () => {
+ render(
+ <MemoryRouter>
+ <LatestEntitiesList
+ entities={[
+ {
+ guid: 'g1',
+ name: 'NamelessType',
+ attributes: {
__timestamp: Date.now() },
+ },
+ ]}
+ />
+ </MemoryRouter>,
+ )
+ expect(screen.getByText('(Entity)')).toBeInTheDocument()
+ })
Review Comment:
Added unit test renders extremely long typeName without breaking layout in
LatestEntitiesList.test.tsx verifying that a 300-character typeName renders
gracefully without crashing and is enclosed within the
latest-entities-type-wrapper truncation container.
##########
dashboard/src/views/DashboardOverview/LatestEntitiesList.scss:
##########
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+.latest-entities-paper {
+ padding: 16px;
+ border-radius: 8px;
+ min-height: 340px;
+ min-width: 0;
+ width: 100%;
+ flex: 1;
+ box-sizing: border-box;
+ transition: box-shadow 0.3s ease;
+
+ &:hover {
+ box-shadow: 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0,
0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12);
+ }
+}
+
+.latest-entities-header {
+ padding-bottom: 16px;
+ border-bottom: 1px solid rgba(0, 0, 0, 0.12);
+}
+
+.latest-entities-title {
+ font-size: 1rem;
+ font-weight: 600;
+ color: rgba(0, 0, 0, 0.87);
+}
+
+.latest-entities-view-all {
+ font-size: 0.875rem;
+ cursor: pointer;
+ text-decoration: none;
+}
+
+.latest-entities-empty {
+ padding-top: 16px;
+}
+
+.latest-entities-list {
+ padding-top: 16px;
+}
+
+.latest-entities-list-item {
+ padding-top: 8px;
+ padding-bottom: 8px;
+ border-bottom: 1px solid rgba(0, 0, 0, 0.12);
+
+ &:last-child {
+ border-bottom: none;
+ }
+}
+
+.latest-entities-entity-name {
+ font-size: 0.875rem;
+}
+
+.latest-entities-entity-name-link {
+ cursor: pointer;
+}
+
+.latest-entities-entity-name-fallback {
+ font-weight: 500;
+ color: rgba(0, 0, 0, 0.87);
+}
+
+.latest-entities-type-name {
Review Comment:
Fixed. Added explicit truncation properties (overflow: hidden;
text-overflow: ellipsis; white-space: nowrap; min-width: 0;) directly to
.latest-entities-type-name in LatestEntitiesList.scss for consistency and
styling enforcement alongside OverflowTooltip.
##########
dashboard/src/views/DashboardOverview/LatestEntitiesList.tsx:
##########
@@ -136,6 +138,8 @@ const formatRelativeTime = (raw: unknown): string => {
return formatCreatedRelativeFromMs(ms);
};
+
Review Comment:
Fixed. Removed extra blank lines between formatRelativeTime and the
LatestEntitiesList component definition.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]