Store prefs
This commit is contained in:
parent
5a07ba5f56
commit
851c2f1327
|
@ -14,5 +14,7 @@ module.exports = createActionCreators({
|
||||||
|
|
||||||
MOVE_SINK_INPUT: (sinkInputIndex, destSinkIndex) => ({ sinkInputIndex, destSinkIndex }),
|
MOVE_SINK_INPUT: (sinkInputIndex, destSinkIndex) => ({ sinkInputIndex, destSinkIndex }),
|
||||||
MOVE_SOURCE_OUTPUT: (sourceOutputIndex, destSourceIndex) => ({ sourceOutputIndex, destSourceIndex }),
|
MOVE_SOURCE_OUTPUT: (sourceOutputIndex, destSourceIndex) => ({ sourceOutputIndex, destSourceIndex }),
|
||||||
|
|
||||||
|
KILL_CLIENT_BY_INDEX: clientIndex => ({ clientIndex }),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ const {
|
||||||
values,
|
values,
|
||||||
flatten,
|
flatten,
|
||||||
memoizeWith,
|
memoizeWith,
|
||||||
pick,
|
path,
|
||||||
filter,
|
filter,
|
||||||
} = require('ramda');
|
} = require('ramda');
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ const {
|
||||||
|
|
||||||
Edge.calculateOffset = function (nodeSize, source, target) {
|
Edge.calculateOffset = function (nodeSize, source, target) {
|
||||||
const arrowVector = math.matrix([ target.x - source.x, target.y - source.y ]);
|
const arrowVector = math.matrix([ target.x - source.x, target.y - source.y ]);
|
||||||
const offsetLength = Math.max(0, Math.min((0.85 * size), (math.norm(arrowVector) / 2) - 40));
|
const offsetLength = Math.max(0, Math.min((0.75 * size), (math.norm(arrowVector) / 2) - 40));
|
||||||
const offsetVector = math.dotMultiply(arrowVector, (offsetLength / math.norm(arrowVector)) || 0);
|
const offsetVector = math.dotMultiply(arrowVector, (offsetLength / math.norm(arrowVector)) || 0);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -94,12 +94,7 @@ const graphConfig = {
|
||||||
viewBox: '0 0 50 50',
|
viewBox: '0 0 50 50',
|
||||||
id: 'sinkInput',
|
id: 'sinkInput',
|
||||||
key: '0',
|
key: '0',
|
||||||
}, r.circle({
|
}),
|
||||||
cx: '25',
|
|
||||||
cy: '25',
|
|
||||||
r: '8',
|
|
||||||
fill: 'currentColor',
|
|
||||||
})),
|
|
||||||
},
|
},
|
||||||
sourceOutput: {
|
sourceOutput: {
|
||||||
shapeId: '#sourceOutput',
|
shapeId: '#sourceOutput',
|
||||||
|
@ -107,12 +102,7 @@ const graphConfig = {
|
||||||
viewBox: '0 0 50 50',
|
viewBox: '0 0 50 50',
|
||||||
id: 'sourceOutput',
|
id: 'sourceOutput',
|
||||||
key: '0',
|
key: '0',
|
||||||
}, r.circle({
|
}),
|
||||||
cx: '25',
|
|
||||||
cy: '25',
|
|
||||||
r: '8',
|
|
||||||
fill: 'currentColor',
|
|
||||||
})),
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -173,9 +163,9 @@ const renderDefs = () => r(React.Fragment, [
|
||||||
})),
|
})),
|
||||||
|
|
||||||
r('marker', {
|
r('marker', {
|
||||||
id: 'start-arrow',
|
id: 'my-source-arrow',
|
||||||
viewBox: '0 -8 16 16',
|
viewBox: '0 -8 16 16',
|
||||||
refX: '8',
|
refX: '16',
|
||||||
markerWidth: '16',
|
markerWidth: '16',
|
||||||
markerHeight: '16',
|
markerHeight: '16',
|
||||||
orient: 'auto',
|
orient: 'auto',
|
||||||
|
@ -183,6 +173,18 @@ const renderDefs = () => r(React.Fragment, [
|
||||||
className: 'arrow',
|
className: 'arrow',
|
||||||
d: 'M 16,-8 L 0,0 L 16,8',
|
d: 'M 16,-8 L 0,0 L 16,8',
|
||||||
})),
|
})),
|
||||||
|
|
||||||
|
r('marker', {
|
||||||
|
id: 'my-sink-arrow',
|
||||||
|
viewBox: '0 -8 16 16',
|
||||||
|
refX: '16',
|
||||||
|
markerWidth: '16',
|
||||||
|
markerHeight: '16',
|
||||||
|
orient: 'auto',
|
||||||
|
}, r.path({
|
||||||
|
className: 'arrow',
|
||||||
|
d: 'M 0,-8 L 16,0 L 0,8',
|
||||||
|
})),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const renderNode = (nodeRef, data, key, selected, hovered) => r({
|
const renderNode = (nodeRef, data, key, selected, hovered) => r({
|
||||||
|
@ -220,6 +222,7 @@ const SourceText = ({ dgo, pai, props }) => r.div([
|
||||||
|
|
||||||
const ClientText = ({ dgo, pai, props }) => r.div([
|
const ClientText = ({ dgo, pai, props }) => r.div([
|
||||||
r.div({
|
r.div({
|
||||||
|
title: path('properties.application.process.binary'.split('.'), pai),
|
||||||
}, pai.name),
|
}, pai.name),
|
||||||
r(DebugText, { dgo, pai, props }),
|
r(DebugText, { dgo, pai, props }),
|
||||||
]);
|
]);
|
||||||
|
@ -258,6 +261,7 @@ const afterRenderEdge = (id, element, edge, edgeContainer) => {
|
||||||
if (edge.type) {
|
if (edge.type) {
|
||||||
edgeContainer.classList.add(edge.type);
|
edgeContainer.classList.add(edge.type);
|
||||||
}
|
}
|
||||||
|
//const edgeOverlay = edgeContainer.querySelector('.edge-overlay-path');
|
||||||
};
|
};
|
||||||
|
|
||||||
class Graph extends React.Component {
|
class Graph extends React.Component {
|
||||||
|
@ -299,7 +303,10 @@ class Graph extends React.Component {
|
||||||
onUpdateNode() {
|
onUpdateNode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDeleteNode() {
|
onDeleteNode(selected) {
|
||||||
|
if (selected.type === 'client') {
|
||||||
|
this.props.killClientByIndex(selected.index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onSelectEdge() {
|
onSelectEdge() {
|
||||||
|
@ -316,7 +323,8 @@ class Graph extends React.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDeleteEdge() {}
|
onDeleteEdge() {
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const edges = map(paiToEdge, flatten(map(values, [
|
const edges = map(paiToEdge, flatten(map(values, [
|
||||||
|
@ -392,7 +400,7 @@ class Graph extends React.Component {
|
||||||
|
|
||||||
showGraphControls: false,
|
showGraphControls: false,
|
||||||
|
|
||||||
edgeArrowSize: 16,
|
edgeArrowSize: 128,
|
||||||
|
|
||||||
backgroundFillId: '#background-pattern',
|
backgroundFillId: '#background-pattern',
|
||||||
|
|
||||||
|
@ -411,8 +419,5 @@ module.exports = connect(
|
||||||
|
|
||||||
preferences: state.preferences,
|
preferences: state.preferences,
|
||||||
}),
|
}),
|
||||||
dispatch => bindActionCreators(pick([
|
dispatch => bindActionCreators(pulseActions, dispatch),
|
||||||
'moveSinkInput',
|
|
||||||
'moveSourceOutput',
|
|
||||||
], pulseActions), dispatch),
|
|
||||||
)(Graph);
|
)(Graph);
|
||||||
|
|
|
@ -79,7 +79,7 @@ const Preferences = withStateHandlers(
|
||||||
] : [
|
] : [
|
||||||
r(Button, {
|
r(Button, {
|
||||||
onClick: toggle,
|
onClick: toggle,
|
||||||
}, 'Props'),
|
}, 'Preferences'),
|
||||||
]));
|
]));
|
||||||
|
|
||||||
module.exports = connect(
|
module.exports = connect(
|
||||||
|
|
14
index.css
14
index.css
|
@ -51,7 +51,15 @@ button:active {
|
||||||
.view-wrapper .sourceOutput .edge {
|
.view-wrapper .sourceOutput .edge {
|
||||||
/* marker-end: none; */
|
/* marker-end: none; */
|
||||||
/* marker-start: url(#start-arrow); */
|
/* marker-start: url(#start-arrow); */
|
||||||
marker-end: url(#start-arrow);
|
marker-end: url(#my-source-arrow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.view-wrapper .sinkInput .edge {
|
||||||
|
marker-end: url(#my-sink-arrow);
|
||||||
|
}
|
||||||
|
|
||||||
|
#edge-custom-container .edge {
|
||||||
|
marker-end: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-wrapper .graph .edge {
|
.view-wrapper .graph .edge {
|
||||||
|
@ -90,3 +98,7 @@ button:active {
|
||||||
.checkbox {
|
.checkbox {
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.view-wrapper .graph .edge-mouse-handler {
|
||||||
|
stroke-width: 30px;
|
||||||
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@jakejarrett/gtk-theme": "^1.1.2",
|
"@jakejarrett/gtk-theme": "^1.1.2",
|
||||||
"camelcase": "^5.0.0",
|
"camelcase": "^5.0.0",
|
||||||
|
"electron-store": "^2.0.0",
|
||||||
"mathjs": "^5.2.3",
|
"mathjs": "^5.2.3",
|
||||||
"paclient": "^0.0.2",
|
"paclient": "^0.0.2",
|
||||||
"r-dom": "^2.4.0",
|
"r-dom": "^2.4.0",
|
||||||
|
@ -35,6 +36,7 @@
|
||||||
"redux-actions": "^2.6.4",
|
"redux-actions": "^2.6.4",
|
||||||
"redux-logger": "^3.0.6",
|
"redux-logger": "^3.0.6",
|
||||||
"redux-persist": "^5.10.0",
|
"redux-persist": "^5.10.0",
|
||||||
|
"redux-persist-electron-storage": "^2.0.0",
|
||||||
"redux-promise-middleware": "^5.1.1",
|
"redux-promise-middleware": "^5.1.1",
|
||||||
"redux-thunk": "^2.3.0",
|
"redux-thunk": "^2.3.0",
|
||||||
"remote-redux-devtools": "^0.5.13",
|
"remote-redux-devtools": "^0.5.13",
|
||||||
|
|
|
@ -8,7 +8,7 @@ const { default: thunkMiddleware } = require('redux-thunk');
|
||||||
const { default: createPromiseMiddleware } = require('redux-promise-middleware');
|
const { default: createPromiseMiddleware } = require('redux-promise-middleware');
|
||||||
|
|
||||||
const { persistStore, persistReducer } = require('redux-persist');
|
const { persistStore, persistReducer } = require('redux-persist');
|
||||||
const { default: storage } = require('redux-persist/lib/storage');
|
const createElectronStorage = require('redux-persist-electron-storage');
|
||||||
|
|
||||||
const { reducer, initialState } = require('../reducers');
|
const { reducer, initialState } = require('../reducers');
|
||||||
|
|
||||||
|
@ -16,8 +16,8 @@ const pulseMiddleware = require('./pulse-middleware');
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
key: 'redux-persist',
|
key: 'redux-persist',
|
||||||
whitelist: [ 'localStorage' ],
|
whitelist: [ 'preferences' ],
|
||||||
storage,
|
storage: createElectronStorage(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const dev = process.env.NODE_ENV !== 'production';
|
const dev = process.env.NODE_ENV !== 'production';
|
||||||
|
|
|
@ -77,21 +77,23 @@ module.exports = store => {
|
||||||
|
|
||||||
pa.connect();
|
pa.connect();
|
||||||
|
|
||||||
|
const rethrow = error => {
|
||||||
|
if (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handlePulseActions = handleActions({
|
const handlePulseActions = handleActions({
|
||||||
[pulseActions.moveSinkInput]: (state, { payload: { sinkInputIndex, destSinkIndex } }) => {
|
[pulseActions.moveSinkInput]: (state, { payload: { sinkInputIndex, destSinkIndex } }) => {
|
||||||
pa.moveSinkInput(sinkInputIndex, destSinkIndex, error => {
|
pa.moveSinkInput(sinkInputIndex, destSinkIndex, rethrow);
|
||||||
if (error) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return state;
|
return state;
|
||||||
},
|
},
|
||||||
[pulseActions.moveSourceOutput]: (state, { payload: { sourceOutputIndex, destSourceIndex } }) => {
|
[pulseActions.moveSourceOutput]: (state, { payload: { sourceOutputIndex, destSourceIndex } }) => {
|
||||||
pa.moveSourceOutput(sourceOutputIndex, destSourceIndex, error => {
|
pa.moveSourceOutput(sourceOutputIndex, destSourceIndex, rethrow);
|
||||||
if (error) {
|
return state;
|
||||||
throw error;
|
},
|
||||||
}
|
[pulseActions.killClientByIndex]: (state, { payload: { clientIndex } }) => {
|
||||||
});
|
pa.killClientByIndex(clientIndex, rethrow);
|
||||||
return state;
|
return state;
|
||||||
},
|
},
|
||||||
}, null);
|
}, null);
|
||||||
|
|
25
yarn.lock
25
yarn.lock
|
@ -1276,6 +1276,17 @@ concordance@^3.0.0:
|
||||||
semver "^5.3.0"
|
semver "^5.3.0"
|
||||||
well-known-symbols "^1.0.0"
|
well-known-symbols "^1.0.0"
|
||||||
|
|
||||||
|
conf@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/conf/-/conf-2.0.0.tgz#43f7e282b32faca31f4d18bf279d6841ad657d5a"
|
||||||
|
integrity sha512-iCLzBsGFi8S73EANsEJZz0JnJ/e5VZef/kSaxydYZLAvw0rFNAUx5R7K5leC/CXXR2mZfXWhUvcZOO/dM2D5xg==
|
||||||
|
dependencies:
|
||||||
|
dot-prop "^4.1.0"
|
||||||
|
env-paths "^1.0.0"
|
||||||
|
make-dir "^1.0.0"
|
||||||
|
pkg-up "^2.0.0"
|
||||||
|
write-file-atomic "^2.3.0"
|
||||||
|
|
||||||
configstore@^3.0.0:
|
configstore@^3.0.0:
|
||||||
version "3.1.2"
|
version "3.1.2"
|
||||||
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f"
|
resolved "https://registry.yarnpkg.com/configstore/-/configstore-3.1.2.tgz#c6f25defaeef26df12dd33414b001fe81a543f8f"
|
||||||
|
@ -1898,6 +1909,13 @@ electron-download@^4.1.0:
|
||||||
semver "^5.4.1"
|
semver "^5.4.1"
|
||||||
sumchecker "^2.0.2"
|
sumchecker "^2.0.2"
|
||||||
|
|
||||||
|
electron-store@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/electron-store/-/electron-store-2.0.0.tgz#1035cca2a95409d1f54c7466606345852450d64a"
|
||||||
|
integrity sha512-1WCFYHsYvZBqDsoaS0Relnz0rd81ZkBAI0Fgx7Nq2UWU77rSNs1qxm4S6uH7TCZ0bV3LQpJFk7id/is/ZgoOPA==
|
||||||
|
dependencies:
|
||||||
|
conf "^2.0.0"
|
||||||
|
|
||||||
electron@^3.0.8:
|
electron@^3.0.8:
|
||||||
version "3.0.8"
|
version "3.0.8"
|
||||||
resolved "https://registry.yarnpkg.com/electron/-/electron-3.0.8.tgz#7905806ebaead4c693531e11cda6568c32efa7bb"
|
resolved "https://registry.yarnpkg.com/electron/-/electron-3.0.8.tgz#7905806ebaead4c693531e11cda6568c32efa7bb"
|
||||||
|
@ -5183,6 +5201,11 @@ redux-logger@^3.0.6:
|
||||||
dependencies:
|
dependencies:
|
||||||
deep-diff "^0.3.5"
|
deep-diff "^0.3.5"
|
||||||
|
|
||||||
|
redux-persist-electron-storage@^2.0.0:
|
||||||
|
version "2.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/redux-persist-electron-storage/-/redux-persist-electron-storage-2.0.0.tgz#60de80877b97440ba0c52b52776497ce3226d84f"
|
||||||
|
integrity sha512-VHKyYi4+QB/vNbCRnqNt8X9a5AZDqFU6wH524eb9EgbxOI4NIekN2t6crSCw0+eiCxztfETfMBEhfxHE3laKHQ==
|
||||||
|
|
||||||
redux-persist@^5.10.0:
|
redux-persist@^5.10.0:
|
||||||
version "5.10.0"
|
version "5.10.0"
|
||||||
resolved "https://registry.yarnpkg.com/redux-persist/-/redux-persist-5.10.0.tgz#5d8d802c5571e55924efc1c3a9b23575283be62b"
|
resolved "https://registry.yarnpkg.com/redux-persist/-/redux-persist-5.10.0.tgz#5d8d802c5571e55924efc1c3a9b23575283be62b"
|
||||||
|
@ -6533,7 +6556,7 @@ write-file-atomic@^1.1.4:
|
||||||
imurmurhash "^0.1.4"
|
imurmurhash "^0.1.4"
|
||||||
slide "^1.1.5"
|
slide "^1.1.5"
|
||||||
|
|
||||||
write-file-atomic@^2.0.0:
|
write-file-atomic@^2.0.0, write-file-atomic@^2.3.0:
|
||||||
version "2.3.0"
|
version "2.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab"
|
resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.3.0.tgz#1ff61575c2e2a4e8e510d6fa4e243cce183999ab"
|
||||||
integrity sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==
|
integrity sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==
|
||||||
|
|
Loading…
Reference in New Issue
Block a user