interface: finish delete graph integration

This commit is contained in:
Logan Allen 2020-09-21 10:17:12 -05:00
parent f426da1753
commit 6503bb9164
3 changed files with 15 additions and 8 deletions

View File

@ -86,8 +86,9 @@ const removeGraph = (json, state) => {
if (!('graphs' in state)) {
state.graphs = {};
}
let resource = data.resource.ship + '/' + data.resource.name;
let resource = data.ship + '/' + data.name;
delete state.graphs[resource];
state.graphKeys.delete(resource);
}
};

View File

@ -99,7 +99,10 @@ export class LinksApp extends Component {
const autoJoin = () => {
try {
// TODO: graph join
api.graph.joinGraph(
`~${props.match.params.ship}`,
props.match.params.name
);
props.history.push(`/~link/${resource}`);
} catch(err) {
setTimeout(autoJoin, 2000);
@ -121,6 +124,7 @@ export class LinksApp extends Component {
const contactDetails = contacts[resource['group-path']] || {};
const group = groups[resource['group-path']] || new Set([]);
const amOwner = amOwnerOfGroup(resource['group-path']);
const hasGraph = !!graphs[resourcePath];
return (
<Skeleton
@ -138,6 +142,7 @@ export class LinksApp extends Component {
contacts={contacts}
contactDetails={contactDetails}
graphResource={graphKeys.has(resourcePath)}
hasGraph={!!hasGraph}
group={group}
amOwner={amOwner}
resourcePath={resourcePath}

View File

@ -26,8 +26,6 @@ export class SettingsScreen extends Component {
componentDidUpdate() {
const { props, state } = this;
console.log(props.resource);
if (Boolean(state.isLoading) && !props.resource) {
this.setState({
isLoading: false
@ -69,7 +67,6 @@ export class SettingsScreen extends Component {
type: 'Deleting'
});
console.log(props.match.params.name);
props.api.graph.deleteGraph(props.match.params.name);
}
@ -117,12 +114,16 @@ export class SettingsScreen extends Component {
render() {
const { props, state } = this;
const title = props.resource.metadata.title || props.resourcePath;
console.log(props);
if (!props.graphResource || !props.resource.metadata.color) {
if (
(!props.hasGraph || !props.resource.metadata.color)
&& props.graphResource
) {
return <LoadingScreen />;
} else if (!props.graphResource) {
props.history.push('/~link');
return <div></div>;
}
return (