2024-01-03 01:36:56 +01:00
|
|
|
<template>
|
2024-02-11 23:48:16 +01:00
|
|
|
<div class="min-h-40">
|
|
|
|
<table v-if="providers.length" id="providers">
|
|
|
|
<tr>
|
|
|
|
<th>{{ $strings.LabelName }}</th>
|
|
|
|
<th>URL</th>
|
|
|
|
<th>Authorization Header Value</th>
|
|
|
|
<th class="w-12"></th>
|
|
|
|
</tr>
|
|
|
|
<tr v-for="provider in providers" :key="provider.id">
|
|
|
|
<td class="text-sm">{{ provider.name }}</td>
|
|
|
|
<td class="text-sm">{{ provider.url }}</td>
|
|
|
|
<td class="text-sm">
|
|
|
|
<span v-if="provider.authHeaderValue" class="custom-provider-api-key">{{ provider.authHeaderValue }}</span>
|
|
|
|
</td>
|
|
|
|
<td class="py-0">
|
|
|
|
<div class="h-8 w-8 flex items-center justify-center text-white text-opacity-50 hover:text-error cursor-pointer" @click.stop="removeProvider(provider)">
|
2024-07-08 18:36:37 +02:00
|
|
|
<button type="button" :aria-label="$strings.ButtonDelete" class="material-symbols text-base">delete</button>
|
2024-02-11 23:48:16 +01:00
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<div v-else-if="!processing" class="text-center py-8">
|
2024-05-31 00:03:33 +02:00
|
|
|
<p class="text-lg">{{ $strings.LabelNoCustomMetadataProviders }}</p>
|
2024-02-11 23:48:16 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="processing" class="absolute inset-0 h-full flex items-center justify-center bg-black/40 rounded-md">
|
|
|
|
<ui-loading-indicator />
|
2024-01-03 01:36:56 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
2024-02-11 23:48:16 +01:00
|
|
|
props: {
|
|
|
|
providers: {
|
|
|
|
type: Array,
|
|
|
|
default: () => []
|
|
|
|
},
|
|
|
|
processing: Boolean
|
|
|
|
},
|
2024-01-03 01:36:56 +01:00
|
|
|
data() {
|
2024-02-11 23:48:16 +01:00
|
|
|
return {}
|
2024-01-03 01:36:56 +01:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
removeProvider(provider) {
|
2024-02-11 23:48:16 +01:00
|
|
|
const payload = {
|
2024-08-31 00:47:49 +02:00
|
|
|
message: this.$getString('MessageConfirmDeleteMetadataProvider', [provider.name]),
|
2024-02-11 23:48:16 +01:00
|
|
|
callback: (confirmed) => {
|
|
|
|
if (confirmed) {
|
|
|
|
this.$emit('update:processing', true)
|
2024-01-03 01:36:56 +01:00
|
|
|
|
2024-02-11 23:48:16 +01:00
|
|
|
this.$axios
|
|
|
|
.$delete(`/api/custom-metadata-providers/${provider.id}`)
|
|
|
|
.then(() => {
|
2024-08-31 00:47:49 +02:00
|
|
|
this.$toast.success(this.$strings.ToastProviderRemoveSuccess)
|
2024-02-11 23:48:16 +01:00
|
|
|
this.$emit('removed', provider.id)
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Failed to remove provider', error)
|
2024-08-31 00:47:49 +02:00
|
|
|
this.$toast.error(this.$strings.ToastRemoveFailed)
|
2024-02-11 23:48:16 +01:00
|
|
|
})
|
|
|
|
.finally(() => {
|
|
|
|
this.$emit('update:processing', false)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
|
|
|
type: 'yesNo'
|
|
|
|
}
|
|
|
|
this.$store.commit('globals/setConfirmPrompt', payload)
|
2024-01-03 01:36:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#providers {
|
|
|
|
table-layout: fixed;
|
|
|
|
border-collapse: collapse;
|
|
|
|
border: 1px solid #474747;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
#providers td,
|
|
|
|
#providers th {
|
|
|
|
/* border: 1px solid #2e2e2e; */
|
|
|
|
padding: 8px 8px;
|
|
|
|
text-align: left;
|
|
|
|
}
|
|
|
|
|
|
|
|
#providers td.py-0 {
|
|
|
|
padding: 0px 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#providers tr:nth-child(even) {
|
|
|
|
background-color: #373838;
|
|
|
|
}
|
|
|
|
|
|
|
|
#providers tr:nth-child(odd) {
|
|
|
|
background-color: #2f2f2f;
|
|
|
|
}
|
|
|
|
|
|
|
|
#providers tr:hover {
|
|
|
|
background-color: #444;
|
|
|
|
}
|
|
|
|
|
|
|
|
#providers th {
|
|
|
|
font-size: 0.8rem;
|
|
|
|
font-weight: 600;
|
|
|
|
padding-top: 5px;
|
|
|
|
padding-bottom: 5px;
|
|
|
|
background-color: #272727;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-provider-api-key {
|
|
|
|
padding: 1px;
|
|
|
|
background-color: #272727;
|
|
|
|
border-radius: 4px;
|
|
|
|
color: transparent;
|
|
|
|
transition: color, background-color 0.5s ease;
|
|
|
|
}
|
|
|
|
|
|
|
|
.custom-provider-api-key:hover {
|
|
|
|
background-color: transparent;
|
|
|
|
color: white;
|
|
|
|
}
|
|
|
|
</style>
|