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

Use icons with deployment selection details #2535

Merged
merged 2 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="deployment-control" v-on="{ click: onSelectDeployment }">
<QuickPickItem
:label="deploymentTitle"
:details="deploymentSubTitles"
:details="deploymentDetails"
:title="toolTipText"
:data-automation="`entrypoint-label`"
/>
Expand Down Expand Up @@ -241,7 +241,7 @@ import { filterConfigurationsToValidAndType } from "../../../../src/utils/filter
import { useHostConduitService } from "src/HostConduitService";
import { useHomeStore } from "src/stores/home";

import QuickPickItem from "src/components/QuickPickItem.vue";
import QuickPickItem, { IconDetail } from "src/components/QuickPickItem.vue";
import ActionToolbar from "src/components/ActionToolbar.vue";
import DeployButton from "src/components/DeployButton.vue";
import TextStringWithAnchor from "./TextStringWithAnchor.vue";
Expand Down Expand Up @@ -343,13 +343,13 @@ const deploymentTitle = computed(() => {
return result.title;
});

const deploymentSubTitles = computed(() => {
const subTitles: string[] = [];
subTitles.push(credentialSubTitle.value);
const deploymentDetails = computed(() => {
const details: IconDetail[] = [];
details.push({ icon: "codicon-server", text: credentialSubTitle.value });
if (entrypointSubTitle.value) {
subTitles.push(entrypointSubTitle.value);
details.push({ icon: "codicon-file", text: entrypointSubTitle.value });
}
return subTitles;
return details;
});

const credentialSubTitle = computed(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,25 @@
</div>
</div>
<div v-for="detail in details" class="quick-pick-row">
<span class="quick-pick-detail">{{ detail }}</span>
<div v-if="isIconDetail(detail)" class="quick-pick-detail">
<div class="quick-pick-icon codicon" :class="detail.icon" />
<span>{{ detail.text }}</span>
</div>
<span v-else class="quick-pick-detail">{{ detail }}</span>
</div>
</div>
</template>

<script setup lang="ts">
export type IconDetail = { icon: string; text: string };

const isIconDetail = (detail: string | IconDetail): detail is IconDetail =>
typeof detail === "object" && "icon" in detail && "text" in detail;

defineProps<{
label: string;
description?: string;
details: string[];
details: Array<string | IconDetail>;
codicon?: string;
}>();
</script>
Expand All @@ -42,11 +51,17 @@ defineProps<{
.quick-pick-label-container {
.quick-pick-label {
font-weight: 600;
padding-bottom: 4px;
margin-bottom: 4px;
}
}
}

&:not(:last-child) {
.quick-pick-detail {
margin-bottom: 2px;
}
}

.quick-pick-icon {
vertical-align: text-bottom;
padding-right: 6px;
Expand Down Expand Up @@ -85,6 +100,10 @@ defineProps<{
overflow: hidden;
text-overflow: ellipsis;
white-space: pre;

.quick-pick-icon {
font-size: var(--vscode-font-size);
}
}
}
}
Expand Down
Loading