Merge pull request #600 from csduarte/BASH-18
BASH-18 Add configs to show/hide server management and multiteam settings
This commit is contained in:
@@ -24,7 +24,8 @@ const MainPage = createReactClass({
|
||||
initialIndex: PropTypes.number.isRequired,
|
||||
useSpellChecker: PropTypes.bool.isRequired,
|
||||
onSelectSpellCheckerLocale: PropTypes.func.isRequired,
|
||||
deeplinkingUrl: PropTypes.string
|
||||
deeplinkingUrl: PropTypes.string,
|
||||
showAddServerButton: PropTypes.bool.isRequired
|
||||
},
|
||||
|
||||
getInitialState() {
|
||||
@@ -258,6 +259,7 @@ const MainPage = createReactClass({
|
||||
activeKey={this.state.key}
|
||||
onSelect={this.handleSelect}
|
||||
onAddServer={this.addServer}
|
||||
showAddServerButton={this.props.showAddServerButton}
|
||||
/>
|
||||
</Row>
|
||||
);
|
||||
|
@@ -255,6 +255,41 @@ const SettingsPage = createReactClass({
|
||||
},
|
||||
|
||||
render() {
|
||||
const settingsPage = {
|
||||
navbar: {
|
||||
backgroundColor: '#fff'
|
||||
},
|
||||
close: {
|
||||
textDecoration: 'none',
|
||||
position: 'absolute',
|
||||
right: '0',
|
||||
top: '5px',
|
||||
fontSize: '35px',
|
||||
fontWeight: 'normal',
|
||||
color: '#bbb'
|
||||
},
|
||||
heading: {
|
||||
textAlign: 'center',
|
||||
fontSize: '24px',
|
||||
margin: '0',
|
||||
padding: '1em 0'
|
||||
},
|
||||
sectionHeading: {
|
||||
fontSize: '20px',
|
||||
margin: '0',
|
||||
padding: '1em 0',
|
||||
float: 'left'
|
||||
},
|
||||
sectionHeadingLink: {
|
||||
marginTop: '24px',
|
||||
display: 'inline-block',
|
||||
fontSize: '15px'
|
||||
},
|
||||
footer: {
|
||||
padding: '0.4em 0'
|
||||
}
|
||||
};
|
||||
|
||||
var teamsRow = (
|
||||
<Row>
|
||||
<Col md={12}>
|
||||
@@ -267,11 +302,53 @@ const SettingsPage = createReactClass({
|
||||
updateTeam={this.updateTeam}
|
||||
addServer={this.addServer}
|
||||
onTeamClick={backToIndex}
|
||||
allowTeamEdit={this.state.enableTeamModification}
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
|
||||
var serversRow = (
|
||||
<Row>
|
||||
<Col
|
||||
md={10}
|
||||
xs={8}
|
||||
>
|
||||
<h2 style={settingsPage.sectionHeading}>{'Server Management'}</h2>
|
||||
<div className='IndicatorContainer'>
|
||||
<AutoSaveIndicator
|
||||
savingState={this.state.savingState.servers}
|
||||
errorMessage={'Can\'t save your changes. Please try again.'}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
<Col
|
||||
md={2}
|
||||
xs={4}
|
||||
>
|
||||
<p className='text-right'>
|
||||
<a
|
||||
style={settingsPage.sectionHeadingLink}
|
||||
id='addNewServer'
|
||||
href='#'
|
||||
onClick={this.toggleShowTeamForm}
|
||||
>{'⊞ Add new server'}</a>
|
||||
</p>
|
||||
</Col>
|
||||
</Row>
|
||||
);
|
||||
|
||||
var srvMgmt;
|
||||
if (this.state.enableServerManagement || this.state.teams.length === 0) {
|
||||
srvMgmt = (
|
||||
<div>
|
||||
{serversRow}
|
||||
{teamsRow}
|
||||
<hr/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
var options = [];
|
||||
|
||||
// MacOS has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
||||
@@ -404,41 +481,6 @@ const SettingsPage = createReactClass({
|
||||
</Checkbox>);
|
||||
}
|
||||
|
||||
const settingsPage = {
|
||||
navbar: {
|
||||
backgroundColor: '#fff'
|
||||
},
|
||||
close: {
|
||||
textDecoration: 'none',
|
||||
position: 'absolute',
|
||||
right: '0',
|
||||
top: '5px',
|
||||
fontSize: '35px',
|
||||
fontWeight: 'normal',
|
||||
color: '#bbb'
|
||||
},
|
||||
heading: {
|
||||
textAlign: 'center',
|
||||
fontSize: '24px',
|
||||
margin: '0',
|
||||
padding: '1em 0'
|
||||
},
|
||||
sectionHeading: {
|
||||
fontSize: '20px',
|
||||
margin: '0',
|
||||
padding: '1em 0',
|
||||
float: 'left'
|
||||
},
|
||||
sectionHeadingLink: {
|
||||
marginTop: '24px',
|
||||
display: 'inline-block',
|
||||
fontSize: '15px'
|
||||
},
|
||||
footer: {
|
||||
padding: '0.4em 0'
|
||||
}
|
||||
};
|
||||
|
||||
var optionsRow = (options.length > 0) ? (
|
||||
<Row>
|
||||
<Col md={12}>
|
||||
@@ -482,35 +524,7 @@ const SettingsPage = createReactClass({
|
||||
className='settingsPage'
|
||||
style={{paddingTop: '100px'}}
|
||||
>
|
||||
<Row>
|
||||
<Col
|
||||
md={10}
|
||||
xs={8}
|
||||
>
|
||||
<h2 style={settingsPage.sectionHeading}>{'Server Management'}</h2>
|
||||
<div className='IndicatorContainer'>
|
||||
<AutoSaveIndicator
|
||||
savingState={this.state.savingState.servers}
|
||||
errorMessage={'Can\'t save your changes. Please try again.'}
|
||||
/>
|
||||
</div>
|
||||
</Col>
|
||||
<Col
|
||||
md={2}
|
||||
xs={4}
|
||||
>
|
||||
<p className='text-right'>
|
||||
<a
|
||||
style={settingsPage.sectionHeadingLink}
|
||||
id='addNewServer'
|
||||
href='#'
|
||||
onClick={this.toggleShowTeamForm}
|
||||
>{'⊞ Add new server'}</a>
|
||||
</p>
|
||||
</Col>
|
||||
</Row>
|
||||
{ teamsRow }
|
||||
<hr/>
|
||||
{ srvMgmt }
|
||||
{ optionsRow }
|
||||
</Grid>
|
||||
</div>
|
||||
|
@@ -53,17 +53,19 @@ function TabBar(props) {
|
||||
{ badgeDiv }
|
||||
</NavItem>);
|
||||
});
|
||||
tabs.push(
|
||||
<NavItem
|
||||
className='TabBar-addServerButton'
|
||||
key='addServerButton'
|
||||
id='addServerButton'
|
||||
eventKey='addServerButton'
|
||||
title='Add new server'
|
||||
>
|
||||
<Glyphicon glyph='plus'/>
|
||||
</NavItem>
|
||||
);
|
||||
if (props.showAddServerButton === true) {
|
||||
tabs.push(
|
||||
<NavItem
|
||||
className='TabBar-addServerButton'
|
||||
key='addServerButton'
|
||||
id='addServerButton'
|
||||
eventKey='addServerButton'
|
||||
title='Add new server'
|
||||
>
|
||||
<Glyphicon glyph='plus'/>
|
||||
</NavItem>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<Nav
|
||||
className='TabBar'
|
||||
@@ -92,7 +94,8 @@ TabBar.propTypes = {
|
||||
unreadAtActive: PropTypes.array,
|
||||
mentionCounts: PropTypes.array,
|
||||
mentionAtActiveCounts: PropTypes.array,
|
||||
onAddServer: PropTypes.func
|
||||
onAddServer: PropTypes.func,
|
||||
showAddServerButton: PropTypes.bool
|
||||
};
|
||||
|
||||
module.exports = TabBar;
|
||||
|
@@ -116,6 +116,7 @@ ReactDOM.render(
|
||||
useSpellChecker={AppConfig.data.useSpellChecker}
|
||||
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
||||
deeplinkingUrl={deeplinkingUrl}
|
||||
showAddServerButton={AppConfig.data.enableServerManagement}
|
||||
/>,
|
||||
document.getElementById('content')
|
||||
);
|
||||
|
@@ -11,7 +11,8 @@
|
||||
"showUnreadBadge": true,
|
||||
"useSpellChecker": true,
|
||||
"spellCheckerLocale": "en-US",
|
||||
"helpLink": "https://docs.mattermost.com/help/apps/desktop-guide.html"
|
||||
"helpLink": "https://docs.mattermost.com/help/apps/desktop-guide.html",
|
||||
"enableServerManagement": true
|
||||
},
|
||||
"1": {
|
||||
"teams": [],
|
||||
@@ -25,6 +26,7 @@
|
||||
"showUnreadBadge": true,
|
||||
"useSpellChecker": true,
|
||||
"spellCheckerLocale": "en-US",
|
||||
"helpLink": "https://docs.mattermost.com/help/apps/desktop-guide.html"
|
||||
"helpLink": "https://docs.mattermost.com/help/apps/desktop-guide.html",
|
||||
"enableServerManagement": true
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,7 @@ function createTemplate(mainWindow, config, isDev) {
|
||||
var firstMenuName = (process.platform === 'darwin') ? appName : 'File';
|
||||
var template = [];
|
||||
|
||||
const platformAppMenu = process.platform === 'darwin' ? [{
|
||||
var platformAppMenu = process.platform === 'darwin' ? [{
|
||||
label: 'About ' + appName,
|
||||
role: 'about',
|
||||
click() {
|
||||
@@ -30,38 +30,41 @@ function createTemplate(mainWindow, config, isDev) {
|
||||
click() {
|
||||
mainWindow.loadURL(settingsURL);
|
||||
}
|
||||
}, {
|
||||
label: 'Sign in to Another Server',
|
||||
click() {
|
||||
mainWindow.webContents.send('add-server');
|
||||
}
|
||||
}, separatorItem, {
|
||||
role: 'hide'
|
||||
}, {
|
||||
role: 'hideothers'
|
||||
}, {
|
||||
role: 'unhide'
|
||||
}, separatorItem, {
|
||||
role: 'quit'
|
||||
}] : [{
|
||||
label: 'Settings...',
|
||||
accelerator: 'CmdOrCtrl+,',
|
||||
click() {
|
||||
mainWindow.loadURL(settingsURL);
|
||||
}
|
||||
}, {
|
||||
label: 'Sign in to Another Server',
|
||||
click() {
|
||||
mainWindow.webContents.send('add-server');
|
||||
}
|
||||
}, separatorItem, {
|
||||
role: 'quit',
|
||||
accelerator: 'CmdOrCtrl+Q',
|
||||
click() {
|
||||
electron.app.quit();
|
||||
}
|
||||
}];
|
||||
|
||||
if (config.enableServerManagement === true || config.teams.length === 0) {
|
||||
platformAppMenu.push({
|
||||
label: 'Sign in to Another Server',
|
||||
click() {
|
||||
mainWindow.webContents.send('add-server');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
platformAppMenu = platformAppMenu.concat(process.platform === 'darwin' ? [
|
||||
separatorItem, {
|
||||
role: 'hide'
|
||||
}, {
|
||||
role: 'hideothers'
|
||||
}, {
|
||||
role: 'unhide'
|
||||
}, separatorItem, {
|
||||
role: 'quit'
|
||||
}] : [separatorItem, {
|
||||
role: 'quit',
|
||||
accelerator: 'CmdOrCtrl+Q',
|
||||
click() {
|
||||
electron.app.quit();
|
||||
}
|
||||
}]
|
||||
);
|
||||
|
||||
template.push({
|
||||
label: '&' + firstMenuName,
|
||||
submenu: [
|
||||
|
Reference in New Issue
Block a user