diff options
Diffstat (limited to 'app/assets/javascripts/projects')
10 files changed, 92 insertions, 57 deletions
diff --git a/app/assets/javascripts/projects/commit_box/info/index.js b/app/assets/javascripts/projects/commit_box/info/index.js index 352ac39f3c4..254d178f013 100644 --- a/app/assets/javascripts/projects/commit_box/info/index.js +++ b/app/assets/javascripts/projects/commit_box/info/index.js @@ -1,4 +1,5 @@ import { loadBranches } from './load_branches'; +import { initDetailsButton } from './init_details_button'; import { fetchCommitMergeRequests } from '~/commit_merge_requests'; import MiniPipelineGraph from '~/mini_pipeline_graph_dropdown'; @@ -15,4 +16,6 @@ export const initCommitBoxInfo = (containerSelector = '.js-commit-box-info') => new MiniPipelineGraph({ container: '.js-commit-pipeline-graph', }).bindEvents(); + + initDetailsButton(); }; diff --git a/app/assets/javascripts/projects/commit_box/info/init_details_button.js b/app/assets/javascripts/projects/commit_box/info/init_details_button.js new file mode 100644 index 00000000000..032fbf5316a --- /dev/null +++ b/app/assets/javascripts/projects/commit_box/info/init_details_button.js @@ -0,0 +1,11 @@ +import $ from 'jquery'; + +export const initDetailsButton = () => { + $('body').on('click', '.js-details-expand', function expand(e) { + e.preventDefault(); + $(this) + .next('.js-details-content') + .removeClass('hide'); + $(this).hide(); + }); +}; diff --git a/app/assets/javascripts/projects/components/project_delete_button.vue b/app/assets/javascripts/projects/components/project_delete_button.vue index 2f3ff92d7ae..5429d51dae0 100644 --- a/app/assets/javascripts/projects/components/project_delete_button.vue +++ b/app/assets/javascripts/projects/components/project_delete_button.vue @@ -25,7 +25,7 @@ export default { 'Once a project is permanently deleted it %{strongStart}cannot be recovered%{strongEnd}. Permanently deleting this project will %{strongStart}immediately delete%{strongEnd} its repositories and %{strongStart}all related resources%{strongEnd} including issues, merge requests etc.', ), modalBody: __( - "This action cannot be undone. You will lose the project's repository and all content: issues, merge requests, etc.", + "This action cannot be undone. You will lose this project's repository and all content: issues, merge requests, etc.", ), }, }; diff --git a/app/assets/javascripts/projects/pipelines/charts/components/app.vue b/app/assets/javascripts/projects/pipelines/charts/components/app.vue index 0777dddfc19..c6e2b2e1140 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/app.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/app.vue @@ -45,9 +45,12 @@ export default { }, data() { return { - timesChartTransformedData: { - full: this.mergeLabelsAndValues(this.timesChartData.labels, this.timesChartData.values), - }, + timesChartTransformedData: [ + { + name: 'full', + data: this.mergeLabelsAndValues(this.timesChartData.labels, this.timesChartData.values), + }, + ], }; }, computed: { @@ -128,7 +131,7 @@ export default { <gl-column-chart :height="$options.chartContainerHeight" :option="$options.timesChartOptions" - :data="timesChartTransformedData" + :bars="timesChartTransformedData" :y-axis-title="__('Minutes')" :x-axis-title="__('Commit')" x-axis-type="category" diff --git a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue index cd9e464c5ac..aa59717ddcd 100644 --- a/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue +++ b/app/assets/javascripts/projects/pipelines/charts/components/statistics_list.vue @@ -1,4 +1,7 @@ <script> +import { formatTime } from '~/lib/utils/datetime_utility'; +import { s__, n__ } from '~/locale'; + export default { props: { counts: { @@ -6,25 +9,44 @@ export default { required: true, }, }, + computed: { + totalDuration() { + return formatTime(this.counts.totalDuration); + }, + statistics() { + return [ + { + title: s__('PipelineCharts|Total:'), + value: n__('1 pipeline', '%d pipelines', this.counts.total), + }, + { + title: s__('PipelineCharts|Successful:'), + value: n__('1 pipeline', '%d pipelines', this.counts.success), + }, + { + title: s__('PipelineCharts|Failed:'), + value: n__('1 pipeline', '%d pipelines', this.counts.failed), + }, + { + title: s__('PipelineCharts|Success ratio:'), + value: `${this.counts.successRatio}%`, + }, + { + title: s__('PipelineCharts|Total duration:'), + value: this.totalDuration, + }, + ]; + }, + }, }; </script> <template> <ul> - <li> - <span>{{ s__('PipelineCharts|Total:') }}</span> - <strong>{{ n__('1 pipeline', '%d pipelines', counts.total) }}</strong> - </li> - <li> - <span>{{ s__('PipelineCharts|Successful:') }}</span> - <strong>{{ n__('1 pipeline', '%d pipelines', counts.success) }}</strong> - </li> - <li> - <span>{{ s__('PipelineCharts|Failed:') }}</span> - <strong>{{ n__('1 pipeline', '%d pipelines', counts.failed) }}</strong> - </li> - <li> - <span>{{ s__('PipelineCharts|Success ratio:') }}</span> - <strong>{{ counts.successRatio }}%</strong> - </li> + <template v-for="({ title, value }, index) in statistics"> + <li :key="index"> + <span>{{ title }}</span> + <strong>{{ value }}</strong> + </li> + </template> </ul> </template> diff --git a/app/assets/javascripts/projects/pipelines/charts/index.js b/app/assets/javascripts/projects/pipelines/charts/index.js index 4ae2b729200..eef1bc2d28b 100644 --- a/app/assets/javascripts/projects/pipelines/charts/index.js +++ b/app/assets/javascripts/projects/pipelines/charts/index.js @@ -7,6 +7,7 @@ export default () => { countsFailed, countsSuccess, countsTotal, + countsTotalDuration, successRatio, timesChartLabels, timesChartValues, @@ -41,6 +42,7 @@ export default () => { success: countsSuccess, total: countsTotal, successRatio, + totalDuration: countsTotalDuration, }, timesChartData: { labels: JSON.parse(timesChartLabels), diff --git a/app/assets/javascripts/projects/settings_service_desk/components/service_desk_root.vue b/app/assets/javascripts/projects/settings_service_desk/components/service_desk_root.vue index 4bfed6d489d..df7d9b56aed 100644 --- a/app/assets/javascripts/projects/settings_service_desk/components/service_desk_root.vue +++ b/app/assets/javascripts/projects/settings_service_desk/components/service_desk_root.vue @@ -20,7 +20,12 @@ export default { type: String, required: true, }, - initialIncomingEmail: { + incomingEmail: { + type: String, + required: false, + default: '', + }, + customEmail: { type: String, required: false, default: '', @@ -50,23 +55,18 @@ export default { data() { return { isEnabled: this.initialIsEnabled, - incomingEmail: this.initialIncomingEmail, isTemplateSaving: false, isAlertShowing: false, alertVariant: 'danger', alertMessage: '', + updatedCustomEmail: this.customEmail, }; }, created() { eventHub.$on('serviceDeskEnabledCheckboxToggled', this.onEnableToggled); eventHub.$on('serviceDeskTemplateSave', this.onSaveTemplate); - this.service = new ServiceDeskService(this.endpoint); - - if (this.isEnabled && !this.incomingEmail) { - this.fetchIncomingEmail(); - } }, beforeDestroy() { @@ -75,22 +75,6 @@ export default { }, methods: { - fetchIncomingEmail() { - this.service - .fetchIncomingEmail() - .then(({ data }) => { - const email = data.service_desk_address; - if (!email) { - throw new Error(__("Response didn't include `service_desk_address`")); - } - - this.incomingEmail = email; - }) - .catch(() => - this.showAlert(__('An error occurred while fetching the Service Desk address.')), - ); - }, - onEnableToggled(isChecked) { this.isEnabled = isChecked; this.incomingEmail = ''; @@ -119,7 +103,7 @@ export default { this.service .updateTemplate({ selectedTemplate, outgoingName, projectKey }, this.isEnabled) .then(({ data }) => { - this.incomingEmail = data?.service_desk_address; + this.updatedCustomEmail = data?.service_desk_address; this.showAlert(__('Changes were successfully made.'), 'success'); }) .catch(err => { @@ -155,6 +139,7 @@ export default { <service-desk-setting :is-enabled="isEnabled" :incoming-email="incomingEmail" + :custom-email="updatedCustomEmail" :initial-selected-template="selectedTemplate" :initial-outgoing-name="outgoingName" :initial-project-key="projectKey" diff --git a/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue b/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue index e18cfefc3ca..5d120fd0b3f 100644 --- a/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue +++ b/app/assets/javascripts/projects/settings_service_desk/components/service_desk_setting.vue @@ -26,6 +26,11 @@ export default { required: false, default: '', }, + customEmail: { + type: String, + required: false, + default: '', + }, initialSelectedTemplate: { type: String, required: false, @@ -57,7 +62,6 @@ export default { selectedTemplate: this.initialSelectedTemplate, outgoingName: this.initialOutgoingName || __('GitLab Support Bot'), projectKey: this.initialProjectKey, - baseEmail: this.incomingEmail.replace(this.initialProjectKey, ''), }; }, computed: { @@ -67,6 +71,12 @@ export default { hasProjectKeySupport() { return Boolean(this.glFeatures.serviceDeskCustomAddress); }, + email() { + return this.customEmail || this.incomingEmail; + }, + hasCustomEmail() { + return this.customEmail && this.customEmail !== this.incomingEmail; + }, }, methods: { onCheckboxToggle(isChecked) { @@ -101,30 +111,31 @@ export default { <strong id="incoming-email-describer" class="d-block mb-1"> {{ __('Forward external support email address to') }} </strong> - <template v-if="incomingEmail"> + <template v-if="email"> <div class="input-group"> <input ref="service-desk-incoming-email" type="text" - class="form-control incoming-email" + class="form-control" + data-testid="incoming-email" :placeholder="__('Incoming email')" :aria-label="__('Incoming email')" aria-describedby="incoming-email-describer" - :value="incomingEmail" + :value="email" disabled="true" /> <div class="input-group-append"> <clipboard-button :title="__('Copy')" - :text="incomingEmail" + :text="email" css-class="input-group-text qa-clipboard-button" /> </div> </div> - <span v-if="projectKey" class="form-text text-muted"> + <span v-if="hasCustomEmail" class="form-text text-muted"> <gl-sprintf :message="__('Emails sent to %{email} will still be supported')"> <template #email> - <code>{{ baseEmail }}</code> + <code>{{ incomingEmail }}</code> </template> </gl-sprintf> </span> diff --git a/app/assets/javascripts/projects/settings_service_desk/index.js b/app/assets/javascripts/projects/settings_service_desk/index.js index 15c077de72e..c73163788ef 100644 --- a/app/assets/javascripts/projects/settings_service_desk/index.js +++ b/app/assets/javascripts/projects/settings_service_desk/index.js @@ -17,6 +17,7 @@ export default () => { initialIsEnabled: parseBoolean(dataset.enabled), endpoint: dataset.endpoint, incomingEmail: dataset.incomingEmail, + customEmail: dataset.customEmail, selectedTemplate: dataset.selectedTemplate, outgoingName: dataset.outgoingName, projectKey: dataset.projectKey, @@ -28,7 +29,8 @@ export default () => { props: { initialIsEnabled: this.initialIsEnabled, endpoint: this.endpoint, - initialIncomingEmail: this.incomingEmail, + incomingEmail: this.incomingEmail, + customEmail: this.customEmail, selectedTemplate: this.selectedTemplate, outgoingName: this.outgoingName, projectKey: this.projectKey, diff --git a/app/assets/javascripts/projects/settings_service_desk/services/service_desk_service.js b/app/assets/javascripts/projects/settings_service_desk/services/service_desk_service.js index d707763c64e..b68c5bb876f 100644 --- a/app/assets/javascripts/projects/settings_service_desk/services/service_desk_service.js +++ b/app/assets/javascripts/projects/settings_service_desk/services/service_desk_service.js @@ -5,10 +5,6 @@ class ServiceDeskService { this.endpoint = endpoint; } - fetchIncomingEmail() { - return axios.get(this.endpoint); - } - toggleServiceDesk(enable) { return axios.put(this.endpoint, { service_desk_enabled: enable }); } |