Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
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
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
42 deletions
+19
-42
app/assets/javascripts/projects/gke_cluster_dropdowns/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';
import
GkeMachineTypeDropdown
from
'
./components/gke_machine_type_dropdown.vue
'
;
import
*
as
CONSTANTS
from
'
./constants
'
;
const
mount
GkeProjectIdDropdown
=
(
)
=>
{
const
el
=
document
.
querySelector
(
'
.js-gcp-project-id-dropdown-entry-point
'
);
const
mount
Component
=
(
entryPoint
,
component
,
componentName
,
extraProps
=
{}
)
=>
{
const
el
=
document
.
querySelector
(
entryPoint
);
const
hiddenInput
=
el
.
querySelector
(
'
input
'
);
if
(
!
el
)
return
false
;
...
...
@@ -15,62 +15,39 @@ const mountGkeProjectIdDropdown = () => {
return
new
Vue
({
el
,
components
:
{
GkeProjectIdDropdown
,
[
componentName
]:
component
,
},
render
:
createElement
=>
createElement
(
'
gke-project-id-dropdown
'
,
{
createElement
(
componentName
,
{
props
:
{
docsUrl
:
el
.
dataset
.
docsurl
,
fieldName
:
hiddenInput
.
getAttribute
(
'
name
'
),
fieldId
:
hiddenInput
.
getAttribute
(
'
id
'
),
defaultValue
:
hiddenInput
.
value
,
...
extraProps
,
},
}),
});
};
const
mountGkeZoneDropdown
=
()
=>
{
const
el
=
document
.
querySelector
(
'
.js-gcp-zone-dropdown-entry-point
'
);
const
hiddenInput
=
el
.
querySelector
(
'
input
'
);
if
(
!
el
)
return
false
;
const
mountGkeProjectIdDropdown
=
()
=>
{
const
entryPoint
=
'
.js-gcp-project-id-dropdown-entry-point
'
;
const
el
=
document
.
querySelector
(
entryPoint
);
return
new
Vue
({
el
,
components
:
{
GkeZoneDropdown
,
},
render
:
createElement
=>
createElement
(
'
gke-zone-dropdown
'
,
{
props
:
{
fieldName
:
hiddenInput
.
getAttribute
(
'
name
'
),
fieldId
:
hiddenInput
.
getAttribute
(
'
id
'
),
defaultValue
:
hiddenInput
.
value
,
},
}),
mountComponent
(
entryPoint
,
GkeProjectIdDropdown
,
'
gke-project-id-dropdown
'
,
{
docsUrl
:
el
.
dataset
.
docsurl
,
});
};
const
mountGkeMachineTypeDropdown
=
()
=>
{
const
el
=
document
.
querySelector
(
'
.js-gcp-machine-type-dropdown-entry-point
'
);
const
hiddenInput
=
el
.
querySelector
(
'
input
'
);
if
(
!
el
)
return
false
;
const
mountGkeZoneDropdown
=
()
=>
{
mountComponent
(
'
.js-gcp-zone-dropdown-entry-point
'
,
GkeZoneDropdown
,
'
gke-zone-dropdown
'
);
};
return
new
Vue
({
el
,
components
:
{
GkeMachineTypeDropdown
,
},
render
:
createElement
=>
createElement
(
'
gke-machine-type-dropdown
'
,
{
props
:
{
fieldName
:
hiddenInput
.
getAttribute
(
'
name
'
),
fieldId
:
hiddenInput
.
getAttribute
(
'
id
'
),
defaultValue
:
hiddenInput
.
value
,
},
}),
});
const
mountGkeMachineTypeDropdown
=
()
=>
{
mountComponent
(
'
.js-gcp-machine-type-dropdown-entry-point
'
,
GkeMachineTypeDropdown
,
'
gke-machine-type-dropdown
'
,
);
};
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