forked from kytos/topology
-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
topology/ui/k-info-panel/link_info.kytos
Lines 133 to 235 in 1ddf8c8
| state_toggle(){ | |
| let request = $.ajax({ | |
| type:"POST", | |
| url: this.$kytos_server_api + "kytos/topology/v3/links/" + this.details.id | |
| + "/" + this.next_state.toLowerCase(), | |
| async: true,}); | |
| request.done(this.msg_state_success) | |
| request.fail(this.msg_state_failure) | |
| }, | |
| bt_add_metadata() { | |
| let name = this.metadata.link_name !== undefined && this.metadata.link_name.length !== 0? '"' + this.metadata.link_name + '"' : this.details.id | |
| var _this = this | |
| let request = $.ajax({ | |
| type: "POST", | |
| url: this.$kytos_server_api + "kytos/topology/v3/links/" + this.details.id | |
| + "/metadata", | |
| async: true, | |
| data: this.to_add, | |
| dataType: "json", | |
| contentType: "application/json; charset=utf-8", | |
| }); | |
| request.done(function() { | |
| let notification = { | |
| icon: 'gear', | |
| title: 'Add metadata: Success', | |
| description: '"' + _this.to_add + '" was added to the metadata. Link: ' + name, | |
| } | |
| _this.$kytos.eventBus.$emit("setNotification", notification) | |
| let temp = JSON.parse(_this.to_add) | |
| for (key in temp){ | |
| _this.metadata[key] = temp[key] | |
| _this.content.metadata[key] = temp[key] | |
| } | |
| _this.to_add = '' | |
| }); | |
| request.fail(function(data) { | |
| let notification = { | |
| icon: 'gear', | |
| title: 'Add metadata: Failure', | |
| description: data.status + ': ' + data.responseJSON.description + ' "' + _this.to_add + '" was not added to the metadata. Link: ' + name, | |
| } | |
| _this.$kytos.eventBus.$emit("setNotification", notification) | |
| }); | |
| }, | |
| bt_rmv_metadata() { | |
| let name = this.metadata.link_name !== undefined && this.metadata.link_name.length !== 0? '"' + this.metadata.link_name + '"' : this.details.id | |
| var _this = this | |
| let request = $.ajax({ | |
| type: "DELETE", | |
| url: this.$kytos_server_api + "kytos/topology/v3/links/" + this.details.id | |
| + "/metadata/" + this.to_delete, | |
| async: true, | |
| }); | |
| request.done(function() { | |
| let notification = { | |
| icon: 'gear', | |
| title: 'Delete metadata: Success', | |
| description: '"' + _this.to_delete + '" was deleted from the metadata. Link: ' + name, | |
| } | |
| _this.$kytos.eventBus.$emit("setNotification", notification) | |
| delete _this.metadata[_this.to_delete] | |
| delete _this.content.metadata[_this.to_delete] | |
| _this.to_delete = '' | |
| }); | |
| request.fail(function(data) { | |
| let notification = { | |
| icon: 'gear', | |
| title: 'Delete metadata: Failure', | |
| description: data.status + ': ' + data.responseJSON.description + ' "' + _this.to_delete + '" was not deleted from the metadata. Link: ' + name, | |
| } | |
| _this.$kytos.eventBus.$emit("setNotification", notification) | |
| }); | |
| }, | |
| bt_delete(){ | |
| this.show_modal = true; | |
| }, | |
| delete_link(){ | |
| let name = this.metadata.link_name !== undefined && this.metadata.link_name.length !== 0? '"' + this.metadata.link_name + '"' : this.details.id | |
| var _this = this | |
| let request = $.ajax({ | |
| type: "DELETE", | |
| url: this.$kytos_server_api + "kytos/topology/v3/links/" + this.details.id, | |
| async: true, | |
| }); | |
| request.done(function() { | |
| let notification = { | |
| icon: 'gear', | |
| title: 'Delete link: Success', | |
| description: 'The link ' + name + ' was deleted.', | |
| } | |
| _this.$kytos.eventBus.$emit("setNotification", notification) | |
| _this.$kytos.eventBus.$emit("hideInfoPanel") | |
| }); | |
| request.fail(function(data) { | |
| let notification = { | |
| icon: 'gear', | |
| title: 'Delete link: Failure', | |
| description: data.status + ': ' + data.responseJSON.description + ' The link ' + name + ' was not deleted.', | |
| } | |
| _this.$kytos.eventBus.$emit("setNotification", notification) | |
| }); | |
| }, | |
| }, |
jQuery AJAX should be replaced with Axios
Use as reference:
kytos-ng/mef_eline#659
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels