dochub-sdk 0.1.160 → 0.1.161
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/classes/vue2/Documents.ts +17 -14
- package/package.json +1 -1
@@ -10,7 +10,8 @@ import ajv_localize from 'ajv-i18n/localize/ru';
|
|
10
10
|
export class DocHubDocumentProto extends Vue implements IDocHubEditableComponent {
|
11
11
|
onRefresher: any = null; // Таймер отложенного выполнения обновления
|
12
12
|
followURI: string | null = null; // URI файла за которым установлено слежение
|
13
|
-
error: string | null = null; // Ошибка
|
13
|
+
error: string | null = null; // Ошибка
|
14
|
+
isPending = true; // Признак внутренней работы. Например загрузка данных.
|
14
15
|
|
15
16
|
/**
|
16
17
|
* Профиль документа
|
@@ -85,27 +86,29 @@ export class DocHubDocumentProto extends Vue implements IDocHubEditableComponent
|
|
85
86
|
*/
|
86
87
|
async doRefresh(): Promise<void> {
|
87
88
|
try {
|
89
|
+
this.isPending = true;
|
88
90
|
await this.refreshFileFollow();
|
89
91
|
if (this.profile?.source) {
|
90
|
-
DocHub.dataLake.pullData(this.profile.source, this.params)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
});
|
92
|
+
const result = await DocHub.dataLake.pullData(this.profile.source, this.params);
|
93
|
+
// Валидируем данные по структуре
|
94
|
+
const rules = new ajv({ allErrors: true });
|
95
|
+
const validator = rules.compile(this.getSchemaData());
|
96
|
+
if (!validator(result)) {
|
97
|
+
ajv_localize(validator.errors);
|
98
|
+
this.error = JSON.stringify(validator.errors, null, 4);
|
99
|
+
return;
|
100
|
+
}
|
101
|
+
// Если все в порядке, вызываем процессинг данных
|
102
|
+
this.processingData(result);
|
103
|
+
this.error = null;
|
103
104
|
} else this.processingData(undefined);
|
104
105
|
} catch (error) {
|
105
106
|
// eslint-disable-next-line no-console
|
106
107
|
console.error(error);
|
107
108
|
this.error = error;
|
108
109
|
this.processingData(undefined);
|
110
|
+
} finally {
|
111
|
+
this.isPending = false;
|
109
112
|
}
|
110
113
|
}
|
111
114
|
|