Kaydet (Commit) 36fc9ace authored tarafından Eda Altuntaş's avatar Eda Altuntaş

Parka dosya yükleme özelliği eklendi

üst 76b44568
const { ipcMain } = require("electron");
const { ipcMain, dialog } = require("electron");
const { spawn } = require("child_process");
const { basename, join, posix } = require("path");
const { copyFileSync } = require("fs");
const handler = () => {
ipcMain.on("terminal", (_, data) => {
......@@ -25,6 +27,32 @@ const handler = () => {
"Oyun Parkı"
]);
});
ipcMain.on("upload", (_, data) => {
const { Id, Source, Target, Username } = data;
dialog
.showOpenDialog({
properties: ["openFile", "multiSelections"]
})
.then(result => {
if (result.canceled) {
return;
}
result.filePaths.map(f => {
copyFileSync(f, join(Source, basename(f)));
spawn("docker", [
"exec",
Id,
"cp",
"-r",
`${posix.join(Target, basename(f))}`,
`/home/${Username}/Desktop/`
]);
});
})
.catch(err => {
console.log(err);
});
});
};
module.exports = handler;
......@@ -20,6 +20,7 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import {
faCircle,
faExternalLinkAlt,
faFileUpload,
faPlay,
faStop,
faTerminal,
......@@ -36,7 +37,8 @@ library.add(
faTrash,
faExternalLinkAlt,
faTerminal,
faCircle
faCircle,
faFileUpload
);
Vue.component("icon", FontAwesomeIcon);
......
......@@ -100,7 +100,7 @@
</el-table-column>
<el-table-column
v-bind:label="$t('containers.table.actions')"
width="300"
width="340"
>
<template slot-scope="scope">
<el-tooltip v-bind:content="$t('containers.table.tooltips.viewer')">
......@@ -122,6 +122,21 @@
<icon icon="terminal" fixed-width />
</el-button>
</el-tooltip>
<el-tooltip v-bind:content="$t('containers.table.tooltips.upload')">
<el-button
v-on:click.native.prevent="
f('upload', {
Id: scope.row.Id,
Source: scope.row.Labels['desktop.docker.io/binds/0/Source'],
Target: scope.row.Labels['desktop.docker.io/binds/0/Target'],
Username: scope.row.Labels['Username']
})
"
circle
>
<icon icon="file-upload" fixed-width />
</el-button>
</el-tooltip>
<el-tooltip
v-bind:content="$t('containers.table.tooltips.stop')"
v-if="scope.row.State === 'running'"
......@@ -212,15 +227,14 @@ export default {
sound: this.form.sound
})
.then(() => {
this.$notify({
title: this.$t("containers.create.notification.success.title"),
this.$message({
message: this.$t("containers.create.notification.success.message"),
type: "success"
type: "success",
showClose: true
});
})
.catch(() => {
this.$notify({
title: this.$t("containers.create.notification.fail.title"),
this.$message({
message: this.$t("containers.create.notification.fail.message")
});
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment