@@ -2,8 +2,12 @@ import { existsSync, statSync } from 'fs';
2
2
import { join } from 'path' ;
3
3
import { ExtensionContext , window , commands , Uri } from 'vscode' ;
4
4
import { COMMANDS , TRACKED_EVENTS } from '../constants' ;
5
- import { buildStatusBarItem , getRootPath } from '../helpers' ;
6
- import { invalidateParentDirectoryCache } from '../helpers' ;
5
+ import {
6
+ buildStatusBarItem ,
7
+ getRootPath ,
8
+ invalidateParentDirectoryCache ,
9
+ showMissingAccountError ,
10
+ } from '../helpers' ;
7
11
import { trackEvent } from '../tracking' ;
8
12
9
13
const { deleteFile, upload } = require ( '@hubspot/local-dev-lib/api/fileMapper' ) ;
@@ -26,6 +30,7 @@ export const registerCommands = (context: ExtensionContext) => {
26
30
commands . registerCommand (
27
31
COMMANDS . REMOTE_FS . FETCH ,
28
32
async ( clickedFileLink ) => {
33
+ showMissingAccountError ( ) ;
29
34
const remoteFilePath = clickedFileLink . path ;
30
35
// We use showOpenDialog instead of showSaveDialog because the latter has worse support for this use-case
31
36
const destPath = await window . showOpenDialog ( {
@@ -67,7 +72,7 @@ export const registerCommands = (context: ExtensionContext) => {
67
72
trackEvent ( TRACKED_EVENTS . REMOTE_FS . FETCH ) ;
68
73
try {
69
74
await downloadFileOrFolder (
70
- getAccountId ( ) ,
75
+ getAccountId ( ) ! ,
71
76
remoteFilePath ,
72
77
localFilePath ,
73
78
undefined ,
@@ -91,6 +96,7 @@ export const registerCommands = (context: ExtensionContext) => {
91
96
commands . registerCommand (
92
97
COMMANDS . REMOTE_FS . DELETE ,
93
98
async ( clickedFileLink ) => {
99
+ showMissingAccountError ( ) ;
94
100
console . log ( COMMANDS . REMOTE_FS . DELETE ) ;
95
101
const filePath = clickedFileLink . path ;
96
102
const selection = await window . showWarningMessage (
@@ -103,7 +109,7 @@ export const registerCommands = (context: ExtensionContext) => {
103
109
trackEvent ( TRACKED_EVENTS . REMOTE_FS . DELETE ) ;
104
110
const deletingStatus = buildStatusBarItem ( `Deleting...` ) ;
105
111
deletingStatus . show ( ) ;
106
- deleteFile ( getAccountId ( ) , filePath )
112
+ deleteFile ( getAccountId ( ) ! , filePath )
107
113
. then ( ( ) => {
108
114
window . showInformationMessage ( `Successfully deleted "${ filePath } "` ) ;
109
115
invalidateParentDirectoryCache ( filePath ) ;
@@ -126,6 +132,7 @@ export const registerCommands = (context: ExtensionContext) => {
126
132
commands . registerCommand (
127
133
COMMANDS . REMOTE_FS . UPLOAD ,
128
134
async ( clickedFileLink ) => {
135
+ showMissingAccountError ( ) ;
129
136
let srcPath : string ;
130
137
if (
131
138
clickedFileLink === undefined ||
@@ -246,7 +253,8 @@ const handleFileUpload = async (srcPath: string, destPath: string) => {
246
253
return ;
247
254
}
248
255
trackEvent ( TRACKED_EVENTS . REMOTE_FS . UPLOAD_FILE ) ;
249
- upload ( getAccountId ( ) , srcPath , destPath )
256
+ showMissingAccountError ( ) ;
257
+ upload ( getAccountId ( ) ! , srcPath , destPath )
250
258
. then ( ( ) => {
251
259
window . showInformationMessage (
252
260
`Uploading files to "${ destPath } " was successful`
@@ -268,16 +276,7 @@ const handleFolderUpload = async (srcPath: string, destPath: string) => {
268
276
`Beginning upload of "${ srcPath } " to "${ destPath } "...`
269
277
) ;
270
278
trackEvent ( TRACKED_EVENTS . REMOTE_FS . UPLOAD_FOLDER ) ;
271
- uploadFolder (
272
- getAccountId ( ) ,
273
- srcPath ,
274
- destPath ,
275
- {
276
- mode : 'publish' ,
277
- } ,
278
- { } ,
279
- filePaths
280
- )
279
+ uploadFolder ( getAccountId ( ) ! , srcPath , destPath , { } , { } , filePaths , 'publish' )
281
280
. then ( async ( results : any ) => {
282
281
if ( ! hasUploadErrors ( results ) ) {
283
282
window . showInformationMessage (
0 commit comments