Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions src/store/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,27 +76,39 @@ const {
async fetchWorkspaces(context) {
const { commit } = rootActionContext(context);
const workspaces = await api.workspaces();
commit.setWorkspaces(workspaces);
commit.setWorkspaces(workspaces.results.map((w) => w.name));
},

async fetchWorkspace(context, workspace: string) {
const { commit } = rootActionContext(context);
commit.unsetCurrentWorkspace();

const nodeTables = await api.tables(workspace, { type: 'node' });
const edgeTables = await api.tables(workspace, { type: 'edge' });
const graphs = await api.graphs(workspace);
const tables = (await api.tables(workspace)).results;
const nodeTables = tables.filter((table) => table.edge === false);
const edgeTables = tables.filter((table) => table.edge === true);

commit.setCurrentWorkspace({
name: workspace, nodeTables, edgeTables, graphs,
name: workspace,
nodeTables: nodeTables.map((table) => table.name),
edgeTables: edgeTables.map((table) => table.name),
graphs: graphs.results.map((graph) => graph.name),
});
},

async fetchUserInfo(context) {
const { commit } = rootActionContext(context);

const info = await api.userInfo();
commit.setUserInfo(info);
try {
const info = await api.userInfo();
commit.setUserInfo(info);
} catch (error) {
if (error.response.status === 401) {
commit.setUserInfo(null);
} else {
throw new Error(error);
}
}
},

async logout(context) {
Expand Down
6 changes: 3 additions & 3 deletions src/views/TableDetail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export default Vue.extend({
});

const {
rows,
results: rows,
count,
} = result;

Expand Down Expand Up @@ -272,9 +272,9 @@ export default Vue.extend({
this.headers = headers;

// Roni to convert these lines to computed function
this.tables = await api.tables(this.workspace, {
this.tables = (await api.tables(this.workspace, {
type: 'all',
});
})).results.map((table) => table.name);

this.loading = false;
},
Expand Down