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 {
...
@@ -25,7 +25,7 @@ export default {
mixins
:
[
glFeatureFlagsMixin
()],
mixins
:
[
glFeatureFlagsMixin
()],
computed
:
{
computed
:
{
...
mapGetters
([
'
currentKey
'
,
'
propsSource
'
,
'
isSavingOrTesting
'
]),
...
mapGetters
([
'
currentKey
'
,
'
propsSource
'
,
'
isSavingOrTesting
'
]),
...
mapState
([
'
admin
State
'
,
'
override
'
,
'
isSaving
'
,
'
isTesting
'
]),
...
mapState
([
'
default
State
'
,
'
override
'
,
'
isSaving
'
,
'
isTesting
'
]),
isEditable
()
{
isEditable
()
{
return
this
.
propsSource
.
editable
;
return
this
.
propsSource
.
editable
;
},
},
...
@@ -53,8 +53,8 @@ export default {
...
@@ -53,8 +53,8 @@ export default {
<
template
>
<
template
>
<div>
<div>
<override-dropdown
<override-dropdown
v-if=
"
admin
State !== null"
v-if=
"
default
State !== null"
:inherit-from-id=
"
admin
State.id"
:inherit-from-id=
"
default
State.id"
:override=
"override"
:override=
"override"
:learn-more-path=
"propsSource.learnMorePath"
:learn-more-path=
"propsSource.learnMorePath"
@
change=
"setOverride"
@
change=
"setOverride"
...
...
app/assets/javascripts/integrations/edit/components/override_dropdown.vue
View file @
62f34905
...
@@ -44,9 +44,9 @@ export default {
...
@@ -44,9 +44,9 @@ export default {
};
};
},
},
computed
:
{
computed
:
{
...
mapState
([
'
admin
State
'
]),
...
mapState
([
'
default
State
'
]),
description
()
{
description
()
{
const
level
=
this
.
admin
State
.
integrationLevel
;
const
level
=
this
.
default
State
.
integrationLevel
;
return
(
return
(
overrideDropdownDescriptions
[
level
]
||
overrideDropdownDescriptions
[
defaultIntegrationLevel
]
overrideDropdownDescriptions
[
level
]
||
overrideDropdownDescriptions
[
defaultIntegrationLevel
]
...
...
app/assets/javascripts/integrations/edit/index.js
View file @
62f34905
...
@@ -72,7 +72,7 @@ function parseDatasetToProps(data) {
...
@@ -72,7 +72,7 @@ function parseDatasetToProps(data) {
};
};
}
}
export
default
(
el
,
admin
El
)
=>
{
export
default
(
el
,
default
El
)
=>
{
if
(
!
el
)
{
if
(
!
el
)
{
return
null
;
return
null
;
}
}
...
@@ -80,12 +80,12 @@ export default (el, adminEl) => {
...
@@ -80,12 +80,12 @@ export default (el, adminEl) => {
const
props
=
parseDatasetToProps
(
el
.
dataset
);
const
props
=
parseDatasetToProps
(
el
.
dataset
);
const
initialState
=
{
const
initialState
=
{
admin
State
:
null
,
default
State
:
null
,
customState
:
props
,
customState
:
props
,
};
};
if
(
admin
El
)
{
if
(
default
El
)
{
initialState
.
adminState
=
Object
.
freeze
(
parseDatasetToProps
(
admin
El
.
dataset
));
initialState
.
defaultState
=
Object
.
freeze
(
parseDatasetToProps
(
default
El
.
dataset
));
}
}
return
new
Vue
({
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
isSavingOrTesting
=
state
=>
state
.
isSaving
||
state
.
isTesting
;
export
const
propsSource
=
(
state
,
getters
)
=>
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
'
);
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
=
{}
}
=
{})
=>
{
export
default
({
default
State
=
null
,
customState
=
{}
}
=
{})
=>
{
const
override
=
adminState
!==
null
?
admin
State
.
id
!==
customState
.
inheritFromId
:
false
;
const
override
=
defaultState
!==
null
?
default
State
.
id
!==
customState
.
inheritFromId
:
false
;
return
{
return
{
override
,
override
,
admin
State
,
default
State
,
customState
,
customState
,
isSaving
:
false
,
isSaving
:
false
,
isTesting
:
false
,
isTesting
:
false
,
...
...
app/assets/javascripts/integrations/integration_settings_form.js
View file @
62f34905
...
@@ -20,7 +20,7 @@ export default class IntegrationSettingsForm {
...
@@ -20,7 +20,7 @@ export default class IntegrationSettingsForm {
// Init Vue component
// Init Vue component
this
.
vue
=
initForm
(
this
.
vue
=
initForm
(
document
.
querySelector
(
'
.js-vue-integration-settings
'
),
document
.
querySelector
(
'
.js-vue-integration-settings
'
),
document
.
querySelector
(
'
.js-vue-
admin
-integration-settings
'
),
document
.
querySelector
(
'
.js-vue-
default
-integration-settings
'
),
);
);
eventHub
.
$on
(
'
toggle
'
,
active
=>
{
eventHub
.
$on
(
'
toggle
'
,
active
=>
{
this
.
formActive
=
active
;
this
.
formActive
=
active
;
...
...
app/controllers/groups/settings/integrations_controller.rb
View file @
62f34905
...
@@ -12,7 +12,7 @@ module Groups
...
@@ -12,7 +12,7 @@ module Groups
end
end
def
edit
def
edit
@
admin
_integration
=
Service
.
default_integration
(
integration
.
type
,
group
)
@
default
_integration
=
Service
.
default_integration
(
integration
.
type
,
group
)
super
super
end
end
...
...
app/controllers/projects/services_controller.rb
View file @
62f34905
...
@@ -20,7 +20,7 @@ class Projects::ServicesController < Projects::ApplicationController
...
@@ -20,7 +20,7 @@ class Projects::ServicesController < Projects::ApplicationController
layout
"project_settings"
layout
"project_settings"
def
edit
def
edit
@
admin
_integration
=
Service
.
default_integration
(
service
.
type
,
project
)
@
default
_integration
=
Service
.
default_integration
(
service
.
type
,
project
)
end
end
def
update
def
update
...
...
app/views/shared/_service_settings.html.haml
View file @
62f34905
...
@@ -8,6 +8,6 @@
...
@@ -8,6 +8,6 @@
=
markdown
integration
.
help
=
markdown
integration
.
help
.service-settings
.service-settings
-
if
@
admin
_integration
-
if
@
default
_integration
.js-vue-
admin-integration-settings
{
data:
integration_form_data
(
@admin
_integration
)
}
.js-vue-
default-integration-settings
{
data:
integration_form_data
(
@default
_integration
)
}
.js-vue-integration-settings
{
data:
integration_form_data
(
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', () => {
...
@@ -137,13 +137,13 @@ describe('IntegrationForm', () => {
});
});
});
});
describe
(
'
admin
State state is null
'
,
()
=>
{
describe
(
'
default
State state is null
'
,
()
=>
{
it
(
'
does not render OverrideDropdown
'
,
()
=>
{
it
(
'
does not render OverrideDropdown
'
,
()
=>
{
createComponent
(
createComponent
(
{},
{},
{},
{},
{
{
admin
State
:
null
,
default
State
:
null
,
},
},
);
);
...
@@ -151,13 +151,13 @@ describe('IntegrationForm', () => {
...
@@ -151,13 +151,13 @@ describe('IntegrationForm', () => {
});
});
});
});
describe
(
'
admin
State state is an object
'
,
()
=>
{
describe
(
'
default
State state is an object
'
,
()
=>
{
it
(
'
renders OverrideDropdown
'
,
()
=>
{
it
(
'
renders OverrideDropdown
'
,
()
=>
{
createComponent
(
createComponent
(
{},
{},
{},
{},
{
{
admin
State
:
{
default
State
:
{
...
mockIntegrationProps
,
...
mockIntegrationProps
,
},
},
},
},
...
...
spec/frontend/integrations/edit/components/override_dropdown_spec.js
View file @
62f34905
...
@@ -13,15 +13,15 @@ describe('OverrideDropdown', () => {
...
@@ -13,15 +13,15 @@ describe('OverrideDropdown', () => {
override
:
true
,
override
:
true
,
};
};
const
default
Admin
StateProps
=
{
const
default
Default
StateProps
=
{
integrationLevel
:
'
group
'
,
integrationLevel
:
'
group
'
,
};
};
const
createComponent
=
(
props
=
{},
admin
StateProps
=
{})
=>
{
const
createComponent
=
(
props
=
{},
default
StateProps
=
{})
=>
{
wrapper
=
shallowMount
(
OverrideDropdown
,
{
wrapper
=
shallowMount
(
OverrideDropdown
,
{
propsData
:
{
...
defaultProps
,
...
props
},
propsData
:
{
...
defaultProps
,
...
props
},
store
:
createStore
({
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';
...
@@ -5,22 +5,22 @@ import { mockIntegrationProps } from '../mock_data';
describe
(
'
Integration form store getters
'
,
()
=>
{
describe
(
'
Integration form store getters
'
,
()
=>
{
let
state
;
let
state
;
const
customState
=
{
...
mockIntegrationProps
,
type
:
'
CustomState
'
};
const
customState
=
{
...
mockIntegrationProps
,
type
:
'
CustomState
'
};
const
adminState
=
{
...
mockIntegrationProps
,
type
:
'
Admin
State
'
};
const
defaultState
=
{
...
mockIntegrationProps
,
type
:
'
Default
State
'
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
state
=
createState
({
customState
});
state
=
createState
({
customState
});
});
});
describe
(
'
isInheriting
'
,
()
=>
{
describe
(
'
isInheriting
'
,
()
=>
{
describe
(
'
when
admin
State is null
'
,
()
=>
{
describe
(
'
when
default
State is null
'
,
()
=>
{
it
(
'
returns false
'
,
()
=>
{
it
(
'
returns false
'
,
()
=>
{
expect
(
isInheriting
(
state
)).
toBe
(
false
);
expect
(
isInheriting
(
state
)).
toBe
(
false
);
});
});
});
});
describe
(
'
when
admin
State is an object
'
,
()
=>
{
describe
(
'
when
default
State is an object
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
state
.
adminState
=
admin
State
;
state
.
defaultState
=
default
State
;
});
});
describe
(
'
when override is false
'
,
()
=>
{
describe
(
'
when override is false
'
,
()
=>
{
...
@@ -47,11 +47,11 @@ describe('Integration form store getters', () => {
...
@@ -47,11 +47,11 @@ describe('Integration form store getters', () => {
describe
(
'
propsSource
'
,
()
=>
{
describe
(
'
propsSource
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
state
.
adminState
=
admin
State
;
state
.
defaultState
=
default
State
;
});
});
it
(
'
equals
admin
State if inheriting
'
,
()
=>
{
it
(
'
equals
default
State if inheriting
'
,
()
=>
{
expect
(
propsSource
(
state
,
{
isInheriting
:
true
})).
toEqual
(
admin
State
);
expect
(
propsSource
(
state
,
{
isInheriting
:
true
})).
toEqual
(
default
State
);
});
});
it
(
'
equals customState if not inheriting
'
,
()
=>
{
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';
...
@@ -3,7 +3,7 @@ import createState from '~/integrations/edit/store/state';
describe
(
'
Integration form state factory
'
,
()
=>
{
describe
(
'
Integration form state factory
'
,
()
=>
{
it
(
'
states default to null
'
,
()
=>
{
it
(
'
states default to null
'
,
()
=>
{
expect
(
createState
()).
toEqual
({
expect
(
createState
()).
toEqual
({
admin
State
:
null
,
default
State
:
null
,
customState
:
{},
customState
:
{},
isSaving
:
false
,
isSaving
:
false
,
isTesting
:
false
,
isTesting
:
false
,
...
@@ -19,9 +19,9 @@ describe('Integration form state factory', () => {
...
@@ -19,9 +19,9 @@ describe('Integration form state factory', () => {
[
null
,
{
inheritFromId
:
null
},
false
],
[
null
,
{
inheritFromId
:
null
},
false
],
[
null
,
{
inheritFromId
:
25
},
false
],
[
null
,
{
inheritFromId
:
25
},
false
],
])(
])(
'
for
admin
State: %p, customState: %p: override = `%p`
'
,
'
for
default
State: %p, customState: %p: override = `%p`
'
,
(
admin
State
,
customState
,
expected
)
=>
{
(
default
State
,
customState
,
expected
)
=>
{
expect
(
createState
({
admin
State
,
customState
}).
override
).
toEqual
(
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