mirror of https://github.com/Fabio286/antares.git
refactor: remap of table data object
This commit is contained in:
parent
b7c779eef6
commit
936de04cd3
|
@ -34,6 +34,7 @@ This is a roadmap with major features will come in near future.
|
|||
- Users management (add/edit/delete).
|
||||
- Stored procedures, views, schedulers and trigger support.
|
||||
- Database tools.
|
||||
- Improve query suggestions.
|
||||
- Context menu shortcuts.
|
||||
- Keyboard shortcuts.
|
||||
- More secure password storage.
|
||||
|
@ -48,7 +49,7 @@ This is a roadmap with major features will come in near future.
|
|||
### Databases
|
||||
|
||||
- [x] MySQL/MariaDB
|
||||
- [ ] PostrgreSQL
|
||||
- [ ] PostgreSQL
|
||||
- [ ] MSSQL
|
||||
- [ ] SQLite
|
||||
- [ ] OracleDB
|
||||
|
|
|
@ -62,9 +62,34 @@ export class MySQLClient extends AntaresCore {
|
|||
}
|
||||
|
||||
return databases.map(db => { // TODO: remap all objects,
|
||||
const tablesRemapped = tables.filter(table => table.TABLE_SCHEMA === db.Database).map(table => {
|
||||
let tableType;
|
||||
switch (table.TABLE_TYPE) {
|
||||
case 'VIEW':
|
||||
tableType = 'view';
|
||||
break;
|
||||
default:
|
||||
tableType = 'table';
|
||||
break;
|
||||
}
|
||||
|
||||
return {
|
||||
name: table.TABLE_NAME,
|
||||
type: tableType,
|
||||
rows: table.TABLE_ROWS,
|
||||
created: table.CREATE_TIME,
|
||||
updated: table.UPDATE_TIME,
|
||||
engine: table.ENGINE,
|
||||
comment: table.TABLE_COMMENT,
|
||||
size: table.DATA_LENGTH + table.INDEX_LENGTH,
|
||||
autoIncrement: table.AUTO_INCREMENT,
|
||||
collation: table.TABLE_COLLATION
|
||||
};
|
||||
});
|
||||
|
||||
return {
|
||||
name: db.Database,
|
||||
tables: tables.filter(table => table.TABLE_SCHEMA === db.Database),
|
||||
tables: tablesRemapped,
|
||||
functions: functions.filter(func => func.Db === db.Database),
|
||||
procedures: procedures.filter(procedure => procedure.Db === db.Database),
|
||||
triggers: triggersArr.filter(trigger => trigger.Db === db.Database),
|
||||
|
|
|
@ -15,15 +15,15 @@
|
|||
<ul class="menu menu-nav pt-0">
|
||||
<li
|
||||
v-for="table of database.tables"
|
||||
:key="table.TABLE_NAME"
|
||||
:key="table.name"
|
||||
class="menu-item"
|
||||
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.table === table.TABLE_NAME}"
|
||||
@click="changeBreadcrumbs({schema: database.name, table: table.TABLE_NAME})"
|
||||
@contextmenu.prevent="showTableContext($event, table.TABLE_NAME)"
|
||||
:class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.table === table.name}"
|
||||
@click="changeBreadcrumbs({schema: database.name, table: table.name})"
|
||||
@contextmenu.prevent="showTableContext($event, table.name)"
|
||||
>
|
||||
<a class="table-name">
|
||||
<i class="table-icon mdi mdi-18px mr-1" :class="table.TABLE_TYPE === 'VIEW' ? 'mdi-table-eye' : 'mdi-table'" />
|
||||
<span>{{ table.TABLE_NAME }}</span>
|
||||
<i class="table-icon mdi mdi-18px mr-1" :class="table.type === 'view' ? 'mdi-table-eye' : 'mdi-table'" />
|
||||
<span>{{ table.name }}</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
|
Loading…
Reference in New Issue