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
9ccd95e1
Commit
9ccd95e1
authored
May 04, 2017
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply changes from
2d43f8a2
parent
09484066
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
22 additions
and
115 deletions
+22
-115
app/assets/javascripts/environments/components/environment.vue
...ssets/javascripts/environments/components/environment.vue
+10
-2
app/assets/javascripts/environments/components/environment_actions.vue
...vascripts/environments/components/environment_actions.vue
+1
-18
app/assets/javascripts/environments/components/environment_item.vue
.../javascripts/environments/components/environment_item.vue
+4
-9
app/assets/javascripts/environments/components/environment_rollback.vue
...ascripts/environments/components/environment_rollback.vue
+1
-19
app/assets/javascripts/environments/components/environment_stop.vue
.../javascripts/environments/components/environment_stop.vue
+2
-17
app/assets/javascripts/environments/components/environments_table.vue
...avascripts/environments/components/environments_table.vue
+1
-2
app/assets/javascripts/environments/folder/environments_folder_view.vue
...ascripts/environments/folder/environments_folder_view.vue
+3
-2
spec/javascripts/environments/environment_actions_spec.js
spec/javascripts/environments/environment_actions_spec.js
+0
-12
spec/javascripts/environments/environment_rollback_spec.js
spec/javascripts/environments/environment_rollback_spec.js
+0
-24
spec/javascripts/environments/environment_stop_spec.js
spec/javascripts/environments/environment_stop_spec.js
+0
-10
No files found.
app/assets/javascripts/environments/components/environment.vue
View file @
9ccd95e1
<
script
>
/* eslint-disable no-new */
/* global Flash */
import
EnvironmentsService
from
'
../services/environments_service
'
;
import
EnvironmentTable
from
'
./environments_table.vue
'
;
...
...
@@ -82,11 +80,13 @@ export default {
eventHub
.
$on
(
'
refreshEnvironments
'
,
this
.
fetchEnvironments
);
eventHub
.
$on
(
'
toggleFolder
'
,
this
.
toggleFolder
);
eventHub
.
$on
(
'
postAction
'
,
this
.
postAction
);
},
beforeDestroyed
()
{
eventHub
.
$off
(
'
refreshEnvironments
'
);
eventHub
.
$off
(
'
toggleFolder
'
);
eventHub
.
$off
(
'
postAction
'
);
},
methods
:
{
...
...
@@ -144,6 +144,7 @@ export default {
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
// eslint-disable-next-line no-new
new
Flash
(
'
An error occurred while fetching the environments.
'
);
});
},
...
...
@@ -159,9 +160,16 @@ export default {
})
.
catch
(()
=>
{
this
.
isLoadingFolderContent
=
false
;
// eslint-disable-next-line no-new
new
Flash
(
'
An error occurred while fetching the environments.
'
);
});
},
postAction
(
endpoint
)
{
this
.
service
.
postAction
(
endpoint
)
.
then
(()
=>
this
.
fetchEnvironments
())
.
catch
(()
=>
new
Flash
(
'
An error occured while making the request.
'
));
},
},
};
</
script
>
...
...
app/assets/javascripts/environments/components/environment_actions.vue
View file @
9ccd95e1
<
script
>
/* global Flash */
/* eslint-disable no-new */
import
playIconSvg
from
'
icons/_icon_play.svg
'
;
import
eventHub
from
'
../event_hub
'
;
...
...
@@ -12,11 +9,6 @@ export default {
required
:
false
,
default
:
()
=>
[],
},
service
:
{
type
:
Object
,
required
:
true
,
},
},
data
()
{
...
...
@@ -37,16 +29,7 @@ export default {
this
.
isLoading
=
true
;
$
(
this
.
$refs
.
tooltip
).
tooltip
(
'
destroy
'
);
this
.
service
.
postAction
(
endpoint
)
.
then
(()
=>
{
this
.
isLoading
=
false
;
eventHub
.
$emit
(
'
refreshEnvironments
'
);
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
new
Flash
(
'
An error occured while making the request.
'
);
});
eventHub
.
$emit
(
'
postAction
'
,
endpoint
);
},
isActionDisabled
(
action
)
{
...
...
app/assets/javascripts/environments/components/environment_item.vue
View file @
9ccd95e1
...
...
@@ -47,11 +47,6 @@ export default {
required
:
false
,
},
service
:
{
type
:
Object
,
required
:
true
,
default
:
()
=>
({}),
},
},
computed
:
{
...
...
@@ -560,8 +555,8 @@ export default {
<actions-component
v-if=
"hasManualActions && canCreateDeployment"
:
service=
"service
"
:actions=
"manualActions"
/>
:
actions=
"manualActions
"
/>
<external-url-component
v-if=
"externalURL && canReadEnvironment"
...
...
@@ -578,13 +573,13 @@ export default {
<stop-component
v-if=
"hasStopAction && canCreateDeployment"
:stop-url=
"model.stop_path"
:service=
"service"
/>
/>
<rollback-component
v-if=
"canRetry && canCreateDeployment"
:is-last-deployment=
"isLastDeployment"
:retry-url=
"retryUrl"
:service=
"service"
/>
/>
</div>
</td>
</tr>
...
...
app/assets/javascripts/environments/components/environment_rollback.vue
View file @
9ccd95e1
<
script
>
/* global Flash */
/* eslint-disable no-new */
/**
* Renders Rollback or Re deploy button in environments table depending
* of the provided property `isLastDeployment`.
...
...
@@ -20,12 +18,6 @@ export default {
type
:
Boolean
,
default
:
true
,
},
service
:
{
type
:
Object
,
required
:
true
,
default
:
()
=>
({}),
},
},
data
()
{
...
...
@@ -38,17 +30,7 @@ export default {
onClick
()
{
this
.
isLoading
=
true
;
$
(
this
.
$el
).
tooltip
(
'
destroy
'
);
this
.
service
.
postAction
(
this
.
retryUrl
)
.
then
(()
=>
{
this
.
isLoading
=
false
;
eventHub
.
$emit
(
'
refreshEnvironments
'
);
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
new
Flash
(
'
An error occured while making the request.
'
);
});
eventHub
.
$emit
(
'
postAction
'
,
this
.
retryUrl
);
},
},
};
...
...
app/assets/javascripts/environments/components/environment_stop.vue
View file @
9ccd95e1
<
script
>
/* global Flash */
/* eslint-disable no-new, no-alert */
/**
* Renders the stop "button" that allows stop an environment.
* Used in environments table.
...
...
@@ -13,12 +11,6 @@ export default {
type
:
String
,
default
:
''
,
},
service
:
{
type
:
Object
,
required
:
true
,
default
:
()
=>
({}),
},
},
data
()
{
...
...
@@ -35,20 +27,13 @@ export default {
methods
:
{
onClick
()
{
// eslint-disable-next-line no-alert
if
(
confirm
(
'
Are you sure you want to stop this environment?
'
))
{
this
.
isLoading
=
true
;
$
(
this
.
$el
).
tooltip
(
'
destroy
'
);
this
.
service
.
postAction
(
this
.
retryUrl
)
.
then
(()
=>
{
this
.
isLoading
=
false
;
eventHub
.
$emit
(
'
refreshEnvironments
'
);
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
new
Flash
(
'
An error occured while making the request.
'
,
'
alert
'
);
});
eventHub
.
$emit
(
'
postAction
'
,
this
.
stopUrl
);
}
},
},
...
...
app/assets/javascripts/environments/components/environments_table.vue
View file @
9ccd95e1
...
...
@@ -92,7 +92,6 @@ export default {
:model=
"model"
:can-create-deployment=
"canCreateDeployment"
:can-read-environment=
"canReadEnvironment"
:service=
"service"
:toggleDeployBoard=
"toggleDeployBoard"
/>
...
...
@@ -124,7 +123,7 @@ export default {
:model=
"children"
:can-create-deployment=
"canCreateDeployment"
:can-read-environment=
"canReadEnvironment"
:service=
"service"
/>
/>
<tr>
<td
...
...
app/assets/javascripts/environments/folder/environments_folder_view.vue
View file @
9ccd95e1
<
script
>
/* eslint-disable no-new */
/* global Flash */
import
EnvironmentsService
from
'
../services/environments_service
'
;
import
EnvironmentTable
from
'
../components/environments_table.vue
'
;
...
...
@@ -100,6 +99,7 @@ export default {
})
.
catch
(()
=>
{
this
.
isLoading
=
false
;
// eslint-disable-next-line no-new
new
Flash
(
'
An error occurred while fetching the environments.
'
,
'
alert
'
);
});
},
...
...
@@ -183,7 +183,8 @@ export default {
:can-read-environment=
"canReadEnvironmentParsed"
:toggleDeployBoard=
"toggleDeployBoard"
:store=
"store"
:service=
"service"
/>
:service=
"service"
/>
<table-pagination
v-if=
"state.paginationInformation && state.paginationInformation.totalPages > 1"
...
...
spec/javascripts/environments/environment_actions_spec.js
View file @
9ccd95e1
...
...
@@ -4,7 +4,6 @@ import actionsComp from '~/environments/components/environment_actions.vue';
describe
(
'
Actions Component
'
,
()
=>
{
let
ActionsComponent
;
let
actionsMock
;
let
spy
;
let
component
;
beforeEach
(()
=>
{
...
...
@@ -26,13 +25,9 @@ describe('Actions Component', () => {
},
];
spy
=
jasmine
.
createSpy
(
'
spy
'
).
and
.
returnValue
(
Promise
.
resolve
());
component
=
new
ActionsComponent
({
propsData
:
{
actions
:
actionsMock
,
service
:
{
postAction
:
spy
,
},
},
}).
$mount
();
});
...
...
@@ -48,13 +43,6 @@ describe('Actions Component', () => {
).
toEqual
(
actionsMock
.
length
);
});
it
(
'
should call the service when an action is clicked
'
,
()
=>
{
component
.
$el
.
querySelector
(
'
.dropdown
'
).
click
();
component
.
$el
.
querySelector
(
'
.js-manual-action-link
'
).
click
();
expect
(
spy
).
toHaveBeenCalledWith
(
actionsMock
[
0
].
play_path
);
});
it
(
'
should render a disabled action when it
\'
s not playable
'
,
()
=>
{
expect
(
component
.
$el
.
querySelector
(
'
.dropdown-menu li:last-child button
'
).
getAttribute
(
'
disabled
'
),
...
...
spec/javascripts/environments/environment_rollback_spec.js
View file @
9ccd95e1
...
...
@@ -4,11 +4,9 @@ import rollbackComp from '~/environments/components/environment_rollback.vue';
describe
(
'
Rollback Component
'
,
()
=>
{
const
retryURL
=
'
https://gitlab.com/retry
'
;
let
RollbackComponent
;
let
spy
;
beforeEach
(()
=>
{
RollbackComponent
=
Vue
.
extend
(
rollbackComp
);
spy
=
jasmine
.
createSpy
(
'
spy
'
).
and
.
returnValue
(
Promise
.
resolve
());
});
it
(
'
Should render Re-deploy label when isLastDeployment is true
'
,
()
=>
{
...
...
@@ -17,9 +15,6 @@ describe('Rollback Component', () => {
propsData
:
{
retryUrl
:
retryURL
,
isLastDeployment
:
true
,
service
:
{
postAction
:
spy
,
},
},
}).
$mount
();
...
...
@@ -32,28 +27,9 @@ describe('Rollback Component', () => {
propsData
:
{
retryUrl
:
retryURL
,
isLastDeployment
:
false
,
service
:
{
postAction
:
spy
,
},
},
}).
$mount
();
expect
(
component
.
$el
.
querySelector
(
'
span
'
).
textContent
).
toContain
(
'
Rollback
'
);
});
it
(
'
should call the service when the button is clicked
'
,
()
=>
{
const
component
=
new
RollbackComponent
({
propsData
:
{
retryUrl
:
retryURL
,
isLastDeployment
:
false
,
service
:
{
postAction
:
spy
,
},
},
}).
$mount
();
component
.
$el
.
click
();
expect
(
spy
).
toHaveBeenCalledWith
(
retryURL
);
});
});
spec/javascripts/environments/environment_stop_spec.js
View file @
9ccd95e1
...
...
@@ -4,20 +4,15 @@ import stopComp from '~/environments/components/environment_stop.vue';
describe
(
'
Stop Component
'
,
()
=>
{
let
StopComponent
;
let
component
;
let
spy
;
const
stopURL
=
'
/stop
'
;
beforeEach
(()
=>
{
StopComponent
=
Vue
.
extend
(
stopComp
);
spy
=
jasmine
.
createSpy
(
'
spy
'
).
and
.
returnValue
(
Promise
.
resolve
());
spyOn
(
window
,
'
confirm
'
).
and
.
returnValue
(
true
);
component
=
new
StopComponent
({
propsData
:
{
stopUrl
:
stopURL
,
service
:
{
postAction
:
spy
,
},
},
}).
$mount
();
});
...
...
@@ -26,9 +21,4 @@ describe('Stop Component', () => {
expect
(
component
.
$el
.
tagName
).
toEqual
(
'
BUTTON
'
);
expect
(
component
.
$el
.
getAttribute
(
'
title
'
)).
toEqual
(
'
Stop
'
);
});
it
(
'
should call the service when an action is clicked
'
,
()
=>
{
component
.
$el
.
click
();
expect
(
spy
).
toHaveBeenCalled
();
});
});
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