Kaydet (Commit) 1f462ddf authored tarafından Eda Altuntaş's avatar Eda Altuntaş

Arayüzden dosya yüklenmesine feedback yapıldı

üst 4bbdae3c
...@@ -74,7 +74,7 @@ if (!gotTheLock) { ...@@ -74,7 +74,7 @@ if (!gotTheLock) {
} }
createWindow(); createWindow();
}); });
require("./ipc")(); require("./ipc")(mainWindow);
} }
if (isDevelopment) { if (isDevelopment) {
......
...@@ -3,7 +3,7 @@ const { spawn } = require("child_process"); ...@@ -3,7 +3,7 @@ const { spawn } = require("child_process");
const { basename, join, posix } = require("path"); const { basename, join, posix } = require("path");
const { copyFileSync, unlinkSync } = require("fs"); const { copyFileSync, unlinkSync } = require("fs");
const handler = () => { const handler = win => {
ipcMain.on("terminal", (_, data) => { ipcMain.on("terminal", (_, data) => {
if (process.platform === "win32") { if (process.platform === "win32") {
spawn("cmd", ["/c", "start", "docker", "exec", "-it", data, "bash"]); spawn("cmd", ["/c", "start", "docker", "exec", "-it", data, "bash"]);
...@@ -20,15 +20,11 @@ const handler = () => { ...@@ -20,15 +20,11 @@ const handler = () => {
} }
}); });
ipcMain.on("viewer", (_, data) => { ipcMain.on("viewer", (_, data) => {
spawn("remote-viewer", [ const { Port, Name } = data;
`spice://localhost:${data}`, spawn("remote-viewer", [`spice://localhost:${Port}`, "-f", "-t", Name]);
"-f",
"-t",
"Oyun Parkı"
]);
}); });
ipcMain.on("upload", (_, data) => { ipcMain.on("upload", (_, data) => {
const { Id, Source, Target, Username } = data; const { Id, Name, Source, Target, Username } = data;
dialog dialog
.showOpenDialog({ .showOpenDialog({
properties: ["openFile", "multiSelections"] properties: ["openFile", "multiSelections"]
...@@ -55,10 +51,21 @@ const handler = () => { ...@@ -55,10 +51,21 @@ const handler = () => {
`${Username}:${Username}`, `${Username}:${Username}`,
`/home/${Username}/Desktop/${basename(f)}` `/home/${Username}/Desktop/${basename(f)}`
]); ]);
if (win && win.webContents) {
win.webContents.executeJavaScript(
`window.dispatchEvent(new CustomEvent('uploaded', { detail: {success: true, file: '${basename(
basename(f)
)}', container: '${Name}'}}));`
);
}
}); });
}) })
.catch(err => { .catch(() => {
console.log(err); if (win && win.webContents) {
win.webContents.executeJavaScript(
`window.dispatchEvent(new CustomEvent('uploaded', { detail: {success: false, file: '', container: '${Name}'}}));`
);
}
}); });
}); });
}; };
......
...@@ -110,7 +110,10 @@ ...@@ -110,7 +110,10 @@
<el-tooltip v-bind:content="$t('containers.table.tooltips.viewer')"> <el-tooltip v-bind:content="$t('containers.table.tooltips.viewer')">
<el-button <el-button
v-on:click.native.prevent=" v-on:click.native.prevent="
f('viewer', scope.row.Ports[0].PublicPort) f('viewer', {
Port: scope.row.Ports[0].PublicPort,
Name: scope.row.Names[0]
})
" "
v-if="scope.row.Ports[0]" v-if="scope.row.Ports[0]"
circle circle
...@@ -131,6 +134,7 @@ ...@@ -131,6 +134,7 @@
v-on:click.native.prevent=" v-on:click.native.prevent="
f('upload', { f('upload', {
Id: scope.row.Id, Id: scope.row.Id,
Name: scope.row.Names[0],
Source: Source:
scope.row.Labels['desktop.docker.io/binds/0/Source'] || scope.row.Labels['desktop.docker.io/binds/0/Source'] ||
scope.row.Mounts[0].Source, scope.row.Mounts[0].Source,
...@@ -256,6 +260,30 @@ export default { ...@@ -256,6 +260,30 @@ export default {
console.error(e); console.error(e);
} }
}; };
const vm = this;
window.addEventListener(
"uploaded",
function(e) {
if (e.detail.success) {
vm.$message({
message: vm.$t("containers.upload_modal.successfully_uploaded", {
file: e.detail.file,
container: e.detail.container
}),
type: "success"
});
} else {
vm.$message({
message: vm.$t("containers.upload_modal.upload_failed", {
file: e.detail.file,
container: e.detail.container
}),
type: "error"
});
}
},
false
);
}, },
methods: { methods: {
getContainers: function() { getContainers: function() {
......
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