Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TFS
controller
Commits
3b6d3d4e
Commit
3b6d3d4e
authored
2 years ago
by
Lluis Gifre Renom
Browse files
Options
Downloads
Patches
Plain Diff
WebUI component:
- Link detail: added delete button
parent
e669847a
No related branches found
No related tags found
2 merge requests
!142
Release TeraFlowSDN 2.1
,
!95
WebUI component: Added delete link button
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/webui/service/link/routes.py
+24
-2
24 additions, 2 deletions
src/webui/service/link/routes.py
src/webui/service/templates/link/detail.html
+85
-55
85 additions, 55 deletions
src/webui/service/templates/link/detail.html
with
109 additions
and
57 deletions
src/webui/service/link/routes.py
+
24
−
2
View file @
3b6d3d4e
...
@@ -13,8 +13,8 @@
...
@@ -13,8 +13,8 @@
# limitations under the License.
# limitations under the License.
from
flask
import
render_template
,
Blueprint
,
flash
,
session
,
redirect
,
url_for
from
flask
import
current_app
,
render_template
,
Blueprint
,
flash
,
session
,
redirect
,
url_for
from
common.proto.context_pb2
import
Empty
,
Link
,
LinkList
from
common.proto.context_pb2
import
Empty
,
Link
,
LinkId
,
LinkList
from
common.tools.context_queries.EndPoint
import
get_endpoint_names
from
common.tools.context_queries.EndPoint
import
get_endpoint_names
from
common.tools.context_queries.Link
import
get_link
from
common.tools.context_queries.Link
import
get_link
from
common.tools.context_queries.Topology
import
get_topology
from
common.tools.context_queries.Topology
import
get_topology
...
@@ -65,3 +65,25 @@ def detail(link_uuid: str):
...
@@ -65,3 +65,25 @@ def detail(link_uuid: str):
device_names
,
endpoints_data
=
get_endpoint_names
(
context_client
,
link_obj
.
link_endpoint_ids
)
device_names
,
endpoints_data
=
get_endpoint_names
(
context_client
,
link_obj
.
link_endpoint_ids
)
context_client
.
close
()
context_client
.
close
()
return
render_template
(
'
link/detail.html
'
,
link
=
link_obj
,
device_names
=
device_names
,
endpoints_data
=
endpoints_data
)
return
render_template
(
'
link/detail.html
'
,
link
=
link_obj
,
device_names
=
device_names
,
endpoints_data
=
endpoints_data
)
@link.get
(
'
<path:link_uuid>/delete
'
)
def
delete
(
link_uuid
):
try
:
# first, check if link exists!
# request: LinkId = LinkId()
# request.link_uuid.uuid = link_uuid
# response: Link = client.GetLink(request)
# TODO: finalize implementation
request
=
LinkId
()
request
.
link_uuid
.
uuid
=
link_uuid
# pylint: disable=no-member
context_client
.
connect
()
context_client
.
RemoveLink
(
request
)
context_client
.
close
()
flash
(
f
'
Link
"
{
link_uuid
}
"
deleted successfully!
'
,
'
success
'
)
except
Exception
as
e
:
# pylint: disable=broad-except
flash
(
f
'
Problem deleting link
"
{
link_uuid
}
"
:
{
e
.
details
()
}
'
,
'
danger
'
)
current_app
.
logger
.
exception
(
e
)
return
redirect
(
url_for
(
'
link.home
'
))
This diff is collapsed.
Click to expand it.
src/webui/service/templates/link/detail.html
+
85
−
55
View file @
3b6d3d4e
...
@@ -13,62 +13,92 @@
...
@@ -13,62 +13,92 @@
See the License for the specific language governing permissions and
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
-->
-->
{% extends 'base.html' %}
{% block content %}
<h1>
Link {{ link.name }} ({{ link.link_id.link_uuid.uuid }})
</h1>
<div
class=
"row mb-3"
>
<div
class=
"col-sm-3"
>
<button
type=
"button"
class=
"btn btn-success"
onclick=
"window.location.href='{{ url_for('link.home') }}'"
>
<i
class=
"bi bi-box-arrow-in-left"
></i>
Back to link list
</button>
</div>
</div>
<br>
{% extends 'base.html' %}
<div
class=
"row mb-3"
>
<div
class=
"col-sm-4"
>
{% block content %}
<b>
UUID:
</b>
{{ link.link_id.link_uuid.uuid }}
<br>
<h1>
Link {{ link.name }} ({{ link.link_id.link_uuid.uuid }})
</h1>
<b>
Name:
</b>
{{ link.name }}
<br>
<div
class=
"row mb-3"
>
</div>
<div
class=
"col-sm-3"
>
<div
class=
"col-sm-8"
>
<button
type=
"button"
class=
"btn btn-success"
onclick=
"window.location.href='{{ url_for('link.home') }}'"
>
<table
class=
"table table-striped table-hover"
>
<i
class=
"bi bi-box-arrow-in-left"
></i>
<thead>
Back to link list
<tr>
</button>
<th
scope=
"col"
>
Endpoint UUID
</th>
</div>
<th
scope=
"col"
>
Name
</th>
<div
class=
"col-sm-3"
>
<th
scope=
"col"
>
Device
</th>
<!-- <button type="button" class="btn btn-danger"><i class="bi bi-x-square"></i>Delete link</button> -->
<th
scope=
"col"
>
Endpoint Type
</th>
<button
type=
"button"
class=
"btn btn-danger"
data-bs-toggle=
"modal"
data-bs-target=
"#deleteModal"
>
</tr>
<i
class=
"bi bi-x-square"
></i>
</thead>
Delete link
<tbody>
</button>
{% for endpoint in link.link_endpoint_ids %}
</div>
<tr>
</div>
<td>
{{ endpoint.endpoint_uuid.uuid }}
<br>
</td>
<div
class=
"row mb-3"
>
<td>
<div
class=
"col-sm-4"
>
{{ endpoints_data.get(endpoint.endpoint_uuid.uuid, (endpoint.endpoint_uuid.uuid, ''))[0] }}
<b>
UUID:
</b>
{{ link.link_id.link_uuid.uuid }}
<br>
</td>
<b>
Name:
</b>
{{ link.name }}
<br>
<td>
</div>
<a
href=
"{{ url_for('device.detail', device_uuid=endpoint.device_id.device_uuid.uuid) }}"
>
<div
class=
"col-sm-8"
>
{{ device_names.get(endpoint.device_id.device_uuid.uuid, endpoint.device_id.device_uuid.uuid) }}
<table
class=
"table table-striped table-hover"
>
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
fill=
"currentColor"
class=
"bi bi-eye"
viewBox=
"0 0 16 16"
>
<thead>
<path
d=
"M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"
/>
<tr>
<path
d=
"M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"
/>
<th
scope=
"col"
>
Endpoint UUID
</th>
</svg>
<th
scope=
"col"
>
Name
</th>
</a>
<th
scope=
"col"
>
Device
</th>
</td>
<th
scope=
"col"
>
Endpoint Type
</th>
<td>
</tr>
{{ endpoints_data.get(endpoint.endpoint_uuid.uuid, ('', '-'))[1] }}
</thead>
</td>
<tbody>
</tr>
{% for endpoint in link.link_endpoint_ids %}
{% endfor %}
<tr>
</tbody>
<td>
</table>
{{ endpoint.endpoint_uuid.uuid }}
</td>
<td>
{{ endpoints_data.get(endpoint.endpoint_uuid.uuid, (endpoint.endpoint_uuid.uuid, ''))[0] }}
</td>
<td>
<a
href=
"{{ url_for('device.detail', device_uuid=endpoint.device_id.device_uuid.uuid) }}"
>
{{ device_names.get(endpoint.device_id.device_uuid.uuid, endpoint.device_id.device_uuid.uuid) }}
<svg
xmlns=
"http://www.w3.org/2000/svg"
width=
"16"
height=
"16"
fill=
"currentColor"
class=
"bi bi-eye"
viewBox=
"0 0 16 16"
>
<path
d=
"M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"
/>
<path
d=
"M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"
/>
</svg>
</a>
</td>
<td>
{{ endpoints_data.get(endpoint.endpoint_uuid.uuid, ('', '-'))[1] }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Modal -->
<div
class=
"modal fade"
id=
"deleteModal"
data-bs-backdrop=
"static"
data-bs-keyboard=
"false"
tabindex=
"-1"
aria-labelledby=
"staticBackdropLabel"
aria-hidden=
"true"
>
<div
class=
"modal-dialog"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
id=
"staticBackdropLabel"
>
Delete link?
</h5>
<button
type=
"button"
class=
"btn-close"
data-bs-dismiss=
"modal"
aria-label=
"Close"
></button>
</div>
<div
class=
"modal-body"
>
Are you sure you want to delete the link "{{ link.link_id.link_uuid.uuid }}"?
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-bs-dismiss=
"modal"
>
No
</button>
<a
type=
"button"
class=
"btn btn-danger"
href=
"{{ url_for('link.delete', link_uuid=link.link_id.link_uuid.uuid) }}"
><i
class=
"bi bi-exclamation-diamond"
></i>
Yes
</a>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% endblock %}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment