Skip to content

Commit

Permalink
Updated node-misrcon dep and fixed some errors caused by the update, …
Browse files Browse the repository at this point in the history
…ran prettier on a few files
  • Loading branch information
csprance committed Jan 24, 2019
1 parent ed445ee commit 5330676
Show file tree
Hide file tree
Showing 20 changed files with 10,356 additions and 204 deletions.
107 changes: 77 additions & 30 deletions app/actions/serverActions.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ import * as misrcon from 'node-misrcon';

import * as actionType from '../constants/ActionTypes';


// // // // // // // // //
// initialData Getter
// // // // // // // // //
export function fetchingServerData() {
return {
type: actionType.FETCHING_ALL_SERVER_DATA,
type: actionType.FETCHING_ALL_SERVER_DATA
};
}
export function recievedServerData(data) {
Expand All @@ -25,12 +24,13 @@ export function recievedServerData(data) {
export function getInitialData() {
return (dispatch, getState) => {
dispatch(fetchingServerData());
misrcon.getAllServerData({...getState().credentials.active})
.then((res) => {
misrcon
.getAllServerData({ ...getState().credentials.active })
.then(res => {
dispatch(recievedServerData(res));
return null;
})
.catch((e) => {
.catch(e => {
throw e;
});
};
Expand All @@ -50,20 +50,32 @@ export function fetchingStatus() {
type: actionType.FETCHING_SERVER_STATUS
};
}
export function fetchingFail() {
return {
type: actionType.FETCHING_FAIL
};
}
export function getStatus() {
return (dispatch, getState) => {
dispatch(fetchingStatus());
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: 'status'})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: 'status'
})
.then(statusResponseString => {
dispatch(updateStatus(misrcon.parseStatusResponseToJs(statusResponseString)));
dispatch(
updateStatus(misrcon.parseStatus(statusResponseString))
);
return null;
})
.catch(() => {
.catch(e => {
console.log(e);
dispatch(fetchingFail());
});
};
}


// // // // // // // // //
// Whitelist
// // // // // // // // //
Expand All @@ -81,39 +93,57 @@ export function fetchingWhitelist() {
export function getWhitelist() {
return (dispatch, getState) => {
dispatch(fetchingWhitelist());
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: 'mis_whitelist_status'})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: 'mis_whitelist_status'
})
.then(whitelistResponseString => {
dispatch(updateWhitelist(misrcon.parseWhitelistResponseToJs(whitelistResponseString)));
dispatch(
updateWhitelist(
misrcon.parseWhitelist(whitelistResponseString)
)
);
return null;
})
.catch(() => {
.catch(e => {
console.log(e);
dispatch(fetchingFail());
});
};
}
export function whitelistPlayer(steamid) {
return (dispatch, getState) => {
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: `mis_whitelist_add ${steamid}`})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: `mis_whitelist_add ${steamid}`
})
.then(() => {
dispatch(getWhitelist());
return null;
})
.catch(() => {
.catch(e => {
console.log(e);
dispatch(fetchingFail());
});
};
}
export function unWhitelistPlayer(steamid) {
return (dispatch, getState) => {
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: `mis_whitelist_remove ${steamid}`})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: `mis_whitelist_remove ${steamid}`
})
.then(() => {
dispatch(getWhitelist());
return null;
})
.catch(() => {
});
.catch(() => {});
};
}


// // // // // // // // //
// Ban
// // // // // // // // //
Expand All @@ -131,35 +161,49 @@ export function fetchingBanList() {
export function getBanList() {
return (dispatch, getState) => {
dispatch(fetchingBanList());
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: 'mis_ban_status'})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: 'mis_ban_status'
})
.then(banListResponseString => {
dispatch(updateBanList(misrcon.parseBanListResponseToJs(banListResponseString)));
dispatch(
updateBanList(misrcon.parseBanList(banListResponseString))
);
return null;
})
.catch(() => {
.catch(e => {
console.log(e);
dispatch(fetchingFail());
});
};
}
export function banPlayer(steamid) {
return (dispatch, getState) => {
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: `mis_ban_steamid ${steamid}`})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: `mis_ban_steamid ${steamid}`
})
.then(() => {
dispatch(getBanList());
return null;
})
.catch(() => {
});
.catch(() => {});
};
}
export function unBanPlayer(steamid) {
return (dispatch, getState) => {
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: `mis_ban_remove ${steamid}`})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: `mis_ban_remove ${steamid}`
})
.then(() => {
dispatch(getBanList());
return null;
})
.catch(() => {
});
.catch(() => {});
};
}

Expand All @@ -168,13 +212,16 @@ export function unBanPlayer(steamid) {
// // // // // // // // //
export function kickPlayer(steamid) {
return (dispatch, getState) => {
misrcon.sendRCONCommandToServer({...getState().credentials.active, command: `mis_kick ${steamid}`})
misrcon
.sendRCONCommandToServer({
...getState().credentials.active,
command: `mis_kick ${steamid}`
})
.then(() => {
// add it to status
dispatch(getStatus());
return null;
})
.catch(() => {
});
.catch(() => {});
};
}
Binary file modified app/assets/fonts/Roboto-BlackItalic.ttf
Binary file not shown.
14 changes: 8 additions & 6 deletions app/components/BansView/BansView.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,11 @@ export default class BansView extends Component {
/>
<Spacer />
<FloatingActionButton onTouchTap={this.getBanList} secondary>
{this.props.server.loading === true
? <AnimatedRefresh />
: <RefreshIcon />}
{this.props.server.loading === true ? (
<AnimatedRefresh />
) : (
<RefreshIcon />
)}
</FloatingActionButton>
<Spacer />
</Actions>
Expand Down Expand Up @@ -145,7 +147,7 @@ const AnimatedRefresh = styled(RefreshIcon)`
const Container = styled.div`
width: 100%;
display: flex;
flex-direction: column;
flex-direction: column;
`;

const SearchBar = styled(TextField)`
Expand All @@ -156,14 +158,14 @@ const Actions = styled.div`
height: 100px;
width: 100%;
min-height: 100px;
display: flex;
display: flex;
align-items: center;
justify-content: center;
padding-bottom: 25px;
flex-shrink: 1;
`;

const PlayerList = styled.div`
const PlayerList = styled.div`
width: 100%;
display: flex;
flex-flow: row wrap;
Expand Down
5 changes: 2 additions & 3 deletions app/components/ConsoleView/ConsoleView.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,8 @@ class ConsoleView extends Component {
else if (this.askingForHelp(text))
// help [subject] // specific help docs
this.getHelpOn(text.split(' ')[1]);
else
// send command to server
this.sendCommand(text);
// send command to server
else this.sendCommand(text);
} catch (e) {
log('error', e);
this.console.log(String(e));
Expand Down
10 changes: 5 additions & 5 deletions app/components/LoginView/LoginView.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class LoginView extends Component {

const Container = styled.div`
align-items: center;
justify-content:center;
justify-content: center;
display: flex;
flex-grow:1;
flex-grow: 1;
flex-direction: row;
`;

Expand All @@ -94,12 +94,12 @@ const LoginBox = styled(Paper)`

const LoginBoxHeader = styled.div`
position: relative;
padding-top:15px;
padding-bottom:15px;
padding-top: 15px;
padding-bottom: 15px;
background: ${darkGrey};
color: white;
width: 100%;
text-align:center;
text-align: center;
`;

const Content = styled.div`
Expand Down
14 changes: 7 additions & 7 deletions app/components/LoginView/ServerAddOverlay.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,28 +157,28 @@ const Container = styled.div`
display: flex;
left: ${props => (props.show ? 0 : '900px')};
background: ${lightGray};
transition-duration: .5s;
transition-duration: 0.5s;
z-index: 10;
position: absolute;
top: 0;
right: 0;
bottom: 0;
min-width:100%;
min-width: 100%;
align-items: center;
justify-content:flex-start;
justify-content: flex-start;
flex-align: start;
flex-grow:1;
flex-grow: 1;
flex-direction: column;
`;

const LoginBoxHeader = styled.div`
position: relative;
padding-top:15px;
padding-bottom:15px;
padding-top: 15px;
padding-bottom: 15px;
background: ${darkGrey};
color: white;
width: 100%;
text-align:center;
text-align: center;
`;

const ActionButtons = styled.div`
Expand Down
5 changes: 3 additions & 2 deletions app/components/LoginView/ServerSelectCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ const ServerSelectCard = props => {
<Container className="server-select">
<ServerDetails>
<ServerName>{props.name}</ServerName>
<ServerIp>{props.ip}:{props.port}</ServerIp>
<ServerIp>
{props.ip}:{props.port}
</ServerIp>
</ServerDetails>

<IconButton onTouchTap={removeCredentials} touch tooltip={'Delete'}>
Expand All @@ -38,7 +40,6 @@ const ServerSelectCard = props => {
<IconButton onTouchTap={useCredentials} touch tooltip={'Connect'}>
<PlayArrowIcon />
</IconButton>

</Container>
);
};
Expand Down
Loading

0 comments on commit 5330676

Please sign in to comment.