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
5db02fbb
Commit
5db02fbb
authored
May 04, 2024
by
Wen Wei Li
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add agent detail and rule view
parent
43056114
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
36 deletions
+76
-36
src/App.vue
src/App.vue
+4
-3
src/components/AgentDetail.vue
src/components/AgentDetail.vue
+18
-20
src/components/Agents.vue
src/components/Agents.vue
+1
-1
src/components/Navbar.vue
src/components/Navbar.vue
+4
-1
src/components/Rules.vue
src/components/Rules.vue
+44
-0
src/main.js
src/main.js
+5
-11
No files found.
src/App.vue
View file @
5db02fbb
...
...
@@ -18,7 +18,8 @@ import Navbar from './components/Navbar.vue'
import
Footer
from
'
./components/Footer.vue
'
import
Form
from
'
./components/Form.vue
'
import
Agents
from
'
./components/Agents.vue
'
import
Agent
from
'
./components/Agent.vue
'
import
AgentDetail
from
'
./components/AgentDetail.vue
'
import
Rules
from
'
./components/Rules.vue
'
;
export
default
{
name
:
'
App
'
,
components
:
{
...
...
@@ -27,8 +28,8 @@ export default {
Form
,
Footer
,
Agents
,
Agent
,
Agent
Detail
,
Rules
},
}
...
...
src/components/Agent.vue
→
src/components/Agent
Detail
.vue
View file @
5db02fbb
<
template
>
<CContainer>
<div>
<h2>
{{
agentI
d
}}
</h2>
<h2>
{{
$route
.
params
.
i
d
}}
</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
v-for=
"(data, index) in agent_data"
:key=
"index"
>
<CTableDataCell>
{{
data
.
id
}}
</CTableDataCell>
<CTableDataCell>
{{
data
.
name
}}
</CTableDataCell>
</CTableRow>
</CTableBody>
</CTable>
...
...
@@ -27,20 +25,24 @@
</
template
>
<
script
>
import
{
ref
,
watch
}
from
'
vue
'
;
import
{
onMounted
}
from
'
vue
'
;
import
{
useRoute
}
from
'
vue-router
'
export
default
{
name
:
"
Agent
"
,
name
:
"
Agent
Detail
"
,
data
()
{
return
{
agent_data
:
[{
"
id
"
:
"
001
"
}]
agentId
:
"
000
"
,
agent_data
:
[]
};
},
mounted
()
{
this
.
fetchAgent
s
Data
();
this
.
fetchAgentData
();
},
methods
:
{
async
fetchAgentsData
()
{
async
fetchAgentData
()
{
this
.
agent_data
=
[{
"
id
"
:
this
.
$route
.
params
.
id
,
"
name
"
:
"
test
"
}]
this
.
agentId
=
this
.
$route
.
params
.
id
/*
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}`");
...
...
@@ -50,13 +52,9 @@
} 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 @
5db02fbb
...
...
@@ -15,7 +15,7 @@
<CTableBody>
<CTableRow
v-for=
"(agent, index) in agents"
:key=
"agent.id"
>
<CTableDataCell>
<router-link
:to=
"`/agent
s
/$
{agent.id}`" >
<router-link
:to=
"`/agent/$
{agent.id}`" >
{{
agent
.
id
}}
</router-link>
</CTableDataCell>
...
...
src/components/Navbar.vue
View file @
5db02fbb
...
...
@@ -10,6 +10,9 @@
Home
</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink
href=
"/rules"
active
>
Rules
</CNavLink>
</CNavItem>
<CNavItem>
<CNavLink
href=
"/agents"
active
>
Agents
</CNavLink>
</CNavItem>
...
...
@@ -20,7 +23,7 @@
</
template
>
<
script
>
import
{
CContainer
,
CNavbarNav
,
CCollapse
,
CNavItem
,
CNavbar
,
CNavbarToggler
,
CNavbarBrand
}
from
'
@coreui/vue
'
import
{
CContainer
,
CNavbarNav
,
CCollapse
,
CNavItem
,
CNavbar
,
CNavbarToggler
,
CNavbarBrand
,
CNavLink
}
from
'
@coreui/vue
'
export
default
{
name
:
'
Navbar
'
}
...
...
src/components/Rules.vue
0 → 100644
View file @
5db02fbb
<
template
>
<CContainer>
<div>
<h2>
Rule List
</h2>
<CContainer>
<CTable
hover
>
<CTableHead>
<CTableRow>
<CTableHeaderCell
scope=
"col"
>
#
</CTableHeaderCell>
<CTableHeaderCell
scope=
"col"
>
Attribute
</CTableHeaderCell>
<CTableHeaderCell
scope=
"col"
>
Threshold
</CTableHeaderCell>
</CTableRow>
</CTableHead>
<CTableBody>
<CTableRow
v-for=
"(rule, index) in rules"
:key=
"index"
>
<CTableDataCell>
{{
index
}}
</CTableDataCell>
<CTableDataCell>
{{
rule
.
attribute
}}
</CTableDataCell>
<CTableDataCell>
{{
rule
.
threshold
}}
</CTableDataCell>
</CTableRow>
</CTableBody>
</CTable>
</CContainer>
</div>
</CContainer>
</
template
>
<
script
>
export
default
{
name
:
"
Rules
"
,
data
()
{
return
{
rules
:
[]
};
},
mounted
()
{
this
.
fetchAgentsData
();
},
methods
:
{
async
fetchAgentsData
()
{
this
.
rules
=
[{
"
attribute
"
:
"
SCA
"
,
"
threshold
"
:
"
60
"
}]
}
}
}
</
script
>
\ No newline at end of file
src/main.js
View file @
5db02fbb
...
...
@@ -12,21 +12,15 @@ import * as icon from '@coreui/icons';
import
{
createRouter
,
createWebHistory
}
from
'
vue-router
'
;
import
Criteria
from
'
./components/Criteria.vue
'
;
import
Agents
from
'
./components/Agents.vue
'
import
Agent
from
'
./components/Agents.vue
'
import
AgentDetail
from
'
./components/AgentDetail.vue
'
import
Rules
from
'
./components/Rules.vue
'
const
router
=
createRouter
({
history
:
createWebHistory
(),
routes
:
[
{
path
:
'
/
'
,
component
:
Criteria
},
{
path
:
'
/agents
'
,
component
:
Agents
,
children
:
[
{
path
:
'
:agentId
'
,
name
:
'
agentId
'
,
props
:
true
,
component
:
Agent
}
]
},
{
path
:
'
/agents
'
,
component
:
Agents
},
{
path
:
'
/agent/:id
'
,
component
:
AgentDetail
},
{
path
:
'
/rules
'
,
component
:
Rules
},
]
});
export
default
router
;
...
...
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