summaryrefslogtreecommitdiff
path: root/opendc-web/opendc-web-ui/src/redux/actions
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-07-22 19:05:58 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2022-02-17 16:58:40 +0100
commit41e02cdab85ba5db92be7f7bea07ae1f20bcbdd9 (patch)
tree2f32b9b76b7bf05172c0e0d90ba60e06b7f34ae4 /opendc-web/opendc-web-ui/src/redux/actions
parenta5b32960460b2e7b52032471bf23d29832734fba (diff)
fix(web/ui): Fix creation of topologies
This change fixes an issue with the creation of topologies in the frontend. Previously, the frontend relied on Redux to update the state. However, since we removed the reliance on Redux, we also need to create a new topology using the functions from React Query to actually send a request to the API server.
Diffstat (limited to 'opendc-web/opendc-web-ui/src/redux/actions')
-rw-r--r--opendc-web/opendc-web-ui/src/redux/actions/topologies.js27
-rw-r--r--opendc-web/opendc-web-ui/src/redux/actions/topology/index.js39
2 files changed, 39 insertions, 27 deletions
diff --git a/opendc-web/opendc-web-ui/src/redux/actions/topologies.js b/opendc-web/opendc-web-ui/src/redux/actions/topologies.js
deleted file mode 100644
index fc697cc2..00000000
--- a/opendc-web/opendc-web-ui/src/redux/actions/topologies.js
+++ /dev/null
@@ -1,27 +0,0 @@
-export const OPEN_TOPOLOGY = 'OPEN_TOPOLOGY'
-export const ADD_TOPOLOGY = 'ADD_TOPOLOGY'
-export const STORE_TOPOLOGY = 'STORE_TOPOLOGY'
-
-export function openTopology(id) {
- return {
- type: OPEN_TOPOLOGY,
- id,
- }
-}
-
-export function addTopology(projectId, name, duplicateId) {
- return {
- type: ADD_TOPOLOGY,
- projectId,
- name,
- duplicateId,
- }
-}
-
-export function storeTopology(topology, entities) {
- return {
- type: STORE_TOPOLOGY,
- topology,
- entities,
- }
-}
diff --git a/opendc-web/opendc-web-ui/src/redux/actions/topology/index.js b/opendc-web/opendc-web-ui/src/redux/actions/topology/index.js
new file mode 100644
index 00000000..94a712c4
--- /dev/null
+++ b/opendc-web/opendc-web-ui/src/redux/actions/topology/index.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2021 AtLarge Research
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+export const OPEN_TOPOLOGY = 'OPEN_TOPOLOGY'
+export const STORE_TOPOLOGY = 'STORE_TOPOLOGY'
+
+export function openTopology(id) {
+ return {
+ type: OPEN_TOPOLOGY,
+ id,
+ }
+}
+
+export function storeTopology(topology, entities) {
+ return {
+ type: STORE_TOPOLOGY,
+ topology,
+ entities,
+ }
+}