mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
refactor: use Record to type objects
This commit is contained in:
@ -113,7 +113,7 @@ const selectedGroup: Ref<string> = ref('manual');
|
||||
const selectedMethod: Ref<string> = ref('');
|
||||
const selectedValue: Ref<string> = ref('');
|
||||
const debounceTimeout: Ref<NodeJS.Timeout> = ref(null);
|
||||
const methodParams: Ref<{[key: string]: string}> = ref({});
|
||||
const methodParams: Ref<Record<string, string>> = ref({});
|
||||
const enumArray: Ref<string[]> = ref(null);
|
||||
|
||||
const fakerGroups = computed(() => {
|
||||
|
@ -73,7 +73,7 @@ const props = defineProps({
|
||||
const emit = defineEmits(['confirm', 'close']);
|
||||
|
||||
const firstInput: Ref<HTMLInputElement[]> = ref(null);
|
||||
const values: Ref<{[key: string]: string}> = ref({});
|
||||
const values: Ref<Record<string, string>> = ref({});
|
||||
|
||||
const inParameters = computed(() => {
|
||||
return props.localRoutine.parameters.filter(param => param.context === 'IN');
|
||||
|
@ -327,7 +327,7 @@ const tables: Ref<{
|
||||
}[]> = ref([]);
|
||||
const options: Ref<Partial<ExportOptions>> = ref({
|
||||
schema: selectedSchema.value,
|
||||
includes: {} as {[key: string]: boolean},
|
||||
includes: {} as Record<string, boolean>,
|
||||
outputFormat: 'sql' as 'sql' | 'sql.zip',
|
||||
sqlInsertAfter: 250,
|
||||
sqlInsertDivider: 'bytes' as 'bytes' | 'rows'
|
||||
|
@ -142,7 +142,7 @@ const { getSelected: selectedWorkspace } = storeToRefs(workspacesStore);
|
||||
const { trapRef } = useFocusTrap({ disableAutofocus: true });
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const localRow: Ref<{[key: string]: any}> = ref({});
|
||||
const localRow: Ref<Record<string, any>> = ref({});
|
||||
const fieldsToExclude = ref([]);
|
||||
const nInserts = ref(1);
|
||||
const isInserting = ref(false);
|
||||
@ -225,7 +225,7 @@ const insertRows = async () => {
|
||||
delete rowToInsert[key];
|
||||
});
|
||||
|
||||
const fieldTypes: {[key: string]: string} = {};
|
||||
const fieldTypes: Record<string, string> = {};
|
||||
props.fields.forEach(field => {
|
||||
fieldTypes[field.name] = field.type;
|
||||
});
|
||||
@ -290,7 +290,7 @@ onMounted(() => {
|
||||
}
|
||||
}, 50);
|
||||
|
||||
const rowObj: {[key: string]: unknown} = {};
|
||||
const rowObj: Record<string, unknown> = {};
|
||||
|
||||
if (!props.rowToDuplicate) {
|
||||
// Set default values
|
||||
|
@ -67,7 +67,7 @@ const props = defineProps({
|
||||
|
||||
const emit = defineEmits(['select-row', 'contextmenu', 'stop-refresh']);
|
||||
|
||||
const isInlineEditor: Ref<{[key: string]: boolean}> = ref({});
|
||||
const isInlineEditor: Ref<Record<string, boolean>> = ref({});
|
||||
const isInfoModal = ref(false);
|
||||
const editorMode = ref('sql');
|
||||
|
||||
|
@ -32,7 +32,7 @@ const { removeNotification } = notificationsStore;
|
||||
const { notifications } = storeToRefs(notificationsStore);
|
||||
const { notificationsTimeout } = storeToRefs(settingsStore);
|
||||
|
||||
const timeouts: Ref<{[key: string]: NodeJS.Timeout}> = ref({});
|
||||
const timeouts: Ref<Record<string, NodeJS.Timeout>> = ref({});
|
||||
|
||||
const latestNotifications = computed(() => notifications.value.slice(0, 10));
|
||||
|
||||
|
@ -695,7 +695,7 @@ const openAsPermanentTab = (tab: WorkspaceTab) => {
|
||||
routine: 'routine-props',
|
||||
procedure: 'routine-props',
|
||||
scheduler: 'scheduler-props'
|
||||
} as {[key: string]: string};
|
||||
} as Record<string, string>;
|
||||
|
||||
newTab({
|
||||
uid: props.connection.uid,
|
||||
|
@ -572,11 +572,11 @@ const pathSelection = (event: Event & {target: {files: {path: string}[]}}, name:
|
||||
const { files } = event.target;
|
||||
if (!files.length) return;
|
||||
|
||||
(connection.value as unknown as {[key: string]: string})[name] = files[0].path as string;
|
||||
(connection.value as unknown as Record<string, string>)[name] = files[0].path as string;
|
||||
};
|
||||
|
||||
const pathClear = (name: keyof ConnectionParams) => {
|
||||
(connection.value as unknown as {[key: string]: string})[name] = '';
|
||||
(connection.value as unknown as Record<string, string>)[name] = '';
|
||||
};
|
||||
|
||||
setDefaults();
|
||||
|
@ -569,11 +569,11 @@ const pathSelection = (event: Event & {target: {files: {path: string}[]}}, name:
|
||||
const { files } = event.target;
|
||||
if (!files.length) return;
|
||||
|
||||
(localConnection.value as unknown as {[key: string]: string})[name] = files[0].path;
|
||||
(localConnection.value as unknown as Record<string, string>)[name] = files[0].path;
|
||||
};
|
||||
|
||||
const pathClear = (name: keyof ConnectionParams) => {
|
||||
(localConnection.value as unknown as {[key: string]: string})[name] = '';
|
||||
(localConnection.value as unknown as Record<string, string>)[name] = '';
|
||||
};
|
||||
|
||||
localConnection.value = JSON.parse(JSON.stringify(props.connection));
|
||||
|
@ -382,7 +382,7 @@ const getFieldsData = async () => {
|
||||
if (status === 'success') {
|
||||
const indexesObj = response
|
||||
.filter((index: TableIndex) => index.type !== 'FOREIGN KEY')
|
||||
.reduce((acc: {[key: string]: TableIndex[]}, curr: TableIndex) => {
|
||||
.reduce((acc: Record<string, TableIndex[]>, curr: TableIndex) => {
|
||||
acc[curr.name] = acc[curr.name] || [];
|
||||
acc[curr.name].push(curr);
|
||||
return acc;
|
||||
|
@ -258,7 +258,7 @@ const indexesPanel: Ref<HTMLDivElement> = ref(null);
|
||||
const foreignProxy = ref([]);
|
||||
const selectedForeignID = ref('');
|
||||
const modalInnerHeight = ref(400);
|
||||
const refFields = ref({} as {[key: string]: TableField[]});
|
||||
const refFields = ref({} as Record<string, TableField[]>);
|
||||
|
||||
const foreignActions = computed(() => props.workspace.customizations.foreignActions);
|
||||
const selectedForeignObj = computed(() => foreignProxy.value.find(foreign => foreign._antares_id === selectedForeignID.value));
|
||||
|
Reference in New Issue
Block a user