Skip to content

Commit

Permalink
Fix PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
schwartz-concordium committed Sep 20, 2023
1 parent 557f0d2 commit 67a8098
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class ModuleReferenceEventQuery
}

/// <summary>
/// Adds additional fields to the GraphQL type <see cref="ModuleReferenceRejectEvent"/>.
/// Adds additional fields to the GraphQL type <see cref="ModuleReferenceEvent"/>.
/// </summary>
[ExtendObjectType(typeof(ModuleReferenceEvent))]
public sealed class ModuleReferenceEventExtensions
Expand Down
6 changes: 4 additions & 2 deletions backend/Application/Api/GraphQL/Search/SearchResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ public IQueryable<Contract> GetContracts(GraphQlDbContext context)
[UsePaging]
public IQueryable<ModuleReferenceEvent> GetModules(GraphQlDbContext context)
{
if (string.IsNullOrEmpty(_queryString) || !HashRegex.IsMatch(_queryString))
if (string.IsNullOrEmpty(_queryString) || !HashRegex.IsMatch(_queryString))
{
return new List<ModuleReferenceEvent>().AsQueryable();

}

var lowerCaseQuery = _queryString.ToLowerInvariant() + "%";
return context.ModuleReferenceEvents.AsNoTracking()
.Where(module => EF.Functions.Like(module.ModuleReference, lowerCaseQuery))
Expand Down
13 changes: 3 additions & 10 deletions frontend/src/components/Module/ModuleDetailsContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@
>
<template #content>
<ModuleDetailsLinkedContracts
v-if="
moduleReferenceEvent.linkedContracts?.nodes?.length &&
moduleReferenceEvent.linkedContracts?.nodes?.length > 0
"
v-if="moduleReferenceEvent.linkedContracts?.nodes?.length"
:linked-contracts="moduleReferenceEvent.linkedContracts!.nodes"
:page-info="moduleReferenceEvent.linkedContracts!.pageInfo"
:go-to-page="goToPageLinkedContract"
Expand All @@ -54,9 +51,7 @@
<ModuleDetailsContractLinkEvents
v-if="
moduleReferenceEvent.moduleReferenceContractLinkEvents?.nodes
?.length &&
moduleReferenceEvent.moduleReferenceContractLinkEvents?.nodes
?.length > 0
?.length
"
:link-events="moduleReferenceEvent.moduleReferenceContractLinkEvents!.nodes"
:page-info="moduleReferenceEvent.moduleReferenceContractLinkEvents!.pageInfo"
Expand All @@ -74,9 +69,7 @@
<template #content>
<ModuleDetailsRejectEvents
v-if="
moduleReferenceEvent.moduleReferenceRejectEvents?.nodes?.length &&
moduleReferenceEvent.moduleReferenceRejectEvents?.nodes?.length >
0
moduleReferenceEvent.moduleReferenceRejectEvents?.nodes?.length
"
:module-reject-events="moduleReferenceEvent.moduleReferenceRejectEvents!.nodes"
:page-info="moduleReferenceEvent.moduleReferenceRejectEvents!.pageInfo"
Expand Down
31 changes: 13 additions & 18 deletions frontend/src/components/Search/Search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
Age
<Tooltip
:text="formatTimestamp(block.blockSlotTime)"
:position="index === 0 ? tooltipPositionBottom : ''"
:position="getTooltipPosition(index)"
>
{{
convertTimestampToRelative(block.blockSlotTime || '', NOW)
Expand Down Expand Up @@ -99,9 +99,7 @@
Age
<Tooltip
:text="formatTimestamp(transaction.block.blockSlotTime)"
:position="
index === 0 ? tooltipPositionBottom : tooltipPositionTop
"
:position="getTooltipPosition(index)"
>
{{
convertTimestampToRelative(
Expand Down Expand Up @@ -134,7 +132,7 @@
Age
<Tooltip
:text="formatTimestamp(account.createdAt)"
:position="index === 0 ? tooltipPositionBottom : ''"
:position="getTooltipPosition(index)"
>
{{ convertTimestampToRelative(account.createdAt || '', NOW) }}
</Tooltip>
Expand Down Expand Up @@ -164,14 +162,9 @@
Age
<Tooltip
:text="formatTimestamp(contract.blockSlotTime)"
:position="index === 0 ? tooltipPositionBottom : ''"
:position="getTooltipPosition(index)"
>
{{
convertTimestampToRelative(
contract.blockSlotTime || '',
NOW
)
}}
{{ convertTimestampToRelative(contract.blockSlotTime, NOW) }}
</Tooltip>
</div>
</div>
Expand All @@ -195,11 +188,9 @@
Age
<Tooltip
:text="formatTimestamp(module.blockSlotTime)"
:position="index === 0 ? tooltipPositionBottom : ''"
:position="getTooltipPosition(index)"
>
{{
convertTimestampToRelative(module.blockSlotTime || '', NOW)
}}
{{ convertTimestampToRelative(module.blockSlotTime, NOW) }}
</Tooltip>
</div>
</div>
Expand Down Expand Up @@ -320,7 +311,7 @@ const gotoSearchResult = () => {
else if (data.value.search.modules.nodes[0])
drawer.push({
entityTypeName: 'module',
hash: data.value.search.modules.nodes[0].moduleReference,
moduleReference: data.value.search.modules.nodes[0].moduleReference,
})
else if (data.value.search.blocks.nodes[0])
drawer.push({
Expand Down Expand Up @@ -366,6 +357,10 @@ const lostFocusOnSearch = (x: FocusEvent) => {
}, 100)
}
const getTooltipPosition = (index: number) => {
return index === 0 ? tooltipPositionBottom : tooltipPositionTop
}
const resultCount = computed(() => ({
modules: data.value?.search.modules.nodes.length,
contracts: data.value?.search.contracts.nodes.length,
Expand All @@ -381,7 +376,7 @@ const resultCount = computed(() => ({
(data.value?.search.accounts.nodes.length ?? 0) +
(data.value?.search.bakers.nodes.length ?? 0) +
(data.value?.search.nodeStatuses.nodes.length ?? 0) +
(data.value?.search.modules.nodes.length ?? 0),
(data.value?.search.modules?.nodes.length ?? 0),
}))
</script>

Expand Down

0 comments on commit 67a8098

Please sign in to comment.