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
06c996be
Commit
06c996be
authored
Oct 10, 2019
by
Enrique Alcantara
Committed by
Tiger
Nov 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move accountId, externalId, and hasCredentials
to be part of the Vuex store state
parent
617f68c8
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
54 additions
and
71 deletions
+54
-71
app/assets/javascripts/create_cluster/eks_cluster/components/create_eks_cluster.vue
...ate_cluster/eks_cluster/components/create_eks_cluster.vue
+4
-12
app/assets/javascripts/create_cluster/eks_cluster/components/service_credentials_form.vue
...uster/eks_cluster/components/service_credentials_form.vue
+2
-8
app/assets/javascripts/create_cluster/eks_cluster/index.js
app/assets/javascripts/create_cluster/eks_cluster/index.js
+24
-27
app/assets/javascripts/create_cluster/eks_cluster/store/index.js
...ets/javascripts/create_cluster/eks_cluster/store/index.js
+2
-2
app/assets/javascripts/create_cluster/eks_cluster/store/state.js
...ets/javascripts/create_cluster/eks_cluster/store/state.js
+5
-1
app/views/clusters/clusters/eks/_index.html.haml
app/views/clusters/clusters/eks/_index.html.haml
+1
-1
spec/frontend/create_cluster/eks_cluster/components/create_eks_cluster_spec.js
...cluster/eks_cluster/components/create_eks_cluster_spec.js
+16
-20
No files found.
app/assets/javascripts/create_cluster/eks_cluster/components/create_eks_cluster.vue
View file @
06c996be
<
script
>
<
script
>
import
ServiceCredentialsForm
from
'
./service_credentials_form.vue
'
;
import
ServiceCredentialsForm
from
'
./service_credentials_form.vue
'
;
import
EksClusterConfigurationForm
from
'
./eks_cluster_configuration_form.vue
'
;
import
EksClusterConfigurationForm
from
'
./eks_cluster_configuration_form.vue
'
;
import
{
mapState
}
from
'
vuex
'
;
export
default
{
export
default
{
components
:
{
components
:
{
...
@@ -24,18 +25,9 @@ export default {
...
@@ -24,18 +25,9 @@ export default {
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
},
},
externalId
:
{
type
:
String
,
required
:
true
,
},
accountId
:
{
type
:
String
,
required
:
true
,
},
validCredentials
:
{
type
:
Boolean
,
required
:
true
,
},
},
computed
:
{
...
mapState
([
'
hasCredentials
'
]),
},
},
};
};
</
script
>
</
script
>
...
...
app/assets/javascripts/create_cluster/eks_cluster/components/service_credentials_form.vue
View file @
06c996be
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
{
GlFormInput
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlFormInput
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
sprintf
,
s__
}
from
'
~/locale
'
;
import
{
sprintf
,
s__
}
from
'
~/locale
'
;
import
_
from
'
underscore
'
;
import
_
from
'
underscore
'
;
import
{
mapState
}
from
'
vuex
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
export
default
{
export
default
{
...
@@ -11,14 +12,6 @@ export default {
...
@@ -11,14 +12,6 @@ export default {
ClipboardButton
,
ClipboardButton
,
},
},
props
:
{
props
:
{
accountId
:
{
type
:
String
,
required
:
true
,
},
externalId
:
{
type
:
String
,
required
:
true
,
},
accountAndExternalIdsHelpPath
:
{
accountAndExternalIdsHelpPath
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
...
@@ -34,6 +27,7 @@ export default {
...
@@ -34,6 +27,7 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
accountId
'
,
'
externalId
'
]),
accountAndExternalIdsHelpText
()
{
accountAndExternalIdsHelpText
()
{
const
escapedUrl
=
_
.
escape
(
this
.
accountAndExternalIdsHelpPath
);
const
escapedUrl
=
_
.
escape
(
this
.
accountAndExternalIdsHelpPath
);
...
...
app/assets/javascripts/create_cluster/eks_cluster/index.js
View file @
06c996be
...
@@ -6,42 +6,39 @@ import createStore from './store';
...
@@ -6,42 +6,39 @@ import createStore from './store';
Vue
.
use
(
Vuex
);
Vue
.
use
(
Vuex
);
export
default
el
=>
{
export
default
el
=>
{
const
{
gitlabManagedClusterHelpPath
,
kubernetesIntegrationHelpPath
}
=
el
.
dataset
;
return
new
Vue
({
el
,
store
:
createStore
(),
components
:
{
CreateEksCluster
,
},
data
()
{
const
{
const
{
gitlabManagedClusterHelpPath
,
gitlabManagedClusterHelpPath
,
kubernetesIntegrationHelpPath
,
accountAndExternalIdsHelpPath
,
accountAndExternalIdsHelpPath
,
createRoleArnHelpPath
,
createRoleArnHelpPath
,
externalId
,
externalId
,
accountId
,
accountId
,
validCredentials
,
hasCredentials
,
}
=
document
.
querySelector
(
this
.
$options
.
el
).
dataset
;
createCredentialsPath
,
}
=
el
.
dataset
;
return
{
return
new
Vue
({
gitlabManagedClusterHelpPath
,
el
,
accountAndExternalIdsHelpPath
,
store
:
createStore
({
createRoleArnHelpPath
,
initialState
:
{
hasCredentials
,
externalId
,
externalId
,
accountId
,
accountId
,
validCredentials
,
},
};
apiPaths
:
{
createCredentialsPath
,
},
}),
components
:
{
CreateEksCluster
,
},
},
render
(
createElement
)
{
render
(
createElement
)
{
return
createElement
(
'
create-eks-cluster
'
,
{
return
createElement
(
'
create-eks-cluster
'
,
{
props
:
{
props
:
{
gitlabManagedClusterHelpPath
:
this
.
gitlabManagedClusterHelpPath
,
gitlabManagedClusterHelpPath
,
accountAndExternalIdsHelpPath
:
this
.
accountAndExternalIdsHelpPath
,
kubernetesIntegrationHelpPath
,
createRoleArnHelpPath
:
this
.
createRoleArnHelpPath
,
accountAndExternalIdsHelpPath
,
externalId
:
this
.
externalId
,
createRoleArnHelpPath
,
accountId
:
this
.
accountId
,
validCredentials
:
this
.
validCredentials
,
},
},
});
});
},
},
...
...
app/assets/javascripts/create_cluster/eks_cluster/store/index.js
View file @
06c996be
...
@@ -8,12 +8,12 @@ import clusterDropdownStore from './cluster_dropdown';
...
@@ -8,12 +8,12 @@ import clusterDropdownStore from './cluster_dropdown';
import
*
as
awsServices
from
'
../services/aws_services_facade
'
;
import
*
as
awsServices
from
'
../services/aws_services_facade
'
;
const
createStore
=
()
=>
const
createStore
=
(
{
initialState
}
)
=>
new
Vuex
.
Store
({
new
Vuex
.
Store
({
actions
,
actions
,
getters
,
getters
,
mutations
,
mutations
,
state
:
state
(
),
state
:
Object
.
assign
(
state
(),
initialState
),
modules
:
{
modules
:
{
roles
:
{
roles
:
{
namespaced
:
true
,
namespaced
:
true
,
...
...
app/assets/javascripts/create_cluster/eks_cluster/store/state.js
View file @
06c996be
...
@@ -2,7 +2,11 @@ import { KUBERNETES_VERSIONS } from '../constants';
...
@@ -2,7 +2,11 @@ import { KUBERNETES_VERSIONS } from '../constants';
export
default
()
=>
({
export
default
()
=>
({
isValidatingCredentials
:
false
,
isValidatingCredentials
:
false
,
validCredentials
:
false
,
hasCredentials
:
false
,
invalidCredentials
:
false
,
invalidCredentialsError
:
null
,
accountId
:
''
,
externalId
:
''
,
clusterName
:
''
,
clusterName
:
''
,
environmentScope
:
'
*
'
,
environmentScope
:
'
*
'
,
...
...
app/views/clusters/clusters/eks/_index.html.haml
View file @
06c996be
...
@@ -7,4 +7,4 @@
...
@@ -7,4 +7,4 @@
'account-id'
=>
Gitlab
::
CurrentSettings
.
eks_account_id
,
'account-id'
=>
Gitlab
::
CurrentSettings
.
eks_account_id
,
'external-id'
=>
@aws_role
.
role_external_id
,
'external-id'
=>
@aws_role
.
role_external_id
,
'kubernetes-integration-help-path'
=>
help_page_path
(
'user/project/clusters/index'
),
'kubernetes-integration-help-path'
=>
help_page_path
(
'user/project/clusters/index'
),
'
valid
-credentials'
=>
@aws_role
.
role_arn
.
present?
}
}
'
has
-credentials'
=>
@aws_role
.
role_arn
.
present?
}
}
spec/frontend/create_cluster/eks_cluster/components/create_eks_cluster_spec.js
View file @
06c996be
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
Vuex
from
'
vuex
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
CreateEksCluster
from
'
~/create_cluster/eks_cluster/components/create_eks_cluster.vue
'
;
import
CreateEksCluster
from
'
~/create_cluster/eks_cluster/components/create_eks_cluster.vue
'
;
import
EksClusterConfigurationForm
from
'
~/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue
'
;
import
EksClusterConfigurationForm
from
'
~/create_cluster/eks_cluster/components/eks_cluster_configuration_form.vue
'
;
import
ServiceCredentialsForm
from
'
~/create_cluster/eks_cluster/components/service_credentials_form.vue
'
;
import
ServiceCredentialsForm
from
'
~/create_cluster/eks_cluster/components/service_credentials_form.vue
'
;
const
localVue
=
createLocalVue
();
localVue
.
use
(
Vuex
);
describe
(
'
CreateEksCluster
'
,
()
=>
{
describe
(
'
CreateEksCluster
'
,
()
=>
{
let
vm
;
let
vm
;
const
accountId
=
'
accountId
'
;
let
state
;
const
externalId
=
'
externalId
'
;
const
gitlabManagedClusterHelpPath
=
'
gitlab-managed-cluster-help-path
'
;
const
gitlabManagedClusterHelpPath
=
'
gitlab-managed-cluster-help-path
'
;
const
accountAndExternalIdsHelpPath
=
'
account-and-external-id-help-path
'
;
const
accountAndExternalIdsHelpPath
=
'
account-and-external-id-help-path
'
;
const
createRoleArnHelpPath
=
'
role-arn-help-path
'
;
const
createRoleArnHelpPath
=
'
role-arn-help-path
'
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
state
=
{
hasCredentials
:
false
};
const
store
=
new
Vuex
.
Store
({
state
,
});
vm
=
shallowMount
(
CreateEksCluster
,
{
vm
=
shallowMount
(
CreateEksCluster
,
{
propsData
:
{
propsData
:
{
validCredentials
:
false
,
accountId
,
externalId
,
gitlabManagedClusterHelpPath
,
gitlabManagedClusterHelpPath
,
accountAndExternalIdsHelpPath
,
accountAndExternalIdsHelpPath
,
createRoleArnHelpPath
,
createRoleArnHelpPath
,
},
},
localVue
,
store
,
});
});
});
});
afterEach
(()
=>
vm
.
destroy
());
afterEach
(()
=>
vm
.
destroy
());
describe
(
'
when credentials are
vali
d
'
,
()
=>
{
describe
(
'
when credentials are
provide
d
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
.
setProps
({
validCredentials
:
true
})
;
state
.
hasCredentials
=
true
;
});
});
it
(
'
displays eks cluster configuration form when credentials are valid
'
,
()
=>
{
it
(
'
displays eks cluster configuration form when credentials are valid
'
,
()
=>
{
expect
(
vm
.
find
(
EksClusterConfigurationForm
).
exists
()).
toBe
(
true
);
expect
(
vm
.
find
(
EksClusterConfigurationForm
).
exists
()).
toBe
(
true
);
});
});
it
(
'
provides gitlabManagedClusterHelpPath to eks cluster config form
'
,
()
=>
{
expect
(
vm
.
find
(
EksClusterConfigurationForm
).
props
(
'
gitlabManagedClusterHelpPath
'
)).
toBe
(
gitlabManagedClusterHelpPath
,
);
});
});
});
describe
(
'
when credentials are invalid
'
,
()
=>
{
describe
(
'
when credentials are invalid
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
.
setProps
({
validCredentials
:
false
})
;
state
.
hasCredentials
=
false
;
});
});
it
(
'
displays service credentials form
'
,
()
=>
{
it
(
'
displays service credentials form
'
,
()
=>
{
...
@@ -52,11 +53,6 @@ describe('CreateEksCluster', () => {
...
@@ -52,11 +53,6 @@ describe('CreateEksCluster', () => {
});
});
describe
(
'
passes to the service credentials form
'
,
()
=>
{
describe
(
'
passes to the service credentials form
'
,
()
=>
{
it
(
'
account id and external id
'
,
()
=>
{
expect
(
vm
.
find
(
ServiceCredentialsForm
).
props
(
'
externalId
'
)).
toBe
(
externalId
);
expect
(
vm
.
find
(
ServiceCredentialsForm
).
props
(
'
accountId
'
)).
toBe
(
accountId
);
});
it
(
'
help url for account and external ids
'
,
()
=>
{
it
(
'
help url for account and external ids
'
,
()
=>
{
expect
(
vm
.
find
(
ServiceCredentialsForm
).
props
(
'
accountAndExternalIdsHelpPath
'
)).
toBe
(
expect
(
vm
.
find
(
ServiceCredentialsForm
).
props
(
'
accountAndExternalIdsHelpPath
'
)).
toBe
(
accountAndExternalIdsHelpPath
,
accountAndExternalIdsHelpPath
,
...
...
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