diff --git a/src/browser/components/MainPage.jsx b/src/browser/components/MainPage.jsx
index 60d906f5..34e7186e 100644
--- a/src/browser/components/MainPage.jsx
+++ b/src/browser/components/MainPage.jsx
@@ -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}
/>
);
diff --git a/src/browser/components/SettingsPage.jsx b/src/browser/components/SettingsPage.jsx
index 708337fc..95d7c5b1 100644
--- a/src/browser/components/SettingsPage.jsx
+++ b/src/browser/components/SettingsPage.jsx
@@ -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 = (
@@ -267,11 +302,53 @@ const SettingsPage = createReactClass({
updateTeam={this.updateTeam}
addServer={this.addServer}
onTeamClick={backToIndex}
+ allowTeamEdit={this.state.enableTeamModification}
/>
);
+ var serversRow = (
+
+
+ {'Server Management'}
+
+
+
+
+ {'⊞ Add new server'}
+
+
+
+ );
+
+ var srvMgmt;
+ if (this.state.enableServerManagement || this.state.teams.length === 0) {
+ srvMgmt = (
+
+ {serversRow}
+ {teamsRow}
+
+
+ );
+ }
+
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({
);
}
- 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) ? (
@@ -482,35 +524,7 @@ const SettingsPage = createReactClass({
className='settingsPage'
style={{paddingTop: '100px'}}
>
-
-
- {'Server Management'}
-
-
-
-
- {'⊞ Add new server'}
-
-
-
- { teamsRow }
-
+ { srvMgmt }
{ optionsRow }
diff --git a/src/browser/components/TabBar.jsx b/src/browser/components/TabBar.jsx
index 32d9d6f8..6287b572 100644
--- a/src/browser/components/TabBar.jsx
+++ b/src/browser/components/TabBar.jsx
@@ -53,17 +53,19 @@ function TabBar(props) {
{ badgeDiv }
);
});
- tabs.push(
-
-
-
- );
+ if (props.showAddServerButton === true) {
+ tabs.push(
+
+
+
+ );
+ }
return (
,
document.getElementById('content')
);
diff --git a/src/common/config/base.json b/src/common/config/base.json
index 8e2e1178..6dca7463 100644
--- a/src/common/config/base.json
+++ b/src/common/config/base.json
@@ -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
}
}
diff --git a/src/main/menus/app.js b/src/main/menus/app.js
index 359d0308..587bb465 100644
--- a/src/main/menus/app.js
+++ b/src/main/menus/app.js
@@ -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: [