[Added tooltips] [IPC constants]
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,3 +4,4 @@ node_modules/
|
|||||||
build/
|
build/
|
||||||
chrome_data/
|
chrome_data/
|
||||||
dist/
|
dist/
|
||||||
|
/.cache
|
||||||
|
|||||||
94
electron.js
94
electron.js
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
const {app, BrowserWindow, Tray, nativeImage, Menu} = require('electron');
|
const {app, BrowserWindow, Tray, nativeImage, Menu} = require('electron');
|
||||||
const {ipcMain} = require('electron');
|
const {ipcMain} = require('electron');
|
||||||
|
const Constants = require('./src/constants');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const url = require('url');
|
const url = require('url');
|
||||||
require('electron-debug')();
|
require('electron-debug')();
|
||||||
@@ -76,6 +76,14 @@ function createWindow() {
|
|||||||
autoLauncher.disable();
|
autoLauncher.disable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Exit', click(item) {
|
||||||
|
app.quit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -130,7 +138,7 @@ if (!instanceLock) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcMain.on('check_installed', (event, data) => {
|
ipcMain.on(Constants.IPC_Check_Installed, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
const destination = path.join(dataDirectory, data.Version);
|
const destination = path.join(dataDirectory, data.Version);
|
||||||
helpers
|
helpers
|
||||||
@@ -141,7 +149,7 @@ ipcMain.on('check_installed', (event, data) => {
|
|||||||
exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory();
|
exists = fs.existsSync(destination) && fs.lstatSync(destination).isDirectory();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
event.sender.send('check_installed_reply', {
|
event.sender.send(Constants.IPC_Check_Installed_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Dependencies: dependencies,
|
Dependencies: dependencies,
|
||||||
Exists: exists,
|
Exists: exists,
|
||||||
@@ -150,7 +158,7 @@ ipcMain.on('check_installed', (event, data) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
event.sender.send('check_installed_reply', {
|
event.sender.send(Constants.IPC_Check_Installed_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Dependencies: [],
|
Dependencies: [],
|
||||||
Error: e,
|
Error: e,
|
||||||
@@ -161,7 +169,7 @@ ipcMain.on('check_installed', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('delete_file', (event, data) => {
|
ipcMain.on(Constants.IPC_Delete_File, (event, data) => {
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(data.FilePath)) {
|
if (fs.existsSync(data.FilePath)) {
|
||||||
fs.unlinkSync(data.FilePath);
|
fs.unlinkSync(data.FilePath);
|
||||||
@@ -170,7 +178,7 @@ ipcMain.on('delete_file', (event, data) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('detect_mounts', (event, data) => {
|
ipcMain.on(Constants.IPC_Detect_Mounts, (event, data) => {
|
||||||
let driveLetters = {
|
let driveLetters = {
|
||||||
Hyperspace: [],
|
Hyperspace: [],
|
||||||
Sia: [],
|
Sia: [],
|
||||||
@@ -218,7 +226,7 @@ ipcMain.on('detect_mounts', (event, data) => {
|
|||||||
siaLocation = siaLocation.toUpperCase();
|
siaLocation = siaLocation.toUpperCase();
|
||||||
grabDriveLetters(hsLocation, siaLocation);
|
grabDriveLetters(hsLocation, siaLocation);
|
||||||
}
|
}
|
||||||
event.sender.send('detect_mounts_reply', {
|
event.sender.send(Constants.IPC_Detect_Mounts_Reply, {
|
||||||
data: {
|
data: {
|
||||||
DriveLetters: driveLetters,
|
DriveLetters: driveLetters,
|
||||||
Locations: {
|
Locations: {
|
||||||
@@ -236,7 +244,7 @@ ipcMain.on('detect_mounts', (event, data) => {
|
|||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
grabDriveLetters('', '');
|
grabDriveLetters('', '');
|
||||||
|
|
||||||
event.sender.send('detect_mounts_reply', {
|
event.sender.send(Constants.IPC_Detect_Mounts_Reply, {
|
||||||
data: {
|
data: {
|
||||||
DriveLetters: driveLetters,
|
DriveLetters: driveLetters,
|
||||||
Error: err,
|
Error: err,
|
||||||
@@ -246,11 +254,11 @@ ipcMain.on('detect_mounts', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('download_file', (event, data) => {
|
ipcMain.on(Constants.IPC_Download_File, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
const destination = path.join(dataDirectory, data.Filename);
|
const destination = path.join(dataDirectory, data.Filename);
|
||||||
helpers.downloadFile(data.URL, destination, (progress) => {
|
helpers.downloadFile(data.URL, destination, (progress) => {
|
||||||
event.sender.send('download_file_progress', {
|
event.sender.send(Constants.IPC_Download_File_Progress, {
|
||||||
data: {
|
data: {
|
||||||
Destination: destination,
|
Destination: destination,
|
||||||
Progress: progress,
|
Progress: progress,
|
||||||
@@ -258,7 +266,7 @@ ipcMain.on('download_file', (event, data) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, (success, err) => {
|
}, (success, err) => {
|
||||||
event.sender.send('download_file_complete', {
|
event.sender.send(Constants.IPC_Download_File_Complete, {
|
||||||
data: {
|
data: {
|
||||||
Destination: destination,
|
Destination: destination,
|
||||||
Error: err,
|
Error: err,
|
||||||
@@ -269,7 +277,7 @@ ipcMain.on('download_file', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('extract_release', (event, data) => {
|
ipcMain.on(Constants.IPC_Extract_Release, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
const destination = path.join(dataDirectory, data.Version);
|
const destination = path.join(dataDirectory, data.Version);
|
||||||
helpers.mkDirByPathSync(destination);
|
helpers.mkDirByPathSync(destination);
|
||||||
@@ -283,7 +291,7 @@ ipcMain.on('extract_release', (event, data) => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
stream.close();
|
stream.close();
|
||||||
event.sender.send('extract_release_complete', {
|
event.sender.send(Constants.IPC_Extract_Release_Complete, {
|
||||||
data: {
|
data: {
|
||||||
Error: e,
|
Error: e,
|
||||||
Source: data.Source,
|
Source: data.Source,
|
||||||
@@ -293,7 +301,7 @@ ipcMain.on('extract_release', (event, data) => {
|
|||||||
})
|
})
|
||||||
.on('finish', () => {
|
.on('finish', () => {
|
||||||
stream.close();
|
stream.close();
|
||||||
event.sender.send('extract_release_complete', {
|
event.sender.send(Constants.IPC_Extract_Release_Complete, {
|
||||||
data: {
|
data: {
|
||||||
Source: data.Source,
|
Source: data.Source,
|
||||||
Success: true,
|
Success: true,
|
||||||
@@ -302,20 +310,20 @@ ipcMain.on('extract_release', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('get_config', (event, data) => {
|
ipcMain.on(Constants.IPC_Get_Config, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
helpers
|
helpers
|
||||||
.getConfig(dataDirectory, data.Version, data.StorageType)
|
.getConfig(dataDirectory, data.Version, data.StorageType)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data.Code === 0) {
|
if (data.Code === 0) {
|
||||||
event.sender.send('get_config_reply', {
|
event.sender.send(Constants.IPC_Get_Config_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Success: true,
|
Success: true,
|
||||||
Config: data.Data,
|
Config: data.Data,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('get_config_reply', {
|
event.sender.send(Constants.IPC_Get_Config_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Error: data.Code,
|
Error: data.Code,
|
||||||
Success: false,
|
Success: false,
|
||||||
@@ -324,7 +332,7 @@ ipcMain.on('get_config', (event, data) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e)=> {
|
.catch((e)=> {
|
||||||
event.sender.send('get_config_reply', {
|
event.sender.send(Constants.IPC_Get_Config_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Error: e,
|
Error: e,
|
||||||
Success: false,
|
Success: false,
|
||||||
@@ -333,12 +341,12 @@ ipcMain.on('get_config', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('get_config_template', (event, data) => {
|
ipcMain.on(Constants.IPC_Get_Config_Template, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
helpers
|
helpers
|
||||||
.getConfigTemplate(dataDirectory, data.Version, data.StorageType)
|
.getConfigTemplate(dataDirectory, data.Version, data.StorageType)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
event.sender.send('get_config_template_reply', {
|
event.sender.send(Constants.IPC_Get_Config_Template_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Success: true,
|
Success: true,
|
||||||
Template: data,
|
Template: data,
|
||||||
@@ -346,7 +354,7 @@ ipcMain.on('get_config_template', (event, data) => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((e)=> {
|
.catch((e)=> {
|
||||||
event.sender.send('get_config_template_reply', {
|
event.sender.send(Constants.IPC_Get_Config_Template_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Error: e,
|
Error: e,
|
||||||
Success: false,
|
Success: false,
|
||||||
@@ -355,40 +363,40 @@ ipcMain.on('get_config_template', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('get_platform', (event) => {
|
ipcMain.on(Constants.IPC_Get_Platform, (event) => {
|
||||||
event.sender.send('get_platform_reply', {
|
event.sender.send(Constants.IPC_Get_Platform_Reply, {
|
||||||
data: os.platform()
|
data: os.platform()
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('get_state', (event, data) => {
|
ipcMain.on(Constants.IPC_Get_State, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data);
|
const dataDirectory = helpers.resolvePath(data);
|
||||||
helpers.mkDirByPathSync(dataDirectory);
|
helpers.mkDirByPathSync(dataDirectory);
|
||||||
const configFile = path.join(dataDirectory, 'settings.json');
|
const configFile = path.join(dataDirectory, 'settings.json');
|
||||||
if (fs.existsSync(configFile)) {
|
if (fs.existsSync(configFile)) {
|
||||||
event.sender.send('get_state_reply', {
|
event.sender.send(Constants.IPC_Get_State_Reply, {
|
||||||
data: JSON.parse(fs.readFileSync(configFile, 'utf8')),
|
data: JSON.parse(fs.readFileSync(configFile, 'utf8')),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('get_state_reply', {
|
event.sender.send(Constants.IPC_Get_State_Reply, {
|
||||||
data: null,
|
data: null,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('grab_releases', (event) => {
|
ipcMain.on(Constants.IPC_Grab_Releases, (event) => {
|
||||||
event.sender.send('grab_releases_reply');
|
event.sender.send(Constants.IPC_Grab_Releases_Reply);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('grab_ui_releases', (event) => {
|
ipcMain.on(Constants.IPC_Grab_UI_Releases, (event) => {
|
||||||
event.sender.send('grab_ui_releases_reply');
|
event.sender.send(Constants.IPC_Grab_UI_Releases_Reply);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('install_dependency', (event, data) => {
|
ipcMain.on(Constants.IPC_Install_Dependency, (event, data) => {
|
||||||
helpers
|
helpers
|
||||||
.executeAndWait(data.Source)
|
.executeAndWait(data.Source)
|
||||||
.then(()=> {
|
.then(()=> {
|
||||||
event.sender.send('install_dependency_reply', {
|
event.sender.send(Constants.IPC_Install_Dependency_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Source: data.Source,
|
Source: data.Source,
|
||||||
Success: true,
|
Success: true,
|
||||||
@@ -396,7 +404,7 @@ ipcMain.on('install_dependency', (event, data) => {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch((e)=> {
|
.catch((e)=> {
|
||||||
event.sender.send('install_dependency_reply', {
|
event.sender.send(Constants.IPC_Install_Dependency_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Error: e,
|
Error: e,
|
||||||
Source: data.Source,
|
Source: data.Source,
|
||||||
@@ -406,14 +414,14 @@ ipcMain.on('install_dependency', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('install_upgrade', (event, data) => {
|
ipcMain.on(Constants.IPC_Install_Upgrade, (event, data) => {
|
||||||
helpers
|
helpers
|
||||||
.executeAsync(data.Source)
|
.executeAsync(data.Source)
|
||||||
.then(()=> {
|
.then(()=> {
|
||||||
mainWindow.close();
|
mainWindow.close();
|
||||||
})
|
})
|
||||||
.catch((e)=> {
|
.catch((e)=> {
|
||||||
event.sender.send('install_upgrade_reply', {
|
event.sender.send(Constants.IPC_Install_Upgrade_Reply, {
|
||||||
data: {
|
data: {
|
||||||
Error: e,
|
Error: e,
|
||||||
Source: data.Source,
|
Source: data.Source,
|
||||||
@@ -423,11 +431,11 @@ ipcMain.on('install_upgrade', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('mount_drive', (event, data) => {
|
ipcMain.on(Constants.IPC_Mount_Drive, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
const errorHandler = (pid) => {
|
const errorHandler = (pid) => {
|
||||||
mountedPIDs.splice(mountedPIDs.indexOf(pid), 1);
|
mountedPIDs.splice(mountedPIDs.indexOf(pid), 1);
|
||||||
event.sender.send('unmount_drive_reply', {
|
event.sender.send(Constants.IPC_Unmount_Drive_Reply, {
|
||||||
data: {
|
data: {
|
||||||
PID: -1,
|
PID: -1,
|
||||||
StorageType: data.StorageType,
|
StorageType: data.StorageType,
|
||||||
@@ -442,7 +450,7 @@ ipcMain.on('mount_drive', (event, data) => {
|
|||||||
if (pid !== -1) {
|
if (pid !== -1) {
|
||||||
mountedPIDs.push(pid);
|
mountedPIDs.push(pid);
|
||||||
}
|
}
|
||||||
event.sender.send('mount_drive_reply', {
|
event.sender.send(Constants.IPC_Mount_Drive_Reply, {
|
||||||
data: {
|
data: {
|
||||||
PID: pid,
|
PID: pid,
|
||||||
StorageType: data.StorageType,
|
StorageType: data.StorageType,
|
||||||
@@ -455,14 +463,14 @@ ipcMain.on('mount_drive', (event, data) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('save_state', (event, data) => {
|
ipcMain.on(Constants.IPC_Save_State, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
helpers.mkDirByPathSync(dataDirectory);
|
helpers.mkDirByPathSync(dataDirectory);
|
||||||
const configFile = path.join(dataDirectory, 'settings.json');
|
const configFile = path.join(dataDirectory, 'settings.json');
|
||||||
fs.writeFileSync(configFile, JSON.stringify(data.State), 'utf8');
|
fs.writeFileSync(configFile, JSON.stringify(data.State), 'utf8');
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('set_config_values', (event, data) => {
|
ipcMain.on(Constants.IPC_Set_Config_Values, (event, data) => {
|
||||||
const dataDirectory = helpers.resolvePath(data.Directory);
|
const dataDirectory = helpers.resolvePath(data.Directory);
|
||||||
const setConfigValue = (i) => {
|
const setConfigValue = (i) => {
|
||||||
if (i < data.Items.length) {
|
if (i < data.Items.length) {
|
||||||
@@ -475,18 +483,18 @@ ipcMain.on('set_config_values', (event, data) => {
|
|||||||
setConfigValue(++i);
|
setConfigValue(++i);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
event.sender.send('set_config_values_reply', {});
|
event.sender.send(Constants.IPC_Set_Config_Values_Reply, {});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setConfigValue(0);
|
setConfigValue(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('unmount_drive', (event, data) => {
|
ipcMain.on(Constants.IPC_Unmount_Drive, (event, data) => {
|
||||||
helpers
|
helpers
|
||||||
.stopProcessByPID(data.PID)
|
.stopProcessByPID(data.PID)
|
||||||
.then((pid)=> {
|
.then((pid)=> {
|
||||||
if (mountedPIDs.indexOf(pid) === -1) {
|
if (mountedPIDs.indexOf(pid) === -1) {
|
||||||
event.sender.send('unmount_drive_reply');
|
event.sender.send(Constants.IPC_Unmount_Drive_Reply);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|||||||
@@ -47,6 +47,7 @@
|
|||||||
"react-dev-utils": "^5.0.1",
|
"react-dev-utils": "^5.0.1",
|
||||||
"react-dom": "^16.4.1",
|
"react-dom": "^16.4.1",
|
||||||
"react-loader-spinner": "^2.0.6",
|
"react-loader-spinner": "^2.0.6",
|
||||||
|
"react-tooltip": "^3.8.4",
|
||||||
"resolve": "1.6.0",
|
"resolve": "1.6.0",
|
||||||
"style-loader": "0.19.0",
|
"style-loader": "0.19.0",
|
||||||
"sw-precache-webpack-plugin": "0.11.4",
|
"sw-precache-webpack-plugin": "0.11.4",
|
||||||
@@ -68,7 +69,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cross-env": "^5.2.0",
|
"cross-env": "^5.2.0",
|
||||||
"electron": "3.0.0",
|
"electron": "^3.0.2",
|
||||||
"electron-builder": "^20.28.4",
|
"electron-builder": "^20.28.4",
|
||||||
"extract-text-webpack-plugin": "^3.0.2",
|
"extract-text-webpack-plugin": "^3.0.2",
|
||||||
"webpack-browser-plugin": "^1.0.20"
|
"webpack-browser-plugin": "^1.0.20"
|
||||||
@@ -121,6 +122,7 @@
|
|||||||
"appId": "repertory-ui",
|
"appId": "repertory-ui",
|
||||||
"files": [
|
"files": [
|
||||||
"./electron.js",
|
"./electron.js",
|
||||||
|
"./src/constants.js",
|
||||||
"build/**/*",
|
"build/**/*",
|
||||||
"node_modules/**/*",
|
"node_modules/**/*",
|
||||||
"./helpers.js"
|
"./helpers.js"
|
||||||
|
|||||||
52
src/App.js
52
src/App.js
@@ -1,5 +1,4 @@
|
|||||||
import React, {Component} from 'react';
|
import React, {Component} from 'react';
|
||||||
import * as Constants from './constants';
|
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import styles from './App.css';
|
import styles from './App.css';
|
||||||
import Box from './components/UI/Box/Box';
|
import Box from './components/UI/Box/Box';
|
||||||
@@ -15,6 +14,7 @@ import MountItems from './containers/MountItems/MountItems';
|
|||||||
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
||||||
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
||||||
|
|
||||||
|
const Constants = require('./constants');
|
||||||
const Scheduler = require('node-schedule');
|
const Scheduler = require('node-schedule');
|
||||||
|
|
||||||
let ipcRenderer = null;
|
let ipcRenderer = null;
|
||||||
@@ -399,18 +399,7 @@ class App extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
onGrabReleasesReply = ()=> {
|
onGrabReleasesReply = ()=> {
|
||||||
axios.get(Constants.RELEASES_URL)
|
const doUpdate = (locationsLookup, versionLookup) => {
|
||||||
.then(response => {
|
|
||||||
const versionLookup = {
|
|
||||||
Alpha: response.data.Versions.Alpha[this.state.Platform],
|
|
||||||
Beta: response.data.Versions.Beta[this.state.Platform],
|
|
||||||
RC: response.data.Versions.RC[this.state.Platform],
|
|
||||||
Release: response.data.Versions.Release[this.state.Platform],
|
|
||||||
};
|
|
||||||
const locationsLookup = {
|
|
||||||
...response.data.Locations[this.state.Platform],
|
|
||||||
};
|
|
||||||
|
|
||||||
const latestVersion = versionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
const latestVersion = versionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
||||||
let version = this.state.Version;
|
let version = this.state.Version;
|
||||||
if (version === -1) {
|
if (version === -1) {
|
||||||
@@ -424,9 +413,40 @@ class App extends Component {
|
|||||||
VersionAvailable: version !== latestVersion,
|
VersionAvailable: version !== latestVersion,
|
||||||
VersionLookup: versionLookup,
|
VersionLookup: versionLookup,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.checkVersionInstalled(this.state.Release, version, versionLookup);
|
this.checkVersionInstalled(this.state.Release, version, versionLookup);
|
||||||
|
};
|
||||||
|
|
||||||
|
axios.get(Constants.RELEASES_URL)
|
||||||
|
.then(response => {
|
||||||
|
const versionLookup = {
|
||||||
|
Alpha: response.data.Versions.Alpha[this.state.Platform],
|
||||||
|
Beta: response.data.Versions.Beta[this.state.Platform],
|
||||||
|
RC: response.data.Versions.RC[this.state.Platform],
|
||||||
|
Release: response.data.Versions.Release[this.state.Platform],
|
||||||
|
};
|
||||||
|
const locationsLookup = {
|
||||||
|
...response.data.Locations[this.state.Platform],
|
||||||
|
};
|
||||||
|
|
||||||
|
window.localStorage.setItem('releases', JSON.stringify({
|
||||||
|
LocationsLookup: locationsLookup,
|
||||||
|
VersionLookup: versionLookup
|
||||||
|
}));
|
||||||
|
|
||||||
|
doUpdate(locationsLookup, versionLookup);
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
const releases = window.localStorage.getItem('releases');
|
||||||
|
if (releases && (releases.length > 0)) {
|
||||||
|
const obj = JSON.parse(releases);
|
||||||
|
const locationsLookup = obj.LocationsLookup;
|
||||||
|
const versionLookup = obj.VersionLookup;
|
||||||
|
|
||||||
|
doUpdate(locationsLookup, versionLookup);
|
||||||
|
} else {
|
||||||
|
// TODO Handle error
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -446,6 +466,10 @@ class App extends Component {
|
|||||||
}
|
}
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
this.setState({
|
||||||
|
UpgradeAvailable: false,
|
||||||
|
UpgradeData: {},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -648,7 +672,7 @@ class App extends Component {
|
|||||||
<table cellPadding={0}
|
<table cellPadding={0}
|
||||||
cellSpacing={0}
|
cellSpacing={0}
|
||||||
style={{margin: 0, padding: 0}}
|
style={{margin: 0, padding: 0}}
|
||||||
width="100%">
|
width='100%'>
|
||||||
<tbody style={{margin: 0, padding: 0}}>
|
<tbody style={{margin: 0, padding: 0}}>
|
||||||
<tr style={{margin: 0, padding: 0}}>
|
<tr style={{margin: 0, padding: 0}}>
|
||||||
<td style={{margin: 0, padding: 0}}
|
<td style={{margin: 0, padding: 0}}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
.MountItem {
|
.MountItem {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import CSSModules from 'react-css-modules';
|
|||||||
import styles from './Box.css';
|
import styles from './Box.css';
|
||||||
|
|
||||||
export default CSSModules((props) => {
|
export default CSSModules((props) => {
|
||||||
const styleList = ['Box'];
|
const styleList = [];
|
||||||
|
styleList.push('Box');
|
||||||
if (props.dxDark) {
|
if (props.dxDark) {
|
||||||
styleList.push('Darker');
|
styleList.push('Darker');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
.UpgradeIcon {
|
.Owner {
|
||||||
display: block;
|
display: block;
|
||||||
margin-right: 2px;
|
margin-right: 2px;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@@ -7,5 +7,20 @@
|
|||||||
border: 0;
|
border: 0;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
opacity: 0.65;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.Owner p {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.UpgradeIcon {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
border: 0;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
opacity: 0.65;
|
||||||
|
}
|
||||||
@@ -2,18 +2,34 @@ import React from 'react';
|
|||||||
import CSSModules from 'react-css-modules';
|
import CSSModules from 'react-css-modules';
|
||||||
import styles from './UpgradeIcon.css';
|
import styles from './UpgradeIcon.css';
|
||||||
import availableImage from '../../assets/images/release_available.png';
|
import availableImage from '../../assets/images/release_available.png';
|
||||||
|
import ReactTooltip from 'react-tooltip';
|
||||||
|
|
||||||
export default CSSModules((props) => {
|
export default CSSModules((props) => {
|
||||||
let style;
|
let style;
|
||||||
|
let style2;
|
||||||
|
let placement = 'left';
|
||||||
|
let toolTipText = 'UI Upgrade Available';
|
||||||
if (props.release) {
|
if (props.release) {
|
||||||
style = {float: 'right', marginRight: '5%', cursor: 'default'};
|
placement='bottom';
|
||||||
|
toolTipText = 'New Release Available';
|
||||||
|
style = {float: 'right', marginRight: '5%', width: '15px', height: '15px', cursor: 'default'};
|
||||||
|
style2 = {width: '15px', height: '15px'};
|
||||||
}
|
}
|
||||||
|
|
||||||
return props.available ?
|
return props
|
||||||
<img alt=''
|
.available ?
|
||||||
onClick={props.clicked}
|
(
|
||||||
src={availableImage}
|
<div style={style}
|
||||||
style={style}
|
styleName='Owner'>
|
||||||
styleName='UpgradeIcon'/> :
|
<p data-tip='' data-for={placement}>
|
||||||
null;
|
<img alt=''
|
||||||
|
onClick={props.clicked}
|
||||||
|
src={availableImage}
|
||||||
|
style={style2}
|
||||||
|
styleName='UpgradeIcon'/>
|
||||||
|
</p>
|
||||||
|
<ReactTooltip id={placement} place={placement}>{toolTipText}</ReactTooltip>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
: null;
|
||||||
}, styles, {allowMultiple: true});
|
}, styles, {allowMultiple: true});
|
||||||
@@ -1,57 +1,60 @@
|
|||||||
export const RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory/raw/master/releases.json';
|
Object.defineProperty(exports, "__esModule", {
|
||||||
export const DATA_LOCATIONS = {
|
value: true
|
||||||
|
});
|
||||||
|
exports.RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory/raw/1.0.0-alpha.2_branch/releases.json';
|
||||||
|
exports.DATA_LOCATIONS = {
|
||||||
linux: '~/.local/repertory/ui',
|
linux: '~/.local/repertory/ui',
|
||||||
darwin: '~/Library/Application Support/repertory/ui',
|
darwin: '~/Library/Application Support/repertory/ui',
|
||||||
win32: '%LOCALAPPDATA%\\repertory\\ui',
|
win32: '%LOCALAPPDATA%\\repertory\\ui'
|
||||||
};
|
};
|
||||||
export const UI_RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory-ui/raw/master/releases.json';
|
exports.UI_RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory-ui/raw/1.0.1_branch/releases.json';
|
||||||
|
|
||||||
export const IPC_Check_Installed = 'check_installed';
|
exports.IPC_Check_Installed = 'check_installed';
|
||||||
export const IPC_Check_Installed_Reply = 'check_installed_reply';
|
exports.IPC_Check_Installed_Reply = 'check_installed_reply';
|
||||||
|
|
||||||
export const IPC_Delete_File = 'delete_file';
|
exports.IPC_Delete_File = 'delete_file';
|
||||||
|
|
||||||
export const IPC_Detect_Mounts = 'detect_mounts';
|
exports.IPC_Detect_Mounts = 'detect_mounts';
|
||||||
export const IPC_Detect_Mounts_Reply = 'detect_mounts_reply';
|
exports.IPC_Detect_Mounts_Reply = 'detect_mounts_reply';
|
||||||
|
|
||||||
export const IPC_Download_File = 'download_file';
|
exports.IPC_Download_File = 'download_file';
|
||||||
export const IPC_Download_File_Complete = 'download_file_complete';
|
exports.IPC_Download_File_Complete = 'download_file_complete';
|
||||||
export const IPC_Download_File_Progress = 'download_file_progress';
|
exports.IPC_Download_File_Progress = 'download_file_progress';
|
||||||
|
|
||||||
export const IPC_Extract_Release = 'extract_release';
|
exports.IPC_Extract_Release = 'extract_release';
|
||||||
export const IPC_Extract_Release_Complete = 'extract_release_complete';
|
exports.IPC_Extract_Release_Complete = 'extract_release_complete';
|
||||||
|
|
||||||
export const IPC_Get_Config = 'get_config';
|
exports.IPC_Get_Config = 'get_config';
|
||||||
export const IPC_Get_Config_Reply = 'get_config_reply';
|
exports.IPC_Get_Config_Reply = 'get_config_reply';
|
||||||
|
|
||||||
export const IPC_Get_Config_Template = 'get_config_template';
|
exports.IPC_Get_Config_Template = 'get_config_template';
|
||||||
export const IPC_Get_Config_Template_Reply = 'get_config_template_reply';
|
exports.IPC_Get_Config_Template_Reply = 'get_config_template_reply';
|
||||||
|
|
||||||
export const IPC_Get_Platform = 'get_platform';
|
exports.IPC_Get_Platform = 'get_platform';
|
||||||
export const IPC_Get_Platform_Reply = 'get_platform_reply';
|
exports.IPC_Get_Platform_Reply = 'get_platform_reply';
|
||||||
|
|
||||||
export const IPC_Get_State = 'get_state';
|
exports.IPC_Get_State = 'get_state';
|
||||||
export const IPC_Get_State_Reply = 'get_state_reply';
|
exports.IPC_Get_State_Reply = 'get_state_reply';
|
||||||
|
|
||||||
export const IPC_Grab_Releases = 'grab_releases';
|
exports.IPC_Grab_Releases = 'grab_releases';
|
||||||
export const IPC_Grab_Releases_Reply = 'grab_releases_reply';
|
exports.IPC_Grab_Releases_Reply = 'grab_releases_reply';
|
||||||
|
|
||||||
export const IPC_Grab_UI_Releases = 'grab_ui_releases';
|
exports.IPC_Grab_UI_Releases = 'grab_ui_releases';
|
||||||
export const IPC_Grab_UI_Releases_Reply = 'grab_ui_releases_reply';
|
exports.IPC_Grab_UI_Releases_Reply = 'grab_ui_releases_reply';
|
||||||
|
|
||||||
export const IPC_Install_Dependency = 'install_dependency';
|
exports.IPC_Install_Dependency = 'install_dependency';
|
||||||
export const IPC_Install_Dependency_Reply = 'install_dependency_reply';
|
exports.IPC_Install_Dependency_Reply = 'install_dependency_reply';
|
||||||
|
|
||||||
export const IPC_Install_Upgrade = 'install_upgrade';
|
exports.IPC_Install_Upgrade = 'install_upgrade';
|
||||||
export const IPC_Install_Upgrade_Reply = 'install_upgrade_reply';
|
exports.IPC_Install_Upgrade_Reply = 'install_upgrade_reply';
|
||||||
|
|
||||||
export const IPC_Mount_Drive = 'mount_drive';
|
exports.IPC_Mount_Drive = 'mount_drive';
|
||||||
export const IPC_Mount_Drive_Reply = 'mount_drive_reply';
|
exports.IPC_Mount_Drive_Reply = 'mount_drive_reply';
|
||||||
|
|
||||||
export const IPC_Save_State = 'save_state';
|
exports.IPC_Save_State = 'save_state';
|
||||||
|
|
||||||
export const IPC_Set_Config_Values = 'set_config_values';
|
exports.IPC_Set_Config_Values = 'set_config_values';
|
||||||
export const IPC_Set_Config_Values_Reply = 'set_config_values_reply';
|
exports.IPC_Set_Config_Values_Reply = 'set_config_values_reply';
|
||||||
|
|
||||||
export const IPC_Unmount_Drive = 'unmount_drive';
|
exports.IPC_Unmount_Drive = 'unmount_drive';
|
||||||
export const IPC_Unmount_Drive_Reply = 'unmount_drive_reply';
|
exports.IPC_Unmount_Drive_Reply = 'unmount_drive_reply';
|
||||||
@@ -3,10 +3,11 @@ import styles from './Configuration.css';
|
|||||||
import Box from '../../components/UI/Box/Box';
|
import Box from '../../components/UI/Box/Box';
|
||||||
import Button from '../../components/UI/Button/Button';
|
import Button from '../../components/UI/Button/Button';
|
||||||
import ConfigurationItem from '../../components/ConfigurationItem/ConfigurationItem';
|
import ConfigurationItem from '../../components/ConfigurationItem/ConfigurationItem';
|
||||||
import * as Constants from '../../constants';
|
|
||||||
import CSSModules from 'react-css-modules';
|
import CSSModules from 'react-css-modules';
|
||||||
import Modal from '../../components/UI/Modal/Modal';
|
import Modal from '../../components/UI/Modal/Modal';
|
||||||
|
|
||||||
|
const Constants = require('../../constants');
|
||||||
|
|
||||||
let ipcRenderer = null;
|
let ipcRenderer = null;
|
||||||
if (!process.versions.hasOwnProperty('electron')) {
|
if (!process.versions.hasOwnProperty('electron')) {
|
||||||
ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null);
|
ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
.MountItems {
|
.MountItems {
|
||||||
margin-top: 10px;
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Component} from 'react';
|
import {Component} from 'react';
|
||||||
import * as Constants from '../../constants';
|
|
||||||
import CSSModules from 'react-css-modules';
|
import CSSModules from 'react-css-modules';
|
||||||
import styles from './MountItems.css';
|
import styles from './MountItems.css';
|
||||||
import MountItem from '../../components/MountItem/MountItem';
|
import MountItem from '../../components/MountItem/MountItem';
|
||||||
import {IPC_Detect_Mounts} from "../../constants";
|
|
||||||
import {IPC_Mount_Drive} from "../../constants";
|
const Constants = require('../../constants');
|
||||||
import {IPC_Unmount_Drive} from "../../constants";
|
|
||||||
|
|
||||||
let ipcRenderer = null;
|
let ipcRenderer = null;
|
||||||
if (!process.versions.hasOwnProperty('electron')) {
|
if (!process.versions.hasOwnProperty('electron')) {
|
||||||
@@ -50,7 +48,7 @@ class MountItems extends Component {
|
|||||||
|
|
||||||
detectMounts = ()=> {
|
detectMounts = ()=> {
|
||||||
this.props.mountsBusy(true);
|
this.props.mountsBusy(true);
|
||||||
ipcRenderer.send(IPC_Detect_Mounts, {
|
ipcRenderer.send(Constants.IPC_Detect_Mounts, {
|
||||||
Directory: this.props.directory,
|
Directory: this.props.directory,
|
||||||
Version: this.props.version,
|
Version: this.props.version,
|
||||||
});
|
});
|
||||||
@@ -78,14 +76,14 @@ class MountItems extends Component {
|
|||||||
this.props.mountsBusy(true);
|
this.props.mountsBusy(true);
|
||||||
|
|
||||||
if (mount) {
|
if (mount) {
|
||||||
ipcRenderer.send(IPC_Mount_Drive, {
|
ipcRenderer.send(Constants.IPC_Mount_Drive, {
|
||||||
Directory: this.props.directory,
|
Directory: this.props.directory,
|
||||||
Location: location,
|
Location: location,
|
||||||
StorageType: storageType,
|
StorageType: storageType,
|
||||||
Version: this.props.version,
|
Version: this.props.version,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
ipcRenderer.send(IPC_Unmount_Drive, {
|
ipcRenderer.send(Constants.IPC_Unmount_Drive, {
|
||||||
Directory: this.props.directory,
|
Directory: this.props.directory,
|
||||||
Location: location,
|
Location: location,
|
||||||
PID: pid,
|
PID: pid,
|
||||||
|
|||||||
Reference in New Issue
Block a user