Skip to content
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
32 changes: 32 additions & 0 deletions dashboard/src/components/provider/ProviderSourcesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@
</v-select>
</div>

<v-btn
v-if="canDeleteSelectedSource"
class="provider-sources-mobile-delete"
icon="mdi-delete-outline"
variant="text"
size="small"
color="error"
:aria-label="tm('providerSources.delete')"
:title="tm('providerSources.delete')"
@click.stop="deleteSelectedSource"
></v-btn>
Comment thread
letr007 marked this conversation as resolved.

<StyledMenu>
<template #activator="{ props }">
<v-btn
Expand Down Expand Up @@ -130,6 +142,8 @@
icon="mdi-delete-outline"
variant="text"
size="small"
:aria-label="tm('providerSources.delete')"
:title="tm('providerSources.delete')"
@click.stop="emitDeleteSource(source)"
></v-btn>
</div>
Expand Down Expand Up @@ -181,6 +195,9 @@ const emit = defineEmits([
])

const selectedId = computed(() => props.selectedProviderSource?.id || null)
const canDeleteSelectedSource = computed(() =>
Boolean(props.selectedProviderSource && !props.selectedProviderSource.isPlaceholder)
)
Comment thread
letr007 marked this conversation as resolved.

const isActive = (source) => {
if (source.isPlaceholder) return false
Expand Down Expand Up @@ -211,6 +228,12 @@ const emitAddSource = (type) => emit('add-provider-source', type)
const emitSelectSource = (source) => emit('select-provider-source', source)
const emitDeleteSource = (source) => emit('delete-provider-source', source)

const deleteSelectedSource = () => {
if (canDeleteSelectedSource.value) {
emitDeleteSource(props.selectedProviderSource)
}
}

const selectSourceByValue = (value) => {
const option = sourceOptions.value.find((item) => item.value === value)
if (option?.source) {
Expand Down Expand Up @@ -263,6 +286,11 @@ const selectSourceByValue = (value) => {
flex: 1;
}

.provider-sources-mobile-delete {
display: none;
flex-shrink: 0;
}

.provider-source-select-value {
min-width: 0;
display: inline-flex;
Expand Down Expand Up @@ -375,6 +403,10 @@ const selectSourceByValue = (value) => {
display: block;
}

.provider-sources-mobile-delete {
display: inline-flex;
}

.provider-sources-controls {
width: 100%;
}
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/i18n/locales/en-US/features/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"providerSources": {
"title": "Provider Sources",
"add": "Add",
"delete": "Delete provider source",
"empty": "No provider sources",
"selectHint": "Please select a provider source",
"selectCreated": "Select created provider source",
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/i18n/locales/ru-RU/features/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"providerSources": {
"title": "Источник провайдера",
"add": "Добавить",
"delete": "Удалить источник провайдера",
"empty": "Источники не найдены",
"selectHint": "Пожалуйста, выберите источник провайдера",
"selectCreated": "Выбрать существующий источник",
Expand Down
1 change: 1 addition & 0 deletions dashboard/src/i18n/locales/zh-CN/features/provider.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
"providerSources": {
"title": "提供商源",
"add": "新增",
"delete": "删除提供商源",
"empty": "暂无提供商源",
"selectHint": "请选择一个提供商源",
"selectCreated": "选择已创建的提供商源",
Expand Down
Loading