BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
81d769ec
Commit
81d769ec
authored
May 07, 2018
by
Dennis Tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor component mounts into reusable function
parent
36eaa408
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
42 deletions
+19
-42
index.js
...ssets/javascripts/projects/gke_cluster_dropdowns/index.js
+19
-42
No files found.
app/assets/javascripts/projects/gke_cluster_dropdowns/index.js
View file @
81d769ec
...
@@ -6,8 +6,8 @@ import GkeZoneDropdown from './components/gke_zone_dropdown.vue';
...
@@ -6,8 +6,8 @@ import GkeZoneDropdown from './components/gke_zone_dropdown.vue';
import
GkeMachineTypeDropdown
from
'./components/gke_machine_type_dropdown.vue'
;
import
GkeMachineTypeDropdown
from
'./components/gke_machine_type_dropdown.vue'
;
import
*
as
CONSTANTS
from
'./constants'
;
import
*
as
CONSTANTS
from
'./constants'
;
const
mount
GkeProjectIdDropdown
=
(
)
=>
{
const
mount
Component
=
(
entryPoint
,
component
,
componentName
,
extraProps
=
{}
)
=>
{
const
el
=
document
.
querySelector
(
'.js-gcp-project-id-dropdown-entry-point'
);
const
el
=
document
.
querySelector
(
entryPoint
);
const
hiddenInput
=
el
.
querySelector
(
'input'
);
const
hiddenInput
=
el
.
querySelector
(
'input'
);
if
(
!
el
)
return
false
;
if
(
!
el
)
return
false
;
...
@@ -15,62 +15,39 @@ const mountGkeProjectIdDropdown = () => {
...
@@ -15,62 +15,39 @@ const mountGkeProjectIdDropdown = () => {
return
new
Vue
({
return
new
Vue
({
el
,
el
,
components
:
{
components
:
{
GkeProjectIdDropdown
,
[
componentName
]:
component
,
},
},
render
:
createElement
=>
render
:
createElement
=>
createElement
(
'gke-project-id-dropdown'
,
{
createElement
(
componentName
,
{
props
:
{
props
:
{
docsUrl
:
el
.
dataset
.
docsurl
,
fieldName
:
hiddenInput
.
getAttribute
(
'name'
),
fieldName
:
hiddenInput
.
getAttribute
(
'name'
),
fieldId
:
hiddenInput
.
getAttribute
(
'id'
),
fieldId
:
hiddenInput
.
getAttribute
(
'id'
),
defaultValue
:
hiddenInput
.
value
,
defaultValue
:
hiddenInput
.
value
,
...
extraProps
,
},
},
}),
}),
});
});
};
};
const
mountGkeZoneDropdown
=
()
=>
{
const
mountGkeProjectIdDropdown
=
()
=>
{
const
el
=
document
.
querySelector
(
'.js-gcp-zone-dropdown-entry-point'
);
const
entryPoint
=
'.js-gcp-project-id-dropdown-entry-point'
;
const
hiddenInput
=
el
.
querySelector
(
'input'
);
const
el
=
document
.
querySelector
(
entryPoint
);
if
(
!
el
)
return
false
;
return
new
Vue
({
mountComponent
(
entryPoint
,
GkeProjectIdDropdown
,
'gke-project-id-dropdown'
,
{
el
,
docsUrl
:
el
.
dataset
.
docsurl
,
components
:
{
GkeZoneDropdown
,
},
render
:
createElement
=>
createElement
(
'gke-zone-dropdown'
,
{
props
:
{
fieldName
:
hiddenInput
.
getAttribute
(
'name'
),
fieldId
:
hiddenInput
.
getAttribute
(
'id'
),
defaultValue
:
hiddenInput
.
value
,
},
}),
});
});
};
};
const
mountGkeMachineTypeDropdown
=
()
=>
{
const
mountGkeZoneDropdown
=
()
=>
{
const
el
=
document
.
querySelector
(
'.js-gcp-machine-type-dropdown-entry-point'
);
mountComponent
(
'.js-gcp-zone-dropdown-entry-point'
,
GkeZoneDropdown
,
'gke-zone-dropdown'
);
const
hiddenInput
=
el
.
querySelector
(
'input'
);
};
if
(
!
el
)
return
false
;
return
new
Vue
({
const
mountGkeMachineTypeDropdown
=
()
=>
{
el
,
mountComponent
(
components
:
{
'.js-gcp-machine-type-dropdown-entry-point'
,
GkeMachineTypeDropdown
,
GkeMachineTypeDropdown
,
},
'gke-machine-type-dropdown'
,
render
:
createElement
=>
);
createElement
(
'gke-machine-type-dropdown'
,
{
props
:
{
fieldName
:
hiddenInput
.
getAttribute
(
'name'
),
fieldId
:
hiddenInput
.
getAttribute
(
'id'
),
defaultValue
:
hiddenInput
.
value
,
},
}),
});
};
};
const
gkeDropdownErrorHandler
=
()
=>
{
const
gkeDropdownErrorHandler
=
()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment