Skip to content

Commit 36a71b5

Browse files
authored
Merge pull request #7298 from ProcessMaker/feature/FOUR-18184
FOUR-18184:Add the component auto save instead the notification in Web
2 parents 8d8e65e + c881e01 commit 36a71b5

File tree

3 files changed

+53
-16
lines changed

3 files changed

+53
-16
lines changed

resources/js/tasks/components/TaskSaveNotification.vue

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
<template>
22
<div>
3-
<div
4-
class="btn text-black text-capitalize cursor-default"
5-
>
3+
<div class="btn text-black text-capitalize cursor-default">
64
<div class="toolbar-item d-flex align-items-center">
7-
<span>
5+
<div class="save-date">
6+
<span
7+
v-if="size === 0"
8+
class="autosave-draft-date"
9+
>
10+
{{ date }}
11+
</span>
812
<FontAwesomeIcon
913
v-if="task.draft"
1014
:class="{ 'text-success': !error, 'text-secondary': error }"
1115
:icon="icon"
1216
:spin="isLoading"
1317
/>
14-
</span>
18+
<span
19+
v-if="size === 0"
20+
class="autosave-draft-date"
21+
>
22+
{{ $t("Saved") }}
23+
</span>
24+
</div>
1525
<span
1626
id="saved-status"
1727
class="element-name truncate-text"
1828
:style="{
1929
maxWidth: `${size}px`
2030
}"
2131
v-html="sanitizeHtml(task.element_name)"
22-
>
23-
</span>
32+
/>
2433
</div>
2534
</div>
2635
<b-tooltip
@@ -32,11 +41,22 @@
3241
{{ task.process_request.case_title }}
3342
</div>
3443
<div class="tooltip-draft-date">
35-
<FontAwesomeIcon v-if="!error" class="text-success" :icon="savedIcon" />
36-
{{ $t('Last Autosave: ')+date }}
44+
<FontAwesomeIcon
45+
v-if="!error"
46+
class="text-success"
47+
:icon="savedIcon"
48+
/>
49+
{{ $t('Last Autosave: ') + date }}
3750
</div>
38-
<div v-if="error" class="tooltip-draft-error">
39-
<FontAwesomeIcon v-if="error" class="text-secondary" :icon="errorIcon " />
51+
<div
52+
v-if="error"
53+
class="tooltip-draft-error"
54+
>
55+
<FontAwesomeIcon
56+
v-if="error"
57+
class="text-secondary"
58+
:icon="errorIcon "
59+
/>
4060
<span>{{ $t('Unable to save. Verify your internet connection.') }}
4161
</span>
4262
</div>
@@ -124,14 +144,14 @@ export default {
124144
return this.removeScriptsHtml(html);
125145
},
126146
removeScriptsHtml(input) {
127-
const doc = new DOMParser().parseFromString(input, 'text/html');
147+
const doc = new DOMParser().parseFromString(input, "text/html");
128148
129-
const scripts = doc.querySelectorAll('script');
149+
const scripts = doc.querySelectorAll("script");
130150
scripts.forEach((script) => {
131151
script.remove();
132152
});
133153
134-
const styles = doc.querySelectorAll('style');
154+
const styles = doc.querySelectorAll("style");
135155
styles.forEach((style) => {
136156
style.remove();
137157
});
@@ -194,4 +214,9 @@ export default {
194214
white-space: nowrap;
195215
text-overflow: ellipsis;
196216
}
217+
.save-date {
218+
display: flex;
219+
gap: 8px;
220+
align-items: baseline;
221+
}
197222
</style>

resources/js/tasks/show.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import TasksList from "./components/TasksList.vue";
1313
import TaskSavePanel from "./components/TaskSavePanel.vue";
1414
import autosaveMixins from "../modules/autosave/autosaveMixin";
1515
import draftFileUploadMixin from "../modules/autosave/draftFileUploadMixin";
16+
import TaskSaveNotification from "./components/TaskSaveNotification.vue";
1617

1718
Vue.use(Vuex);
1819
Vue.use("task", Task);
@@ -25,6 +26,7 @@ Vue.component("TimelineItem", TimelineItem);
2526
Vue.component("QuickFillPreview", QuickFillPreview);
2627
Vue.component("TasksList", TasksList);
2728
Vue.component("TaskSavePanel", TaskSavePanel);
29+
Vue.component("TaskSaveNotification", TaskSaveNotification);
2830

2931
Vue.mixin(autosaveMixins);
3032
Vue.mixin(draftFileUploadMixin);

resources/views/tasks/edit.blade.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,15 @@ class="btn d-block mr-0 ml-auto button-collapse"
146146
<div class="card collapse-content">
147147
<ul class="list-group list-group-flush w-100">
148148
<li class="list-group-item">
149-
<!-- ADD THE OTHER BUTTONS -->
149+
<div class="row justify-content-start pb-1">
150+
<task-save-notification
151+
:options="options"
152+
:task="task"
153+
:date="lastAutosaveNav"
154+
:error="errorAutosave"
155+
:form-data="formData"
156+
/>
157+
</div>
150158
<div class="row button-group">
151159
<div class="col-6">
152160
<button
@@ -435,6 +443,7 @@ class="multiselect__tag-icon"></i>
435443
is_loading: false,
436444
},
437445
lastAutosave: "-",
446+
lastAutosaveNav: "-",
438447
errorAutosave: false,
439448
formDataWatcherActive: true,
440449
showTabs: true,
@@ -453,8 +462,10 @@ class="multiselect__tag-icon"></i>
453462
}
454463
if (task.draft) {
455464
this.lastAutosave = moment(task.draft.updated_at).format("DD MMMM YYYY | HH:mm");
465+
this.lastAutosaveNav = moment(task.draft.updated_at).format("MMM DD, YYYY / HH:mm");
456466
} else {
457467
this.lastAutosave = "-";
468+
this.lastAutosaveNav = "-"
458469
}
459470
}
460471
},
@@ -704,7 +715,6 @@ class="multiselect__tag-icon"></i>
704715
return ProcessMaker.apiClient
705716
.put("drafts/" + this.task.id, draftData)
706717
.then((response) => {
707-
ProcessMaker.alert(this.$t('Saved'), 'success')
708718
this.task.draft = _.merge(
709719
{},
710720
this.task.draft,

0 commit comments

Comments
 (0)