[Added tooltips] [IPC constants]
This commit is contained in:
52
src/App.js
52
src/App.js
@@ -1,5 +1,4 @@
|
||||
import React, {Component} from 'react';
|
||||
import * as Constants from './constants';
|
||||
import axios from 'axios';
|
||||
import styles from './App.css';
|
||||
import Box from './components/UI/Box/Box';
|
||||
@@ -15,6 +14,7 @@ import MountItems from './containers/MountItems/MountItems';
|
||||
import UpgradeIcon from './components/UpgradeIcon/UpgradeIcon';
|
||||
import UpgradeUI from './components/UpgradeUI/UpgradeUI';
|
||||
|
||||
const Constants = require('./constants');
|
||||
const Scheduler = require('node-schedule');
|
||||
|
||||
let ipcRenderer = null;
|
||||
@@ -399,18 +399,7 @@ class App extends Component {
|
||||
};
|
||||
|
||||
onGrabReleasesReply = ()=> {
|
||||
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],
|
||||
};
|
||||
|
||||
const doUpdate = (locationsLookup, versionLookup) => {
|
||||
const latestVersion = versionLookup[this.state.ReleaseTypes[this.state.Release]].length - 1;
|
||||
let version = this.state.Version;
|
||||
if (version === -1) {
|
||||
@@ -424,9 +413,40 @@ class App extends Component {
|
||||
VersionAvailable: version !== latestVersion,
|
||||
VersionLookup: 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 => {
|
||||
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 => {
|
||||
console.log(error);
|
||||
this.setState({
|
||||
UpgradeAvailable: false,
|
||||
UpgradeData: {},
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -648,7 +672,7 @@ class App extends Component {
|
||||
<table cellPadding={0}
|
||||
cellSpacing={0}
|
||||
style={{margin: 0, padding: 0}}
|
||||
width="100%">
|
||||
width='100%'>
|
||||
<tbody style={{margin: 0, padding: 0}}>
|
||||
<tr style={{margin: 0, padding: 0}}>
|
||||
<td style={{margin: 0, padding: 0}}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
.MountItem {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@ import CSSModules from 'react-css-modules';
|
||||
import styles from './Box.css';
|
||||
|
||||
export default CSSModules((props) => {
|
||||
const styleList = ['Box'];
|
||||
const styleList = [];
|
||||
styleList.push('Box');
|
||||
if (props.dxDark) {
|
||||
styleList.push('Darker');
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.UpgradeIcon {
|
||||
.Owner {
|
||||
display: block;
|
||||
margin-right: 2px;
|
||||
padding: 0;
|
||||
@@ -7,5 +7,20 @@
|
||||
border: 0;
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.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 styles from './UpgradeIcon.css';
|
||||
import availableImage from '../../assets/images/release_available.png';
|
||||
import ReactTooltip from 'react-tooltip';
|
||||
|
||||
export default CSSModules((props) => {
|
||||
let style;
|
||||
let style2;
|
||||
let placement = 'left';
|
||||
let toolTipText = 'UI Upgrade Available';
|
||||
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 ?
|
||||
<img alt=''
|
||||
onClick={props.clicked}
|
||||
src={availableImage}
|
||||
style={style}
|
||||
styleName='UpgradeIcon'/> :
|
||||
null;
|
||||
return props
|
||||
.available ?
|
||||
(
|
||||
<div style={style}
|
||||
styleName='Owner'>
|
||||
<p data-tip='' data-for={placement}>
|
||||
<img alt=''
|
||||
onClick={props.clicked}
|
||||
src={availableImage}
|
||||
style={style2}
|
||||
styleName='UpgradeIcon'/>
|
||||
</p>
|
||||
<ReactTooltip id={placement} place={placement}>{toolTipText}</ReactTooltip>
|
||||
</div>
|
||||
)
|
||||
: null;
|
||||
}, styles, {allowMultiple: true});
|
||||
@@ -1,57 +1,60 @@
|
||||
export const RELEASES_URL = 'https://bitbucket.org/blockstorage/repertory/raw/master/releases.json';
|
||||
export const DATA_LOCATIONS = {
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
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',
|
||||
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';
|
||||
export const IPC_Check_Installed_Reply = 'check_installed_reply';
|
||||
exports.IPC_Check_Installed = 'check_installed';
|
||||
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';
|
||||
export const IPC_Detect_Mounts_Reply = 'detect_mounts_reply';
|
||||
exports.IPC_Detect_Mounts = 'detect_mounts';
|
||||
exports.IPC_Detect_Mounts_Reply = 'detect_mounts_reply';
|
||||
|
||||
export const IPC_Download_File = 'download_file';
|
||||
export const IPC_Download_File_Complete = 'download_file_complete';
|
||||
export const IPC_Download_File_Progress = 'download_file_progress';
|
||||
exports.IPC_Download_File = 'download_file';
|
||||
exports.IPC_Download_File_Complete = 'download_file_complete';
|
||||
exports.IPC_Download_File_Progress = 'download_file_progress';
|
||||
|
||||
export const IPC_Extract_Release = 'extract_release';
|
||||
export const IPC_Extract_Release_Complete = 'extract_release_complete';
|
||||
exports.IPC_Extract_Release = 'extract_release';
|
||||
exports.IPC_Extract_Release_Complete = 'extract_release_complete';
|
||||
|
||||
export const IPC_Get_Config = 'get_config';
|
||||
export const IPC_Get_Config_Reply = 'get_config_reply';
|
||||
exports.IPC_Get_Config = 'get_config';
|
||||
exports.IPC_Get_Config_Reply = 'get_config_reply';
|
||||
|
||||
export const IPC_Get_Config_Template = 'get_config_template';
|
||||
export const IPC_Get_Config_Template_Reply = 'get_config_template_reply';
|
||||
exports.IPC_Get_Config_Template = 'get_config_template';
|
||||
exports.IPC_Get_Config_Template_Reply = 'get_config_template_reply';
|
||||
|
||||
export const IPC_Get_Platform = 'get_platform';
|
||||
export const IPC_Get_Platform_Reply = 'get_platform_reply';
|
||||
exports.IPC_Get_Platform = 'get_platform';
|
||||
exports.IPC_Get_Platform_Reply = 'get_platform_reply';
|
||||
|
||||
export const IPC_Get_State = 'get_state';
|
||||
export const IPC_Get_State_Reply = 'get_state_reply';
|
||||
exports.IPC_Get_State = 'get_state';
|
||||
exports.IPC_Get_State_Reply = 'get_state_reply';
|
||||
|
||||
export const IPC_Grab_Releases = 'grab_releases';
|
||||
export const IPC_Grab_Releases_Reply = 'grab_releases_reply';
|
||||
exports.IPC_Grab_Releases = 'grab_releases';
|
||||
exports.IPC_Grab_Releases_Reply = 'grab_releases_reply';
|
||||
|
||||
export const IPC_Grab_UI_Releases = 'grab_ui_releases';
|
||||
export const IPC_Grab_UI_Releases_Reply = 'grab_ui_releases_reply';
|
||||
exports.IPC_Grab_UI_Releases = 'grab_ui_releases';
|
||||
exports.IPC_Grab_UI_Releases_Reply = 'grab_ui_releases_reply';
|
||||
|
||||
export const IPC_Install_Dependency = 'install_dependency';
|
||||
export const IPC_Install_Dependency_Reply = 'install_dependency_reply';
|
||||
exports.IPC_Install_Dependency = 'install_dependency';
|
||||
exports.IPC_Install_Dependency_Reply = 'install_dependency_reply';
|
||||
|
||||
export const IPC_Install_Upgrade = 'install_upgrade';
|
||||
export const IPC_Install_Upgrade_Reply = 'install_upgrade_reply';
|
||||
exports.IPC_Install_Upgrade = 'install_upgrade';
|
||||
exports.IPC_Install_Upgrade_Reply = 'install_upgrade_reply';
|
||||
|
||||
export const IPC_Mount_Drive = 'mount_drive';
|
||||
export const IPC_Mount_Drive_Reply = 'mount_drive_reply';
|
||||
exports.IPC_Mount_Drive = 'mount_drive';
|
||||
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';
|
||||
export const IPC_Set_Config_Values_Reply = 'set_config_values_reply';
|
||||
exports.IPC_Set_Config_Values = 'set_config_values';
|
||||
exports.IPC_Set_Config_Values_Reply = 'set_config_values_reply';
|
||||
|
||||
export const IPC_Unmount_Drive = 'unmount_drive';
|
||||
export const IPC_Unmount_Drive_Reply = 'unmount_drive_reply';
|
||||
exports.IPC_Unmount_Drive = 'unmount_drive';
|
||||
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 Button from '../../components/UI/Button/Button';
|
||||
import ConfigurationItem from '../../components/ConfigurationItem/ConfigurationItem';
|
||||
import * as Constants from '../../constants';
|
||||
import CSSModules from 'react-css-modules';
|
||||
import Modal from '../../components/UI/Modal/Modal';
|
||||
|
||||
const Constants = require('../../constants');
|
||||
|
||||
let ipcRenderer = null;
|
||||
if (!process.versions.hasOwnProperty('electron')) {
|
||||
ipcRenderer = ((window && window.require) ? window.require('electron').ipcRenderer : null);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
.MountItems {
|
||||
margin-top: 10px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
width: 100%;
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
import React from 'react';
|
||||
import {Component} from 'react';
|
||||
import * as Constants from '../../constants';
|
||||
import CSSModules from 'react-css-modules';
|
||||
import styles from './MountItems.css';
|
||||
import MountItem from '../../components/MountItem/MountItem';
|
||||
import {IPC_Detect_Mounts} from "../../constants";
|
||||
import {IPC_Mount_Drive} from "../../constants";
|
||||
import {IPC_Unmount_Drive} from "../../constants";
|
||||
|
||||
const Constants = require('../../constants');
|
||||
|
||||
let ipcRenderer = null;
|
||||
if (!process.versions.hasOwnProperty('electron')) {
|
||||
@@ -50,7 +48,7 @@ class MountItems extends Component {
|
||||
|
||||
detectMounts = ()=> {
|
||||
this.props.mountsBusy(true);
|
||||
ipcRenderer.send(IPC_Detect_Mounts, {
|
||||
ipcRenderer.send(Constants.IPC_Detect_Mounts, {
|
||||
Directory: this.props.directory,
|
||||
Version: this.props.version,
|
||||
});
|
||||
@@ -78,14 +76,14 @@ class MountItems extends Component {
|
||||
this.props.mountsBusy(true);
|
||||
|
||||
if (mount) {
|
||||
ipcRenderer.send(IPC_Mount_Drive, {
|
||||
ipcRenderer.send(Constants.IPC_Mount_Drive, {
|
||||
Directory: this.props.directory,
|
||||
Location: location,
|
||||
StorageType: storageType,
|
||||
Version: this.props.version,
|
||||
});
|
||||
} else {
|
||||
ipcRenderer.send(IPC_Unmount_Drive, {
|
||||
ipcRenderer.send(Constants.IPC_Unmount_Drive, {
|
||||
Directory: this.props.directory,
|
||||
Location: location,
|
||||
PID: pid,
|
||||
|
||||
Reference in New Issue
Block a user