Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: search by asset #2765

Merged
merged 27 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
db3348c
begin layout and clean some things
shawnyama Jan 31, 2024
53972ed
endpoint
shawnyama Feb 16, 2024
f50c0e3
s
shawnyama Feb 16, 2024
0ee6dc5
Merge branch 'main' into new-search-api
shawnyama Feb 16, 2024
a9bebb1
Merge branch 'main' into new-search-api
shawnyama Feb 20, 2024
a04bb11
get res
shawnyama Feb 20, 2024
cb99942
Merge branch 'data-explorer-revamp' into new-search-api
shawnyama Feb 20, 2024
ec86022
gap
shawnyama Feb 20, 2024
c7f97f0
Merge branch 'main' into new-search-api
shawnyama Feb 20, 2024
f635a90
show models properly
shawnyama Feb 21, 2024
5c11bd3
Merge branch 'main' into new-search-api
shawnyama Feb 21, 2024
048d939
avoid interference with old search
shawnyama Feb 21, 2024
cb7d576
Merge branch 'main' into new-search-api
shawnyama Feb 21, 2024
794460f
Merge branch 'main' into new-search-api
shawnyama Feb 21, 2024
2eacfad
Merge branch 'main' into new-search-api
shawnyama Feb 21, 2024
76fd282
better search name
shawnyama Feb 21, 2024
0fcd6f3
Merge branch 'new-search-api' of https://github.com/DARPA-ASKEM/terar…
shawnyama Feb 21, 2024
87717bf
s
shawnyama Feb 21, 2024
3d93861
Update packages/client/hmi-client/src/page/data-explorer/components/t…
shawnyama Feb 21, 2024
be4fa3e
Update packages/client/hmi-client/src/page/data-explorer/components/t…
shawnyama Feb 21, 2024
991805d
Update packages/client/hmi-client/src/page/data-explorer/DataExplorer…
shawnyama Feb 21, 2024
1a4a734
Update packages/client/hmi-client/src/components/navbar/tera-searchba…
shawnyama Feb 21, 2024
2554961
Update packages/client/hmi-client/src/components/navbar/tera-searchba…
shawnyama Feb 21, 2024
68a6910
Merge branch 'main' into new-search-api
shawnyama Feb 21, 2024
f5407c9
try catch
shawnyama Feb 21, 2024
727e0f8
return type
shawnyama Feb 21, 2024
a9f6a1c
param for now
shawnyama Feb 21, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions packages/client/hmi-client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<Toast position="top-right" group="info" />
<Toast position="top-right" group="success" />
<header>
<tera-navbar :active="displayNavBar" :show-suggestions="showSuggestions" />
<tera-navbar :active="displayNavBar" />
</header>
<main>
<router-view v-slot="{ Component }">
<component class="page" ref="pageRef" :is="Component" />
<component class="page" :is="Component" />
</router-view>
</main>
<footer>
Expand All @@ -19,15 +19,14 @@
</template>

<script setup lang="ts">
import { computed, onMounted, ref, watch } from 'vue';
import { computed, onMounted, watch } from 'vue';
import Toast from 'primevue/toast';

import { ToastSummaries, ToastSeverity, useToastService } from '@/services/toast';
import { useRoute, useRouter } from 'vue-router';
import API from '@/api/api';
import TeraNavbar from '@/components/navbar/tera-navbar.vue';
import TeraFooter from '@/components/navbar/tera-footer.vue';
import { ResourceType } from '@/types/common';
import { useProjects } from '@/composables/project';
import { Project } from '@/types/Types';
import TeraCommonModalDialogs from './components/widgets/tera-common-modal-dialogs.vue';
Expand All @@ -44,16 +43,6 @@ const currentRoute = useCurrentRoute();

const displayNavBar = computed(() => currentRoute.value.name !== 'unauthorized');

// This pageRef is used to grab the assetType being searched for in data-explorer.vue, it is accessed using defineExpose
const pageRef = ref();
// For navbar.vue -> search-bar.vue
// Later the asset type searched for in the data explorer should be in the route,
// so we won't have to pass this from here
const showSuggestions = computed(() => {
const assetType = pageRef.value?.resourceType ?? ResourceType.XDD;
return assetType === ResourceType.XDD;
});

/**
* Project
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
<section class="search-bar-container">
<div class="search">
<span class="p-input-icon-left p-input-icon-right">
<i class="pi pi-search" />
<vue-feather type="message-square" size="1.25rem" stroke="var(--text-color-subdued)" />
<AutoComplete
ref="searchBarRef"
:active="searchBarRef?.overlayVisible"
v-model="query"
:suggestions="autocompleteMenuItems"
placeholder="Search"
:placeholder="placeholder ?? 'Search'"
:autoOptionFocus="false"
:minLength="3"
scrollHeight="400px"
Expand All @@ -28,13 +28,16 @@
</template>
</AutoComplete>
<i class="pi pi-times clear-search" :class="{ hidden: !query }" @click="clearQuery" />
<!-- <Button
class="search-by-example-button"
icon="pi pi-upload"
text
rounded
size="small"
@click="searchByExampleToggle = !searchByExampleToggle"
:active="isSearchByExampleVisible"
/> -->
shawnyama marked this conversation as resolved.
Show resolved Hide resolved
</span>
<Button
class="p-button-icon-only p-button-text p-button-rounded p-button-icon-only-small search-by-example-button"
icon="pi pi-upload"
@click="searchByExampleToggle = !searchByExampleToggle"
:active="isSearchByExampleVisible"
/>
</div>
<section v-if="isSearchByExampleVisible" class="search-by-example">
<header>
Expand Down Expand Up @@ -137,6 +140,7 @@ import { useProjects } from '@/composables/project';

const props = defineProps<{
showSuggestions: boolean;
placeholder?: string;
}>();

const emit = defineEmits(['query-changed']);
Expand Down Expand Up @@ -263,7 +267,6 @@ watch(
display: flex;
align-items: center;
flex-direction: column;
max-width: 50%;
overflow: hidden;
}

Expand All @@ -280,8 +283,9 @@ watch(
}

.p-autocomplete:deep(.p-inputtext) {
border-radius: 1.5rem;
width: 100%;
border-radius: var(--border-radius-medium);
background: rgba(216, 234, 227, 0.3);
}

.p-autocomplete:deep(.p-inputtext:focus) {
Expand All @@ -291,8 +295,9 @@ watch(
.p-autocomplete:deep(.p-inputtext),
.p-autocomplete:deep(.p-inputtext:hover),
.p-autocomplete:deep(.p-inputtext:focus) {
border: 1px solid var(--surface-border);
padding-left: 3rem;
/**TODO: Make this a gradient border like the design #cae8c0*/
border: 4px solid var(--primary-color);
padding-left: 2.5rem;
}

.p-autocomplete[active='true']:deep(.p-inputtext) {
Expand All @@ -308,12 +313,12 @@ watch(
}

.p-input-icon-left {
margin-right: 1rem;
flex: 1;
}

i {
color: var(--text-color-subdued);
margin-left: 0.5rem;
shawnyama marked this conversation as resolved.
Show resolved Hide resolved
z-index: 1;
}

Expand All @@ -322,10 +327,6 @@ i {
width: 100%;
}

.pi-search {
margin-right: 1rem;
}

.pi-arrow-right {
margin-left: auto;
}
Expand Down Expand Up @@ -437,14 +438,9 @@ i {
margin-bottom: 0rem;
}

.p-button.search-by-example-button {
right: 4rem;
}

.p-button[active='false'].search-by-example-button,
.p-button[active='false'].search-by-example-button:focus,
.p-button[active='false'].search-by-example-button:enabled {
background-color: var(--surface-section);
border-radius: var(--border-radius-bigger);
color: var(--text-color-subdued);
}
Expand Down
Loading
Loading