Skip to content

Commit

Permalink
Fix click event of Volume detail page (#65)
Browse files Browse the repository at this point in the history
Fixes: #64
Signed-off-by: Aravinda Vishwanathapura <[email protected]>
  • Loading branch information
aravindavk authored Dec 21, 2022
1 parent 6c6556b commit 1e53b7c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion gdash/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
"""Version"""
VERSION = "1.0.5"
VERSION = "main"
10 changes: 6 additions & 4 deletions ui/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ function App() {
element={<Login/>}/>
<Route path="/dashboard"
element={<Dashboard/>}/>
<Route path="/volumes/:volumeId"
element={<VolumeDetail/>}/>
<Route path="/volumes"
element={<Volumes/>}/>
<Route path="/volumes">
<Route path=""
element={<Volumes/>}/>
<Route path=":volumeId"
element={<VolumeDetail/>}/>
</Route>
<Route path="/peers"
element={<Peers/>}/>
<Route path="/bricks"
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/bricks.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function bricksUI(volumes) {
return volume.subvols.map((subvol, sdx) => {
return subvol.bricks.map((brick, bdx) => {
return (
<tr key={vdx + '-' + sdx + '-' + bdx} className="border-b border-indigo-100 hover:bg-gray-100 cursor-pointer">
<tr key={vdx + '-' + sdx + '-' + bdx} className="border-b border-indigo-100 hover:bg-gray-100">
<td className="px-5 py-2" style={{minWidth: "250px"}}>
{volume.name}<div className="text-sm text-gray-700">{volume.uuid}</div>
</td>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/pages/volumeDetail.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function volumeDetailUI(volumeId, volumes) {
</tr>
</thead>
<tbody>
<tr key={volume.uuid} className="border-b border-indigo-100 hover:bg-gray-100 cursor-pointer">
<tr key={volume.uuid} className="border-b border-indigo-100 hover:bg-gray-100">
<td className="px-5 py-2" style={{minWidth: "250px"}}>
{volume.name}<div className="text-sm text-gray-700">{volume.uuid}</div>
</td>
Expand Down
12 changes: 4 additions & 8 deletions ui/src/pages/volumes.jsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React, { useState, useEffect } from 'react';

import axios from 'axios';
import * as dayjs from 'dayjs';

import { Content } from '../components/content.jsx'
import { volumeStatus, capitalize, sizeUtilization, inodesUtilization } from '../components/helpers';

function volumesUI(history, volumes) {

function handleClick(volume_id) {
history.push('/volumes/' + volume_id)
}

return (
<table className="border border-indigo-100 rounded-lg shadow-lg" style={{width: "90%"}}>
<thead>
Expand All @@ -26,7 +22,7 @@ function volumesUI(history, volumes) {
{
volumes.map((volume, idx) => {
return (
<tr key={idx} className="border-b border-indigo-100 hover:bg-gray-100 cursor-pointer" onClick={() => handleClick(volume.uuid)}>
<tr key={idx} className="border-b border-indigo-100 hover:bg-gray-100 cursor-pointer" onClick={() => window.location = '/volumes/' + volume.uuid}>
<td className="px-5 py-2" style={{minWidth: "250px"}}>
{volume.name}<div className="text-sm text-gray-700">{volume.uuid}</div>
</td>
Expand All @@ -37,12 +33,12 @@ function volumesUI(history, volumes) {
<td className="px-5 py-2">{sizeUtilization(volume)}</td>
<td className="px-5 py-2">{inodesUtilization(volume)}</td>
</tr>
);
);
})
}
</tbody>
</table>
)
)
}

export function Volumes({ history }) {
Expand Down

0 comments on commit 1e53b7c

Please sign in to comment.