make account samba work again
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
gitea/salix-front/pipeline/pr-dev This commit looks good
Details
This commit is contained in:
parent
1e67a0feca
commit
fa4a18fbbb
|
@ -43,7 +43,7 @@ const hasData = computed({
|
||||||
|
|
||||||
const initialDataLoaded = ref(false);
|
const initialDataLoaded = ref(false);
|
||||||
const formUrlCreate = ref(null);
|
const formUrlCreate = ref(null);
|
||||||
const formUrlUpdate = ref(`LdapConfigs/${1}`);
|
const formUrlUpdate = ref(null);
|
||||||
const formCustomFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
|
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
|
|
|
@ -7,13 +7,20 @@ import VnRow from 'components/ui/VnRow.vue';
|
||||||
import VnInput from 'src/components/common/VnInput.vue';
|
import VnInput from 'src/components/common/VnInput.vue';
|
||||||
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
import VnSubToolbar from 'src/components/ui/VnSubToolbar.vue';
|
||||||
|
|
||||||
|
import { useArrayData } from 'src/composables/useArrayData';
|
||||||
import useNotify from 'src/composables/useNotify.js';
|
import useNotify from 'src/composables/useNotify.js';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
const { t } = useI18n();
|
const { t } = useI18n();
|
||||||
const { notify } = useNotify();
|
const { notify } = useNotify();
|
||||||
|
|
||||||
|
const arrayData = useArrayData('AccountSamba');
|
||||||
|
|
||||||
const formModel = ref(null);
|
const formModel = ref(null);
|
||||||
|
|
||||||
|
const URL_UPDATE = `SambaConfigs/${1}`;
|
||||||
|
const URL_CREATE = `SambaConfigs`;
|
||||||
|
|
||||||
const DEFAULT_DATA = {
|
const DEFAULT_DATA = {
|
||||||
id: 1,
|
id: 1,
|
||||||
hasData: false,
|
hasData: false,
|
||||||
|
@ -33,15 +40,15 @@ const hasData = computed({
|
||||||
get: () => initialData.value.hasData,
|
get: () => initialData.value.hasData,
|
||||||
set: (val) => {
|
set: (val) => {
|
||||||
initialData.value.hasData = val;
|
initialData.value.hasData = val;
|
||||||
if (!val) customFn.value = deleteMailForward;
|
if (!val) formCustomFn.value = deleteMailForward;
|
||||||
else customFn.value = null;
|
else formCustomFn.value = null;
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const initialDataLoaded = ref(false);
|
const initialDataLoaded = ref(false);
|
||||||
const urlCreate = ref(null);
|
const formUrlCreate = ref(null);
|
||||||
const urlUpdate = ref(`SambaConfigs/${1}`);
|
const formUrlUpdate = ref(null);
|
||||||
const customFn = ref(null);
|
const formCustomFn = ref(null);
|
||||||
|
|
||||||
const onTestConection = async () => {
|
const onTestConection = async () => {
|
||||||
try {
|
try {
|
||||||
|
@ -52,22 +59,25 @@ const onTestConection = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const getInitialLdapConfig = async () => {
|
const getInitialSambaConfig = async () => {
|
||||||
try {
|
try {
|
||||||
initialDataLoaded.value = false;
|
initialDataLoaded.value = false;
|
||||||
const { data } = await axios.get(urlUpdate.value);
|
const { data } = await axios.get(URL_UPDATE);
|
||||||
initialData.value = data;
|
initialData.value = data;
|
||||||
hasData.value = true;
|
hasData.value = true;
|
||||||
return data;
|
return data;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
console.error('Error fetching initial LDAP config', error);
|
arrayData.destroy();
|
||||||
|
console.error('Error fetching initial Samba config', error);
|
||||||
return null;
|
return null;
|
||||||
} finally {
|
} finally {
|
||||||
if (hasData.value) urlCreate.value = null;
|
if (hasData.value) {
|
||||||
else {
|
formUrlUpdate.value = URL_UPDATE;
|
||||||
urlUpdate.value = null;
|
formUrlCreate.value = null;
|
||||||
urlCreate.value = `SambaConfigs`;
|
} else {
|
||||||
|
formUrlUpdate.value = null;
|
||||||
|
formUrlCreate.value = URL_CREATE;
|
||||||
}
|
}
|
||||||
initialDataLoaded.value = true;
|
initialDataLoaded.value = true;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +85,7 @@ const getInitialLdapConfig = async () => {
|
||||||
|
|
||||||
const deleteMailForward = async () => {
|
const deleteMailForward = async () => {
|
||||||
try {
|
try {
|
||||||
await axios.delete(urlUpdate.value);
|
await axios.delete(URL_UPDATE);
|
||||||
initialData.value = { ...DEFAULT_DATA };
|
initialData.value = { ...DEFAULT_DATA };
|
||||||
hasData.value = false;
|
hasData.value = false;
|
||||||
notify(t('globals.dataSaved'), 'positive');
|
notify(t('globals.dataSaved'), 'positive');
|
||||||
|
@ -84,7 +94,7 @@ const deleteMailForward = async () => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
onMounted(async () => await getInitialLdapConfig());
|
onMounted(async () => await getInitialSambaConfig());
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -95,22 +105,22 @@ onMounted(async () => await getInitialLdapConfig());
|
||||||
:key="initialDataLoaded"
|
:key="initialDataLoaded"
|
||||||
model="AccountSamba"
|
model="AccountSamba"
|
||||||
:form-initial-data="initialData"
|
:form-initial-data="initialData"
|
||||||
:url-create="urlCreate"
|
:url-create="formUrlCreate"
|
||||||
:url-update="urlUpdate"
|
:url-update="formUrlUpdate"
|
||||||
:save-fn="customFn"
|
:save-fn="formCustomFn"
|
||||||
auto-load
|
auto-load
|
||||||
@on-data-saved="getInitialLdapConfig()"
|
@on-data-saved="getInitialSambaConfig()"
|
||||||
>
|
>
|
||||||
<template #moreActions>
|
<template #moreActions>
|
||||||
<QBtn
|
<QBtn
|
||||||
class="q-ml-none"
|
class="q-ml-none"
|
||||||
color="primary"
|
color="primary"
|
||||||
:label="t('ldap.testConnection')"
|
:label="t('samba.testConnection')"
|
||||||
:disable="formModel.hasChanges"
|
:disable="formModel.hasChanges"
|
||||||
@click="onTestConection()"
|
@click="onTestConection()"
|
||||||
>
|
>
|
||||||
<QTooltip>
|
<QTooltip>
|
||||||
{{ t('ldap.testConnection') }}
|
{{ t('samba.testConnection') }}
|
||||||
</QTooltip>
|
</QTooltip>
|
||||||
</QBtn>
|
</QBtn>
|
||||||
</template>
|
</template>
|
||||||
|
@ -118,7 +128,7 @@ onMounted(async () => await getInitialLdapConfig());
|
||||||
<VnRow class="row q-gutter-md">
|
<VnRow class="row q-gutter-md">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<QCheckbox
|
<QCheckbox
|
||||||
:label="t('ldap.enableSync')"
|
:label="t('samba.enableSync')"
|
||||||
v-model="data.hasData"
|
v-model="data.hasData"
|
||||||
@update:model-value="($event) => (hasData = $event)"
|
@update:model-value="($event) => (hasData = $event)"
|
||||||
:toggle-indeterminate="false"
|
:toggle-indeterminate="false"
|
||||||
|
|
Loading…
Reference in New Issue