MOBILE-3325 settings: Move ios shared files to site settings
parent
3140b1c966
commit
721f7c6f36
|
@ -17,39 +17,39 @@
|
|||
</ion-item>
|
||||
<a ion-item *ngFor="let handler of handlers" [ngClass]="['core-moremenu-handler', handler.class || '']" (click)="openHandler(handler)" title="{{ handler.title | translate }}" detail-push>
|
||||
<core-icon [name]="handler.icon" item-start></core-icon>
|
||||
<p>{{ handler.title | translate}}</p>
|
||||
<h2>{{ handler.title | translate}}</h2>
|
||||
<ion-badge item-end *ngIf="handler.showBadge" [hidden]="handler.loading || !handler.badge">{{handler.badge}}</ion-badge>
|
||||
<ion-spinner item-end *ngIf="handler.showBadge && handler.loading"></ion-spinner>
|
||||
</a>
|
||||
<div *ngFor="let item of customItems" class="core-moremenu-customitem">
|
||||
<a ion-item *ngIf="item.type != 'embedded'" [href]="item.url" core-link [capture]="item.type == 'app'" [inApp]="item.type == 'inappbrowser'" title="{{item.label}}">
|
||||
<core-icon [name]="item.icon" item-start></core-icon>
|
||||
<p>{{item.label}}</p>
|
||||
<h2>{{item.label}}</h2>
|
||||
</a>
|
||||
<a ion-item *ngIf="item.type == 'embedded'" (click)="openItem(item)" title="{{item.label}}">
|
||||
<core-icon [name]="item.icon" item-start></core-icon>
|
||||
<p>{{item.label}}</p>
|
||||
<h2>{{item.label}}</h2>
|
||||
</a>
|
||||
</div>
|
||||
<a *ngIf="showWeb" ion-item [href]="siteInfo.siteurl" core-link autoLogin="yes" title="{{ 'core.mainmenu.website' | translate }}">
|
||||
<ion-icon name="globe" item-start aria-hidden="true"></ion-icon>
|
||||
<p>{{ 'core.mainmenu.website' | translate }}</p>
|
||||
<h2>{{ 'core.mainmenu.website' | translate }}</h2>
|
||||
</a>
|
||||
<a *ngIf="showHelp" ion-item [href]="docsUrl" core-link autoLogin="no" title="{{ 'core.mainmenu.help' | translate }}">
|
||||
<ion-icon name="help-buoy" item-start aria-hidden="true"></ion-icon>
|
||||
<p>{{ 'core.mainmenu.help' | translate }}</p>
|
||||
<h2>{{ 'core.mainmenu.help' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item (click)="openSiteSettings()" title="{{ 'core.settings.sitesettings' | translate }}">
|
||||
<core-icon name="fa-cog" item-start></core-icon>
|
||||
<p>{{ 'core.settings.sitesettings' | translate }}</p>
|
||||
<h2>{{ 'core.settings.sitesettings' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item (click)="openAppSettings()" title="{{ 'core.settings.appsettings' | translate }}">
|
||||
<core-icon name="fa-cogs" item-start></core-icon>
|
||||
<p>{{ 'core.settings.appsettings' | translate }}</p>
|
||||
<h2>{{ 'core.settings.appsettings' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item (click)="logout()" title="{{ logoutLabel | translate }}">
|
||||
<ion-icon name="log-out" item-start aria-hidden="true"></ion-icon>
|
||||
<p>{{ logoutLabel | translate }}</p>
|
||||
<h2>{{ logoutLabel | translate }}</h2>
|
||||
</a>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
|
|
@ -10,23 +10,23 @@
|
|||
<ion-list>
|
||||
<a ion-item (click)="openHandler('CoreSettingsGeneralPage')" [title]="'core.settings.general' | translate" [class.core-split-item-selected]="'CoreSettingsGeneralPage' == selectedPage" detail-push>
|
||||
<ion-icon name="construct" item-start></ion-icon>
|
||||
<p>{{ 'core.settings.general' | translate }}</p>
|
||||
<h2>{{ 'core.settings.general' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item (click)="openHandler('CoreSettingsSpaceUsagePage')" [title]="'core.settings.spaceusage' | translate" [class.core-split-item-selected]="'CoreSettingsSpaceUsagePage' == selectedPage" detail-push>
|
||||
<ion-icon name="stats" item-start></ion-icon>
|
||||
<p>{{ 'core.settings.spaceusage' | translate }}</p>
|
||||
<h2>{{ 'core.settings.spaceusage' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item (click)="openHandler('CoreSettingsSynchronizationPage')" [title]="'core.settings.synchronization' | translate" [class.core-split-item-selected]="'CoreSettingsSynchronizationPage' == selectedPage" detail-push>
|
||||
<ion-icon name="sync" item-start></ion-icon>
|
||||
<p>{{ 'core.settings.synchronization' | translate }}</p>
|
||||
<h2>{{ 'core.settings.synchronization' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item *ngIf="isIOS" (click)="openHandler('CoreSharedFilesListPage', {manage: true})" [title]="'core.sharedfiles.sharedfiles' | translate" [class.core-split-item-selected]="'CoreSharedFilesListPage' == selectedPage" detail-push>
|
||||
<ion-icon name="folder" item-start></ion-icon>
|
||||
<p>{{ 'core.sharedfiles.sharedfiles' | translate }}</p>
|
||||
<h2>{{ 'core.sharedfiles.sharedfiles' | translate }}</h2>
|
||||
</a>
|
||||
<a ion-item (click)="openHandler('CoreSettingsAboutPage')" [title]="'core.settings.about' | translate" [class.core-split-item-selected]="'CoreSettingsAboutPage' == selectedPage" detail-push>
|
||||
<ion-icon name="contacts" item-start></ion-icon>
|
||||
<p>{{ 'core.settings.about' | translate }}</p>
|
||||
<h2>{{ 'core.settings.about' | translate }}</h2>
|
||||
</a>
|
||||
</ion-list>
|
||||
</ion-content>
|
||||
|
|
|
@ -12,20 +12,17 @@
|
|||
</ion-refresher>
|
||||
<core-loading [hideUntil]="loaded">
|
||||
<ion-list>
|
||||
<ion-item *ngIf="siteInfo" text-wrap>
|
||||
<ion-avatar core-user-avatar [user]="siteInfo" item-start></ion-avatar>
|
||||
<ion-item *ngIf="siteInfo" text-wrap>
|
||||
<h2>{{siteInfo.fullname}}</h2>
|
||||
<ion-note class="core-note-block"><core-format-text [text]="siteName" contextLevel="system" [contextInstanceId]="0" [wsNotFiltered]="true"></core-format-text></ion-note>
|
||||
<ion-note class="core-note-block">{{ siteUrl }}</ion-note>
|
||||
</ion-item>
|
||||
|
||||
<ion-item-divider></ion-item-divider>
|
||||
<ion-item text-wrap *ngIf="spaceUsage">
|
||||
<ion-icon name="stats" item-start></ion-icon>
|
||||
<h2 text-wrap>{{ 'core.settings.spaceusage' | translate }}</h2>
|
||||
<div item-end>
|
||||
<p *ngIf="spaceUsage.spaceUsage != null" text-end>{{ spaceUsage.spaceUsage | coreBytesToSize }}</p>
|
||||
<p *ngIf="spaceUsage.cacheEntries != null" text-end>{{ 'core.settings.entriesincache' | translate: { $a: spaceUsage.cacheEntries } }}</p>
|
||||
</div>
|
||||
<p *ngIf="spaceUsage.spaceUsage != null">{{ spaceUsage.spaceUsage | coreBytesToSize }}</p>
|
||||
<p *ngIf="spaceUsage.cacheEntries != null">{{ 'core.settings.entriesincache' | translate: { $a: spaceUsage.cacheEntries } }}</p>
|
||||
<button ion-button icon-only clear color="danger" item-end (click)="deleteSiteStorage()" [hidden]="!spaceUsage.spaceUsage > '0' && !spaceUsage.cacheEntries > '0'" [attr.aria-label]="'core.settings.deletesitefilestitle' | translate">
|
||||
<ion-icon name="trash"></ion-icon>
|
||||
</button>
|
||||
|
@ -38,14 +35,15 @@
|
|||
</button>
|
||||
<ion-spinner item-end *ngIf="isSynchronizing()"></ion-spinner>
|
||||
</ion-item>
|
||||
<a ion-item *ngIf="isIOS" (click)="openHandler('CoreSharedFilesListPage', {manage: true})" [title]="'core.sharedfiles.sharedfiles' | translate" [class.core-split-item-selected]="'CoreSharedFilesListPage' == selectedPage" detail-push>
|
||||
<a ion-item *ngIf="isIOS" (click)="openHandler('CoreSharedFilesListPage', {manage: true, siteId: siteId, hideSitePicker: true})" [title]="'core.sharedfiles.sharedfiles' | translate" [class.core-split-item-selected]="'CoreSharedFilesListPage' == selectedPage" detail-push>
|
||||
<ion-icon name="folder" item-start></ion-icon>
|
||||
<p>{{ 'core.sharedfiles.sharedfiles' | translate }}</p>
|
||||
<h2>{{ 'core.sharedfiles.sharedfiles' | translate }}</h2>
|
||||
<ion-badge item-end>{{ iosSharedFiles }}</ion-badge>
|
||||
</a>
|
||||
|
||||
<a ion-item *ngFor="let handler of handlers" [ngClass]="['core-settings-handler', handler.class]" (click)="openHandler(handler.page, handler.params)" [title]="handler.title | translate" detail-push [class.core-split-item-selected]="handler.page == selectedPage">
|
||||
<core-icon [name]="handler.icon" item-start *ngIf="handler.icon"></core-icon>
|
||||
<p>{{ handler.title | translate}}</p>
|
||||
<h2>{{ handler.title | translate}}</h2>
|
||||
</a>
|
||||
</ion-list>
|
||||
</core-loading>
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
import { Component, ViewChild } from '@angular/core';
|
||||
import { IonicPage, NavParams, Platform } from 'ionic-angular';
|
||||
import { CoreSettingsDelegate, CoreSettingsHandlerData } from '../../providers/delegate';
|
||||
import { CoreSite } from '@classes/site';
|
||||
import { CoreEventsProvider } from '@providers/events';
|
||||
import { CoreSitesProvider, CoreSiteBasicInfo } from '@providers/sites';
|
||||
import { CoreDomUtilsProvider } from '@providers/utils/dom';
|
||||
import { CoreSplitViewComponent } from '@components/split-view/split-view';
|
||||
import { CoreSharedFilesProvider } from '@core/sharedfiles/providers/sharedfiles';
|
||||
import { CoreSettingsHelper, CoreSiteSpaceUsage } from '../../providers/helper';
|
||||
|
||||
/**
|
||||
|
@ -36,7 +36,7 @@ export class CoreSiteSettingsPage {
|
|||
handlers: CoreSettingsHandlerData[];
|
||||
isIOS: boolean;
|
||||
selectedPage: string;
|
||||
currentSite: CoreSite;
|
||||
siteId: string;
|
||||
siteInfo: CoreSiteBasicInfo[] = [];
|
||||
siteName: string;
|
||||
siteUrl: string;
|
||||
|
@ -45,7 +45,8 @@ export class CoreSiteSettingsPage {
|
|||
spaceUsage: 0
|
||||
};
|
||||
loaded = false;
|
||||
protected sitesObserver: any;
|
||||
iosSharedFiles: number;
|
||||
protected sitesObserver: any;
|
||||
protected isDestroyed = false;
|
||||
|
||||
constructor(protected settingsDelegate: CoreSettingsDelegate,
|
||||
|
@ -53,6 +54,7 @@ export class CoreSiteSettingsPage {
|
|||
protected sitesProvider: CoreSitesProvider,
|
||||
protected domUtils: CoreDomUtilsProvider,
|
||||
protected eventsProvider: CoreEventsProvider,
|
||||
protected sharedFilesProvider: CoreSharedFilesProvider,
|
||||
platorm: Platform,
|
||||
navParams: NavParams) {
|
||||
|
||||
|
@ -61,7 +63,7 @@ export class CoreSiteSettingsPage {
|
|||
this.selectedPage = navParams.get('page') || false;
|
||||
|
||||
this.sitesObserver = this.eventsProvider.on(CoreEventsProvider.SITE_UPDATED, (data) => {
|
||||
if (data.siteId == this.currentSite.id) {
|
||||
if (data.siteId == this.siteId) {
|
||||
this.refreshData();
|
||||
}
|
||||
});
|
||||
|
@ -87,15 +89,22 @@ export class CoreSiteSettingsPage {
|
|||
const promises = [];
|
||||
|
||||
this.handlers = this.settingsDelegate.getHandlers();
|
||||
this.currentSite = this.sitesProvider.getCurrentSite();
|
||||
this.siteInfo = this.currentSite.getInfo();
|
||||
this.siteName = this.currentSite.getSiteName();
|
||||
this.siteUrl = this.currentSite.getURL();
|
||||
const currentSite = this.sitesProvider.getCurrentSite();
|
||||
this.siteId = currentSite.id;
|
||||
this.siteInfo = currentSite.getInfo();
|
||||
this.siteName = currentSite.getSiteName();
|
||||
this.siteUrl = currentSite.getURL();
|
||||
|
||||
promises.push(this.settingsHelper.getSiteSpaceUsage(this.sitesProvider.getCurrentSiteId()).then((spaceUsage) => {
|
||||
promises.push(this.settingsHelper.getSiteSpaceUsage(this.siteId).then((spaceUsage) => {
|
||||
this.spaceUsage = spaceUsage;
|
||||
}));
|
||||
|
||||
if (this.isIOS) {
|
||||
promises.push(this.sharedFilesProvider.getSiteSharedFiles(this.siteId).then((files) => {
|
||||
this.iosSharedFiles = files.length;
|
||||
}));
|
||||
}
|
||||
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
|
@ -104,7 +113,7 @@ export class CoreSiteSettingsPage {
|
|||
*/
|
||||
synchronize(siteId: string): void {
|
||||
// Using syncOnlyOnWifi false to force manual sync.
|
||||
this.settingsHelper.synchronizeSite(false, this.currentSite.id).catch((error) => {
|
||||
this.settingsHelper.synchronizeSite(false, this.siteId).catch((error) => {
|
||||
if (this.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
@ -118,7 +127,7 @@ export class CoreSiteSettingsPage {
|
|||
* @return True if site is beeing synchronized, false otherwise.
|
||||
*/
|
||||
isSynchronizing(): boolean {
|
||||
return this.currentSite && !!this.settingsHelper.getSiteSyncPromise(this.currentSite.id);
|
||||
return this.siteId && !!this.settingsHelper.getSiteSyncPromise(this.siteId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,7 +147,7 @@ export class CoreSiteSettingsPage {
|
|||
* @param siteData Site object with space usage.
|
||||
*/
|
||||
deleteSiteStorage(): void {
|
||||
this.settingsHelper.deleteSiteStorage(this.currentSite.getSiteName(), this.currentSite.getId()).then((newInfo) => {
|
||||
this.settingsHelper.deleteSiteStorage(this.siteName, this.siteId).then((newInfo) => {
|
||||
this.spaceUsage = newInfo;
|
||||
}).catch(() => {
|
||||
// Ignore cancelled confirmation modal.
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</button>
|
||||
</ion-item>
|
||||
<ion-item-divider *ngIf="totals">
|
||||
<p>{{ 'core.settings.total' | translate }}</p>
|
||||
<h2>{{ 'core.settings.total' | translate }}</h2>
|
||||
<div item-end>
|
||||
<p>{{ totals.spaceUsage | coreBytesToSize }}</p>
|
||||
<p>{{ 'core.settings.entriesincache' | translate: { $a: totals.cacheEntries } }}</p>
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<ion-content>
|
||||
<core-loading [hideUntil]="sitesLoaded">
|
||||
<ion-item-divider>
|
||||
<p>{{ 'core.settings.syncsettings' | translate }}</p>
|
||||
<h2>{{ 'core.settings.syncsettings' | translate }}</h2>
|
||||
</ion-item-divider>
|
||||
<ion-item text-wrap>
|
||||
<ion-label>{{ 'core.settings.enablesyncwifi' | translate }}</ion-label>
|
||||
|
@ -14,7 +14,7 @@
|
|||
</ion-toggle>
|
||||
</ion-item>
|
||||
<ion-item-divider>
|
||||
<p>{{ 'core.settings.sites' | translate }}</p>
|
||||
<h2>{{ 'core.settings.sites' | translate }}</h2>
|
||||
</ion-item-divider>
|
||||
<ion-item *ngFor="let site of sites" [class.core-primary-selected-item]="site.id == currentSiteId" text-wrap>
|
||||
<h2><core-format-text [text]="site.siteName" clean="true" [siteId]="site.id"></core-format-text></h2>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<ion-refresher-content pullingText="{{ 'core.pulltorefresh' | translate }}"></ion-refresher-content>
|
||||
</ion-refresher>
|
||||
<!-- Allow selecting the site to view. -->
|
||||
<core-site-picker [hidden]="!filesLoaded" [initialSite]="siteId" (siteSelected)="changeSite($event)"></core-site-picker>
|
||||
<core-site-picker *ngIf="showSitePicker" [hidden]="!filesLoaded" [initialSite]="siteId" (siteSelected)="changeSite($event)"></core-site-picker>
|
||||
<core-loading [hideUntil]="filesLoaded">
|
||||
<ion-list *ngIf="files && files.length > 0">
|
||||
<ng-container *ngFor="let file of files; let idx = index">
|
||||
|
|
|
@ -35,6 +35,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy {
|
|||
isModal: boolean;
|
||||
manage: boolean;
|
||||
pick: boolean; // To pick a file you MUST use a modal.
|
||||
showSitePicker: boolean;
|
||||
path = '';
|
||||
title: string;
|
||||
filesLoaded: boolean;
|
||||
|
@ -52,6 +53,7 @@ export class CoreSharedFilesListPage implements OnInit, OnDestroy {
|
|||
this.manage = !!navParams.get('manage');
|
||||
this.pick = !!navParams.get('pick');
|
||||
this.path = navParams.get('path') || '';
|
||||
this.showSitePicker = !navParams.get('hideSitePicker');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue