Skip to content

Commit

Permalink
feat(UI): empty workspace view
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Jul 18, 2021
1 parent 6b725b1 commit e1855a2
Show file tree
Hide file tree
Showing 10 changed files with 662 additions and 47 deletions.
6 changes: 4 additions & 2 deletions src/renderer/components/Workspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
<span>
Query #{{ tab.index }}
<span
v-if="queryTabs.length > 1"
class="btn btn-clear"
:title="$t('word.close')"
@click.stop="closeTab(tab)"
Expand Down Expand Up @@ -230,6 +229,7 @@
:connection="connection"
:scheduler="workspace.breadcrumbs.scheduler"
/> -->
<WorkspaceEmptyState v-if="!workspace.tabs.length" @new-tab="addQueryTab" />
<template v-for="tab of workspace.tabs">
<WorkspaceQueryTab
v-if="tab.type==='query'"
Expand Down Expand Up @@ -292,6 +292,7 @@
import { mapGetters, mapActions } from 'vuex';
import Draggable from 'vuedraggable';
import Connection from '@/ipc-api/Connection';
import WorkspaceEmptyState from '@/components/WorkspaceEmptyState';
import WorkspaceExploreBar from '@/components/WorkspaceExploreBar';
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel';
import WorkspaceQueryTab from '@/components/WorkspaceQueryTab';
Expand All @@ -310,6 +311,7 @@ export default {
name: 'Workspace',
components: {
Draggable,
WorkspaceEmptyState,
WorkspaceExploreBar,
WorkspaceEditConnectionPanel,
WorkspaceQueryTab,
Expand Down Expand Up @@ -413,7 +415,7 @@ export default {
},
closeTab (tab, force) {
this.unsavedTab = null;
if (tab.type === 'query' && this.queryTabs.length === 1) return;
// if (tab.type === 'query' && this.queryTabs.length === 1) return;
if (!force && tab.isChanged) {
this.unsavedTab = tab;
return;
Expand Down
45 changes: 45 additions & 0 deletions src/renderer/components/WorkspaceEmptyState.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<template>
<div class="column col-12 empty">
<div class="empty-icon">
<img :src="require(`@/images/logo-${applicationTheme}.svg`).default" width="200">
</div>
<!-- <p class="empty-title h5">
{{ $t('message.appWelcome') }}
</p> -->
<p class="h6 empty-subtitle">
{{ $t('message.noOpenTabs') }}
</p>
<div class="empty-action">
<button class="btn btn-gray d-flex" @click="$emit('new-tab')">
<i class="mdi mdi-24px mdi-tab-plus mr-2" />
{{ $t('message.openNewTab') }}
</button>
</div>
</div>
</template>

<script>
import { mapGetters } from 'vuex';
export default {
name: 'WorkspaceEmptyState',
computed: {
...mapGetters({
applicationTheme: 'settings/getApplicationTheme'
})
}
};
</script>

<style scoped>
.empty {
height: 100%;
border-radius: 0;
background: transparent;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin-left: auto;
margin-right: auto;
}
</style>
4 changes: 3 additions & 1 deletion src/renderer/components/WorkspacePropsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -444,16 +444,18 @@ export default {
await this.refreshStructure(this.connection.uid);
if (oldName !== this.localOptions.name) {
this.setUnsavedChanges(false);
this.renameTabs({
uid: this.connection.uid,
schema: this.schema,
elementName: oldName,
elementNewName: this.localOptions.name,
elementType: 'table'
});
this.changeBreadcrumbs({ schema: this.schema, table: this.localOptions.name });
}
this.getFieldsData();
}
else
this.addNotification({ status: 'error', message: response });
Expand Down
1 change: 0 additions & 1 deletion src/renderer/components/WorkspacePropsTabTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,6 @@ export default {
await this.refreshStructure(this.connection.uid);
if (this.originalTrigger.name !== this.localTrigger.name) {
this.setUnsavedChanges(false);
const triggerName = this.customizations.triggerTableInName ? `${this.localTrigger.table}.${this.localTrigger.name}` : this.localTrigger.name;
const triggerOldName = this.customizations.triggerTableInName ? `${this.originalTrigger.table}.${this.originalTrigger.name}` : this.originalTrigger.name;
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/components/WorkspacePropsTabView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -323,17 +323,18 @@ export default {
await this.refreshStructure(this.connection.uid);
if (oldName !== this.localView.name) {
this.setUnsavedChanges(false);
this.renameTabs({
uid: this.connection.uid,
schema: this.schema,
elementName: oldName,
elementNewName: this.localView.name,
elementType: 'view'
});
this.changeBreadcrumbs({ schema: this.schema, view: this.localView.name });
}
this.getViewData();
}
else
this.addNotification({ status: 'error', message: response });
Expand Down
37 changes: 0 additions & 37 deletions src/renderer/components/old/TheAppWelcome.vue

This file was deleted.

3 changes: 2 additions & 1 deletion src/renderer/i18n/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,8 @@ module.exports = {
dataTabPageSize: 'DATA tab page size',
enableSsh: 'Enable SSH',
pageNumber: 'Page number',
duplicateTable: 'Duplicate table'
duplicateTable: 'Duplicate table',
noOpenTabs: 'There are no open tabs, navigate on the left bar or:'
},
faker: {
address: 'Address',
Expand Down
Loading

0 comments on commit e1855a2

Please sign in to comment.