2017-12-10 23:49:20 +00:00
|
|
|
<template>
|
|
|
|
<div class="side-bar__panel side-bar__panel--menu">
|
2018-07-03 23:41:24 +00:00
|
|
|
<div class="workspace" v-for="(workspace, id) in workspacesById" :key="id">
|
2017-12-10 23:49:20 +00:00
|
|
|
<menu-entry :href="workspace.url" target="_blank">
|
2017-12-17 15:08:52 +00:00
|
|
|
<icon-provider slot="icon" :provider-id="workspace.providerId"></icon-provider>
|
|
|
|
<div class="workspace__name"><div class="menu-entry__label" v-if="currentWorkspace === workspace">current</div>{{workspace.name}}</div>
|
2017-12-10 23:49:20 +00:00
|
|
|
</menu-entry>
|
|
|
|
</div>
|
|
|
|
<hr>
|
2018-01-24 07:31:54 +00:00
|
|
|
<menu-entry @click.native="addCouchdbWorkspace">
|
|
|
|
<icon-provider slot="icon" provider-id="couchdbWorkspace"></icon-provider>
|
2018-07-03 23:41:24 +00:00
|
|
|
<div>CouchDB workspace</div>
|
|
|
|
<span>Add a workspace synced with your CouchDB database.</span>
|
2018-01-24 07:31:54 +00:00
|
|
|
</menu-entry>
|
2018-04-27 14:37:05 +00:00
|
|
|
<menu-entry @click.native="addGithubWorkspace">
|
|
|
|
<icon-provider slot="icon" provider-id="githubWorkspace"></icon-provider>
|
2018-07-03 23:41:24 +00:00
|
|
|
<div>GitHub workspace</div>
|
|
|
|
<span>Add a workspace synced with a GitHub repository.</span>
|
2018-04-27 14:37:05 +00:00
|
|
|
</menu-entry>
|
|
|
|
<menu-entry @click.native="addGoogleDriveWorkspace">
|
|
|
|
<icon-provider slot="icon" provider-id="googleDriveWorkspace"></icon-provider>
|
2018-07-03 23:41:24 +00:00
|
|
|
<div>Google Drive workspace</div>
|
|
|
|
<span>Add a workspace synced with a Google Drive folder.</span>
|
2018-04-27 14:37:05 +00:00
|
|
|
</menu-entry>
|
2017-12-10 23:49:20 +00:00
|
|
|
<menu-entry @click.native="manageWorkspaces">
|
|
|
|
<icon-database slot="icon"></icon-database>
|
2018-07-03 23:41:24 +00:00
|
|
|
<span><div class="menu-entry__label menu-entry__label--count">{{workspaceCount}}</div> Manage workspaces</span>
|
2017-12-10 23:49:20 +00:00
|
|
|
</menu-entry>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import MenuEntry from './common/MenuEntry';
|
|
|
|
import googleHelper from '../../services/providers/helpers/googleHelper';
|
|
|
|
|
|
|
|
export default {
|
|
|
|
components: {
|
|
|
|
MenuEntry,
|
|
|
|
},
|
|
|
|
computed: {
|
2017-12-17 15:08:52 +00:00
|
|
|
...mapGetters('workspace', [
|
2018-07-03 23:41:24 +00:00
|
|
|
'workspacesById',
|
2017-12-17 15:08:52 +00:00
|
|
|
'currentWorkspace',
|
|
|
|
]),
|
2018-07-03 23:41:24 +00:00
|
|
|
workspaceCount() {
|
|
|
|
return Object.keys(this.workspacesById).length;
|
|
|
|
},
|
2017-12-10 23:49:20 +00:00
|
|
|
},
|
|
|
|
methods: {
|
2018-05-13 13:27:33 +00:00
|
|
|
async addCouchdbWorkspace() {
|
|
|
|
try {
|
|
|
|
this.$store.dispatch('modal/open', {
|
|
|
|
type: 'couchdbWorkspace',
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
// Cancel
|
|
|
|
}
|
2018-04-27 14:37:05 +00:00
|
|
|
},
|
2018-05-13 13:27:33 +00:00
|
|
|
async addGithubWorkspace() {
|
|
|
|
try {
|
|
|
|
this.$store.dispatch('modal/open', {
|
|
|
|
type: 'githubWorkspace',
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
// Cancel
|
|
|
|
}
|
2018-04-27 14:37:05 +00:00
|
|
|
},
|
2018-05-13 13:27:33 +00:00
|
|
|
async addGoogleDriveWorkspace() {
|
|
|
|
try {
|
|
|
|
const token = await googleHelper.addDriveAccount(true);
|
|
|
|
this.$store.dispatch('modal/open', {
|
2017-12-10 23:49:20 +00:00
|
|
|
type: 'googleDriveWorkspace',
|
|
|
|
token,
|
2018-05-13 13:27:33 +00:00
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
// Cancel
|
|
|
|
}
|
2017-12-10 23:49:20 +00:00
|
|
|
},
|
|
|
|
manageWorkspaces() {
|
2018-05-13 13:27:33 +00:00
|
|
|
this.$store.dispatch('modal/open', 'workspaceManagement');
|
2017-12-10 23:49:20 +00:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss">
|
2018-05-06 00:46:33 +00:00
|
|
|
@import '../../styles/variables.scss';
|
2017-12-17 15:08:52 +00:00
|
|
|
|
|
|
|
.workspace .menu-entry {
|
|
|
|
padding-top: 12px;
|
|
|
|
padding-bottom: 12px;
|
|
|
|
}
|
|
|
|
|
2017-12-10 23:49:20 +00:00
|
|
|
.workspace__name {
|
|
|
|
font-weight: bold;
|
2017-12-17 15:08:52 +00:00
|
|
|
line-height: 1.2;
|
2017-12-10 23:49:20 +00:00
|
|
|
}
|
|
|
|
</style>
|