summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-10 06:09:41 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-10 06:09:41 +0000
commit187ee320b39af22929d74c5a2d9b0650bf50a09b (patch)
treeff04eab6c7914f6408c4f637f863fc07aa409cdc /app/assets
parenta7dc052b7e01aee680d130274c79da9bfa459272 (diff)
downloadgitlab-ce-187ee320b39af22929d74c5a2d9b0650bf50a09b.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/reports/components/summary_row.vue16
-rw-r--r--app/assets/javascripts/static_site_editor/components/publish_toolbar.vue15
-rw-r--r--app/assets/javascripts/static_site_editor/components/static_site_editor.vue10
-rw-r--r--app/assets/javascripts/static_site_editor/index.js2
-rw-r--r--app/assets/javascripts/static_site_editor/services/submit_content_changes.js4
-rw-r--r--app/assets/javascripts/static_site_editor/store/actions.js12
-rw-r--r--app/assets/javascripts/static_site_editor/store/mutation_types.js3
-rw-r--r--app/assets/javascripts/static_site_editor/store/mutations.js11
-rw-r--r--app/assets/javascripts/static_site_editor/store/state.js1
9 files changed, 64 insertions, 10 deletions
diff --git a/app/assets/javascripts/reports/components/summary_row.vue b/app/assets/javascripts/reports/components/summary_row.vue
index 1191e43d0d9..9cbe2a690a0 100644
--- a/app/assets/javascripts/reports/components/summary_row.vue
+++ b/app/assets/javascripts/reports/components/summary_row.vue
@@ -53,11 +53,19 @@ export default {
/>
<ci-icon v-else :status="iconStatus" :size="24" />
</div>
-
<div class="report-block-list-issue-description">
- <div class="report-block-list-issue-description-text">{{ summary }}</div>
-
- <popover v-if="popoverOptions" :options="popoverOptions" />
+ <div class="report-block-list-issue-description-text">
+ {{ summary
+ }}<span v-if="popoverOptions" class="text-nowrap"
+ >&nbsp;<popover v-if="popoverOptions" :options="popoverOptions" class="align-top" />
+ </span>
+ </div>
+ </div>
+ <div
+ v-if="$slots.default"
+ class="text-right flex-fill d-flex justify-content-end flex-column flex-sm-row"
+ >
+ <slot></slot>
</div>
</div>
</template>
diff --git a/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue b/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue
index 83b50b2f8eb..7f00fb71b04 100644
--- a/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue
+++ b/app/assets/javascripts/static_site_editor/components/publish_toolbar.vue
@@ -1,9 +1,10 @@
<script>
-import { GlNewButton } from '@gitlab/ui';
+import { GlNewButton, GlLoadingIcon } from '@gitlab/ui';
export default {
components: {
GlNewButton,
+ GlLoadingIcon,
},
props: {
saveable: {
@@ -11,12 +12,22 @@ export default {
required: false,
default: false,
},
+ savingChanges: {
+ type: Boolean,
+ required: false,
+ default: false,
+ },
},
};
</script>
<template>
<div class="d-flex bg-light border-top justify-content-between align-items-center py-3 px-4">
- <gl-new-button variant="success" :disabled="!saveable">
+ <gl-loading-icon :class="{ invisible: !savingChanges }" size="md" />
+ <gl-new-button
+ variant="success"
+ :disabled="!saveable || savingChanges"
+ @click="$emit('submit')"
+ >
{{ __('Submit Changes') }}
</gl-new-button>
</div>
diff --git a/app/assets/javascripts/static_site_editor/components/static_site_editor.vue b/app/assets/javascripts/static_site_editor/components/static_site_editor.vue
index 80a55d5ee11..e711510ba44 100644
--- a/app/assets/javascripts/static_site_editor/components/static_site_editor.vue
+++ b/app/assets/javascripts/static_site_editor/components/static_site_editor.vue
@@ -12,14 +12,14 @@ export default {
Toolbar,
},
computed: {
- ...mapState(['content', 'isLoadingContent']),
+ ...mapState(['content', 'isLoadingContent', 'isSavingChanges']),
...mapGetters(['isContentLoaded', 'contentChanged']),
},
mounted() {
this.loadContent();
},
methods: {
- ...mapActions(['loadContent', 'setContent']),
+ ...mapActions(['loadContent', 'setContent', 'submitChanges']),
},
};
</script>
@@ -41,7 +41,11 @@ export default {
:value="content"
@input="setContent"
/>
- <toolbar :saveable="contentChanged" />
+ <toolbar
+ :saveable="contentChanged"
+ :saving-changes="isSavingChanges"
+ @submit="submitChanges"
+ />
</div>
</div>
</template>
diff --git a/app/assets/javascripts/static_site_editor/index.js b/app/assets/javascripts/static_site_editor/index.js
index 22f96a60df0..3d40f3918a4 100644
--- a/app/assets/javascripts/static_site_editor/index.js
+++ b/app/assets/javascripts/static_site_editor/index.js
@@ -6,7 +6,7 @@ const initStaticSiteEditor = el => {
const { projectId, path: sourcePath } = el.dataset;
const store = createStore({
- initialState: { projectId, sourcePath },
+ initialState: { projectId, sourcePath, username: window.gon.current_username },
});
return new Vue({
diff --git a/app/assets/javascripts/static_site_editor/services/submit_content_changes.js b/app/assets/javascripts/static_site_editor/services/submit_content_changes.js
new file mode 100644
index 00000000000..6b0d8c74ff7
--- /dev/null
+++ b/app/assets/javascripts/static_site_editor/services/submit_content_changes.js
@@ -0,0 +1,4 @@
+// TODO implement
+const submitContentChanges = () => new Promise(resolve => setTimeout(resolve, 1000));
+
+export default submitContentChanges;
diff --git a/app/assets/javascripts/static_site_editor/store/actions.js b/app/assets/javascripts/static_site_editor/store/actions.js
index 141148de1e0..c57ef86f6ef 100644
--- a/app/assets/javascripts/static_site_editor/store/actions.js
+++ b/app/assets/javascripts/static_site_editor/store/actions.js
@@ -3,6 +3,7 @@ import { __ } from '~/locale';
import * as mutationTypes from './mutation_types';
import loadSourceContent from '~/static_site_editor/services/load_source_content';
+import submitContentChanges from '~/static_site_editor/services/submit_content_changes';
export const loadContent = ({ commit, state: { sourcePath, projectId } }) => {
commit(mutationTypes.LOAD_CONTENT);
@@ -19,4 +20,15 @@ export const setContent = ({ commit }, content) => {
commit(mutationTypes.SET_CONTENT, content);
};
+export const submitChanges = ({ state: { projectId, content, sourcePath, username }, commit }) => {
+ commit(mutationTypes.SUBMIT_CHANGES);
+
+ return submitContentChanges({ content, projectId, sourcePath, username })
+ .then(data => commit(mutationTypes.SUBMIT_CHANGES_SUCCESS, data))
+ .catch(error => {
+ commit(mutationTypes.SUBMIT_CHANGES_ERROR);
+ createFlash(error.message);
+ });
+};
+
export default () => {};
diff --git a/app/assets/javascripts/static_site_editor/store/mutation_types.js b/app/assets/javascripts/static_site_editor/store/mutation_types.js
index 2bb201f5d24..35eb35ebbe9 100644
--- a/app/assets/javascripts/static_site_editor/store/mutation_types.js
+++ b/app/assets/javascripts/static_site_editor/store/mutation_types.js
@@ -2,3 +2,6 @@ export const LOAD_CONTENT = 'loadContent';
export const RECEIVE_CONTENT_SUCCESS = 'receiveContentSuccess';
export const RECEIVE_CONTENT_ERROR = 'receiveContentError';
export const SET_CONTENT = 'setContent';
+export const SUBMIT_CHANGES = 'submitChanges';
+export const SUBMIT_CHANGES_SUCCESS = 'submitChangesSuccess';
+export const SUBMIT_CHANGES_ERROR = 'submitChangesError';
diff --git a/app/assets/javascripts/static_site_editor/store/mutations.js b/app/assets/javascripts/static_site_editor/store/mutations.js
index 8b8bacf35c2..f98177bbc18 100644
--- a/app/assets/javascripts/static_site_editor/store/mutations.js
+++ b/app/assets/javascripts/static_site_editor/store/mutations.js
@@ -16,4 +16,15 @@ export default {
[types.SET_CONTENT](state, content) {
state.content = content;
},
+ [types.SUBMIT_CHANGES](state) {
+ state.isSavingChanges = true;
+ },
+ [types.SUBMIT_CHANGES_SUCCESS](state, meta) {
+ state.savedContentMeta = meta;
+ state.isSavingChanges = false;
+ state.originalContent = state.content;
+ },
+ [types.SUBMIT_CHANGES_ERROR](state) {
+ state.isSavingChanges = false;
+ },
};
diff --git a/app/assets/javascripts/static_site_editor/store/state.js b/app/assets/javascripts/static_site_editor/store/state.js
index 1ae11b3343d..e457fde591a 100644
--- a/app/assets/javascripts/static_site_editor/store/state.js
+++ b/app/assets/javascripts/static_site_editor/store/state.js
@@ -1,4 +1,5 @@
const createState = (initialState = {}) => ({
+ username: null,
projectId: null,
sourcePath: null,