2017-12-10 23:49:20 +00:00
|
|
|
<template>
|
|
|
|
<div class="side-bar__panel side-bar__panel--menu">
|
2019-06-29 16:33:21 +00:00
|
|
|
<menu-entry @click.native="manageWorkspaces">
|
|
|
|
<icon-database slot="icon"></icon-database>
|
|
|
|
<div><div class="menu-entry__label menu-entry__label--count">{{workspaceCount}}</div> Manage workspaces</div>
|
|
|
|
<span>List, rename, remove workspaces</span>
|
|
|
|
</menu-entry>
|
|
|
|
<hr>
|
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>
|
2019-06-16 13:49:50 +00:00
|
|
|
<span>Add a <b>CouchDB</b> workspace</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>
|
2019-06-16 13:49:50 +00:00
|
|
|
<span>Add a <b>GitHub</b> workspace</span>
|
2018-04-27 14:37:05 +00:00
|
|
|
</menu-entry>
|
2018-09-19 08:59:22 +00:00
|
|
|
<menu-entry @click.native="addGitlabWorkspace">
|
|
|
|
<icon-provider slot="icon" provider-id="gitlabWorkspace"></icon-provider>
|
2019-06-16 13:49:50 +00:00
|
|
|
<span>Add a <b>GitLab</b> workspace</span>
|
2018-09-19 08:59:22 +00:00
|
|
|
</menu-entry>
|
2018-04-27 14:37:05 +00:00
|
|
|
<menu-entry @click.native="addGoogleDriveWorkspace">
|
|
|
|
<icon-provider slot="icon" provider-id="googleDriveWorkspace"></icon-provider>
|
2019-06-16 13:49:50 +00:00
|
|
|
<span>Add a <b>Google Drive</b> workspace</span>
|
2018-04-27 14:37:05 +00:00
|
|
|
</menu-entry>
|
2017-12-10 23:49:20 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import { mapGetters } from 'vuex';
|
|
|
|
import MenuEntry from './common/MenuEntry';
|
|
|
|
import googleHelper from '../../services/providers/helpers/googleHelper';
|
2018-09-19 08:59:22 +00:00
|
|
|
import gitlabHelper from '../../services/providers/helpers/gitlabHelper';
|
|
|
|
import store from '../../store';
|
2017-12-10 23:49:20 +00:00
|
|
|
|
|
|
|
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 {
|
2018-09-19 08:59:22 +00:00
|
|
|
store.dispatch('modal/open', {
|
2018-05-13 13:27:33 +00:00
|
|
|
type: 'couchdbWorkspace',
|
|
|
|
});
|
2019-06-30 12:28:37 +00:00
|
|
|
} catch (e) { /* Cancel */ }
|
2018-04-27 14:37:05 +00:00
|
|
|
},
|
2018-05-13 13:27:33 +00:00
|
|
|
async addGithubWorkspace() {
|
|
|
|
try {
|
2018-09-19 08:59:22 +00:00
|
|
|
store.dispatch('modal/open', {
|
2018-05-13 13:27:33 +00:00
|
|
|
type: 'githubWorkspace',
|
|
|
|
});
|
2019-06-30 12:28:37 +00:00
|
|
|
} catch (e) { /* Cancel */ }
|
2018-04-27 14:37:05 +00:00
|
|
|
},
|
2018-09-19 08:59:22 +00:00
|
|
|
async addGitlabWorkspace() {
|
|
|
|
try {
|
|
|
|
const { serverUrl, applicationId } = await store.dispatch('modal/open', { type: 'gitlabAccount' });
|
|
|
|
const token = await gitlabHelper.addAccount(serverUrl, applicationId);
|
|
|
|
store.dispatch('modal/open', {
|
|
|
|
type: 'gitlabWorkspace',
|
|
|
|
token,
|
|
|
|
});
|
2019-06-30 12:28:37 +00:00
|
|
|
} catch (e) { /* Cancel */ }
|
2018-09-19 08:59:22 +00:00
|
|
|
},
|
2018-05-13 13:27:33 +00:00
|
|
|
async addGoogleDriveWorkspace() {
|
|
|
|
try {
|
|
|
|
const token = await googleHelper.addDriveAccount(true);
|
2018-09-19 08:59:22 +00:00
|
|
|
store.dispatch('modal/open', {
|
2017-12-10 23:49:20 +00:00
|
|
|
type: 'googleDriveWorkspace',
|
|
|
|
token,
|
2018-05-13 13:27:33 +00:00
|
|
|
});
|
2019-06-30 12:28:37 +00:00
|
|
|
} catch (e) { /* Cancel */ }
|
2017-12-10 23:49:20 +00:00
|
|
|
},
|
|
|
|
manageWorkspaces() {
|
2019-06-30 12:28:37 +00:00
|
|
|
try {
|
|
|
|
store.dispatch('modal/open', 'workspaceManagement');
|
|
|
|
} catch (e) { /* Cancel */ }
|
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>
|