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 { spawn } = require("child_process");
const { basename, join, posix } = require("path");
const { copyFileSync } = require("fs");
const handler = () => { const handler = () => {
ipcMain.on("terminal", (_, data) => { ipcMain.on("terminal", (_, data) => {
...@@ -25,6 +27,32 @@ const handler = () => { ...@@ -25,6 +27,32 @@ const handler = () => {
"Oyun Parkı" "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; module.exports = handler;
...@@ -20,6 +20,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; ...@@ -20,6 +20,7 @@ import { library } from "@fortawesome/fontawesome-svg-core";
import { import {
faCircle, faCircle,
faExternalLinkAlt, faExternalLinkAlt,
faFileUpload,
faPlay, faPlay,
faStop, faStop,
faTerminal, faTerminal,
...@@ -36,7 +37,8 @@ library.add( ...@@ -36,7 +37,8 @@ library.add(
faTrash, faTrash,
faExternalLinkAlt, faExternalLinkAlt,
faTerminal, faTerminal,
faCircle faCircle,
faFileUpload
); );
Vue.component("icon", FontAwesomeIcon); Vue.component("icon", FontAwesomeIcon);
......
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-bind:label="$t('containers.table.actions')" v-bind:label="$t('containers.table.actions')"
width="300" width="340"
> >
<template slot-scope="scope"> <template slot-scope="scope">
<el-tooltip v-bind:content="$t('containers.table.tooltips.viewer')"> <el-tooltip v-bind:content="$t('containers.table.tooltips.viewer')">
...@@ -122,6 +122,21 @@ ...@@ -122,6 +122,21 @@
<icon icon="terminal" fixed-width /> <icon icon="terminal" fixed-width />
</el-button> </el-button>
</el-tooltip> </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 <el-tooltip
v-bind:content="$t('containers.table.tooltips.stop')" v-bind:content="$t('containers.table.tooltips.stop')"
v-if="scope.row.State === 'running'" v-if="scope.row.State === 'running'"
...@@ -212,15 +227,14 @@ export default { ...@@ -212,15 +227,14 @@ export default {
sound: this.form.sound sound: this.form.sound
}) })
.then(() => { .then(() => {
this.$notify({ this.$message({
title: this.$t("containers.create.notification.success.title"),
message: this.$t("containers.create.notification.success.message"), message: this.$t("containers.create.notification.success.message"),
type: "success" type: "success",
showClose: true
}); });
}) })
.catch(() => { .catch(() => {
this.$notify({ this.$message({
title: this.$t("containers.create.notification.fail.title"),
message: this.$t("containers.create.notification.fail.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