mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-22 15:46:01 +00:00
SYNC: Merge pull request #12 from dbgate/feature/team-files
This commit is contained in:
@@ -184,6 +184,12 @@ const cloudContentListLoader = () => ({
|
||||
reloadTrigger: { key: `cloud-content-changed` },
|
||||
});
|
||||
|
||||
const teamFilesLoader = () => ({
|
||||
url: 'team-files/list',
|
||||
params: {},
|
||||
reloadTrigger: { key: `team-files-changed` },
|
||||
});
|
||||
|
||||
async function getCore(loader, args) {
|
||||
const { url, params, reloadTrigger, transform, onLoaded, errorValue } = loader(args);
|
||||
const key = stableStringify({ url, ...params });
|
||||
@@ -523,3 +529,10 @@ export function getCloudContentList(args) {
|
||||
export function useCloudContentList(args = {}) {
|
||||
return useCore(cloudContentListLoader, args);
|
||||
}
|
||||
|
||||
export function getTeamFiles(args) {
|
||||
return getCore(teamFilesLoader, args);
|
||||
}
|
||||
export function useTeamFiles(args) {
|
||||
return useCore(teamFilesLoader, args);
|
||||
}
|
||||
|
||||
@@ -15,11 +15,14 @@ export default async function saveTabFile(editor, saveMode, folder, format, file
|
||||
const tabs = get(openedTabs);
|
||||
const tabid = editor.activator.tabid;
|
||||
const data = editor.getData();
|
||||
const { savedFile, savedFilePath, savedFolder, savedCloudFolderId, savedCloudContentId } =
|
||||
const { savedFile, savedFilePath, savedFolder, savedCloudFolderId, savedCloudContentId, savedTeamFileId } =
|
||||
tabs.find(x => x.tabid == tabid).props || {};
|
||||
|
||||
const handleSave = async () => {
|
||||
if (savedCloudFolderId && savedCloudContentId) {
|
||||
if (savedTeamFileId) {
|
||||
const resp = await apiCall('team-files/update', { teamFileId: savedTeamFileId, data });
|
||||
markTabSaved(tabid);
|
||||
} else if (savedCloudFolderId && savedCloudContentId) {
|
||||
const resp = await apiCall('cloud/save-file', {
|
||||
folid: savedCloudFolderId,
|
||||
fileName: savedFile,
|
||||
|
||||
Reference in New Issue
Block a user