summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-03-13 10:10:11 +0000
committerPhil Hughes <me@iamphill.com>2018-03-13 10:10:11 +0000
commit908c67725c22cd91aff379449cf833ba4fd724f0 (patch)
tree47761772956b238e8666c2510923a1d5e36cc86a
parent3dcfb6cb16b14e806d642f024eccf269f97acede (diff)
downloadgitlab-ce-908c67725c22cd91aff379449cf833ba4fd724f0.tar.gz
fixed breakpoint
disable stop button when loading
-rw-r--r--app/assets/javascripts/vue_merge_request_widget/components/deployment.vue103
-rw-r--r--app/assets/stylesheets/pages/merge_requests.scss5
2 files changed, 62 insertions, 46 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
index f76971c2850..ae5a9e00c86 100644
--- a/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
+++ b/app/assets/javascripts/vue_merge_request_widget/components/deployment.vue
@@ -1,6 +1,7 @@
<script>
import timeagoMixin from '../../vue_shared/mixins/timeago';
import tooltip from '../../vue_shared/directives/tooltip';
+import LoadingButton from '../../vue_shared/components/loading_button.vue';
import { visitUrl } from '../../lib/utils/url_utility';
import createFlash from '../../flash';
import MemoryUsage from './memory_usage.vue';
@@ -10,6 +11,7 @@ import MRWidgetService from '../services/mr_widget_service';
export default {
name: 'Deployment',
components: {
+ LoadingButton,
MemoryUsage,
StatusIcon,
},
@@ -25,6 +27,11 @@ export default {
required: true,
},
},
+ data() {
+ return {
+ isStopping: false,
+ };
+ },
computed: {
deployTimeago() {
return this.timeFormated(this.deployment.deployed_at);
@@ -43,19 +50,26 @@ export default {
},
},
methods: {
- stopEnvironment(deployment) {
+ stopEnvironment() {
const msg = 'Are you sure you want to stop this environment?';
const isConfirmed = confirm(msg); // eslint-disable-line
if (isConfirmed) {
- MRWidgetService.stopEnvironment(deployment.stop_url)
+ this.isStopping = true;
+
+ MRWidgetService.stopEnvironment(this.deployment.stop_url)
.then(res => res.data)
.then((data) => {
if (data.redirect_url) {
visitUrl(data.redirect_url);
}
+
+ this.isStopping = false;
})
- .catch(() => createFlash('Something went wrong while stopping this environment. Please try again.'));
+ .catch(() => {
+ createFlash('Something went wrong while stopping this environment. Please try again.');
+ this.isStopping = false;
+ });
}
},
},
@@ -72,56 +86,57 @@ export default {
</div>
<div class="media-body">
<div class="deploy-body">
- <span
- v-if="hasDeploymentMeta"
- >
- Deployed to
- </span>
- <span class="deploy-link">
- <a
- v-if="hasDeploymentMeta"
- :href="deployment.url"
- target="_blank"
- rel="noopener noreferrer nofollow"
- class="js-deploy-meta">
- {{ deployment.name }}
- </a>
- </span>
- <span
- v-if="hasExternalUrls"
- >
- on
- </span>
- <span class="deploy-link">
- <a
- v-if="hasExternalUrls"
- :href="deployment.external_url"
- target="_blank"
- rel="noopener noreferrer nofollow"
- class="js-deploy-url">
- <i
- class="fa fa-external-link"
- aria-hidden="true"
+ <template v-if="hasDeploymentMeta">
+ <span>
+ Deployed to
+ </span>
+ <span class="deploy-link">
+ <a
+ :href="deployment.url"
+ target="_blank"
+ rel="noopener noreferrer nofollow"
+ class="js-deploy-meta"
>
- </i>
- {{ deployment.external_url_formatted }}
- </a>
- </span>
+ {{ deployment.name }}
+ </a>
+ </span>
+ </template>
+ <template v-if="hasExternalUrls">
+ <span>
+ on
+ </span>
+ <span class="deploy-link">
+ <a
+ :href="deployment.external_url"
+ target="_blank"
+ rel="noopener noreferrer nofollow"
+ class="js-deploy-url"
+ >
+ <i
+ class="fa fa-external-link"
+ aria-hidden="true"
+ >
+ </i>
+ {{ deployment.external_url_formatted }}
+ </a>
+ </span>
+ </template>
<span
v-if="hasDeploymentTime"
:data-title="deployment.deployed_at_formatted"
class="js-deploy-time"
data-toggle="tooltip"
- data-placement="top">
+ data-placement="top"
+ >
{{ deployTimeago }}
</span>
- <button
- type="button"
+ <loading-button
v-if="deployment.stop_url"
- @click="stopEnvironment(deployment)"
- class="btn btn-default btn-xs">
- Stop environment
- </button>
+ container-class="btn btn-default btn-xs"
+ label="Stop environment"
+ :loading="isStopping"
+ @click="stopEnvironment"
+ />
</div>
<memory-usage
v-if="hasMetrics"
diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss
index c6abf5dd85f..bdb8e3535dd 100644
--- a/app/assets/stylesheets/pages/merge_requests.scss
+++ b/app/assets/stylesheets/pages/merge_requests.scss
@@ -740,7 +740,7 @@
display: flex;
flex-wrap: wrap;
- @media (min-width: $screen-md-min) {
+ @media (min-width: $screen-xs) {
flex-wrap: nowrap;
white-space: nowrap;
}
@@ -761,7 +761,8 @@
min-width: 100px;
max-width: 150px;
- @media (min-width: $screen-md-min) {
+ @media (min-width: $screen-xs) {
+ min-width: 0;
max-width: 100%;
}
}