2222
2323<template >
2424 <div class =" document-status" >
25- <NcEmptyContent v-if =" isLoadingError " :name =" t (' text' , ' Failed to load file' )" :description =" syncError .data .data " >
25+ <NcNoteCard v-if =" hasWarning " type="warning">
26+ <p v-if =" isLoadingError" >
27+ {{ syncError.data.data }}
28+ <!-- Display reload button on PRECONDITION_FAILED response type -->
29+ <a v-if =" syncError.data.status === 412" class =" button primary" @click =" reload" >{{ t('text', 'Reload') }}</a >
30+ </p >
31+ <p v-else-if =" hasSyncCollission" >
32+ {{ t('text', 'Document has been changed outside of the editor. The changes cannot be applied') }}
33+ </p >
34+ <p v-else-if =" hasConnectionIssue" >
35+ {{ t('text', 'Document could not be loaded. Please check your internet connection.') }}
36+ <a class =" button primary" @click =" reconnect" >{{ t('text', 'Reconnect') }}</a >
37+ </p >
38+ </NcNoteCard >
39+ <NcNoteCard v-else-if =" idle " type="info">
40+ <p >
41+ {{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }}
42+ <a class =" button primary" @click =" reconnect" >{{ t('text', 'Reconnect') }}</a >
43+ </p >
44+ </NcNoteCard >
45+ <NcNoteCard v-if =" lock " type="info">
2646 <template #icon >
27- <AlertOctagonOutline />
47+ <Lock : size = " 20 " />
2848 </template >
29- </NcEmptyContent >
30-
31- <p v-else-if =" idle" class =" msg" >
32- {{ t('text', 'Document idle for {timeout} minutes, click to continue editing', { timeout: IDLE_TIMEOUT }) }} <a class =" button primary" @click =" reconnect" >{{ t('text', 'Reconnect') }}</a >
33- </p >
34-
35- <p v-else-if =" hasSyncCollission" class =" msg icon-error" >
36- {{ t('text', 'The document has been changed outside of the editor. The changes cannot be applied.') }}
37- </p >
38-
39- <p v-else-if =" hasConnectionIssue" class =" msg" >
40- {{ t('text', 'File could not be loaded. Please check your internet connection.') }} <a class =" button primary" @click =" reconnect" >{{ t('text', 'Reconnect') }}</a >
41- </p >
42-
43- <p v-if =" lock" class =" msg msg-locked" >
44- <Lock /> {{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }}
45- </p >
49+ <p >
50+ {{ t('text', 'This file is opened read-only as it is currently locked by {user}.', { user: lock.displayName }) }}
51+ </p >
52+ </NcNoteCard >
4653
4754 <CollisionResolveDialog v-if =" hasSyncCollission " :sync-error =" syncError " />
4855 </div >
5158<script >
5259
5360import { ERROR_TYPE , IDLE_TIMEOUT } from ' ./../../services/SyncService.js'
54- import AlertOctagonOutline from ' vue-material-design-icons/AlertOctagonOutline.vue'
5561import Lock from ' vue-material-design-icons/Lock.vue'
56- import { NcEmptyContent } from ' @nextcloud/vue'
62+ import { NcNoteCard } from ' @nextcloud/vue'
5763import CollisionResolveDialog from ' ../CollisionResolveDialog.vue'
5864
5965export default {
6066 name: ' DocumentStatus' ,
6167
6268 components: {
6369 CollisionResolveDialog,
64- AlertOctagonOutline,
6570 Lock,
66- NcEmptyContent ,
71+ NcNoteCard ,
6772 },
6873
6974 props: {
@@ -79,6 +84,7 @@ export default {
7984 type: Object ,
8085 default: null ,
8186 },
87+
8288 hasConnectionIssue: {
8389 type: Boolean ,
8490 require: true ,
@@ -98,12 +104,18 @@ export default {
98104 isLoadingError () {
99105 return this .syncError && this .syncError .type === ERROR_TYPE .LOAD_ERROR
100106 },
107+ hasWarning () {
108+ return this .syncError || this .hasConnectionIssue
109+ },
101110 },
102111
103112 methods: {
104113 reconnect () {
105114 this .$emit (' reconnect' )
106115 },
116+ reload () {
117+ window .location .reload ()
118+ },
107119 },
108120
109121}
@@ -112,28 +124,11 @@ export default {
112124<style scoped lang="scss">
113125 .document-status {
114126 position : sticky ;
115- top : 0 ;
116- z-index : 10000 ;
117- max-height : 50px ;
127+ top : 16px ;
128+ z-index : 100000 ;
129+ // max-height: 50px;
130+ max-width : var (--text-editor-max-width );
131+ margin : auto ;
118132 background-color : var (--color-main-background );
119-
120- .msg {
121- padding : 12px ;
122- background-position : 8px center ;
123- color : var (--color-text-maxcontrast );
124-
125- & .icon-error {
126- padding-left : 30px ;
127- }
128-
129- .button {
130- margin-left : 8px ;
131- }
132-
133- & .msg-locked .lock-icon {
134- padding : 0 10px ;
135- float : left ;
136- }
137- }
138133 }
139134 </style >
0 commit comments