added template not usable

This commit is contained in:
AndzejsP 2023-05-30 17:33:06 +03:00
parent 6e17cfaf0b
commit 17184cc7ea
2 changed files with 59 additions and 38 deletions

View File

@ -2,50 +2,52 @@
<div class=" items-start p-4 hover:bg-primary-light rounded-lg mb-2 shadow-lg border-2 cursor-pointer"
@click.stop="toggleSelected" :class="selected ? ' border-primary-light' : 'border-transparent'">
<div class="flex flex-row items-center flex-shrink-0 gap-3">
<img :src="getImgUrl()" @error="defaultImg($event)" class="w-10 h-10 rounded-full object-fill text-red-700">
<h3 class="font-bold font-large text-lg line-clamp-3">
{{ binding.name }}
</h3>
<div :class="isTemplate ? 'opacity-50' : ''">
</div>
<div class="">
<div class="flex flex-row items-center flex-shrink-0 gap-3">
<img :src="getImgUrl()" @error="defaultImg($event)" class="w-10 h-10 rounded-full object-fill text-red-700">
<h3 class="font-bold font-large text-lg line-clamp-3">
{{ binding.name }}
</h3>
</div>
<div class="">
<div class="">
<div class="flex items-center">
<i data-feather="user" class="w-5 m-1"></i>
<b>Author:&nbsp;</b>
<div class="flex items-center">
<i data-feather="user" class="w-5 m-1"></i>
<b>Author:&nbsp;</b>
{{ binding.author }}
{{ binding.author }}
</div>
<div class="flex items-center">
<i data-feather="folder" class="w-5 m-1"></i>
<b>Folder:&nbsp;</b>
{{ binding.folder }}
</div>
<div class="flex items-center">
<i data-feather="git-merge" class="w-5 m-1"></i>
<b>Version:&nbsp;</b>
{{ binding.version }}
</div>
<a :href="binding.link" target="_blank" class="flex items-center">
<i data-feather="github" class="w-5 m-1"></i>
<b>Link:&nbsp;</b>
{{ binding.link }}
</a>
</div>
<div class="flex items-center">
<i data-feather="folder" class="w-5 m-1"></i>
<b>Folder:&nbsp;</b>
<i data-feather="info" class="w-5 m-1"></i>
<b>Description:&nbsp;</b><br>
</div>
<p class="mx-1 opacity-80 line-clamp-3" :title="binding.description">{{ binding.description }}</p>
{{ binding.folder }}
</div>
<div class="flex items-center">
<i data-feather="git-merge" class="w-5 m-1"></i>
<b>Version:&nbsp;</b>
{{ binding.version }}
</div>
<a :href="binding.link" target="_blank" class="flex items-center">
<i data-feather="github" class="w-5 m-1"></i>
<b>Link:&nbsp;</b>
{{ binding.link }}
</a>
</div>
<div class="flex items-center">
<i data-feather="info" class="w-5 m-1"></i>
<b>Description:&nbsp;</b><br>
</div>
<p class="mx-1 opacity-80 line-clamp-3" :title="binding.description">{{ binding.description }}</p>
</div>
</div>
</template>
@ -59,11 +61,12 @@ export default {
props: {
binding: {},
onSelected: Function,
selected: Boolean
selected: Boolean,
},
data() {
return {
isTemplate: false
};
},
mounted() {
@ -72,6 +75,10 @@ export default {
})
this.getStatus()
},
methods: {
getImgUrl() {
@ -83,7 +90,15 @@ export default {
toggleSelected() {
this.onSelected(this)
},
getStatus() {
if (this.binding.folder === 'backend_template' || this.binding.folder === 'binding_template') {
this.isTemplate = true
}
}
},
}
};
</script>

View File

@ -771,6 +771,12 @@ export default {
socket.emit('uninstall_model', { path: model_object.path });
},
onSelectedBinding(binding_object) {
if(binding_object.binding.folder ==='backend_template' || binding_object.binding.folder==='binding_template'){
this.$refs.toast.showToast("Cannot select template", 4, false)
return
}
this.update_binding(binding_object.binding.folder)
//console.log('lol',binding_object)
},
@ -951,7 +957,7 @@ export default {
const res = await axios.get("/" + endpoint);
if (res) {
return res.data
}