default selection is now none
This commit is contained in:
@@ -31,7 +31,7 @@ export default class CardList extends StatefulVue {
|
||||
|
||||
public async mounted() {
|
||||
const state = await this.getCurrentStateAsync();
|
||||
this.setCategories(state.categories);
|
||||
this.setCategories(state.app.categories);
|
||||
}
|
||||
|
||||
public onSelected(categoryId: number, isExpanded: boolean) {
|
||||
|
||||
@@ -55,7 +55,7 @@ export default class CardListItem extends StatefulVue {
|
||||
|
||||
private async getCardTitleAsync(categoryId: number): Promise<string | undefined> {
|
||||
const state = await this.getCurrentStateAsync();
|
||||
const category = state.getCategory(this.categoryId);
|
||||
const category = state.app.findCategory(this.categoryId);
|
||||
return category ? category.name : undefined;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { INode } from './../SelectableTree/INode';
|
||||
|
||||
export class ScriptNodeParser {
|
||||
public static parseNodes(categoryId: number, state: IApplicationState): INode[] | undefined {
|
||||
const category = state.getCategory(categoryId);
|
||||
const category = state.app.findCategory(categoryId);
|
||||
if (!category) {
|
||||
throw new Error(`Category with id ${categoryId} does not exist`);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
<template>
|
||||
<div class="container">
|
||||
<div class="part">Select:</div>
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="None"
|
||||
:enabled="isNoneSelected"
|
||||
@click="selectNoneAsync()">
|
||||
</SelectableOption>
|
||||
</div>
|
||||
<div class="part"> | </div>
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="Recommended"
|
||||
@@ -8,20 +16,12 @@
|
||||
@click="selectRecommendedAsync()" />
|
||||
</div>
|
||||
<div class="part"> | </div>
|
||||
<div class="part">
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="All"
|
||||
:enabled="isAllSelected"
|
||||
@click="selectAllAsync()" />
|
||||
</div>
|
||||
<div class="part"> | </div>
|
||||
<div class="part">
|
||||
<SelectableOption
|
||||
label="None"
|
||||
:enabled="isNoneSelected"
|
||||
@click="selectNoneAsync()">
|
||||
</SelectableOption>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -63,7 +63,7 @@ export default class TheSelector extends StatefulVue {
|
||||
return;
|
||||
}
|
||||
const state = await this.getCurrentStateAsync();
|
||||
state.selection.selectOnly(state.defaultScripts);
|
||||
state.selection.selectOnly(state.app.getRecommendedScripts());
|
||||
}
|
||||
|
||||
public async selectNoneAsync(): Promise<void> {
|
||||
@@ -76,8 +76,8 @@ export default class TheSelector extends StatefulVue {
|
||||
|
||||
private updateSelections(state: IApplicationState) {
|
||||
this.isNoneSelected = state.selection.totalSelected === 0;
|
||||
this.isAllSelected = state.selection.totalSelected === state.appTotalScripts;
|
||||
this.isRecommendedSelected = this.areSame(state.defaultScripts, state.selection.selectedScripts);
|
||||
this.isAllSelected = state.selection.totalSelected === state.app.totalScripts;
|
||||
this.isRecommendedSelected = this.areSame(state.app.getRecommendedScripts(), state.selection.selectedScripts);
|
||||
}
|
||||
|
||||
private areSame(scripts: ReadonlyArray<IScript>, other: ReadonlyArray<IScript>): boolean {
|
||||
|
||||
Reference in New Issue
Block a user