clean up Do The Thing button and adjust api

This commit is contained in:
Charlie Kolb 2025-08-04 10:11:47 +02:00
parent fa33743e1f
commit ade6ebab22
No known key found for this signature in database
3 changed files with 18 additions and 79 deletions

View File

@ -29,7 +29,6 @@ import Logo from '@/components/Logo/Logo.vue';
import VersionUpdateCTA from '@/components/VersionUpdateCTA.vue';
import { TemplateClickSource, trackTemplatesClick } from '@/utils/experiments';
import { I18nT } from 'vue-i18n';
import { playground } from '@/features/dataStore/dataStore.api';
const becomeTemplateCreatorStore = useBecomeTemplateCreatorStore();
const cloudPlanStore = useCloudPlanStore();
@ -360,10 +359,6 @@ const {
onClickOutside(createBtn as Ref<VueInstance>, () => {
createBtn.value?.close();
});
const customFunction = async () => {
await playground();
};
</script>
<template>
@ -375,7 +370,6 @@ const customFunction = async () => {
[$style.sideMenuCollapsed]: isCollapsed,
}"
>
<N8nButton type="primary" @click="customFunction"> Do The Thing </N8nButton>
<div
id="collapse-change-button"
:class="['clickable', $style.sideMenuCollapseButton]"

View File

@ -1,60 +1,23 @@
import { makeRestApiRequest } from '@n8n/rest-api-client';
import { getFullApiResponse } from '@n8n/rest-api-client';
import type { IRestApiContext } from '@n8n/rest-api-client';
import type { CreateDataStoreDto, DataStore, ListDataStoreQueryDto } from '@n8n/api-types';
import { useRootStore } from '@n8n/stores/useRootStore';
import { getPersonalProject } from '@/api/projects.api';
export const createDataStoreTable = async (
import { type DataStoreEntity } from '@/features/dataStore/datastore.types';
export const fetchDataStores = async (
context: IRestApiContext,
projectId: string,
data: CreateDataStoreDto,
): Promise<DataStore | string> =>
await makeRestApiRequest(context, 'POST', `/projects/${projectId}/data-store`, data);
export const listDataStoreTable = async (
context: IRestApiContext,
projectId: string,
data: Partial<ListDataStoreQueryDto> = {},
): Promise<DataStore | string> =>
await makeRestApiRequest(context, 'GET', `/projects/${projectId}/data-store`, data);
// dev util to run code
export const playground = async () => {
const context = useRootStore().restApiContext;
const project = await getPersonalProject(context);
{
const result = await listDataStoreTable(context, project.id);
console.log(result);
}
{
const result = await createDataStoreTable(context, project.id, {
name: 'myFirstTable' + Math.random(),
columns: [],
});
console.log(result);
}
options?: {
page?: number;
pageSize?: number;
},
) => {
return await getFullApiResponse<DataStoreEntity[]>(
context,
'GET',
`/projects/${projectId}/data-stores`,
{
projectId,
options,
},
);
};
// export const fetchInsightsSummary = async (
// context: IRestApiContext,
// filter?: { dateRange: InsightsDateRange['key'] },
// ): Promise<InsightsSummary> =>
// await makeRestApiRequest(context, 'GET', '/insights/summary', filter);
// export const fetchInsightsByTime = async (
// context: IRestApiContext,
// filter?: { dateRange: InsightsDateRange['key'] },
// ): Promise<InsightsByTime[]> =>
// await makeRestApiRequest(context, 'GET', '/insights/by-time', filter);
// export const fetchInsightsTimeSaved = async (
// context: IRestApiContext,
// filter?: { dateRange: InsightsDateRange['key'] },
// ): Promise<InsightsByTime[]> =>
// await makeRestApiRequest(context, 'GET', '/insights/by-time/time-saved', filter);
// export const fetchInsightsByWorkflow = async (
// context: IRestApiContext,
// filter?: ListInsightsWorkflowQueryDto,
// ): Promise<InsightsByWorkflow> =>
// await makeRestApiRequest(context, 'GET', '/insights/by-workflow', filter);

View File

@ -1,18 +0,0 @@
import { getFullApiResponse } from '@n8n/rest-api-client';
import type { IRestApiContext } from '@n8n/rest-api-client';
import { type DataStoreEntity } from '@/features/dataStore/datastore.types';
export const fetchDataStores = async (
context: IRestApiContext,
projectId?: string,
options?: {
page?: number;
pageSize?: number;
},
) => {
return await getFullApiResponse<DataStoreEntity[]>(context, 'GET', '/data-stores', {
projectId,
options,
});
};