Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rules logic and cloud events standard #168

Merged
merged 40 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f6e7819
First draft for cloud event
rubenvdlinde Jan 9, 2025
5e6fe2f
Add the listener
rubenvdlinde Jan 9, 2025
be5d333
Add rules to open connector
rubenvdlinde Jan 11, 2025
d754763
Setting the frontend code
rubenvdlinde Jan 11, 2025
2e0fabd
More frontend work
rubenvdlinde Jan 11, 2025
7dbcef9
First bit of testing on rules
rubenvdlinde Jan 12, 2025
9f448e5
Basic frontend crud testing
rubenvdlinde Jan 12, 2025
30d4364
Lets try to add dropdowns
rubenvdlinde Jan 12, 2025
60405f9
Console error fix
rubenvdlinde Jan 12, 2025
ee597f3
Fixes from testing
rubenvdlinde Jan 12, 2025
9aaae36
Still getting the model to behave
rubenvdlinde Jan 12, 2025
f4c47ce
Last modal fixes
rubenvdlinde Jan 12, 2025
75e31a2
Merge remote-tracking branch 'origin/development' into feature/CONNEC…
rubenvdlinde Jan 12, 2025
d74bd96
Fixing the endpoint object
rubenvdlinde Jan 12, 2025
9c2d2d6
Add the tabs
rubenvdlinde Jan 12, 2025
21d1829
Add rule dialog
rubenvdlinde Jan 12, 2025
367eb1d
Fixed adding rules to endpoints
rubenvdlinde Jan 12, 2025
3f49014
Small fixed
rubenvdlinde Jan 12, 2025
76edc2b
Docs
rubenvdlinde Jan 12, 2025
58e72d8
Update the rules logic in the endpoint service
rubenvdlinde Jan 12, 2025
d682110
Let round up the rules logic
rubenvdlinde Jan 12, 2025
4f1c11e
add authentication and dowloads to ui en documentation
rubenvdlinde Jan 13, 2025
2da4454
Add upload and locking frontend
rubenvdlinde Jan 13, 2025
2ddd88e
PR review changes, incl. import&export fixes
WilcoLouwerse Jan 13, 2025
85b2975
Forgot to add findByRef for EventSubscriptionMapper & RuleMapper
WilcoLouwerse Jan 13, 2025
a220d22
Update list of objects that are not allowed to be imported/exported
WilcoLouwerse Jan 13, 2025
d0dcc21
Code style & docblock changes
WilcoLouwerse Jan 13, 2025
8e5861e
lint-fix
SudoThijn Jan 13, 2025
a2f33a8
Fix routes
WilcoLouwerse Jan 13, 2025
50d7baa
added my own requested changes
SudoThijn Jan 13, 2025
b91eafc
Merge remote-tracking branch 'origin/feature/CONNECTOR-52/cloud-event…
SudoThijn Jan 13, 2025
397212e
Some more route fixes
WilcoLouwerse Jan 13, 2025
fd71392
Merge remote-tracking branch 'origin/feature/CONNECTOR-52/cloud-event…
WilcoLouwerse Jan 13, 2025
43d304e
Update docblocks
WilcoLouwerse Jan 14, 2025
a00195a
Merge branch 'development' into feature/CONNECTOR-52/cloud-events
WilcoLouwerse Jan 14, 2025
6a12582
Small fix for checking rule method
WilcoLouwerse Jan 14, 2025
9c16b7d
Fixes for dealing with empty responces
rubenvdlinde Jan 14, 2025
7d21c04
Fix for getting objects from the root of a responce
rubenvdlinde Jan 14, 2025
c425180
Update documentation
rubenvdlinde Jan 14, 2025
31957a6
LInting fixes
rubenvdlinde Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Small fixed
  • Loading branch information
rubenvdlinde committed Jan 12, 2025
commit 3f4901438af0c0183c19d418c7ebfada30c450dc
12 changes: 7 additions & 5 deletions src/modals/Endpoint/AddEndpointRule.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,22 @@ export default {
if (!updatedEndpoint.rules) {
updatedEndpoint.rules = []
} else if (!Array.isArray(updatedEndpoint.rules)) {
// If rules exists but is not an array, convert it to array
updatedEndpoint.rules = []
}

// Add the new rule ID
updatedEndpoint.rules.push(this.ruleOptions.value.value)
// Convert existing rules to strings and add the new rule ID as string
const updatedRules = [
...updatedEndpoint.rules.map(id => String(id)),
String(this.ruleOptions.value.value)
]

// Ensure we're not modifying properties that should remain unchanged
// Prepare endpoint data for saving
const endpointToSave = {
...updatedEndpoint,
endpointArray: Array.isArray(updatedEndpoint.endpointArray)
? updatedEndpoint.endpointArray
: updatedEndpoint.endpointArray.split(/ *, */g),
rules: updatedEndpoint.rules
rules: updatedRules // Use the array of string IDs
}

const { response } = await endpointStore.saveEndpoint(endpointToSave)
Expand Down
52 changes: 37 additions & 15 deletions src/views/Endpoint/EndpointDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ import { endpointStore, navigationStore, ruleStore } from '../../store/store.js'
<span v-else>Loading...</span>
</template>
<template #actions>
<NcActionButton @click.stop="editRule(ruleId)">
<NcActionButton @click.stop="viewRule(ruleId)">
<template #icon>
<Pencil :size="20" />
<EyeOutline :size="20" />
</template>
Edit
View
</NcActionButton>
<NcActionButton @click.stop="deleteRule(ruleId)">
<NcActionButton @click.stop="removeRule(ruleId)">
<template #icon>
<Delete :size="20" />
<LinkOff :size="20" />
</template>
Delete
Remove
</NcActionButton>
</template>
</NcListItem>
Expand Down Expand Up @@ -161,6 +161,8 @@ import FileExportOutline from 'vue-material-design-icons/FileExportOutline.vue'
import SitemapOutline from 'vue-material-design-icons/SitemapOutline.vue'
import Delete from 'vue-material-design-icons/Delete.vue'
import Plus from 'vue-material-design-icons/Plus.vue'
import EyeOutline from 'vue-material-design-icons/EyeOutline.vue'
import LinkOff from 'vue-material-design-icons/LinkOff.vue'

export default {
name: 'EndpointDetails',
Expand All @@ -177,6 +179,8 @@ export default {
SitemapOutline,
Delete,
Plus,
EyeOutline,
LinkOff,
},
data() {
return {
Expand All @@ -188,6 +192,7 @@ export default {
this.loadRules()
},
methods: {

async loadRules() {
try {
await ruleStore.refreshRuleList()
Expand Down Expand Up @@ -220,16 +225,33 @@ export default {
}
},
viewRule(ruleId) {
ruleStore.setRuleItem(this.rulesList.find(rule => rule.id === ruleId))
navigationStore.setView('ruleDetails')
},
editRule(ruleId) {
ruleStore.setRuleItem(this.rulesList.find(rule => rule.id === ruleId))
navigationStore.setModal('editRule')
const rule = this.rulesList.find(rule => String(rule.id) === String(ruleId))
if (rule) {
ruleStore.setRuleItem(rule)
navigationStore.setView('rule')
}
},
deleteRule(ruleId) {
ruleStore.setRuleItem(this.rulesList.find(rule => rule.id === ruleId))
navigationStore.setDialog('deleteRule')
async removeRule(ruleId) {
try {
const updatedEndpoint = { ...endpointStore.endpointItem }

// Remove the rule ID from the rules array
updatedEndpoint.rules = updatedEndpoint.rules.filter(id => String(id) !== String(ruleId))

// Save the updated endpoint
await endpointStore.saveEndpoint({
...updatedEndpoint,
endpointArray: Array.isArray(updatedEndpoint.endpointArray)
? updatedEndpoint.endpointArray
: updatedEndpoint.endpointArray.split(/ *, */g),
rules: updatedEndpoint.rules.map(id => String(id))
})

// Refresh the rules list
await this.loadRules()
} catch (error) {
console.error('Failed to remove rule:', error)
}
}
}
}
Expand Down