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
62f34905
Commit
62f34905
authored
Sep 17, 2020
by
Justin Ho Tuan Duong
Committed by
Martin Wortschack
Sep 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename admin integration to default integration
In controllers / backend
parent
ed8236e5
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
37 additions
and
37 deletions
+37
-37
app/assets/javascripts/integrations/edit/components/integration_form.vue
...scripts/integrations/edit/components/integration_form.vue
+3
-3
app/assets/javascripts/integrations/edit/components/override_dropdown.vue
...cripts/integrations/edit/components/override_dropdown.vue
+2
-2
app/assets/javascripts/integrations/edit/index.js
app/assets/javascripts/integrations/edit/index.js
+4
-4
app/assets/javascripts/integrations/edit/store/getters.js
app/assets/javascripts/integrations/edit/store/getters.js
+2
-2
app/assets/javascripts/integrations/edit/store/state.js
app/assets/javascripts/integrations/edit/store/state.js
+3
-3
app/assets/javascripts/integrations/integration_settings_form.js
...ets/javascripts/integrations/integration_settings_form.js
+1
-1
app/controllers/groups/settings/integrations_controller.rb
app/controllers/groups/settings/integrations_controller.rb
+1
-1
app/controllers/projects/services_controller.rb
app/controllers/projects/services_controller.rb
+1
-1
app/views/shared/_service_settings.html.haml
app/views/shared/_service_settings.html.haml
+2
-2
spec/frontend/integrations/edit/components/integration_form_spec.js
...end/integrations/edit/components/integration_form_spec.js
+4
-4
spec/frontend/integrations/edit/components/override_dropdown_spec.js
...nd/integrations/edit/components/override_dropdown_spec.js
+3
-3
spec/frontend/integrations/edit/store/getters_spec.js
spec/frontend/integrations/edit/store/getters_spec.js
+7
-7
spec/frontend/integrations/edit/store/state_spec.js
spec/frontend/integrations/edit/store/state_spec.js
+4
-4
No files found.
app/assets/javascripts/integrations/edit/components/integration_form.vue
View file @
62f34905
...
...
@@ -25,7 +25,7 @@ export default {
mixins
:
[
glFeatureFlagsMixin
()],
computed
:
{
...
mapGetters
([
'
currentKey
'
,
'
propsSource
'
,
'
isSavingOrTesting
'
]),
...
mapState
([
'
admin
State
'
,
'
override
'
,
'
isSaving
'
,
'
isTesting
'
]),
...
mapState
([
'
default
State
'
,
'
override
'
,
'
isSaving
'
,
'
isTesting
'
]),
isEditable
()
{
return
this
.
propsSource
.
editable
;
},
...
...
@@ -53,8 +53,8 @@ export default {
<
template
>
<div>
<override-dropdown
v-if=
"
admin
State !== null"
:inherit-from-id=
"
admin
State.id"
v-if=
"
default
State !== null"
:inherit-from-id=
"
default
State.id"
:override=
"override"
:learn-more-path=
"propsSource.learnMorePath"
@
change=
"setOverride"
...
...
app/assets/javascripts/integrations/edit/components/override_dropdown.vue
View file @
62f34905
...
...
@@ -44,9 +44,9 @@ export default {
};
},
computed
:
{
...
mapState
([
'
admin
State
'
]),
...
mapState
([
'
default
State
'
]),
description
()
{
const
level
=
this
.
admin
State
.
integrationLevel
;
const
level
=
this
.
default
State
.
integrationLevel
;
return
(
overrideDropdownDescriptions
[
level
]
||
overrideDropdownDescriptions
[
defaultIntegrationLevel
]
...
...
app/assets/javascripts/integrations/edit/index.js
View file @
62f34905
...
...
@@ -72,7 +72,7 @@ function parseDatasetToProps(data) {
};
}
export
default
(
el
,
admin
El
)
=>
{
export
default
(
el
,
default
El
)
=>
{
if
(
!
el
)
{
return
null
;
}
...
...
@@ -80,12 +80,12 @@ export default (el, adminEl) => {
const
props
=
parseDatasetToProps
(
el
.
dataset
);
const
initialState
=
{
admin
State
:
null
,
default
State
:
null
,
customState
:
props
,
};
if
(
admin
El
)
{
initialState
.
adminState
=
Object
.
freeze
(
parseDatasetToProps
(
admin
El
.
dataset
));
if
(
default
El
)
{
initialState
.
defaultState
=
Object
.
freeze
(
parseDatasetToProps
(
default
El
.
dataset
));
}
return
new
Vue
({
...
...
app/assets/javascripts/integrations/edit/store/getters.js
View file @
62f34905
export
const
isInheriting
=
state
=>
(
state
.
admin
State
===
null
?
false
:
!
state
.
override
);
export
const
isInheriting
=
state
=>
(
state
.
default
State
===
null
?
false
:
!
state
.
override
);
export
const
isSavingOrTesting
=
state
=>
state
.
isSaving
||
state
.
isTesting
;
export
const
propsSource
=
(
state
,
getters
)
=>
getters
.
isInheriting
?
state
.
admin
State
:
state
.
customState
;
getters
.
isInheriting
?
state
.
default
State
:
state
.
customState
;
export
const
currentKey
=
(
state
,
getters
)
=>
(
getters
.
isInheriting
?
'
admin
'
:
'
custom
'
);
app/assets/javascripts/integrations/edit/store/state.js
View file @
62f34905
export
default
({
admin
State
=
null
,
customState
=
{}
}
=
{})
=>
{
const
override
=
adminState
!==
null
?
admin
State
.
id
!==
customState
.
inheritFromId
:
false
;
export
default
({
default
State
=
null
,
customState
=
{}
}
=
{})
=>
{
const
override
=
defaultState
!==
null
?
default
State
.
id
!==
customState
.
inheritFromId
:
false
;
return
{
override
,
admin
State
,
default
State
,
customState
,
isSaving
:
false
,
isTesting
:
false
,
...
...
app/assets/javascripts/integrations/integration_settings_form.js
View file @
62f34905
...
...
@@ -20,7 +20,7 @@ export default class IntegrationSettingsForm {
// Init Vue component
this
.
vue
=
initForm
(
document
.
querySelector
(
'
.js-vue-integration-settings
'
),
document
.
querySelector
(
'
.js-vue-
admin
-integration-settings
'
),
document
.
querySelector
(
'
.js-vue-
default
-integration-settings
'
),
);
eventHub
.
$on
(
'
toggle
'
,
active
=>
{
this
.
formActive
=
active
;
...
...
app/controllers/groups/settings/integrations_controller.rb
View file @
62f34905
...
...
@@ -12,7 +12,7 @@ module Groups
end
def
edit
@
admin
_integration
=
Service
.
default_integration
(
integration
.
type
,
group
)
@
default
_integration
=
Service
.
default_integration
(
integration
.
type
,
group
)
super
end
...
...
app/controllers/projects/services_controller.rb
View file @
62f34905
...
...
@@ -20,7 +20,7 @@ class Projects::ServicesController < Projects::ApplicationController
layout
"project_settings"
def
edit
@
admin
_integration
=
Service
.
default_integration
(
service
.
type
,
project
)
@
default
_integration
=
Service
.
default_integration
(
service
.
type
,
project
)
end
def
update
...
...
app/views/shared/_service_settings.html.haml
View file @
62f34905
...
...
@@ -8,6 +8,6 @@
=
markdown
integration
.
help
.service-settings
-
if
@
admin
_integration
.js-vue-
admin-integration-settings
{
data:
integration_form_data
(
@admin
_integration
)
}
-
if
@
default
_integration
.js-vue-
default-integration-settings
{
data:
integration_form_data
(
@default
_integration
)
}
.js-vue-integration-settings
{
data:
integration_form_data
(
integration
)
}
spec/frontend/integrations/edit/components/integration_form_spec.js
View file @
62f34905
...
...
@@ -137,13 +137,13 @@ describe('IntegrationForm', () => {
});
});
describe
(
'
admin
State state is null
'
,
()
=>
{
describe
(
'
default
State state is null
'
,
()
=>
{
it
(
'
does not render OverrideDropdown
'
,
()
=>
{
createComponent
(
{},
{},
{
admin
State
:
null
,
default
State
:
null
,
},
);
...
...
@@ -151,13 +151,13 @@ describe('IntegrationForm', () => {
});
});
describe
(
'
admin
State state is an object
'
,
()
=>
{
describe
(
'
default
State state is an object
'
,
()
=>
{
it
(
'
renders OverrideDropdown
'
,
()
=>
{
createComponent
(
{},
{},
{
admin
State
:
{
default
State
:
{
...
mockIntegrationProps
,
},
},
...
...
spec/frontend/integrations/edit/components/override_dropdown_spec.js
View file @
62f34905
...
...
@@ -13,15 +13,15 @@ describe('OverrideDropdown', () => {
override
:
true
,
};
const
default
Admin
StateProps
=
{
const
default
Default
StateProps
=
{
integrationLevel
:
'
group
'
,
};
const
createComponent
=
(
props
=
{},
admin
StateProps
=
{})
=>
{
const
createComponent
=
(
props
=
{},
default
StateProps
=
{})
=>
{
wrapper
=
shallowMount
(
OverrideDropdown
,
{
propsData
:
{
...
defaultProps
,
...
props
},
store
:
createStore
({
adminState
:
{
...
defaultAdminStateProps
,
...
admin
StateProps
},
defaultState
:
{
...
defaultDefaultStateProps
,
...
default
StateProps
},
}),
});
};
...
...
spec/frontend/integrations/edit/store/getters_spec.js
View file @
62f34905
...
...
@@ -5,22 +5,22 @@ import { mockIntegrationProps } from '../mock_data';
describe
(
'
Integration form store getters
'
,
()
=>
{
let
state
;
const
customState
=
{
...
mockIntegrationProps
,
type
:
'
CustomState
'
};
const
adminState
=
{
...
mockIntegrationProps
,
type
:
'
Admin
State
'
};
const
defaultState
=
{
...
mockIntegrationProps
,
type
:
'
Default
State
'
};
beforeEach
(()
=>
{
state
=
createState
({
customState
});
});
describe
(
'
isInheriting
'
,
()
=>
{
describe
(
'
when
admin
State is null
'
,
()
=>
{
describe
(
'
when
default
State is null
'
,
()
=>
{
it
(
'
returns false
'
,
()
=>
{
expect
(
isInheriting
(
state
)).
toBe
(
false
);
});
});
describe
(
'
when
admin
State is an object
'
,
()
=>
{
describe
(
'
when
default
State is an object
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
adminState
=
admin
State
;
state
.
defaultState
=
default
State
;
});
describe
(
'
when override is false
'
,
()
=>
{
...
...
@@ -47,11 +47,11 @@ describe('Integration form store getters', () => {
describe
(
'
propsSource
'
,
()
=>
{
beforeEach
(()
=>
{
state
.
adminState
=
admin
State
;
state
.
defaultState
=
default
State
;
});
it
(
'
equals
admin
State if inheriting
'
,
()
=>
{
expect
(
propsSource
(
state
,
{
isInheriting
:
true
})).
toEqual
(
admin
State
);
it
(
'
equals
default
State if inheriting
'
,
()
=>
{
expect
(
propsSource
(
state
,
{
isInheriting
:
true
})).
toEqual
(
default
State
);
});
it
(
'
equals customState if not inheriting
'
,
()
=>
{
...
...
spec/frontend/integrations/edit/store/state_spec.js
View file @
62f34905
...
...
@@ -3,7 +3,7 @@ import createState from '~/integrations/edit/store/state';
describe
(
'
Integration form state factory
'
,
()
=>
{
it
(
'
states default to null
'
,
()
=>
{
expect
(
createState
()).
toEqual
({
admin
State
:
null
,
default
State
:
null
,
customState
:
{},
isSaving
:
false
,
isTesting
:
false
,
...
...
@@ -19,9 +19,9 @@ describe('Integration form state factory', () => {
[
null
,
{
inheritFromId
:
null
},
false
],
[
null
,
{
inheritFromId
:
25
},
false
],
])(
'
for
admin
State: %p, customState: %p: override = `%p`
'
,
(
admin
State
,
customState
,
expected
)
=>
{
expect
(
createState
({
admin
State
,
customState
}).
override
).
toEqual
(
expected
);
'
for
default
State: %p, customState: %p: override = `%p`
'
,
(
default
State
,
customState
,
expected
)
=>
{
expect
(
createState
({
default
State
,
customState
}).
override
).
toEqual
(
expected
);
},
);
});
...
...
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