Hansimov commited on
Commit
3239c32
1 Parent(s): 2e92470

:gem: [Feature] Bind remove endpoint_and_api_key button

Browse files
Files changed (1) hide show
  1. networks/endpoint_storage.js +20 -1
networks/endpoint_storage.js CHANGED
@@ -28,7 +28,7 @@ class EndpointStorage {
28
  let endpoint_and_api_key_item_html = `
29
  <div class="row mt-2 no-gutters">
30
  <div class="col-auto">
31
- <button class="btn px-0 remove-endpoint-and-key-button">
32
  <i class="fa fa-circle-minus"></i>
33
  </button>
34
  </div>
@@ -104,6 +104,25 @@ class EndpointStorage {
104
  console.log(`new_endpoint: ${endpoint_input_value}`);
105
  }
106
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
  fill_available_models_select() {
109
  var select = $("#available-models-select");
 
28
  let endpoint_and_api_key_item_html = `
29
  <div class="row mt-2 no-gutters">
30
  <div class="col-auto">
31
+ <button class="btn px-0 remove-endpoint-button">
32
  <i class="fa fa-circle-minus"></i>
33
  </button>
34
  </div>
 
104
  console.log(`new_endpoint: ${endpoint_input_value}`);
105
  }
106
  });
107
+
108
+ let remove_endpoint_buttons = endpoint_and_api_key_item.find(
109
+ ".remove-endpoint-button"
110
+ );
111
+ remove_endpoint_buttons.click(function () {
112
+ let endpoint_input =
113
+ endpoint_and_api_key_item.find(".endpoint-input");
114
+ let endpoint_input_value = endpoint_input.val();
115
+ endpoint_and_api_key_item.remove();
116
+ if (
117
+ endpoint_input_value.trim() === "" ||
118
+ self.db.endpoints.get(endpoint_input_value) === undefined
119
+ ) {
120
+ console.log("Endpoint not in endpoints");
121
+ } else {
122
+ self.db.endpoints.delete(endpoint_input_value);
123
+ }
124
+ console.log(`remove endpoint: ${endpoint_input_value}`);
125
+ });
126
  }
127
  fill_available_models_select() {
128
  var select = $("#available-models-select");