mirror of
https://github.com/HangarMC/Hangar.git
synced 2025-03-13 15:39:18 +08:00
Fixes to channel modal
This commit is contained in:
parent
dd49201756
commit
8c956ece9c
@ -27,8 +27,8 @@ const ctx = useContext();
|
||||
const validation = reactive({
|
||||
nameErrors: [] as string[],
|
||||
colorErrors: [] as string[],
|
||||
nameValid: false,
|
||||
colorValid: false,
|
||||
nameValid: props.edit,
|
||||
colorValid: props.edit,
|
||||
});
|
||||
const form = reactive<ProjectChannel>({
|
||||
name: "",
|
||||
@ -62,9 +62,22 @@ const isValid = computed(() => {
|
||||
watch(name, (newVal) => checkName(newVal));
|
||||
watch(color, (newVal) => checkColor(newVal));
|
||||
|
||||
let lastNameEdit = -1;
|
||||
function checkName(name: string) {
|
||||
validation.nameValid = false;
|
||||
validation.nameErrors = [];
|
||||
|
||||
// Don't immediately/constantly spam checks
|
||||
const now = Date.now();
|
||||
lastNameEdit = now;
|
||||
setTimeout(() => {
|
||||
if (lastNameEdit === now) {
|
||||
checkName0(name);
|
||||
}
|
||||
}, 250);
|
||||
}
|
||||
|
||||
function checkName0(name: string) {
|
||||
if (name.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ function getNonChannelTags(version: Version): ApiTag[] {
|
||||
<div class="inline-flex w-full flex-cols space-between">
|
||||
<InputCheckbox v-model="filter.allChecked.channels" class="flex-right" @change="checkAllChannels" />
|
||||
<span class="flex-grow">{{ i18n.t("version.channels") }}</span>
|
||||
<Link :to="`/${project.owner.name}/${project.name}/channels`">
|
||||
<Link v-if="hasPerms(NamedPermission.EDIT_TAGS)" :to="`/${project.owner.name}/${project.name}/channels`">
|
||||
<Button size="small" class="ml-2 text-sm"> <IconMdiPencil /> </Button
|
||||
></Link>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user