Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tacc-frontend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Wen Wei Li
tacc-frontend
Commits
be38f193
Commit
be38f193
authored
May 03, 2024
by
Wen Wei Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add single agent view
parent
3e02a6b1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
78 additions
and
5 deletions
+78
-5
src/App.vue
src/App.vue
+3
-1
src/components/Agent.vue
src/components/Agent.vue
+62
-0
src/components/Agents.vue
src/components/Agents.vue
+9
-2
src/main.js
src/main.js
+4
-2
No files found.
src/App.vue
View file @
be38f193
...
@@ -18,6 +18,7 @@ import Navbar from './components/Navbar.vue'
...
@@ -18,6 +18,7 @@ import Navbar from './components/Navbar.vue'
import
Footer
from
'
./components/Footer.vue
'
import
Footer
from
'
./components/Footer.vue
'
import
Form
from
'
./components/Form.vue
'
import
Form
from
'
./components/Form.vue
'
import
Agents
from
'
./components/Agents.vue
'
import
Agents
from
'
./components/Agents.vue
'
import
Agent
from
'
./components/Agent.vue
'
export
default
{
export
default
{
name
:
'
App
'
,
name
:
'
App
'
,
components
:
{
components
:
{
...
@@ -25,7 +26,8 @@ export default {
...
@@ -25,7 +26,8 @@ export default {
Navbar
,
Navbar
,
Form
,
Form
,
Footer
,
Footer
,
Agents
Agents
,
Agent
,
},
},
...
...
src/components/Agent.vue
0 → 100644
View file @
be38f193
<
template
>
<CContainer>
<div>
<h2>
Agent Lists
</h2>
<CContainer>
<CTable
hover
>
<CTableHead>
<CTableRow>
<CTableHeaderCell
scope=
"col"
>
#
</CTableHeaderCell>
<CTableHeaderCell
scope=
"col"
>
Name
</CTableHeaderCell>
<CTableHeaderCell
scope=
"col"
>
Platform
</CTableHeaderCell>
<CTableHeaderCell
scope=
"col"
>
Status
</CTableHeaderCell>
</CTableRow>
</CTableHead>
<CTableBody>
<CTableRow
v-for=
"(agent, index) in agents"
:key=
"agent.id"
>
<CTableDataCell>
{{
agent
.
id
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
name
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
platform
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
status
}}
</CTableDataCell>
</CTableRow>
</CTableBody>
</CTable>
</CContainer>
</div>
</CContainer>
</
template
>
<
script
>
import
{
ref
,
watch
}
from
'
vue
'
;
export
default
{
name
:
"
Agent
"
,
data
()
{
return
{
agent_data
:
[{
"
id
"
:
"
001
"
}]
};
},
mounted
()
{
this
.
fetchAgentsData
();
},
methods
:
{
async
fetchAgentsData
()
{
try
{
console
.
log
(
"
`http://192.168.88.238:8080/api/v1/agent/${this.agentID}`
"
);
const
response
=
await
fetch
(
"
`http://192.168.88.238:8080/api/v1/agent/${this.agentID}`
"
);
if
(
!
response
.
ok
)
throw
new
Error
(
'
Failed to fetch
'
);
this
.
agent_data
=
await
response
.
json
();
console
.
log
(
this
.
agent_data
);
}
catch
(
error
)
{
console
.
error
(
'
Error fetching products:
'
,
error
);
}
}
},
watch
:
{
'
$route
'
(
to
,
from
)
{
// React to route changes and update the productId
this
.
agentID
=
to
.
params
.
agentID
;
}
}
}
</
script
>
\ No newline at end of file
src/components/Agents.vue
View file @
be38f193
...
@@ -14,8 +14,12 @@
...
@@ -14,8 +14,12 @@
</CTableHead>
</CTableHead>
<CTableBody>
<CTableBody>
<CTableRow
v-for=
"(agent, index) in agents"
:key=
"agent.id"
>
<CTableRow
v-for=
"(agent, index) in agents"
:key=
"agent.id"
>
<CTableDataCell>
{{
agent
.
id
}}
</CTableDataCell>
<CTableDataCell>
<CTableDataCell>
{{
agent
.
name
}}
</CTableDataCell>
<router-link
:to=
"`/agent/$
{agent.id}`" >
{{
agent
.
id
}}
</router-link>
</CTableDataCell>
<CTableDataCell>
{{
agent
.
agent_name
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
platform
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
platform
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
status
}}
</CTableDataCell>
<CTableDataCell>
{{
agent
.
status
}}
</CTableDataCell>
</CTableRow>
</CTableRow>
...
@@ -27,6 +31,8 @@
...
@@ -27,6 +31,8 @@
</
template
>
</
template
>
<
script
>
<
script
>
import
{
CLink
,
CNavLink
}
from
'
@coreui/vue
'
;
export
default
{
export
default
{
name
:
"
Agents
"
,
name
:
"
Agents
"
,
data
()
{
data
()
{
...
@@ -43,6 +49,7 @@ export default {
...
@@ -43,6 +49,7 @@ export default {
const
response
=
await
fetch
(
'
http://192.168.88.238:8080/api/v1/agents
'
);
const
response
=
await
fetch
(
'
http://192.168.88.238:8080/api/v1/agents
'
);
if
(
!
response
.
ok
)
throw
new
Error
(
'
Failed to fetch
'
);
if
(
!
response
.
ok
)
throw
new
Error
(
'
Failed to fetch
'
);
this
.
agents
=
await
response
.
json
();
this
.
agents
=
await
response
.
json
();
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
error
(
'
Error fetching products:
'
,
error
);
console
.
error
(
'
Error fetching products:
'
,
error
);
}
}
...
...
src/main.js
View file @
be38f193
...
@@ -9,14 +9,16 @@ import * as icon from '@coreui/icons';
...
@@ -9,14 +9,16 @@ import * as icon from '@coreui/icons';
import
{
createRouter
,
createWebHistory
}
from
'
vue-router
'
;
import
{
createRouter
,
createWebHistory
}
from
'
vue-router
'
;
import
Criteria
from
'
./components/Criteria.vue
'
;
import
Criteria
from
'
./components/Criteria.vue
'
;
import
Agents
from
'
./components/Agents.vue
'
import
Agents
from
'
./components/Agents.vue
'
import
Agent
from
'
./components/Agents.vue
'
const
router
=
createRouter
({
const
router
=
createRouter
({
history
:
createWebHistory
(),
history
:
createWebHistory
(),
routes
:
[
routes
:
[
{
path
:
'
/
'
,
component
:
Criteria
},
{
path
:
'
/
'
,
component
:
Criteria
},
{
path
:
'
/agents
'
,
component
:
Agents
}
{
path
:
'
/agents
'
,
component
:
Agents
},
{
path
:
'
/agent/:agentID
'
,
component
:
Agent
}
]
]
});
});
export
default
router
;
const
app
=
createApp
(
App
)
const
app
=
createApp
(
App
)
app
.
provide
(
'
icons
'
,
icon
)
app
.
provide
(
'
icons
'
,
icon
)
app
.
component
(
'
CIcon
'
,
CIcon
)
app
.
component
(
'
CIcon
'
,
CIcon
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment