Consider offline during update checks
Hides the spinner if the update checks fail cause the server is unreachable use new cleansup the code a little
This commit is contained in:
parent
876dd1f7d6
commit
a6891ef8e1
@ -96,7 +96,7 @@
|
|||||||
"karma-jasmine-html-reporter": "^1.4.0",
|
"karma-jasmine-html-reporter": "^1.4.0",
|
||||||
"npm-license-crawler": "^0.2.1",
|
"npm-license-crawler": "^0.2.1",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"prettier": "^1.18.2",
|
"prettier": "^1.19.1",
|
||||||
"protractor": "^5.4.2",
|
"protractor": "^5.4.2",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
"source-map-explorer": "^2.0.1",
|
"source-map-explorer": "^2.0.1",
|
||||||
|
@ -625,7 +625,7 @@ export class LinenumberingService {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lineBreakAt !== null && (node.nodeValue[i] !== ' ' && node.nodeValue[i] !== '\n')) {
|
if (lineBreakAt !== null && node.nodeValue[i] !== ' ' && node.nodeValue[i] !== '\n') {
|
||||||
if (lineBreakAt.node === node) {
|
if (lineBreakAt.node === node) {
|
||||||
// The last possible breaking point is in this text node
|
// The last possible breaking point is in this text node
|
||||||
const currLine = node.nodeValue.substring(currLineStart, lineBreakAt.offset + 1);
|
const currLine = node.nodeValue.substring(currLineStart, lineBreakAt.offset + 1);
|
||||||
|
@ -2,10 +2,12 @@ import { Injectable } from '@angular/core';
|
|||||||
import { MatDialog, MatDialogRef } from '@angular/material';
|
import { MatDialog, MatDialogRef } from '@angular/material';
|
||||||
|
|
||||||
import { Observable, Subject } from 'rxjs';
|
import { Observable, Subject } from 'rxjs';
|
||||||
|
import { distinctUntilChanged } from 'rxjs/operators';
|
||||||
|
|
||||||
import { largeDialogSettings } from 'app/shared/utils/dialog-settings';
|
import { largeDialogSettings } from 'app/shared/utils/dialog-settings';
|
||||||
import { SuperSearchComponent } from 'app/site/common/components/super-search/super-search.component';
|
import { SuperSearchComponent } from 'app/site/common/components/super-search/super-search.component';
|
||||||
import { DataStoreUpgradeService } from '../core-services/data-store-upgrade.service';
|
import { DataStoreUpgradeService } from '../core-services/data-store-upgrade.service';
|
||||||
|
import { OfflineService } from '../core-services/offline.service';
|
||||||
import { OpenSlidesService } from '../core-services/openslides.service';
|
import { OpenSlidesService } from '../core-services/openslides.service';
|
||||||
import { OperatorService } from '../core-services/operator.service';
|
import { OperatorService } from '../core-services/operator.service';
|
||||||
|
|
||||||
@ -43,6 +45,11 @@ export class OverlayService {
|
|||||||
*/
|
*/
|
||||||
private hasBooted = false;
|
private hasBooted = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag, whether the client is offline or not
|
||||||
|
*/
|
||||||
|
private isOffline = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param dialogService Injects the `MatDialog` to show the `super-search.component`
|
* @param dialogService Injects the `MatDialog` to show the `super-search.component`
|
||||||
@ -51,7 +58,8 @@ export class OverlayService {
|
|||||||
private dialogService: MatDialog,
|
private dialogService: MatDialog,
|
||||||
private operator: OperatorService,
|
private operator: OperatorService,
|
||||||
OpenSlides: OpenSlidesService,
|
OpenSlides: OpenSlidesService,
|
||||||
upgradeService: DataStoreUpgradeService
|
upgradeService: DataStoreUpgradeService,
|
||||||
|
offlineService: OfflineService
|
||||||
) {
|
) {
|
||||||
// Subscribe to the current user.
|
// Subscribe to the current user.
|
||||||
operator.getViewUserObservable().subscribe(user => {
|
operator.getViewUserObservable().subscribe(user => {
|
||||||
@ -70,6 +78,14 @@ export class OverlayService {
|
|||||||
this.upgradeChecked = upgradeDone;
|
this.upgradeChecked = upgradeDone;
|
||||||
this.checkConnection();
|
this.checkConnection();
|
||||||
});
|
});
|
||||||
|
// Subscribe to check if we are offline
|
||||||
|
offlineService
|
||||||
|
.isOffline()
|
||||||
|
.pipe(distinctUntilChanged())
|
||||||
|
.subscribe(offline => {
|
||||||
|
this.isOffline = offline;
|
||||||
|
this.checkConnection();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,7 +142,7 @@ export class OverlayService {
|
|||||||
* @returns True, if the three booleans are all true.
|
* @returns True, if the three booleans are all true.
|
||||||
*/
|
*/
|
||||||
public isConnectionStable(): boolean {
|
public isConnectionStable(): boolean {
|
||||||
return this.upgradeChecked && this.hasBooted && (!!this.user || this.operator.isAnonymous);
|
return (this.upgradeChecked || this.isOffline) && this.hasBooted && (!!this.user || this.operator.isAnonymous);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,7 +100,10 @@ export abstract class PollService {
|
|||||||
* TODO: Should be given by the server, and editable. For now they are hard
|
* TODO: Should be given by the server, and editable. For now they are hard
|
||||||
* coded
|
* coded
|
||||||
*/
|
*/
|
||||||
private _specialPollVotes: [number, string][] = [[-1, 'majority'], [-2, 'undocumented']];
|
private _specialPollVotes: [number, string][] = [
|
||||||
|
[-1, 'majority'],
|
||||||
|
[-2, 'undocumented']
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getter for the special vote values
|
* getter for the special vote values
|
||||||
|
@ -209,7 +209,7 @@ export class SearchService {
|
|||||||
.map(searchModel => {
|
.map(searchModel => {
|
||||||
const results = this.viewModelStore
|
const results = this.viewModelStore
|
||||||
.getAll(searchModel.collectionString)
|
.getAll(searchModel.collectionString)
|
||||||
.map(x => x as (BaseViewModel & Searchable))
|
.map(x => x as BaseViewModel & Searchable)
|
||||||
.filter(model =>
|
.filter(model =>
|
||||||
!searchOnlyById
|
!searchOnlyById
|
||||||
? model.id === dedicatedId ||
|
? model.id === dedicatedId ||
|
||||||
|
@ -69,7 +69,10 @@ export class SortingTreeComponent<T extends Identifiable & Displayable> implemen
|
|||||||
/**
|
/**
|
||||||
* The tree control
|
* The tree control
|
||||||
*/
|
*/
|
||||||
public treeControl = new FlatTreeControl<FlatNode<T>>(node => node.level, node => node.expandable);
|
public treeControl = new FlatTreeControl<FlatNode<T>>(
|
||||||
|
node => node.level,
|
||||||
|
node => node.expandable
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Source for the tree
|
* Source for the tree
|
||||||
|
@ -312,7 +312,10 @@ export class ListOfSpeakersComponent extends BaseViewComponent implements OnInit
|
|||||||
if (this.isSortMode) {
|
if (this.isSortMode) {
|
||||||
this.isSortMode = false;
|
this.isSortMode = false;
|
||||||
this.listOfSpeakersRepo
|
this.listOfSpeakersRepo
|
||||||
.sortSpeakers(this.viewListOfSpeakers, this.listElement.sortedItems.map(el => el.id))
|
.sortSpeakers(
|
||||||
|
this.viewListOfSpeakers,
|
||||||
|
this.listElement.sortedItems.map(el => el.id)
|
||||||
|
)
|
||||||
.catch(this.raiseError);
|
.catch(this.raiseError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,10 @@ export class AssignmentDetailComponent extends BaseViewComponent implements OnIn
|
|||||||
*/
|
*/
|
||||||
public onSortingChange(listInNewOrder: ViewAssignmentRelatedUser[]): void {
|
public onSortingChange(listInNewOrder: ViewAssignmentRelatedUser[]): void {
|
||||||
this.repo
|
this.repo
|
||||||
.sortCandidates(listInNewOrder.map(relatedUser => relatedUser.id), this.assignment)
|
.sortCandidates(
|
||||||
|
listInNewOrder.map(relatedUser => relatedUser.id),
|
||||||
|
this.assignment
|
||||||
|
)
|
||||||
.catch(this.raiseError);
|
.catch(this.raiseError);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,10 @@ export class ViewCategory extends BaseViewModel<Category> implements CategoryTit
|
|||||||
|
|
||||||
public formatForSearch(): SearchRepresentation {
|
public formatForSearch(): SearchRepresentation {
|
||||||
return {
|
return {
|
||||||
properties: [{ key: 'Name', value: this.name }, { key: 'Prefix', value: this.prefix }],
|
properties: [
|
||||||
|
{ key: 'Name', value: this.name },
|
||||||
|
{ key: 'Prefix', value: this.prefix }
|
||||||
|
],
|
||||||
searchValue: [this.name, this.prefix]
|
searchValue: [this.name, this.prefix]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,8 @@ export class MotionCsvExportService {
|
|||||||
const properties = sortMotionPropertyList(['identifier', 'title'].concat(contentToExport));
|
const properties = sortMotionPropertyList(['identifier', 'title'].concat(contentToExport));
|
||||||
const exportProperties: (
|
const exportProperties: (
|
||||||
| CsvColumnDefinitionProperty<ViewMotion>
|
| CsvColumnDefinitionProperty<ViewMotion>
|
||||||
| CsvColumnDefinitionMap<ViewMotion>)[] = properties.map(option => {
|
| CsvColumnDefinitionMap<ViewMotion>
|
||||||
|
)[] = properties.map(option => {
|
||||||
if (option === 'recommendation') {
|
if (option === 'recommendation') {
|
||||||
return {
|
return {
|
||||||
label: 'recommendation',
|
label: 'recommendation',
|
||||||
|
@ -24,7 +24,10 @@ export class ViewTopic extends BaseViewModelWithAgendaItemAndListOfSpeakers<Topi
|
|||||||
*/
|
*/
|
||||||
public formatForSearch(): SearchRepresentation {
|
public formatForSearch(): SearchRepresentation {
|
||||||
return {
|
return {
|
||||||
properties: [{ key: 'Title', value: this.getTitle() }, { key: 'Text', value: this.text }],
|
properties: [
|
||||||
|
{ key: 'Title', value: this.getTitle() },
|
||||||
|
{ key: 'Text', value: this.text }
|
||||||
|
],
|
||||||
searchValue: [this.getTitle(), this.text]
|
searchValue: [this.getTitle(), this.text]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user