Skip to content

Commit

Permalink
Add form to Expose via Gateway
Browse files Browse the repository at this point in the history
Signed-off-by: Nihal Azmain <[email protected]>
  • Loading branch information
Nihal-Azmain committed Dec 20, 2024
1 parent 50bfe15 commit 7864b5a
Showing 1 changed file with 24 additions and 5 deletions.
29 changes: 24 additions & 5 deletions charts/kubedbcom-mysql-editor/ui/functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2357,16 +2357,35 @@ function isBindingAlreadyOn({ model, getValue }) {
return isExposeBinding
}

function addOrRemoveBinding({ commit, model, getValue, discriminator }) {
async function addOrRemoveBinding({ commit, model, getValue, discriminator }) {
const value = getValue(discriminator, `/binding`)
const resources = getValue(model, '/resources')
const dbName = getValue(model, '/metadata/release/name')
const dbNamespace = getValue(model, '/metadata/release/namespace')
const bindingValues = {
catalogAppscodeComMySQLBinding: {
apiVersion: 'catalog.appscode.com/v1alpha1',
kind: 'MySQLBinding',
metadata: {
name: dbName,
namespace: dbNamespace,
},
spec: {
sourceRef: {
name: dbName,
namespace: dbNamespace,
},
},
},
}

if (value) {
commit('wizard/model$update', {
path: '/resources/kubedbComMySQL/spec/storage/storageClassName',
value: storageClass,
await commit('wizard/model$update', {
path: '/resources/catalogAppscodeComMySQLBinding',
value: bindingValues,
force: true,
})
} else {
await commit('wizard/model$delete', '/resources/catalogAppscodeComMySQLBinding')
}
}

Expand Down

0 comments on commit 7864b5a

Please sign in to comment.