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,
|
initialIndex: PropTypes.number.isRequired,
|
||||||
useSpellChecker: PropTypes.bool.isRequired,
|
useSpellChecker: PropTypes.bool.isRequired,
|
||||||
onSelectSpellCheckerLocale: PropTypes.func.isRequired,
|
onSelectSpellCheckerLocale: PropTypes.func.isRequired,
|
||||||
deeplinkingUrl: PropTypes.string
|
deeplinkingUrl: PropTypes.string,
|
||||||
|
showAddServerButton: PropTypes.bool.isRequired
|
||||||
},
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
@@ -258,6 +259,7 @@ const MainPage = createReactClass({
|
|||||||
activeKey={this.state.key}
|
activeKey={this.state.key}
|
||||||
onSelect={this.handleSelect}
|
onSelect={this.handleSelect}
|
||||||
onAddServer={this.addServer}
|
onAddServer={this.addServer}
|
||||||
|
showAddServerButton={this.props.showAddServerButton}
|
||||||
/>
|
/>
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
@@ -255,6 +255,41 @@ const SettingsPage = createReactClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
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 = (
|
var teamsRow = (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12}>
|
<Col md={12}>
|
||||||
@@ -267,11 +302,53 @@ const SettingsPage = createReactClass({
|
|||||||
updateTeam={this.updateTeam}
|
updateTeam={this.updateTeam}
|
||||||
addServer={this.addServer}
|
addServer={this.addServer}
|
||||||
onTeamClick={backToIndex}
|
onTeamClick={backToIndex}
|
||||||
|
allowTeamEdit={this.state.enableTeamModification}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</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 = [];
|
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
|
// 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>);
|
</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) ? (
|
var optionsRow = (options.length > 0) ? (
|
||||||
<Row>
|
<Row>
|
||||||
<Col md={12}>
|
<Col md={12}>
|
||||||
@@ -482,35 +524,7 @@ const SettingsPage = createReactClass({
|
|||||||
className='settingsPage'
|
className='settingsPage'
|
||||||
style={{paddingTop: '100px'}}
|
style={{paddingTop: '100px'}}
|
||||||
>
|
>
|
||||||
<Row>
|
{ srvMgmt }
|
||||||
<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/>
|
|
||||||
{ optionsRow }
|
{ optionsRow }
|
||||||
</Grid>
|
</Grid>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -53,17 +53,19 @@ function TabBar(props) {
|
|||||||
{ badgeDiv }
|
{ badgeDiv }
|
||||||
</NavItem>);
|
</NavItem>);
|
||||||
});
|
});
|
||||||
tabs.push(
|
if (props.showAddServerButton === true) {
|
||||||
<NavItem
|
tabs.push(
|
||||||
className='TabBar-addServerButton'
|
<NavItem
|
||||||
key='addServerButton'
|
className='TabBar-addServerButton'
|
||||||
id='addServerButton'
|
key='addServerButton'
|
||||||
eventKey='addServerButton'
|
id='addServerButton'
|
||||||
title='Add new server'
|
eventKey='addServerButton'
|
||||||
>
|
title='Add new server'
|
||||||
<Glyphicon glyph='plus'/>
|
>
|
||||||
</NavItem>
|
<Glyphicon glyph='plus'/>
|
||||||
);
|
</NavItem>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<Nav
|
<Nav
|
||||||
className='TabBar'
|
className='TabBar'
|
||||||
@@ -92,7 +94,8 @@ TabBar.propTypes = {
|
|||||||
unreadAtActive: PropTypes.array,
|
unreadAtActive: PropTypes.array,
|
||||||
mentionCounts: PropTypes.array,
|
mentionCounts: PropTypes.array,
|
||||||
mentionAtActiveCounts: PropTypes.array,
|
mentionAtActiveCounts: PropTypes.array,
|
||||||
onAddServer: PropTypes.func
|
onAddServer: PropTypes.func,
|
||||||
|
showAddServerButton: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = TabBar;
|
module.exports = TabBar;
|
||||||
|
@@ -116,6 +116,7 @@ ReactDOM.render(
|
|||||||
useSpellChecker={AppConfig.data.useSpellChecker}
|
useSpellChecker={AppConfig.data.useSpellChecker}
|
||||||
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
onSelectSpellCheckerLocale={handleSelectSpellCheckerLocale}
|
||||||
deeplinkingUrl={deeplinkingUrl}
|
deeplinkingUrl={deeplinkingUrl}
|
||||||
|
showAddServerButton={AppConfig.data.enableServerManagement}
|
||||||
/>,
|
/>,
|
||||||
document.getElementById('content')
|
document.getElementById('content')
|
||||||
);
|
);
|
||||||
|
@@ -11,7 +11,8 @@
|
|||||||
"showUnreadBadge": true,
|
"showUnreadBadge": true,
|
||||||
"useSpellChecker": true,
|
"useSpellChecker": true,
|
||||||
"spellCheckerLocale": "en-US",
|
"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": {
|
"1": {
|
||||||
"teams": [],
|
"teams": [],
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
"showUnreadBadge": true,
|
"showUnreadBadge": true,
|
||||||
"useSpellChecker": true,
|
"useSpellChecker": true,
|
||||||
"spellCheckerLocale": "en-US",
|
"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 firstMenuName = (process.platform === 'darwin') ? appName : 'File';
|
||||||
var template = [];
|
var template = [];
|
||||||
|
|
||||||
const platformAppMenu = process.platform === 'darwin' ? [{
|
var platformAppMenu = process.platform === 'darwin' ? [{
|
||||||
label: 'About ' + appName,
|
label: 'About ' + appName,
|
||||||
role: 'about',
|
role: 'about',
|
||||||
click() {
|
click() {
|
||||||
@@ -30,38 +30,41 @@ function createTemplate(mainWindow, config, isDev) {
|
|||||||
click() {
|
click() {
|
||||||
mainWindow.loadURL(settingsURL);
|
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...',
|
label: 'Settings...',
|
||||||
accelerator: 'CmdOrCtrl+,',
|
accelerator: 'CmdOrCtrl+,',
|
||||||
click() {
|
click() {
|
||||||
mainWindow.loadURL(settingsURL);
|
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({
|
template.push({
|
||||||
label: '&' + firstMenuName,
|
label: '&' + firstMenuName,
|
||||||
submenu: [
|
submenu: [
|
||||||
|
Reference in New Issue
Block a user