Skip to content
This repository has been archived by the owner on Apr 26, 2020. It is now read-only.

Commit

Permalink
feat: split index module
Browse files Browse the repository at this point in the history
Change-Id: I8048884509c20791a478c12fa91b35c1cc260eb4
  • Loading branch information
myml committed Nov 9, 2018
1 parent ed7d99a commit ef2ae59
Show file tree
Hide file tree
Showing 26 changed files with 341 additions and 275 deletions.
6 changes: 0 additions & 6 deletions src/web/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,15 @@ import { RecommendService } from './services/recommend.service';
import { AppComponent } from './app.component';
import { SideNavComponent } from './components/side-nav/side-nav.component';
import { CategoryComponent } from './components/category/category.component';
import { IndexComponent } from './components/index/index.component';
import { DownloadComponent } from './components/app-manage/download/download.component';
import { UninstallComponent } from './components//app-manage/uninstall/uninstall.component';
import { RankingComponent } from './components/ranking/ranking.component';
import { LoginComponent } from './components/login/login.component';
import { TopicComponent } from './components/topic/topic.component';
import { RecommendComponent } from './components/recommend/recommend.component';
import { NotifyComponent } from './components/notify/notify.component';

import { LodashPipe } from './pipes/lodash.pipe';
import { AppInfoPipe } from './pipes/app-info';
import { MoreComponent } from './components/more/more.component';
import { StoreJobErrorComponent } from './components/store-job-error/store-job-error.component';

@NgModule({
Expand All @@ -52,15 +49,12 @@ import { StoreJobErrorComponent } from './components/store-job-error/store-job-e
UninstallComponent,
SideNavComponent,
CategoryComponent,
IndexComponent,
DownloadComponent,
UninstallComponent,
RankingComponent,
LoginComponent,
TopicComponent,
RecommendComponent,
NotifyComponent,
MoreComponent,
LodashPipe,
AppInfoPipe,
StoreJobErrorComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>
<div class="appItem" *ngFor="let $installedApp of $installedApps">
<ng-container *ngIf="($installedApp.name | appInfo | async) as $app">
<img class="icon" [src]="$app | icon" [routerLink]="$app.name" />
<img class="icon" [src]="$app | icon" [routerLink]="['app', $app.name]" />
<div class="content">
<div class="base">
<span>{{ $app.localInfo.description.name }}</span>
Expand Down
58 changes: 0 additions & 58 deletions src/web/src/app/components/index/index.component.html

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ export class StoreService {
}

getVersion(appNameList: string[]): Observable<AppVersion[]> {
if (appNameList.length === 0) {
return of([]);
}
return this.execWithCallback<AppVersion[]>('storeDaemon.queryVersions', appNameList).pipe(
map(versionList => versionList.filter(v => v.remoteVersion)),
);
Expand Down
75 changes: 44 additions & 31 deletions src/web/src/app/dstore/components/assemble/assemble.component.html
Original file line number Diff line number Diff line change
@@ -1,53 +1,66 @@
<dstore-title [title]="section.title|fitLanguage"></dstore-title>
<div class="assembleList"
*ngIf="categoryList">
<dstore-title [title]="section.title | fitLanguage"></dstore-title>
<div class="assembleList" *ngIf="categoryList">
<ng-container *ngFor="let $assemble of assembleList">
<div class="assemble"
*ngIf="$assemble.show && categoryList[$assemble.category]">
<div class="title"
[routerLink]="['/category',$assemble.category]">
{{categoryList[$assemble.category].LocalName}}
<div class="assemble" *ngIf="$assemble.show && categoryList[$assemble.category]">
<div class="title" [routerLink]="['/category', $assemble.category]">
{{ categoryList[$assemble.category].LocalName }}
</div>
<ng-container *ngFor="let $assembleApp of $assemble.apps">
<ng-container *ngIf="$assembleApp.name|appInfo|async as $app">
<div class="item"
[class.job]="jobs[$app.name] || jobsNames.has($app.name)"
[routerLink]="$app.name">
<img class="icon"
[src]="server+'/'+$app.icon">
<ng-container *ngIf="($assembleApp.name | appInfo | async) as $app">
<div
class="item"
[class.job]="jobs[$app.name] || jobsNames.has($app.name)"
[routerLink]="['app', $app.name]"
>
<img class="icon" [src]="server + '/' + $app.icon" />
<div class="cover">
<img [src]="server+'/'+([$app.localInfo.images.cover,$app.localInfo.images.coverHD]|fitImage)">
<img
[src]="
server +
'/' +
([$app.localInfo.images.cover, $app.localInfo.images.coverHD] | fitImage)
"
/>
</div>
<div class="info">
<div class="base">
<span class="name appTitle">{{$app.localInfo.description.name}}</span>
<span class="subtitle">{{$app.localInfo.description.slogan}}</span>
<span class="name appTitle">{{ $app.localInfo.description.name }}</span>
<span class="subtitle">{{ $app.localInfo.description.slogan }}</span>
</div>
<div class="control">
<ng-container *ngIf="jobs[$app.name] as job;else controlBtn">
<dstore-circle-button [running]="[StoreJobStatus.running,StoreJobStatus.ready,StoreJobStatus.end].includes(job.status)"
[progress]="job.progress"
[disabled]="!job.cancelable"
(runningChange)="$event?start(job.job):pause(job.job)"></dstore-circle-button>
<ng-container *ngIf="jobs[$app.name] as job; else: controlBtn">
<dstore-circle-button
[running]="
[StoreJobStatus.running, StoreJobStatus.ready, StoreJobStatus.end].includes(
job.status
)
"
[progress]="job.progress"
[disabled]="!job.cancelable"
(runningChange)="$event ? start(job.job) : pause(job.job)"
></dstore-circle-button>
</ng-container>

<ng-template #controlBtn>
<div #ctlBtn>
<dstore-job-button [version]="versions.get($app.name)"
[appName]="$app.name"
[localName]="$app.localInfo.description.name"
[openType]="$app.extra['open']"
(start)="ctlBtn.hidden=true"></dstore-job-button>
<dstore-job-button
[version]="versions.get($app.name)"
[appName]="$app.name"
[localName]="$app.localInfo.description.name"
[openType]="$app.extra['open']"
(start)="ctlBtn.hidden = true"
></dstore-job-button>
</div>
<dstore-circle-button [running]="true"
*ngIf="ctlBtn.hidden"></dstore-circle-button>
<dstore-circle-button
[running]="true"
*ngIf="ctlBtn.hidden"
></dstore-circle-button>
</ng-template>
</div>
</div>

</div>
</ng-container>
</ng-container>
</div>
</ng-container>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class CarouselComponent implements OnInit, OnDestroy {
if (index === this.selectIndex) {
const select = this._carouselList[this.selectIndex];
if (select.type === CarouselType.App) {
this.router.navigate([select.link], { relativeTo: this.route });
this.router.navigate(['./app/', select.link], { relativeTo: this.route });
} else {
this.router.navigate([select.link]);
}
Expand Down
79 changes: 45 additions & 34 deletions src/web/src/app/dstore/components/cover/cover.component.html
Original file line number Diff line number Diff line change
@@ -1,62 +1,73 @@
<dstore-title [title]="section.title|fitLanguage"
[more]="moreNav">
<dstore-title [title]="section.title | fitLanguage" [more]="moreNav">
<a href="/"></a>
</dstore-title>
<div class="list">
<ng-container *ngFor="let $index of section.rowSpan*section.colSpan|range">
<div class="item"
[class.client]="isNative"
[class.job]="jobs[$app.name] || jobsNames.has($app.name)"
[routerLink]="$app.name"
*ngIf="appList[$index] as $app;else $empty">
<ng-container *ngFor="let $index of (section.rowSpan * section.colSpan | range)">
<div
class="item"
[class.client]="isNative"
[class.job]="jobs[$app.name] || jobsNames.has($app.name)"
[routerLink]="['app', $app.name]"
*ngIf="appList[$index] as $app; else: $empty"
>
<div class="cover">
<img [src]="server+'/'+([$app.localInfo.images.cover,$app.localInfo.images.coverHD]|fitImage)">
<img
[src]="
server + '/' + ([$app.localInfo.images.cover, $app.localInfo.images.coverHD] | fitImage)
"
/>
</div>
<div class="info">
<div class="appTitle">{{$app.localInfo.description.name}}</div>
<div class="appTitle">{{ $app.localInfo.description.name }}</div>
<div>
<span class="subtitle"
[routerLink]="['/category',$app.category]">{{$app.localCategory}}</span>
<dstore-star class="star"
[rate]="$app.rate"></dstore-star>
<span class="subtitle" [routerLink]="['/category', $app.category]">{{
$app.localCategory
}}</span>
<dstore-star class="star" [rate]="$app.rate"></dstore-star>
</div>
</div>
<div class="hover">
<div>
<div class="appTitle">{{$app.localInfo.description.name}}</div>
<span class="subtitle"
[routerLink]="['/category',$app.category]">{{$app.localCategory}}</span>
<div class="appTitle">{{ $app.localInfo.description.name }}</div>
<span class="subtitle" [routerLink]="['/category', $app.category]">{{
$app.localCategory
}}</span>
</div>
<div>
<ng-container *ngIf="jobs[$app.name] as job;else controlBtn">
<dstore-circle-button [running]="[StoreJobStatus.running,StoreJobStatus.ready,StoreJobStatus.end].includes(job.status)"
[progress]="job.progress"
[disabled]="!job.cancelable"
(runningChange)="$event?start(job.job):pause(job.job)"></dstore-circle-button>
<ng-container *ngIf="jobs[$app.name] as job; else: controlBtn">
<dstore-circle-button
[running]="
[StoreJobStatus.running, StoreJobStatus.ready, StoreJobStatus.end].includes(
job.status
)
"
[progress]="job.progress"
[disabled]="!job.cancelable"
(runningChange)="$event ? start(job.job) : pause(job.job)"
></dstore-circle-button>
</ng-container>

<ng-template #controlBtn>
<div #ctlBtn>
<dstore-job-button [version]="$app.version"
[appName]="$app.name"
[localName]="$app.localInfo.description.name"
[openType]="$app.extra['open']"
(start)="ctlBtn.hidden=true"></dstore-job-button>
<dstore-job-button
[version]="$app.version"
[appName]="$app.name"
[localName]="$app.localInfo.description.name"
[openType]="$app.extra['open']"
(start)="ctlBtn.hidden = true"
></dstore-job-button>
</div>
<dstore-circle-button [running]="true"
*ngIf="ctlBtn.hidden"></dstore-circle-button>
<dstore-circle-button [running]="true" *ngIf="ctlBtn.hidden"></dstore-circle-button>
</ng-template>
</div>
</div>
</div>

<ng-template #$empty>
<div class="item empty">
<img class="cover">
<div class="info">
&nbsp;
</div>
<img class="cover" />
<div class="info">&nbsp;</div>
</div>
</ng-template>
</ng-container>
</div>
</div>
Loading

0 comments on commit ef2ae59

Please sign in to comment.