@@ -116,10 +116,7 @@ export const useFunc = (model) => {
116116 async function getIssuerRefsName ( ) {
117117 const owner = storeGet ( '/route/params/user' )
118118 const cluster = storeGet ( '/route/params/cluster' )
119- const kind = getValue (
120- model ,
121- '/resources/kubedbComMilvus/spec/tls/issuerRef/kind' ,
122- )
119+ const kind = getValue ( model , '/resources/kubedbComMilvus/spec/tls/issuerRef/kind' )
123120 const namespace = getValue ( model , '/metadata/release/namespace' )
124121
125122 if ( kind === 'Issuer' ) {
@@ -672,10 +669,8 @@ export const useFunc = (model) => {
672669 function showOpsRequestOptions ( ) {
673670 if ( isKubedb ( ) ) return true
674671 return (
675- ! ! getValue (
676- model ,
677- '/resources/autoscalingKubedbComMilvusAutoscaler/spec/databaseRef/name' ,
678- ) && ! ! getValue ( discriminator , '/autoscalingType' )
672+ ! ! getValue ( model , '/resources/autoscalingKubedbComMilvusAutoscaler/spec/databaseRef/name' ) &&
673+ ! ! getValue ( discriminator , '/autoscalingType' )
679674 )
680675 }
681676
@@ -771,6 +766,45 @@ export const useFunc = (model) => {
771766 }
772767 }
773768
769+ function isBindingAlreadyOn ( ) {
770+ const value = getValue ( model , '/resources' )
771+ const keys = Object . keys ( value )
772+ const isExposeBinding = ! ! keys . find ( ( str ) => str === 'catalogAppscodeComMariaDBBinding' )
773+ return isExposeBinding
774+ }
775+
776+ function addOrRemoveBinding ( ) {
777+ const value = getValue ( discriminator , `/binding` )
778+ const dbName = getValue ( model , '/metadata/release/name' )
779+ const dbNamespace = getValue ( model , '/metadata/release/namespace' )
780+ const labels = getValue ( model , '/resources/kubedbComMariaDB/metadata/labels' )
781+ const bindingValues = {
782+ apiVersion : 'catalog.appscode.com/v1alpha1' ,
783+ kind : 'MariaDBBinding' ,
784+ metadata : {
785+ labels,
786+ name : dbName ,
787+ namespace : dbNamespace ,
788+ } ,
789+ spec : {
790+ sourceRef : {
791+ name : dbName ,
792+ namespace : dbNamespace ,
793+ } ,
794+ } ,
795+ }
796+
797+ if ( value ) {
798+ commit ( 'wizard/model$update' , {
799+ path : '/resources/catalogAppscodeComMariaDBBinding' ,
800+ value : bindingValues ,
801+ force : true ,
802+ } )
803+ } else {
804+ commit ( 'wizard/model$delete' , '/resources/catalogAppscodeComMariaDBBinding' )
805+ }
806+ }
807+
774808 return {
775809 returnFalse,
776810 returnTrue,
@@ -837,5 +871,8 @@ export const useFunc = (model) => {
837871 setApplyToIfReady,
838872 handleUnit,
839873 setValueFromDbDetails,
874+
875+ addOrRemoveBinding,
876+ isBindingAlreadyOn,
840877 }
841878}
0 commit comments