remove apps upload api in favor of sftp container api
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
<Button success @click="terminalInject('redis')" v-show="usesAddon('redis')" :disabled="!connected">Redis</Button>
|
||||
|
||||
<!-- upload/download actions -->
|
||||
<Button style="margin-left: 20px;" :disabled="!connected" @click="onUpload" icon="fa-solid fa-upload">{{ $t('terminal.uploadToTmp') }}</Button>
|
||||
<Button style="margin-left: 20px;" :disabled="!connected" @click="onUpload" icon="fa-solid fa-upload">{{ $t('terminal.uploadTo', { path: '/app/data/' }) }}</Button>
|
||||
<Button :disabled="!connected" @click="onDownload" icon="fa-solid fa-download">{{ $t('terminal.downloadAction') }}</Button>
|
||||
|
||||
<Button style="margin-left: 20px;" :title="$t('filemanager.toolbar.restartApp')" secondary :loading="busyRestart" icon="fa-solid fa-arrows-rotate" @click="onRestartApp"/>
|
||||
@@ -58,6 +58,7 @@ import { AttachAddon } from '@xterm/addon-attach';
|
||||
import { FitAddon } from '@xterm/addon-fit';
|
||||
|
||||
import { create } from '../models/AppModel.js';
|
||||
import { createDirectoryModel } from '../models/DirectoryModel.js';
|
||||
|
||||
const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? 'https://' + import.meta.env.VITE_API_ORIGIN : window.location.origin;
|
||||
|
||||
@@ -76,6 +77,7 @@ export default {
|
||||
accessToken: localStorage.token,
|
||||
apiOrigin: API_ORIGIN || '',
|
||||
appModel: null,
|
||||
directoryModel: null,
|
||||
fatalError: false,
|
||||
busyRestart: false,
|
||||
connected: false,
|
||||
@@ -135,13 +137,10 @@ export default {
|
||||
});
|
||||
},
|
||||
onUpload() {
|
||||
this.$refs.fileUploader.onUploadFile('/tmp');
|
||||
this.$refs.fileUploader.onUploadFile('/');
|
||||
},
|
||||
async uploadHandler(targetDir, file, progressHandler) {
|
||||
await superagent.post(`${this.apiOrigin}/api/v1/apps/${this.id}/upload`)
|
||||
.query({ access_token: this.accessToken, file: `${targetDir}/${file.name}` })
|
||||
.attach('file', file)
|
||||
.on('progress', progressHandler);
|
||||
await this.directoryModel.upload(targetDir, file, progressHandler);
|
||||
},
|
||||
usesAddon(addon) {
|
||||
return !!Object.keys(this.addons).find(function (a) { return a === addon; });
|
||||
@@ -265,6 +264,7 @@ export default {
|
||||
this.name = id;
|
||||
|
||||
this.appModel = create(this.apiOrigin, this.accessToken, this.id);
|
||||
this.directoryModel = createDirectoryModel(this.apiOrigin, this.accessToken, `apps/${id}`);
|
||||
|
||||
try {
|
||||
const app = await this.appModel.get();
|
||||
|
||||
Reference in New Issue
Block a user