From 5e34af373578948beb9dd9400377aa9c440e7535 Mon Sep 17 00:00:00 2001
From: Ruben van der Linde
Date: Mon, 11 Nov 2024 23:47:18 +0100
Subject: [PATCH 01/19] Calls for finishing the mapping tester
---
appinfo/routes.php | 2 ++
lib/Controller/MappingsController.php | 36 +++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
diff --git a/appinfo/routes.php b/appinfo/routes.php
index 27548e58..a0e8b971 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -22,6 +22,8 @@
['name' => 'synchronizations#test', 'url' => '/api/synchronizations-test/{id}', 'verb' => 'POST'],
// Mapping endpoints
['name' => 'mappings#test', 'url' => '/api/mappings/test', 'verb' => 'POST'],
+ ['name' => 'mappings#objectsSave', 'url' => '/api/mappings/objects', 'verb' => 'POST'],
+ ['name' => 'mappings#objectsGet', 'url' => '/api/mappings/objects', 'verb' => 'GET'],
// Running endpoints
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'GET'],
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'PUT'],
diff --git a/lib/Controller/MappingsController.php b/lib/Controller/MappingsController.php
index f3ab9032..03394a88 100644
--- a/lib/Controller/MappingsController.php
+++ b/lib/Controller/MappingsController.php
@@ -291,4 +291,40 @@ public function test(ObjectService $objectService, IURLGenerator $urlGenerator):
'validationErrors' => $validationErrors
]);
}
+
+ /**
+ * Saves a mapping object
+ *
+ * This method saves a mapping object based on POST data.
+ */
+ public function objectsSave(): JSONResponse
+ {
+ // Check if the OpenRegister service is available
+ $openRegisters = $this->objectService->getOpenRegisters();
+ if ($openRegisters !== null) {
+ return new JSONResponse($openRegisters->saveObject($this->request->getParams()));
+ }
+ }
+
+ /**
+ * Retrieves a list of objects to map to
+ *
+ * This method retrieves a list of objects to map to based on GET data.
+ */
+ public function objectsGet(): JSONResponse
+ {
+ // Check if the OpenRegister service is available
+ $openRegisters = $this->objectService->getOpenRegisters();
+ $data = [];
+ if ($openRegisters !== null) {
+ $data['openRegisters'] = true;
+ $data['availableRegisters'] = $openRegisters->getRegisters();
+ }
+ else {
+ $data['openRegisters'] = false;
+ }
+
+ return new JSONResponse($data);
+
+ }
}
From 6fc18c6687b57e7904d6f6a39b9a18a4ff6aff30 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 11:27:37 +0100
Subject: [PATCH 02/19] fixed mapping objects get
---
lib/Controller/MappingsController.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/Controller/MappingsController.php b/lib/Controller/MappingsController.php
index 03394a88..6fea9d91 100644
--- a/lib/Controller/MappingsController.php
+++ b/lib/Controller/MappingsController.php
@@ -31,7 +31,8 @@ public function __construct(
IRequest $request,
private readonly IAppConfig $config,
private readonly MappingMapper $mappingMapper,
- private readonly MappingService $mappingService
+ private readonly MappingService $mappingService,
+ private readonly ObjectService $objectService
)
{
parent::__construct($appName, $request);
@@ -310,6 +311,9 @@ public function objectsSave(): JSONResponse
* Retrieves a list of objects to map to
*
* This method retrieves a list of objects to map to based on GET data.
+ *
+ * @NoAdminRequired
+ * @NoCSRFRequired
*/
public function objectsGet(): JSONResponse
{
From a3f3075e8983dc4df47bdcda3548c87465c4a2b2 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 14:12:36 +0100
Subject: [PATCH 03/19] fixed saving objects
---
lib/Controller/MappingsController.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/Controller/MappingsController.php b/lib/Controller/MappingsController.php
index 6fea9d91..a420a77f 100644
--- a/lib/Controller/MappingsController.php
+++ b/lib/Controller/MappingsController.php
@@ -297,13 +297,17 @@ public function test(ObjectService $objectService, IURLGenerator $urlGenerator):
* Saves a mapping object
*
* This method saves a mapping object based on POST data.
+ *
+ * @NoAdminRequired
+ * @NoCSRFRequired
*/
public function objectsSave(): JSONResponse
{
// Check if the OpenRegister service is available
$openRegisters = $this->objectService->getOpenRegisters();
if ($openRegisters !== null) {
- return new JSONResponse($openRegisters->saveObject($this->request->getParams()));
+ $data = $this->request->getParams();
+ return new JSONResponse($openRegisters->saveObject($data['register'], $data['schema'], $data['object']));
}
}
@@ -311,7 +315,7 @@ public function objectsSave(): JSONResponse
* Retrieves a list of objects to map to
*
* This method retrieves a list of objects to map to based on GET data.
- *
+ *
* @NoAdminRequired
* @NoCSRFRequired
*/
From 30ea9db72c76cdcc6200bedbfeaf3a9fea236021 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 14:15:05 +0100
Subject: [PATCH 04/19] finished frontend saving objects
---
src/modals/MappingTest/TestMapping.vue | 5 +-
.../components/TestMappingResult.vue | 159 +++++++++++++++++-
src/store/modules/mapping.js | 58 +++++++
3 files changed, 219 insertions(+), 3 deletions(-)
diff --git a/src/modals/MappingTest/TestMapping.vue b/src/modals/MappingTest/TestMapping.vue
index a3e4fcba..6df11e7c 100644
--- a/src/modals/MappingTest/TestMapping.vue
+++ b/src/modals/MappingTest/TestMapping.vue
@@ -19,7 +19,8 @@ import { navigationStore } from '../../store/store.js'
@mapping-selected="receiveMappingSelected"
@mapping-test="receiveMappingTest" />
+ :mapping-test="mappingTest"
+ :schema="schema" />
@@ -82,7 +83,7 @@ export default {
value.error !== undefined && (this.mappingTest.error = value.error) // boolean / string
},
receiveSchemaSelected(value) {
- value.selected && (this.schema.selected = value.selected)
+ value?.selected !== undefined && (this.schema.selected = value.selected)
value.schemas && (this.schema.schemas = value.schemas)
value.success !== undefined && (this.schema.success = value.success) // boolean
value.loading !== undefined && (this.schema.loading = value.loading) // boolean
diff --git a/src/modals/MappingTest/components/TestMappingResult.vue b/src/modals/MappingTest/components/TestMappingResult.vue
index be06719a..5c4b3025 100644
--- a/src/modals/MappingTest/components/TestMappingResult.vue
+++ b/src/modals/MappingTest/components/TestMappingResult.vue
@@ -1,3 +1,7 @@
+
+
Test result
@@ -50,6 +54,60 @@
+
+
+
Save object
+
+
+
+
+
+ Loading...
+
+
+ Er zijn geen registers beschikbaar
+
+
+
+
+
+
+
+
+ {{ label }}
+
+ {{ fullRegister.description || 'No description' }}
+
+
+
+
+
+
+
+
+
+
+ Save
+
+
+
+ Object saved successfully
+
+
+ {{ saveObjectError || 'An error occurred' }}
+
+
@@ -58,21 +116,37 @@
import {
NcNoteCard,
NcIconSvgWrapper,
+ NcSelect,
+ NcButton,
+ NcLoadingIcon,
} from '@nextcloud/vue'
import { mdiCheckCircle, mdiCloseCircle } from '@mdi/js'
+import DatabaseOutline from 'vue-material-design-icons/DatabaseOutline.vue'
+import ContentSaveOutline from 'vue-material-design-icons/ContentSaveOutline.vue'
+
export default {
name: 'TestMappingResult',
components: {
NcNoteCard,
NcIconSvgWrapper,
+ NcSelect,
+ NcButton,
+ NcLoadingIcon,
+ // icons
+ DatabaseOutline,
+ ContentSaveOutline,
},
props: {
mappingTest: {
type: Object,
required: true,
},
+ schema: {
+ type: Object,
+ required: true,
+ },
},
setup() {
return {
@@ -82,9 +156,74 @@ export default {
},
data() {
return {
- // data here
+ openRegisterInstalled: false,
+ fetchRegistersLoading: false,
+ rawRegisters: [],
+ registers: {
+ options: [],
+ value: null,
+ },
+ saveObjectLoading: false,
+ saveObjectSuccess: null,
+ saveObjectError: '',
}
},
+ mounted() {
+ this.fetchRegisters()
+ },
+ methods: {
+ fetchRegisters() {
+ this.fetchRegistersLoading = true
+
+ mappingStore.getMappingObjects()
+ .then(({ response, data }) => {
+ this.openRegisterInstalled = data.openRegisters
+ if (!data.openRegisters) return // if open register is not installed, we don't need the rest of this code
+
+ this.rawRegisters = data.availableRegisters
+
+ this.registers.options = data.availableRegisters.map((register) => ({
+ id: register.id,
+ label: register.title,
+ fullRegister: register,
+ }))
+ })
+ .catch((error) => {
+ console.error(error)
+ })
+ .finally(() => {
+ this.fetchRegistersLoading = false
+ })
+ },
+ saveObject() {
+ this.saveObjectLoading = true
+ this.saveObjectSuccess = null
+ this.saveObjectError = ''
+
+ mappingStore.saveMappingObject({
+ object: this.mappingTest.result.resultObject,
+ register: this.registers.value.id,
+ schema: this.schema.selected.id,
+ })
+ .then(({ response }) => {
+ this.saveObjectSuccess = response.ok
+ })
+ .catch((error) => {
+ console.error(error)
+ this.saveObjectSuccess = false
+ this.saveObjectError = error
+ })
+ .finally(() => {
+ this.saveObjectLoading = false
+
+ // cleanup after 3 seconds
+ setTimeout(() => {
+ this.saveObjectSuccess = null
+ this.saveObjectError = ''
+ }, 3000)
+ })
+ },
+ },
}
@@ -125,4 +264,22 @@ export default {
border: 1px solid grey;
padding: 8px;
}
+
+.v-select {
+ min-width: auto;
+ width: 100%;
+}
+
+/* custom select option */
+.custom-select-option {
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+.custom-select-option > .material-design-icon {
+ margin-block-start: 2px;
+}
+.custom-select-option > h6 {
+ line-height: 0.8;
+}
diff --git a/src/store/modules/mapping.js b/src/store/modules/mapping.js
index 18c11a41..e3358b7f 100644
--- a/src/store/modules/mapping.js
+++ b/src/store/modules/mapping.js
@@ -178,5 +178,63 @@ export const useMappingStore = defineStore('mapping', {
return { response, data }
},
+ /**
+ * Get objects on a mapping from the endpoint.
+ *
+ * This method fetches objects related to a mapping from the specified API endpoint.
+ *
+ * @throws Will throw an error if the fetch operation fails.
+ * @return { Promise<{ response: Response, data: object }> } The response and data from the API.
+ */
+ async getMappingObjects() {
+ console.log('Fetching mapping objects...')
+
+ // Fetch objects related to a mapping from the API endpoint
+ const response = await fetch(
+ '/index.php/apps/openconnector/api/mappings/objects',
+ {
+ method: 'GET',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ },
+ )
+
+ // Parse the response data as JSON
+ const data = await response.json()
+
+ // Return the response and parsed data
+ return { response, data }
+ },
+ /**
+ * Save a mapping object to the endpoint.
+ *
+ * This method sends a mapping object to the specified API endpoint to be saved.
+ *
+ * @param { object } mappingObject - The mapping object to be saved.
+ * @return { Promise<{ response: Response, data: object }> } The response and data from the API.
+ * @throws Will throw an error if the save operation fails.
+ */
+ async saveMappingObject(mappingObject) {
+ console.log('Saving mapping object...')
+
+ // Send the mapping object to the API endpoint to be saved
+ const response = await fetch(
+ '/index.php/apps/openconnector/api/mappings/objects',
+ {
+ method: 'POST',
+ headers: {
+ 'Content-Type': 'application/json',
+ },
+ body: JSON.stringify(mappingObject),
+ },
+ )
+
+ // Parse the response data as JSON
+ const data = await response.json()
+
+ // Return the response and parsed data
+ return { response, data }
+ },
},
})
From 1df05b5a544de36a36550954edc3060773e1500e Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 14:32:46 +0100
Subject: [PATCH 05/19] changed function names
---
appinfo/routes.php | 4 ++--
lib/Controller/MappingsController.php | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/appinfo/routes.php b/appinfo/routes.php
index a0e8b971..d9de797f 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -22,8 +22,8 @@
['name' => 'synchronizations#test', 'url' => '/api/synchronizations-test/{id}', 'verb' => 'POST'],
// Mapping endpoints
['name' => 'mappings#test', 'url' => '/api/mappings/test', 'verb' => 'POST'],
- ['name' => 'mappings#objectsSave', 'url' => '/api/mappings/objects', 'verb' => 'POST'],
- ['name' => 'mappings#objectsGet', 'url' => '/api/mappings/objects', 'verb' => 'GET'],
+ ['name' => 'mappings#saveObjects', 'url' => '/api/mappings/objects', 'verb' => 'POST'],
+ ['name' => 'mappings#getObjects', 'url' => '/api/mappings/objects', 'verb' => 'GET'],
// Running endpoints
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'GET'],
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'PUT'],
diff --git a/lib/Controller/MappingsController.php b/lib/Controller/MappingsController.php
index a420a77f..c3c512e0 100644
--- a/lib/Controller/MappingsController.php
+++ b/lib/Controller/MappingsController.php
@@ -301,7 +301,7 @@ public function test(ObjectService $objectService, IURLGenerator $urlGenerator):
* @NoAdminRequired
* @NoCSRFRequired
*/
- public function objectsSave(): JSONResponse
+ public function saveObjects(): JSONResponse
{
// Check if the OpenRegister service is available
$openRegisters = $this->objectService->getOpenRegisters();
@@ -319,7 +319,7 @@ public function objectsSave(): JSONResponse
* @NoAdminRequired
* @NoCSRFRequired
*/
- public function objectsGet(): JSONResponse
+ public function getObjects(): JSONResponse
{
// Check if the OpenRegister service is available
$openRegisters = $this->objectService->getOpenRegisters();
From be0ea081fae197fbc852e652e671ce3e4570ba80 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 14:40:00 +0100
Subject: [PATCH 06/19] removed a S after save objects
---
appinfo/routes.php | 2 +-
lib/Controller/MappingsController.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/appinfo/routes.php b/appinfo/routes.php
index d9de797f..f96805d7 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -22,7 +22,7 @@
['name' => 'synchronizations#test', 'url' => '/api/synchronizations-test/{id}', 'verb' => 'POST'],
// Mapping endpoints
['name' => 'mappings#test', 'url' => '/api/mappings/test', 'verb' => 'POST'],
- ['name' => 'mappings#saveObjects', 'url' => '/api/mappings/objects', 'verb' => 'POST'],
+ ['name' => 'mappings#saveObject', 'url' => '/api/mappings/objects', 'verb' => 'POST'],
['name' => 'mappings#getObjects', 'url' => '/api/mappings/objects', 'verb' => 'GET'],
// Running endpoints
['name' => 'endpoints#run', 'url' => '/api/v1/{endpoint}', 'verb' => 'GET'],
diff --git a/lib/Controller/MappingsController.php b/lib/Controller/MappingsController.php
index c3c512e0..bc48a2b6 100644
--- a/lib/Controller/MappingsController.php
+++ b/lib/Controller/MappingsController.php
@@ -301,7 +301,7 @@ public function test(ObjectService $objectService, IURLGenerator $urlGenerator):
* @NoAdminRequired
* @NoCSRFRequired
*/
- public function saveObjects(): JSONResponse
+ public function saveObject(): JSONResponse
{
// Check if the OpenRegister service is available
$openRegisters = $this->objectService->getOpenRegisters();
From 8bb3786aa4d9a8a557f2361edc2d021a00cecf5c Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 16:23:27 +0100
Subject: [PATCH 07/19] lint fix
---
src/components/CreateEndpointDialog.vue | 1 -
src/components/CreateWebhookDialog.vue | 1 -
src/components/EditEndpointDialog.vue | 1 -
src/components/EditWebhookDialog.vue | 1 -
src/entities/callLog/index.js | 1 -
src/entities/endpoint/index.js | 1 -
src/entities/index.js | 2 +-
src/entities/jobLog/index.js | 1 -
src/modals/Synchronization/EditSynchronization.vue | 6 +++---
src/navigation/MainMenu.vue | 8 +++++++-
10 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/src/components/CreateEndpointDialog.vue b/src/components/CreateEndpointDialog.vue
index 0519ecba..e69de29b 100644
--- a/src/components/CreateEndpointDialog.vue
+++ b/src/components/CreateEndpointDialog.vue
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/CreateWebhookDialog.vue b/src/components/CreateWebhookDialog.vue
index 0519ecba..e69de29b 100644
--- a/src/components/CreateWebhookDialog.vue
+++ b/src/components/CreateWebhookDialog.vue
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/EditEndpointDialog.vue b/src/components/EditEndpointDialog.vue
index 0519ecba..e69de29b 100644
--- a/src/components/EditEndpointDialog.vue
+++ b/src/components/EditEndpointDialog.vue
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/components/EditWebhookDialog.vue b/src/components/EditWebhookDialog.vue
index 0519ecba..e69de29b 100644
--- a/src/components/EditWebhookDialog.vue
+++ b/src/components/EditWebhookDialog.vue
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/src/entities/callLog/index.js b/src/entities/callLog/index.js
index 7b97bc11..ec8b4474 100644
--- a/src/entities/callLog/index.js
+++ b/src/entities/callLog/index.js
@@ -1,4 +1,3 @@
export * from './callLog.ts'
export * from './callLog.types.ts'
export * from './callLog.mock.ts'
-
diff --git a/src/entities/endpoint/index.js b/src/entities/endpoint/index.js
index d9efff0e..5689c47b 100644
--- a/src/entities/endpoint/index.js
+++ b/src/entities/endpoint/index.js
@@ -1,4 +1,3 @@
export * from './endpoint.ts'
export * from './endpoint.types.ts'
export * from './endpoint.mock.ts'
-
diff --git a/src/entities/index.js b/src/entities/index.js
index 9e9bf6ee..99d426c6 100644
--- a/src/entities/index.js
+++ b/src/entities/index.js
@@ -8,4 +8,4 @@ export * from './webhook/index.js'
export * from './mapping/index.js'
export * from './synchronization/index.js'
export * from './source/index.js'
-export * from './callLog/index.js'
+export * from './callLog/index.js'
diff --git a/src/entities/jobLog/index.js b/src/entities/jobLog/index.js
index df9f468f..25968947 100644
--- a/src/entities/jobLog/index.js
+++ b/src/entities/jobLog/index.js
@@ -1,4 +1,3 @@
export * from './jobLog.types.ts'
export * from './jobLog.types.ts'
export * from './jobLog.mock.ts'
-
diff --git a/src/modals/Synchronization/EditSynchronization.vue b/src/modals/Synchronization/EditSynchronization.vue
index bf1aa3e8..3c28da67 100644
--- a/src/modals/Synchronization/EditSynchronization.vue
+++ b/src/modals/Synchronization/EditSynchronization.vue
@@ -1,5 +1,5 @@
@@ -25,8 +25,8 @@ import { synchronizationStore, navigationStore, sourceStore } from '../../store/
-
+
diff --git a/src/navigation/MainMenu.vue b/src/navigation/MainMenu.vue
index d2c09576..51cfb59e 100644
--- a/src/navigation/MainMenu.vue
+++ b/src/navigation/MainMenu.vue
@@ -30,7 +30,11 @@ import { navigationStore } from '../store/store.js'
-
+
@@ -39,6 +43,8 @@ import { navigationStore } from '../store/store.js'
+
+
From c8d76863cecf71026d8f2f8e3109cc4fa333f197 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Tue, 12 Nov 2024 16:48:48 +0100
Subject: [PATCH 08/19] added a clear timeout when closing modal
---
src/modals/JobArgument/DeleteJobArgument.vue | 8 ++------
src/modals/mappingCast/DeleteMappingCast.vue | 14 ++++++++------
src/modals/mappingCast/EditMappingCast.vue | 6 +++---
3 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/src/modals/JobArgument/DeleteJobArgument.vue b/src/modals/JobArgument/DeleteJobArgument.vue
index 75b779f7..b41001e9 100644
--- a/src/modals/JobArgument/DeleteJobArgument.vue
+++ b/src/modals/JobArgument/DeleteJobArgument.vue
@@ -22,7 +22,7 @@ import { navigationStore, jobStore } from '../../store/store.js'
Do you want to delete {{ jobStore.jobArgumentKey }}? This action cannot be undone.
-
+
@@ -94,11 +94,7 @@ export default {
this.success = true
// Wait for the user to read the feedback then close the model
- const self = this
- this.closeTimeoutFunc = setTimeout(function() {
- self.success = null
- navigationStore.setModal(false)
- }, 2000)
+ this.closeTimeoutFunc = setTimeout(this.closeModal, 2000)
})
.catch((err) => {
this.error = err
diff --git a/src/modals/mappingCast/DeleteMappingCast.vue b/src/modals/mappingCast/DeleteMappingCast.vue
index adb12eba..12c4c612 100644
--- a/src/modals/mappingCast/DeleteMappingCast.vue
+++ b/src/modals/mappingCast/DeleteMappingCast.vue
@@ -22,7 +22,7 @@ import { navigationStore, mappingStore } from '../../store/store.js'
Do you want to delete {{ mappingStore.mappingCastKey }}? This action cannot be undone.
-
+
@@ -66,9 +66,15 @@ export default {
loading: false,
success: null,
error: false,
+ closeTimeoutFunc: null,
}
},
methods: {
+ closeModal() {
+ navigationStore.setModal(false)
+ clearTimeout(this.closeTimeoutFunc)
+ this.success = null
+ },
deleteMappingCast() {
this.loading = true
@@ -85,11 +91,7 @@ export default {
this.success = true
// Wait for the user to read the feedback then close the model
- const self = this
- setTimeout(function() {
- self.success = null
- navigationStore.setModal(false)
- }, 2000)
+ this.closeTimeoutFunc = setTimeout(this.closeModal, 2000)
})
.catch((err) => {
this.error = err
diff --git a/src/modals/mappingCast/EditMappingCast.vue b/src/modals/mappingCast/EditMappingCast.vue
index 190a823e..8481236a 100644
--- a/src/modals/mappingCast/EditMappingCast.vue
+++ b/src/modals/mappingCast/EditMappingCast.vue
@@ -80,6 +80,7 @@ export default {
hasUpdated: false,
oldKey: '',
isEdit: false,
+ closeTimeoutFunc: null,
}
},
mounted() {
@@ -115,6 +116,7 @@ export default {
},
closeModal() {
navigationStore.setModal(false)
+ clearTimeout(this.closeTimeoutFunc)
this.success = false
this.loading = false
this.error = false
@@ -146,9 +148,7 @@ export default {
// Close modal or show success message
this.success = true
this.loading = false
- setTimeout(() => {
- this.closeModal()
- }, 2000)
+ this.closeTimeoutFunc = setTimeout(this.closeModal, 2000)
} catch (error) {
this.loading = false
this.success = false
From c356d5659e86360bce216a8ad36a1c7b2217e257 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Wed, 13 Nov 2024 10:57:36 +0100
Subject: [PATCH 09/19] fixed console error when deleting endpoint
---
src/modals/Endpoint/DeleteEndpoint.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modals/Endpoint/DeleteEndpoint.vue b/src/modals/Endpoint/DeleteEndpoint.vue
index 130e212b..77691a5b 100644
--- a/src/modals/Endpoint/DeleteEndpoint.vue
+++ b/src/modals/Endpoint/DeleteEndpoint.vue
@@ -8,7 +8,7 @@ import { endpointStore, navigationStore } from '../../store/store.js'
size="normal"
:can-close="false">
- Do you want to delete {{ endpointStore.endpointItem.name }}? This action cannot be undone.
+ Do you want to delete {{ endpointStore.endpointItem?.name }}? This action cannot be undone.
From f7293a99feac87036fa8361f9b6304142e5366ee Mon Sep 17 00:00:00 2001
From: Thijn
Date: Wed, 13 Nov 2024 13:39:31 +0100
Subject: [PATCH 10/19] added unset property to mapping
---
src/entities/mapping/mapping.ts | 4 +-
src/entities/mapping/mapping.types.ts | 2 +-
.../components/TestMappingMappingSelect.vue | 8 +
src/modals/Modals.vue | 6 +
.../mappingUnset/DeleteMappingUnset.vue | 128 ++++++++++++++++
src/modals/mappingUnset/EditMappingUnset.vue | 137 ++++++++++++++++++
src/store/modules/mapping.js | 5 +
src/views/Mapping/MappingDetails.vue | 43 ++++++
8 files changed, 330 insertions(+), 3 deletions(-)
create mode 100644 src/modals/mappingUnset/DeleteMappingUnset.vue
create mode 100644 src/modals/mappingUnset/EditMappingUnset.vue
diff --git a/src/entities/mapping/mapping.ts b/src/entities/mapping/mapping.ts
index 984092ce..0574e29f 100644
--- a/src/entities/mapping/mapping.ts
+++ b/src/entities/mapping/mapping.ts
@@ -13,7 +13,7 @@ export class Mapping extends ReadonlyBaseClass implements TMapping {
public readonly name: string
public readonly description: string
public readonly mapping: Record
- public readonly unset: any[]
+ public readonly unset: string[]
public readonly cast: Record
public readonly passThrough: boolean
public readonly dateCreated: string
@@ -47,7 +47,7 @@ export class Mapping extends ReadonlyBaseClass implements TMapping {
name: z.string().max(255),
description: z.string(),
mapping: z.record(z.any()),
- unset: z.array(z.any()),
+ unset: z.array(z.string()),
cast: z.record(z.any()),
passThrough: z.boolean(),
dateCreated: z.string().or(z.literal('')),
diff --git a/src/entities/mapping/mapping.types.ts b/src/entities/mapping/mapping.types.ts
index 92e69b53..5d7a9eda 100644
--- a/src/entities/mapping/mapping.types.ts
+++ b/src/entities/mapping/mapping.types.ts
@@ -7,7 +7,7 @@ export type TMapping = {
name: string
description: string
mapping: Record
- unset: any[]
+ unset: string[]
cast: Record
passThrough: boolean
dateCreated: string
diff --git a/src/modals/MappingTest/components/TestMappingMappingSelect.vue b/src/modals/MappingTest/components/TestMappingMappingSelect.vue
index 9de68ca7..683f0fe6 100644
--- a/src/modals/MappingTest/components/TestMappingMappingSelect.vue
+++ b/src/modals/MappingTest/components/TestMappingMappingSelect.vue
@@ -143,6 +143,10 @@ import { mappingStore } from '../../../store/store.js'
:error="!validJson(mappingItem.cast, true)"
:helper-text="!validJson(mappingItem.cast, true) ? 'Invalid JSON' : ''" />
+
+
+
+
@@ -68,6 +70,8 @@ import DeleteMappingCast from './mappingCast/DeleteMappingCast.vue'
import ViewJobLog from './Log/ViewJobLog.vue'
import ViewSynchronizationLog from './Log/ViewSynchronizationLog.vue'
import ViewSynchronizationContract from './Log/ViewSynchronizationContract.vue'
+import EditMappingUnset from './mappingUnset/EditMappingUnset.vue'
+import DeleteMappingUnset from './mappingUnset/DeleteMappingUnset.vue'
export default {
name: 'Modals',
@@ -102,6 +106,8 @@ export default {
ViewJobLog,
ViewSynchronizationLog,
ViewSynchronizationContract,
+ EditMappingUnset,
+ DeleteMappingUnset,
},
setup() {
return {
diff --git a/src/modals/mappingUnset/DeleteMappingUnset.vue b/src/modals/mappingUnset/DeleteMappingUnset.vue
new file mode 100644
index 00000000..43ec63c0
--- /dev/null
+++ b/src/modals/mappingUnset/DeleteMappingUnset.vue
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ Successfully deleted mapping unset
+
+
+ Something went wrong deleting the mapping unset
+
+
+ {{ error }}
+
+
+
+ Do you want to delete {{ mappingStore.mappingUnsetKey }}? This action cannot be undone.
+
+
+
+
+
+
+ {{ success !== null ? 'Close' : 'Cancel' }}
+
+
+
+
+
+
+ Delete
+
+
+
+
+
+
+
+
diff --git a/src/modals/mappingUnset/EditMappingUnset.vue b/src/modals/mappingUnset/EditMappingUnset.vue
new file mode 100644
index 00000000..acd45acd
--- /dev/null
+++ b/src/modals/mappingUnset/EditMappingUnset.vue
@@ -0,0 +1,137 @@
+
+
+
+
+
+
{{ mappingStore.mappingUnsetKey ? 'Edit' : 'Add' }} Mapping Unset
+
+ Mapping Unset successfully added
+
+
+ {{ error }}
+
+
+
+
+
+
+
+
+
+ Save
+
+
+
+
+
+
diff --git a/src/store/modules/mapping.js b/src/store/modules/mapping.js
index 18c11a41..9fe5bbb0 100644
--- a/src/store/modules/mapping.js
+++ b/src/store/modules/mapping.js
@@ -8,6 +8,7 @@ export const useMappingStore = defineStore('mapping', {
mappingList: [],
mappingMappingKey: null,
mappingCastKey: null,
+ mappingUnsetKey: null,
}),
actions: {
setMappingItem(mappingItem) {
@@ -28,6 +29,10 @@ export const useMappingStore = defineStore('mapping', {
this.mappingCastKey = mappingCastKey
console.log('Active mapping cast key set to ' + mappingCastKey)
},
+ setMappingUnsetKey(mappingUnsetKey) {
+ this.mappingUnsetKey = mappingUnsetKey
+ console.log('Active mapping unset key set to ' + mappingUnsetKey)
+ },
/* istanbul ignore next */ // ignore this for Jest until moved into a service
async refreshMappingList(search = null) {
// @todo this might belong in a service?
diff --git a/src/views/Mapping/MappingDetails.vue b/src/views/Mapping/MappingDetails.vue
index 841d493c..72257fb3 100644
--- a/src/views/Mapping/MappingDetails.vue
+++ b/src/views/Mapping/MappingDetails.vue
@@ -33,6 +33,12 @@ import { mappingStore, navigationStore } from '../../store/store.js'
Add Cast
+
+
+
+
+ Add Unset
+
@@ -141,6 +147,42 @@ import { mappingStore, navigationStore } from '../../store/store.js'
No cast found
+
+
+
+
+
+
+
+ {{ value }}
+
+
+
+
+
+
+ Edit
+
+
+
+
+
+ Delete
+
+
+
+
+
+ No unset found
+
+
@@ -159,6 +201,7 @@ import SwapHorizontal from 'vue-material-design-icons/SwapHorizontal.vue'
import TrashCanOutline from 'vue-material-design-icons/TrashCanOutline.vue'
import Delete from 'vue-material-design-icons/Delete.vue'
import TestTube from 'vue-material-design-icons/TestTube.vue'
+import Eraser from 'vue-material-design-icons/Eraser.vue'
export default {
name: 'MappingDetails',
From 20af34691cf5a52738f62453ec311f1a118fcb5e Mon Sep 17 00:00:00 2001
From: Thijn
Date: Wed, 13 Nov 2024 13:41:08 +0100
Subject: [PATCH 11/19] removed a incorrect help text
---
src/modals/MappingTest/components/TestMappingMappingSelect.vue | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/modals/MappingTest/components/TestMappingMappingSelect.vue b/src/modals/MappingTest/components/TestMappingMappingSelect.vue
index 683f0fe6..6ade46d8 100644
--- a/src/modals/MappingTest/components/TestMappingMappingSelect.vue
+++ b/src/modals/MappingTest/components/TestMappingMappingSelect.vue
@@ -145,7 +145,7 @@ import { mappingStore } from '../../../store/store.js'
+ helper-text="Enter a comma-separated list of keys." />
Date: Wed, 13 Nov 2024 13:42:22 +0100
Subject: [PATCH 12/19] forgot to include unset in the test
---
src/modals/MappingTest/components/TestMappingMappingSelect.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/modals/MappingTest/components/TestMappingMappingSelect.vue b/src/modals/MappingTest/components/TestMappingMappingSelect.vue
index 6ade46d8..ff3bad6d 100644
--- a/src/modals/MappingTest/components/TestMappingMappingSelect.vue
+++ b/src/modals/MappingTest/components/TestMappingMappingSelect.vue
@@ -426,6 +426,7 @@ export default {
description: this.mappingItem.description,
mapping: JSON.parse(this.mappingItem.mapping),
cast: this.mappingItem.cast ? JSON.parse(this.mappingItem.cast) : null,
+ unset: this.mappingItem.unset.split(/ *, */g),
},
inputObject: JSON.parse(this.inputObject.value),
schema: this.schemas.value?.id,
From 77cd3880fe67385df29ab6db6bf670e8c13b7ecd Mon Sep 17 00:00:00 2001
From: Remko
Date: Thu, 14 Nov 2024 14:57:08 +0100
Subject: [PATCH 13/19] Fixed small sync bug
---
src/entities/source/source.mock.ts | 2 ++
src/entities/source/source.ts | 3 ++
src/entities/source/source.types.ts | 1 +
.../Synchronization/TestSynchronization.vue | 34 +++++++++++++------
src/views/Source/SourceDetails.vue | 23 ++++++++-----
5 files changed, 44 insertions(+), 19 deletions(-)
diff --git a/src/entities/source/source.mock.ts b/src/entities/source/source.mock.ts
index d4aec985..3be4fa9c 100644
--- a/src/entities/source/source.mock.ts
+++ b/src/entities/source/source.mock.ts
@@ -4,6 +4,7 @@ import { TSource } from './source.types'
export const mockSourceData = (): TSource[] => [
{
id: '5137a1e5-b54d-43ad-abd1-4b5bff5fcd3f',
+ uuid: '5137a1e5-b54d-43ad-abd1-4b5bff5fcd3f',
name: 'Test Source 1',
description: 'A test source for demonstration',
location: 'https://api.test1.com',
@@ -43,6 +44,7 @@ export const mockSourceData = (): TSource[] => [
},
{
id: '4c3edd34-a90d-4d2a-8894-adb5836ecde8',
+ uuid: '4c3edd34-a90d-4d2a-8894-adb5836ecde8',
name: 'Test Source 2',
description: 'Another test source',
location: 'https://api.test2.com',
diff --git a/src/entities/source/source.ts b/src/entities/source/source.ts
index f842a0ca..7846c2da 100644
--- a/src/entities/source/source.ts
+++ b/src/entities/source/source.ts
@@ -7,6 +7,7 @@ import ReadonlyBaseClass from '../ReadonlyBaseClass.js'
export class Source extends ReadonlyBaseClass implements TSource {
public readonly id: string
+ public readonly uuid: string
public readonly name: string
public readonly description: string
public readonly reference: string
@@ -47,6 +48,7 @@ export class Source extends ReadonlyBaseClass implements TSource {
constructor(source: TSource) {
const processedSource: TSource = {
id: source.id || null,
+ uuid: source.uuid || '',
name: source.name || '',
description: source.description || '',
reference: source.reference || '',
@@ -91,6 +93,7 @@ export class Source extends ReadonlyBaseClass implements TSource {
public validate(): SafeParseReturnType {
const schema = z.object({
id: z.string().nullable(),
+ uuid: z.string(),
name: z.string().max(255),
description: z.string(),
reference: z.string(),
diff --git a/src/entities/source/source.types.ts b/src/entities/source/source.types.ts
index 1e4abd8d..a47f21ec 100644
--- a/src/entities/source/source.types.ts
+++ b/src/entities/source/source.types.ts
@@ -1,6 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
export type TSource = {
id: string
+ uuid: string
name: string
description: string
reference: string
diff --git a/src/modals/Synchronization/TestSynchronization.vue b/src/modals/Synchronization/TestSynchronization.vue
index 09812b32..d601b72c 100644
--- a/src/modals/Synchronization/TestSynchronization.vue
+++ b/src/modals/Synchronization/TestSynchronization.vue
@@ -14,20 +14,30 @@ import { synchronizationStore, navigationStore } from '../../store/store.js'
-
+
The connection to the synchronization was successful.
-
- An error occurred while testing the connection: {{ synchronizationStore.synchronizationTest ? synchronizationStore.synchronizationTest.response.statusMessage : error }}
+
+
+ An error occurred while testing the connection: {{
+ synchronizationStore.synchronizationTest
+ ? synchronizationStore.synchronizationTest.message
+ ? synchronizationStore.synchronizationTest.message
+ : synchronizationStore.synchronizationTest.error
+ : response.statusMessage
+ ? response.statusMessage
+ : `${response.status} - ${response.statusText}`
+ }}
+
-
-
Status: {{ synchronizationStore.synchronizationTest.response.statusMessage }} ({{ synchronizationStore.synchronizationTest.response.statusCode }})
-
Response time: {{ synchronizationStore.synchronizationTest.response.responseTime }} (Milliseconds)
-
Size: {{ synchronizationStore.synchronizationTest.response.size }} (Bytes)
-
Remote IP: {{ synchronizationStore.synchronizationTest.response.remoteIp }}
-
Headers: {{ synchronizationStore.synchronizationTest.response.headers }}
-
Body: {{ synchronizationStore.synchronizationTest.response.body }}
+
+
Status: {{ response.statusText }} ({{ response.status }})
+
Response time: {{ response.responseTime ?? 'Onbekend' }} (Milliseconds)
+
Size: {{ response.size ?? 'Onbekend' }} (Bytes)
+
Remote IP: {{ response.remoteIp }}
+
Headers: {{ response.headers }}
+
Body: {{ response.body }}
@@ -53,6 +63,7 @@ export default {
loading: false,
error: false,
updated: false,
+ response: null,
}
},
updated() {
@@ -75,6 +86,9 @@ export default {
synchronizationStore.testSynchronization()
.then(({ response }) => {
+
+ this.response = response
+
this.success = response.ok
this.error = false
response.ok && this.closeModal()
diff --git a/src/views/Source/SourceDetails.vue b/src/views/Source/SourceDetails.vue
index acf51e10..f5eb3b5b 100644
--- a/src/views/Source/SourceDetails.vue
+++ b/src/views/Source/SourceDetails.vue
@@ -44,11 +44,11 @@ import { sourceStore, navigationStore, logStore } from '../../store/store.js'
{{ sourceStore.sourceItem.description }}
-
+
id:
-
{{ sourceStore.sourceItem.uuid }}
+
{{ sourceStore.sourceItem.id || sourceStore.sourceItem.uuid }}
-
+
location:
{{ sourceStore.sourceItem.location }}
@@ -214,7 +214,7 @@ export default {
}
-
From c835df040088b9c66d29f32b93bb4eab28412b4b Mon Sep 17 00:00:00 2001
From: Remko
Date: Thu, 14 Nov 2024 15:12:58 +0100
Subject: [PATCH 14/19] Set format on callLog
---
lib/Db/CallLog.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/Db/CallLog.php b/lib/Db/CallLog.php
index c8c40c83..9dc69b53 100644
--- a/lib/Db/CallLog.php
+++ b/lib/Db/CallLog.php
@@ -80,8 +80,9 @@ public function jsonSerialize(): array
'synchronizationId' => $this->synchronizationId,
'userId' => $this->userId,
'sessionId' => $this->sessionId,
- 'expires' => $this->expires,
- 'created' => $this->created,
+ 'expires' => isset($this->expires) ? $this->expires->format('c') : null,
+ 'created' => isset($this->created) ? $this->created->format('c') : null,
+
];
}
}
From 4ff6d4528652cf6acf090ac5628b2dd7c10c6670 Mon Sep 17 00:00:00 2001
From: Remko
Date: Thu, 14 Nov 2024 15:22:57 +0100
Subject: [PATCH 15/19] cleanup
---
.../Synchronization/TestSynchronization.vue | 22 +++++++++----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/modals/Synchronization/TestSynchronization.vue b/src/modals/Synchronization/TestSynchronization.vue
index d601b72c..d9694105 100644
--- a/src/modals/Synchronization/TestSynchronization.vue
+++ b/src/modals/Synchronization/TestSynchronization.vue
@@ -14,30 +14,30 @@ import { synchronizationStore, navigationStore } from '../../store/store.js'
-
+
The connection to the synchronization was successful.
-
+
An error occurred while testing the connection: {{
synchronizationStore.synchronizationTest
? synchronizationStore.synchronizationTest.message
? synchronizationStore.synchronizationTest.message
: synchronizationStore.synchronizationTest.error
- : response.statusMessage
- ? response.statusMessage
- : `${response.status} - ${response.statusText}`
+ : response?.statusMessage
+ ? response?.statusMessage
+ : `${response?.status} - ${response?.statusText}`
}}
-
Status: {{ response.statusText }} ({{ response.status }})
-
Response time: {{ response.responseTime ?? 'Onbekend' }} (Milliseconds)
-
Size: {{ response.size ?? 'Onbekend' }} (Bytes)
-
Remote IP: {{ response.remoteIp }}
-
Headers: {{ response.headers }}
-
Body: {{ response.body }}
+
Status: {{ response?.statusText }} ({{ response?.status }})
+
Response time: {{ response?.responseTime ?? 'Onbekend' }} (Milliseconds)
+
Size: {{ response?.size ?? 'Onbekend' }} (Bytes)
+
Remote IP: {{ response?.remoteIp }}
+
Headers: {{ response?.headers }}
+
Body: {{ response?.body }}
From 9062428c5ac30288bd3dac50b5574e02d37e9644 Mon Sep 17 00:00:00 2001
From: Barry Brands
Date: Thu, 14 Nov 2024 15:55:47 +0100
Subject: [PATCH 16/19] Fix idPosition default, sourceId check and next page
---
lib/Service/SynchronizationService.php | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/lib/Service/SynchronizationService.php b/lib/Service/SynchronizationService.php
index 3acc7d77..94fc6d8d 100644
--- a/lib/Service/SynchronizationService.php
+++ b/lib/Service/SynchronizationService.php
@@ -83,6 +83,9 @@ public function __construct(
*/
public function synchronize(Synchronization $synchronization, ?bool $isTest = false): array
{
+ if (empty($synchronization->getSourceId()) === true) {
+ throw new Exception('sourceId of synchronziation cannot be empty. Canceling synchronization..');
+ }
$objectList = $this->getAllObjectsFromSource(synchronization: $synchronization, isTest: $isTest);
@@ -151,7 +154,7 @@ private function getOriginId(Synchronization $synchronization, array $object): i
$sourceConfig = $synchronization->getSourceConfig();
// Check if a custom ID position is defined in the source configuration
- if (isset($sourceConfig['idPosition']) === true) {
+ if (isset($sourceConfig['idPosition']) === true && empty($sourceConfig['idPosition']) === false) {
// Override default with custom ID position from config
$originIdPosition = $sourceConfig['idPosition'];
}
@@ -391,19 +394,21 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is
// Current page is 2 because the first call made above is page 1.
$currentPage = 2;
- $usedNextEndpoint = false;
+ $useNextEndpoint = false;
+ if (array_key_exists('next', $body)) {
+ $useNextEndpoint = true;
+ }
// Continue making API calls if there are more pages from 'next' the response body or if paginationQuery is set
- while($nextEndpoint = $this->getNextEndpoint(body: $body, url: $source->getLocation(), sourceConfig: $sourceConfig, currentPage: $currentPage)) {
- $usedNextEndpoint = true;
+ while($useNextEndpoint && $nextEndpoint = $this->getNextEndpoint(body: $body, url: $source->getLocation(), sourceConfig: $sourceConfig, currentPage: $currentPage)) {
// Do not pass $config here becuase it overwrites the query attached to nextEndpoint
$response = $this->callService->call(source: $source, endpoint: $nextEndpoint)->getResponse();
$body = json_decode($response['body'], true);
$objects = array_merge($objects, $this->getAllObjectsFromArray($body, $synchronization));
}
- if ($usedNextEndpoint === false) {
+ if ($useNextEndpoint === false) {
do {
$config = $this->getNextPage(config: $config, sourceConfig: $sourceConfig, currentPage: $currentPage);
$response = $this->callService->call(source: $source, endpoint: $endpoint, method: 'GET', config: $config)->getResponse();
@@ -523,7 +528,6 @@ public function getAllObjectsFromArray(array $array, Synchronization $synchroniz
*/
public function getNextlinkFromCall(array $body): ?string
{
- // Check if the 'next' key exists in the response body
return $body['next'] ?? null;
}
}
From f584a400d7b94ef7b26e82f99ba7397ddb6ee072 Mon Sep 17 00:00:00 2001
From: Barry Brands
Date: Thu, 14 Nov 2024 16:00:07 +0100
Subject: [PATCH 17/19] small cleanup
---
lib/Service/SynchronizationService.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/Service/SynchronizationService.php b/lib/Service/SynchronizationService.php
index 94fc6d8d..920ec6e8 100644
--- a/lib/Service/SynchronizationService.php
+++ b/lib/Service/SynchronizationService.php
@@ -401,7 +401,7 @@ public function getAllObjectsFromApi(Synchronization $synchronization, ?bool $is
// Continue making API calls if there are more pages from 'next' the response body or if paginationQuery is set
- while($useNextEndpoint && $nextEndpoint = $this->getNextEndpoint(body: $body, url: $source->getLocation(), sourceConfig: $sourceConfig, currentPage: $currentPage)) {
+ while($useNextEndpoint === true && $nextEndpoint = $this->getNextEndpoint(body: $body, url: $source->getLocation(), sourceConfig: $sourceConfig, currentPage: $currentPage)) {
// Do not pass $config here becuase it overwrites the query attached to nextEndpoint
$response = $this->callService->call(source: $source, endpoint: $nextEndpoint)->getResponse();
$body = json_decode($response['body'], true);
From 1277f471688a7866b5351b0f121ab219229874a8 Mon Sep 17 00:00:00 2001
From: Thijn
Date: Fri, 15 Nov 2024 16:09:26 +0100
Subject: [PATCH 18/19] fixed jobs next/last run view
---
src/services/getValidISOstring.js | 2 ++
src/views/Job/JobDetails.vue | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/services/getValidISOstring.js b/src/services/getValidISOstring.js
index 34e937a3..231912e3 100644
--- a/src/services/getValidISOstring.js
+++ b/src/services/getValidISOstring.js
@@ -1,6 +1,8 @@
/**
* Converts a given date string or Date object to a valid ISO string.
*
+ * this function can double as a validator for ISO / date strings
+ *
* If the dateString is valid it will return the ISO string,
* if it is not a valid dateString it will return null.
*
diff --git a/src/views/Job/JobDetails.vue b/src/views/Job/JobDetails.vue
index be8e8dc4..8797f680 100644
--- a/src/views/Job/JobDetails.vue
+++ b/src/views/Job/JobDetails.vue
@@ -90,13 +90,13 @@ import { jobStore, navigationStore, logStore } from '../../store/store.js'
Next Run:
- {{ new Date(jobStore.jobItem.nextRun).toLocaleString() || 'N/A' }}
+ {{ getValidISOstring(jobStore.jobItem.nextRun) ? new Date(jobStore.jobItem.nextRun).toLocaleString() : 'N/A' }}
Last Run:
- {{ new Date(jobStore.jobItem.lastRun).toLocaleString() || 'N/A' }}
+ {{ getValidISOstring(jobStore.jobItem.lastRun) ? new Date(jobStore.jobItem.lastRun).toLocaleString() : 'N/A' }}
@@ -195,6 +195,8 @@ import Update from 'vue-material-design-icons/Update.vue'
import Sync from 'vue-material-design-icons/Sync.vue'
import EyeOutline from 'vue-material-design-icons/EyeOutline.vue'
+import getValidISOstring from '../../services/getValidISOstring.js'
+
export default {
name: 'JobDetails',
components: {
From fc1d9e780a61e1a7727456003fa7854a40fb2b86 Mon Sep 17 00:00:00 2001
From: Remko
Date: Wed, 20 Nov 2024 11:21:21 +0100
Subject: [PATCH 19/19] Added specific branch pr to main
---
.../pull-request-from-branch-check.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
create mode 100644 .github/workflows/pull-request-from-branch-check.yaml
diff --git a/.github/workflows/pull-request-from-branch-check.yaml b/.github/workflows/pull-request-from-branch-check.yaml
new file mode 100644
index 00000000..a5476c9c
--- /dev/null
+++ b/.github/workflows/pull-request-from-branch-check.yaml
@@ -0,0 +1,18 @@
+name: Main Branch Protection
+
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ check-branch:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check branch
+ run: |
+ if [[ ${GITHUB_HEAD_REF} != development ]] && [[ ${GITHUB_HEAD_REF} != documentation ]] && ! [[ ${GITHUB_HEAD_REF} =~ ^hotfix/ ]];
+ then
+ echo "Error: Pull request must come from 'development', 'documentation' or 'hotfix/' branch"
+ exit 1
+ fi
\ No newline at end of file