refactor(sh-admin): improved handling of server configurations in admin dashboard (#3971)
Co-authored-by: jamesgeorge007 <jamesgeorge998001@gmail.com>
This commit is contained in:
committed by
GitHub
parent
eecc3db4e9
commit
94248076e6
@@ -69,18 +69,18 @@
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { reactive } from 'vue';
|
||||
import { useI18n } from '~/composables/i18n';
|
||||
import { Config, SsoAuthProviders } from '~/composables/useConfigHandler';
|
||||
import { ServerConfigs, SsoAuthProviders } from '~/helpers/configs';
|
||||
import IconEye from '~icons/lucide/eye';
|
||||
import IconEyeOff from '~icons/lucide/eye-off';
|
||||
|
||||
const t = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
config: Config;
|
||||
config: ServerConfigs;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:config', v: Config): void;
|
||||
(e: 'update:config', v: ServerConfigs): void;
|
||||
}>();
|
||||
|
||||
const workingConfigs = useVModel(props, 'config', emit);
|
||||
@@ -93,7 +93,7 @@ const capitalize = (text: string) =>
|
||||
type ProviderFieldKeys = keyof ProviderFields;
|
||||
|
||||
type ProviderFields = {
|
||||
[Field in keyof Config['providers'][SsoAuthProviders]['fields']]: boolean;
|
||||
[Field in keyof ServerConfigs['providers'][SsoAuthProviders]['fields']]: boolean;
|
||||
} & Partial<{ tenant: boolean }>;
|
||||
|
||||
type ProviderFieldMetadata = {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { Config } from '~/composables/useConfigHandler';
|
||||
import { ServerConfigs } from '~/helpers/configs';
|
||||
|
||||
const props = defineProps<{
|
||||
config: Config;
|
||||
config: ServerConfigs;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:config', v: Config): void;
|
||||
(e: 'update:config', v: ServerConfigs): void;
|
||||
}>();
|
||||
|
||||
const workingConfigs = useVModel(props, 'config', emit);
|
||||
|
||||
@@ -38,17 +38,17 @@
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { computed } from 'vue';
|
||||
import { useI18n } from '~/composables/i18n';
|
||||
import { Config } from '~/composables/useConfigHandler';
|
||||
import { ServerConfigs } from '~/helpers/configs';
|
||||
import IconShieldQuestion from '~icons/lucide/shield-question';
|
||||
|
||||
const t = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
config: Config;
|
||||
config: ServerConfigs;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:config', v: Config): void;
|
||||
(e: 'update:config', v: ServerConfigs): void;
|
||||
}>();
|
||||
|
||||
const workingConfigs = useVModel(props, 'config', emit);
|
||||
|
||||
@@ -17,20 +17,21 @@ import { useMutation } from '@urql/vue';
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useI18n } from '~/composables/i18n';
|
||||
import { useToast } from '~/composables/toast';
|
||||
import { Config, useConfigHandler } from '~/composables/useConfigHandler';
|
||||
import { useConfigHandler } from '~/composables/useConfigHandler';
|
||||
import {
|
||||
EnableAndDisableSsoDocument,
|
||||
ResetInfraConfigsDocument,
|
||||
UpdateInfraConfigsDocument,
|
||||
ToggleAnalyticsCollectionDocument,
|
||||
UpdateInfraConfigsDocument,
|
||||
} from '~/helpers/backend/graphql';
|
||||
import { ServerConfigs } from '~/helpers/configs';
|
||||
|
||||
const t = useI18n();
|
||||
const toast = useToast();
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
workingConfigs?: Config;
|
||||
workingConfigs?: ServerConfigs;
|
||||
reset?: boolean;
|
||||
}>(),
|
||||
{
|
||||
|
||||
@@ -58,18 +58,18 @@
|
||||
import { useVModel } from '@vueuse/core';
|
||||
import { computed, reactive } from 'vue';
|
||||
import { useI18n } from '~/composables/i18n';
|
||||
import { Config } from '~/composables/useConfigHandler';
|
||||
import { ServerConfigs } from '~/helpers/configs';
|
||||
import IconEye from '~icons/lucide/eye';
|
||||
import IconEyeOff from '~icons/lucide/eye-off';
|
||||
|
||||
const t = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
config: Config;
|
||||
config: ServerConfigs;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits<{
|
||||
(e: 'update:config', v: Config): void;
|
||||
(e: 'update:config', v: ServerConfigs): void;
|
||||
}>();
|
||||
|
||||
const workingConfigs = useVModel(props, 'config', emit);
|
||||
@@ -87,7 +87,7 @@ const smtpConfigs = computed({
|
||||
// Mask sensitive fields
|
||||
type Field = {
|
||||
name: string;
|
||||
key: keyof Config['mailConfigs']['fields'];
|
||||
key: keyof ServerConfigs['mailConfigs']['fields'];
|
||||
};
|
||||
|
||||
const smtpConfigFields = reactive<Field[]>([
|
||||
@@ -100,10 +100,10 @@ const maskState = reactive<Record<string, boolean>>({
|
||||
mailer_from_address: true,
|
||||
});
|
||||
|
||||
const toggleMask = (fieldKey: keyof Config['mailConfigs']['fields']) => {
|
||||
const toggleMask = (fieldKey: keyof ServerConfigs['mailConfigs']['fields']) => {
|
||||
maskState[fieldKey] = !maskState[fieldKey];
|
||||
};
|
||||
|
||||
const isMasked = (fieldKey: keyof Config['mailConfigs']['fields']) =>
|
||||
const isMasked = (fieldKey: keyof ServerConfigs['mailConfigs']['fields']) =>
|
||||
maskState[fieldKey];
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user