mirror of https://github.com/Fabio286/antares.git
refactor(UI): improved breadcrumbs and tabs
This commit is contained in:
parent
f0fa7c81b7
commit
ed6e7fa72d
|
@ -186,6 +186,7 @@
|
||||||
:is-selected="selectedTab === tab.uid"
|
:is-selected="selectedTab === tab.uid"
|
||||||
:table="tab.table"
|
:table="tab.table"
|
||||||
:schema="tab.schema"
|
:schema="tab.schema"
|
||||||
|
:element-type="tab.element"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
|
@ -383,15 +384,25 @@ export default {
|
||||||
flex: initial;
|
flex: initial;
|
||||||
|
|
||||||
> a {
|
> a {
|
||||||
padding: 0.2rem 0.8rem;
|
padding: 0.2rem 0.6rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
transition: opacity 0.2s;
|
transition: opacity 0.2s;
|
||||||
|
|
||||||
|
.btn-clear {
|
||||||
|
margin-left: 0.5rem;
|
||||||
|
opacity: 0;
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
||||||
|
.btn-clear {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tab-add {
|
&.tab-add {
|
||||||
|
@ -410,6 +421,10 @@ export default {
|
||||||
|
|
||||||
&.active a {
|
&.active a {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
||||||
|
.btn-clear {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
&.tools-dropdown {
|
&.tools-dropdown {
|
||||||
|
|
|
@ -294,7 +294,7 @@ export default {
|
||||||
this.$emit('show-schema-context', { event, schema });
|
this.$emit('show-schema-context', { event, schema });
|
||||||
},
|
},
|
||||||
showTableContext (event, table) {
|
showTableContext (event, table) {
|
||||||
this.setBreadcrumbs({ schema: this.database.name, [table.type]: table.name });
|
// this.setBreadcrumbs({ schema: this.database.name, [table.type]: table.name });
|
||||||
this.$emit('show-table-context', { event, table });
|
this.$emit('show-table-context', { event, table });
|
||||||
},
|
},
|
||||||
showMiscContext (event, misc) {
|
showMiscContext (event, misc) {
|
||||||
|
|
|
@ -163,8 +163,15 @@ export default {
|
||||||
return this.workspace.uid === this.selectedWorkspace;
|
return this.workspace.uid === this.selectedWorkspace;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
isSelected (val) {
|
||||||
|
if (val)
|
||||||
|
this.changeBreadcrumbs({ schema: this.schema, query: `Query #${this.tab.index}` });
|
||||||
|
}
|
||||||
|
},
|
||||||
created () {
|
created () {
|
||||||
this.query = this.tab.content;
|
this.query = this.tab.content;
|
||||||
|
this.changeBreadcrumbs({ schema: this.schema, query: `Query #${this.tab.index}` });
|
||||||
|
|
||||||
window.addEventListener('keydown', this.onKey);
|
window.addEventListener('keydown', this.onKey);
|
||||||
},
|
},
|
||||||
|
@ -186,7 +193,8 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification'
|
addNotification: 'notifications/addNotification',
|
||||||
|
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
||||||
}),
|
}),
|
||||||
async runQuery (query) {
|
async runQuery (query) {
|
||||||
if (!query || this.isQuering) return;
|
if (!query || this.isQuering) return;
|
||||||
|
|
|
@ -71,6 +71,7 @@
|
||||||
:row="row"
|
:row="row"
|
||||||
:fields="fieldsObj"
|
:fields="fieldsObj"
|
||||||
:key-usage="keyUsage"
|
:key-usage="keyUsage"
|
||||||
|
:element-type="elementType"
|
||||||
:class="{'selected': selectedRows.includes(row._id)}"
|
:class="{'selected': selectedRows.includes(row._id)}"
|
||||||
@select-row="selectRow($event, row._id)"
|
@select-row="selectRow($event, row._id)"
|
||||||
@update-field="updateField($event, row)"
|
@update-field="updateField($event, row)"
|
||||||
|
@ -123,7 +124,8 @@ export default {
|
||||||
results: Array,
|
results: Array,
|
||||||
connUid: String,
|
connUid: String,
|
||||||
mode: String,
|
mode: String,
|
||||||
isSelected: Boolean
|
isSelected: Boolean,
|
||||||
|
elementType: { type: String, default: 'table' }
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -260,7 +260,8 @@ export default {
|
||||||
props: {
|
props: {
|
||||||
row: Object,
|
row: Object,
|
||||||
fields: Object,
|
fields: Object,
|
||||||
keyUsage: Array
|
keyUsage: Array,
|
||||||
|
elementType: { type: String, default: 'table' }
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -334,6 +335,8 @@ export default {
|
||||||
return this.keyUsage.map(key => key.field);
|
return this.keyUsage.map(key => key.field);
|
||||||
},
|
},
|
||||||
isEditable () {
|
isEditable () {
|
||||||
|
if (this.elementType === 'view') return false;
|
||||||
|
|
||||||
if (this.fields) {
|
if (this.fields) {
|
||||||
const nElements = Object.keys(this.fields).reduce((acc, curr) => {
|
const nElements = Object.keys(this.fields).reduce((acc, curr) => {
|
||||||
acc.add(this.fields[curr].table);
|
acc.add(this.fields[curr].table);
|
||||||
|
|
|
@ -131,6 +131,7 @@
|
||||||
:conn-uid="connection.uid"
|
:conn-uid="connection.uid"
|
||||||
:is-selected="isSelected"
|
:is-selected="isSelected"
|
||||||
mode="table"
|
mode="table"
|
||||||
|
:element-type="elementType"
|
||||||
@update-field="updateField"
|
@update-field="updateField"
|
||||||
@delete-selected="deleteSelected"
|
@delete-selected="deleteSelected"
|
||||||
@hard-sort="hardSort"
|
@hard-sort="hardSort"
|
||||||
|
@ -183,7 +184,8 @@ export default {
|
||||||
connection: Object,
|
connection: Object,
|
||||||
isSelected: Boolean,
|
isSelected: Boolean,
|
||||||
table: String,
|
table: String,
|
||||||
schema: String
|
schema: String,
|
||||||
|
elementType: String
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
|
@ -261,9 +263,11 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
isSelected (val) {
|
isSelected (val) {
|
||||||
if (val && this.lastTable !== this.table) {
|
if (val) {
|
||||||
this.getTableData();
|
this.changeBreadcrumbs({ schema: this.schema, [this.elementType]: this.table });
|
||||||
this.lastTable = this.table;
|
|
||||||
|
if (this.lastTable !== this.table)
|
||||||
|
this.getTableData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -277,7 +281,8 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions({
|
...mapActions({
|
||||||
addNotification: 'notifications/addNotification'
|
addNotification: 'notifications/addNotification',
|
||||||
|
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
||||||
}),
|
}),
|
||||||
async getTableData (sortParams) {
|
async getTableData (sortParams) {
|
||||||
if (!this.table) return;
|
if (!this.table) return;
|
||||||
|
@ -287,6 +292,8 @@ export default {
|
||||||
if (this.lastTable !== this.table)
|
if (this.lastTable !== this.table)
|
||||||
this.results = [];
|
this.results = [];
|
||||||
|
|
||||||
|
this.lastTable = this.table;
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
uid: this.connection.uid,
|
uid: this.connection.uid,
|
||||||
schema: this.schema,
|
schema: this.schema,
|
||||||
|
|
|
@ -63,6 +63,12 @@
|
||||||
background-color: $primary-color;
|
background-color: $primary-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.btn-clear {
|
||||||
|
&:hover {
|
||||||
|
background: rgba($light-color, 20%);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
|
|
|
@ -472,7 +472,8 @@ export default {
|
||||||
procedure: null,
|
procedure: null,
|
||||||
function: null,
|
function: null,
|
||||||
scheduler: null,
|
scheduler: null,
|
||||||
view: null
|
view: null,
|
||||||
|
query: null
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasLastChildren = Object.keys(lastBreadcrumbs).filter(b => b !== 'schema').some(b => lastBreadcrumbs[b]);
|
const hasLastChildren = Object.keys(lastBreadcrumbs).filter(b => b !== 'schema').some(b => lastBreadcrumbs[b]);
|
||||||
|
|
Loading…
Reference in New Issue