rename Application to CategoryCollection #40

This commit is contained in:
undergroundwires
2021-01-02 03:13:01 +01:00
parent 7cc161c828
commit 6fe858d86a
42 changed files with 350 additions and 311 deletions

View File

@@ -1,20 +1,20 @@
import { IApplicationContext } from './IApplicationContext';
import { IApplication } from '@/domain/IApplication';
import { IApplicationState } from './State/IApplicationState';
import { ApplicationState } from './State/ApplicationState';
import { ICategoryCollectionState } from './State/ICategoryCollectionState';
import { CategoryCollectionState } from './State/CategoryCollectionState';
import applicationFile from 'js-yaml-loader!@/application/application.yaml';
import { parseApplication } from '../Parser/ApplicationParser';
import { parseCategoryCollection } from '../Parser/CategoryCollectionParser';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export function createContext(): IApplicationContext {
const application = parseApplication(applicationFile);
const application = parseCategoryCollection(applicationFile);
const context = new ApplicationContext(application);
return context;
}
export class ApplicationContext implements IApplicationContext {
public readonly state: IApplicationState;
public constructor(public readonly app: IApplication) {
this.state = new ApplicationState(app);
public readonly state: ICategoryCollectionState;
public constructor(public readonly collection: ICategoryCollection) {
this.state = new CategoryCollectionState(collection);
}
}

View File

@@ -1,9 +1,9 @@
import { ApplicationContext } from './ApplicationContext';
import { IApplicationContext } from '@/application/Context/IApplicationContext';
import applicationFile from 'js-yaml-loader!@/application/application.yaml';
import { parseApplication } from '@/application/Parser/ApplicationParser';
import { parseCategoryCollection } from '@/application/Parser/CategoryCollectionParser';
export function buildContext(): IApplicationContext {
const application = parseApplication(applicationFile);
const application = parseCategoryCollection(applicationFile);
return new ApplicationContext(application);
}

View File

@@ -1,7 +1,7 @@
import { IApplication } from '@/domain/IApplication';
import { IApplicationState } from './State/IApplicationState';
import { ICategoryCollectionState } from './State/ICategoryCollectionState';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export interface IApplicationContext {
readonly app: IApplication;
readonly state: IApplicationState;
readonly collection: ICategoryCollection;
readonly state: ICategoryCollectionState;
}

View File

@@ -3,18 +3,18 @@ import { IUserFilter } from './Filter/IUserFilter';
import { ApplicationCode } from './Code/ApplicationCode';
import { UserSelection } from './Selection/UserSelection';
import { IUserSelection } from './Selection/IUserSelection';
import { IApplicationState } from './IApplicationState';
import { IApplication } from '@/domain/IApplication';
import { ICategoryCollectionState } from './ICategoryCollectionState';
import { IApplicationCode } from './Code/IApplicationCode';
import { ICategoryCollection } from '../../../domain/ICategoryCollection';
export class ApplicationState implements IApplicationState {
export class CategoryCollectionState implements ICategoryCollectionState {
public readonly code: IApplicationCode;
public readonly selection: IUserSelection;
public readonly filter: IUserFilter;
public constructor(readonly app: IApplication) {
this.selection = new UserSelection(app, []);
this.code = new ApplicationCode(this.selection, app.scripting);
this.filter = new UserFilter(app);
public constructor(readonly collection: ICategoryCollection) {
this.selection = new UserSelection(collection, []);
this.code = new ApplicationCode(this.selection, collection.scripting);
this.filter = new UserFilter(collection);
}
}

View File

@@ -1,16 +1,16 @@
import { IScript } from '@/domain/IScript';
import { FilterResult } from './FilterResult';
import { IFilterResult } from './IFilterResult';
import { IApplication } from '@/domain/IApplication';
import { IUserFilter } from './IUserFilter';
import { Signal } from '@/infrastructure/Events/Signal';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export class UserFilter implements IUserFilter {
public readonly filtered = new Signal<IFilterResult>();
public readonly filterRemoved = new Signal<void>();
public currentFilter: IFilterResult | undefined;
constructor(private application: IApplication) {
constructor(private collection: ICategoryCollection) {
}
@@ -19,9 +19,9 @@ export class UserFilter implements IUserFilter {
throw new Error('Filter must be defined and not empty. Use removeFilter() to remove the filter');
}
const filterLowercase = filter.toLocaleLowerCase();
const filteredScripts = this.application.getAllScripts().filter(
const filteredScripts = this.collection.getAllScripts().filter(
(script) => isScriptAMatch(script, filterLowercase));
const filteredCategories = this.application.getAllCategories().filter(
const filteredCategories = this.collection.getAllCategories().filter(
(category) => category.name.toLowerCase().includes(filterLowercase));
const matches = new FilterResult(
filteredScripts,

View File

@@ -3,7 +3,7 @@ import { IUserSelection } from './Selection/IUserSelection';
import { IApplicationCode } from './Code/IApplicationCode';
export { IUserSelection, IApplicationCode, IUserFilter };
export interface IApplicationState {
export interface ICategoryCollectionState {
readonly code: IApplicationCode;
readonly filter: IUserFilter;
readonly selection: IUserSelection;

View File

@@ -1,17 +1,18 @@
import { SelectedScript } from './SelectedScript';
import { IApplication, ICategory } from '@/domain/IApplication';
import { IUserSelection } from './IUserSelection';
import { InMemoryRepository } from '@/infrastructure/Repository/InMemoryRepository';
import { IScript } from '@/domain/IScript';
import { Signal } from '@/infrastructure/Events/Signal';
import { IRepository } from '@/infrastructure/Repository/IRepository';
import { ICategory } from '@/domain/ICategory';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export class UserSelection implements IUserSelection {
public readonly changed = new Signal<ReadonlyArray<SelectedScript>>();
private readonly scripts: IRepository<string, SelectedScript>;
constructor(
private readonly app: IApplication,
private readonly collection: ICategoryCollection,
selectedScripts: ReadonlyArray<SelectedScript>) {
this.scripts = new InMemoryRepository<string, SelectedScript>();
if (selectedScripts && selectedScripts.length > 0) {
@@ -40,7 +41,7 @@ export class UserSelection implements IUserSelection {
}
public removeAllInCategory(categoryId: number): void {
const category = this.app.findCategory(categoryId);
const category = this.collection.findCategory(categoryId);
const scriptsToRemove = category.getAllScriptsRecursively()
.filter((script) => this.scripts.exists(script.id));
if (!scriptsToRemove.length) {
@@ -53,7 +54,7 @@ export class UserSelection implements IUserSelection {
}
public addOrUpdateAllInCategory(categoryId: number, revert: boolean = false): void {
const category = this.app.findCategory(categoryId);
const category = this.collection.findCategory(categoryId);
const scriptsToAddOrUpdate = category.getAllScriptsRecursively()
.filter((script) =>
!this.scripts.exists(script.id)
@@ -70,7 +71,7 @@ export class UserSelection implements IUserSelection {
}
public addSelectedScript(scriptId: string, revert: boolean): void {
const script = this.app.findScript(scriptId);
const script = this.collection.findScript(scriptId);
if (!script) {
throw new Error(`Cannot add (id: ${scriptId}) as it is unknown`);
}
@@ -80,7 +81,7 @@ export class UserSelection implements IUserSelection {
}
public addOrUpdateSelectedScript(scriptId: string, revert: boolean): void {
const script = this.app.findScript(scriptId);
const script = this.collection.findScript(scriptId);
const selectedScript = new SelectedScript(script, revert);
this.scripts.addOrUpdateItem(selectedScript);
this.changed.notify(this.scripts.getItems());
@@ -105,7 +106,7 @@ export class UserSelection implements IUserSelection {
}
public selectAll(): void {
for (const script of this.app.getAllScripts()) {
for (const script of this.collection.getAllScripts()) {
if (!this.scripts.exists(script.id)) {
const selection = new SelectedScript(script, false);
this.scripts.addItem(selection);

View File

@@ -1,6 +1,4 @@
import { Category } from '@/domain/Category';
import { Application } from '@/domain/Application';
import { IApplication } from '@/domain/IApplication';
import { YamlApplication } from 'js-yaml-loader!@/application.yaml';
import { parseCategory } from './CategoryParser';
import { parseProjectInformation } from './ProjectInformationParser';
@@ -8,11 +6,13 @@ import { ScriptCompiler } from './Compiler/ScriptCompiler';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { parseScriptingDefinition } from './ScriptingDefinitionParser';
import { createEnumParser } from '../Common/Enum';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
import { CategoryCollection } from '@/domain/CategoryCollection';
export function parseApplication(
export function parseCategoryCollection(
content: YamlApplication,
env: NodeJS.ProcessEnv = process.env,
osParser = createEnumParser(OperatingSystem)): IApplication {
osParser = createEnumParser(OperatingSystem)): ICategoryCollection {
validate(content);
const compiler = new ScriptCompiler(content.functions);
const categories = new Array<Category>();
@@ -23,19 +23,19 @@ export function parseApplication(
const os = osParser.parseEnum(content.os, 'os');
const info = parseProjectInformation(env);
const scripting = parseScriptingDefinition(content.scripting, info);
const app = new Application(
const collection = new CategoryCollection(
os,
info,
categories,
scripting);
return app;
return collection;
}
function validate(content: YamlApplication): void {
if (!content) {
throw new Error('application is null or undefined');
throw new Error('content is null or undefined');
}
if (!content.actions || content.actions.length <= 0) {
throw new Error('application does not define any action');
throw new Error('content does not define any action');
}
}

View File

@@ -2,17 +2,17 @@ import { getEnumNames, getEnumValues } from '@/application/Common/Enum';
import { IEntity } from '../infrastructure/Entity/IEntity';
import { ICategory } from './ICategory';
import { IScript } from './IScript';
import { IApplication } from './IApplication';
import { IProjectInformation } from './IProjectInformation';
import { RecommendationLevel } from './RecommendationLevel';
import { OperatingSystem } from './OperatingSystem';
import { IScriptingDefinition } from './IScriptingDefinition';
import { ICategoryCollection } from './ICategoryCollection';
export class Application implements IApplication {
export class CategoryCollection implements ICategoryCollection {
public get totalScripts(): number { return this.queryable.allScripts.length; }
public get totalCategories(): number { return this.queryable.allCategories.length; }
private readonly queryable: IQueryableApplication;
private readonly queryable: IQueryableCollection;
constructor(
public readonly os: OperatingSystem,
@@ -89,26 +89,26 @@ function ensureNoDuplicates<TKey>(entities: ReadonlyArray<IEntity<TKey>>) {
}
}
interface IQueryableApplication {
interface IQueryableCollection {
allCategories: ICategory[];
allScripts: IScript[];
scriptsByLevel: Map<RecommendationLevel, readonly IScript[]>;
}
function ensureValid(application: IQueryableApplication) {
function ensureValid(application: IQueryableCollection) {
ensureValidCategories(application.allCategories);
ensureValidScripts(application.allScripts);
}
function ensureValidCategories(allCategories: readonly ICategory[]) {
if (!allCategories || allCategories.length === 0) {
throw new Error('Application must consist of at least one category');
throw new Error('must consist of at least one category');
}
}
function ensureValidScripts(allScripts: readonly IScript[]) {
if (!allScripts || allScripts.length === 0) {
throw new Error('Application must consist of at least one script');
throw new Error('must consist of at least one script');
}
for (const level of getEnumValues(RecommendationLevel)) {
if (allScripts.every((script) => script.level !== level)) {
@@ -130,7 +130,7 @@ function flattenApplication(categories: ReadonlyArray<ICategory>): [ICategory[],
function flattenCategories(
categories: ReadonlyArray<ICategory>,
allCategories: ICategory[],
allScripts: IScript[]): IQueryableApplication {
allScripts: IScript[]): IQueryableCollection {
if (!categories || categories.length === 0) {
return;
}
@@ -153,7 +153,7 @@ function flattenScripts(
}
function makeQueryable(
actions: ReadonlyArray<ICategory>): IQueryableApplication {
actions: ReadonlyArray<ICategory>): IQueryableCollection {
const flattened = flattenApplication(actions);
return {
allCategories: flattened[0],

View File

@@ -1,14 +1,13 @@
import { IScriptingDefinition } from '@/domain/IScriptingDefinition';
import { OperatingSystem } from '@/domain/OperatingSystem';
import { RecommendationLevel } from '@/domain/RecommendationLevel';
import { IScript } from '@/domain/IScript';
import { ICategory } from '@/domain/ICategory';
import { IProjectInformation } from './IProjectInformation';
import { RecommendationLevel } from './RecommendationLevel';
import { OperatingSystem } from './OperatingSystem';
import { IScriptingDefinition } from './IScriptingDefinition';
import { IProjectInformation } from '@/domain/IProjectInformation';
export interface IApplication {
export interface ICategoryCollection {
readonly info: IProjectInformation;
readonly scripting: IScriptingDefinition;
readonly os: OperatingSystem;
readonly totalScripts: number;
readonly totalCategories: number;
@@ -20,6 +19,3 @@ export interface IApplication {
getAllScripts(): ReadonlyArray<IScript>;
getAllCategories(): ReadonlyArray<ICategory>;
}
export { IScript } from '@/domain/IScript';
export { ICategory } from '@/domain/ICategory';

View File

@@ -33,7 +33,7 @@ export default class CardList extends StatefulVue {
public async mounted() {
const context = await this.getCurrentContextAsync();
this.setCategories(context.app.actions);
this.setCategories(context.collection.actions);
this.onOutsideOfActiveCardClicked((element) => {
if (hasDirective(element)) {
return;

View File

@@ -79,7 +79,7 @@ export default class CardListItem extends StatefulVue {
@Watch('categoryId')
public async updateStateAsync(value: |number) {
const context = await this.getCurrentContextAsync();
const category = !value ? undefined : context.app.findCategory(this.categoryId);
const category = !value ? undefined : context.collection.findCategory(this.categoryId);
this.cardTitle = category ? category.name : undefined;
const currentSelection = context.state.selection;
this.isAnyChildSelected = category ? currentSelection.isAnySelected(category) : false;

View File

@@ -1,18 +1,18 @@
import { IApplication } from './../../../domain/IApplication';
import { ICategory, IScript } from '@/domain/ICategory';
import { INode, NodeType } from './SelectableTree/Node/INode';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export function parseAllCategories(app: IApplication): INode[] | undefined {
export function parseAllCategories(collection: ICategoryCollection): INode[] | undefined {
const nodes = new Array<INode>();
for (const category of app.actions) {
for (const category of collection.actions) {
const children = parseCategoryRecursively(category);
nodes.push(convertCategoryToNode(category, children));
}
return nodes;
}
export function parseSingleCategory(categoryId: number, app: IApplication): INode[] | undefined {
const category = app.findCategory(categoryId);
export function parseSingleCategory(categoryId: number, collection: ICategoryCollection): INode[] | undefined {
const category = collection.findCategory(categoryId);
if (!category) {
throw new Error(`Category with id ${categoryId} does not exist`);
}

View File

@@ -19,7 +19,7 @@
import { StatefulVue } from '@/presentation/StatefulVue';
import { IScript } from '@/domain/IScript';
import { ICategory } from '@/domain/ICategory';
import { IApplicationState } from '@/application/Context/State/IApplicationState';
import { ICategoryCollectionState } from '@/application/Context/State/ICategoryCollectionState';
import { IFilterResult } from '@/application/Context/State/Filter/IFilterResult';
import { parseAllCategories, parseSingleCategory, getScriptNodeId, getCategoryNodeId, getCategoryId, getScriptId } from './ScriptNodeParser';
import SelectableTree from './SelectableTree/SelectableTree.vue';
@@ -65,9 +65,9 @@
public async initializeNodesAsync(categoryId?: number) {
const context = await this.getCurrentContextAsync();
if (categoryId) {
this.nodes = parseSingleCategory(categoryId, context.app);
this.nodes = parseSingleCategory(categoryId, context.collection);
} else {
this.nodes = parseAllCategories(context.app);
this.nodes = parseAllCategories(context.collection);
}
this.selectedNodeIds = context.state.selection.selectedScripts
.map((selected) => getScriptNodeId(selected.script));
@@ -80,13 +80,13 @@
(category: ICategory) => node.id === getCategoryNodeId(category));
}
private beginReactingToStateChanges(state: IApplicationState) {
private beginReactingToStateChanges(state: ICategoryCollectionState) {
state.selection.changed.on(this.handleSelectionChanged);
state.filter.filterRemoved.on(this.handleFilterRemoved);
state.filter.filtered.on(this.handleFiltered);
}
private setInitialState(state: IApplicationState) {
private setInitialState(state: ICategoryCollectionState) {
this.initializeNodesAsync(this.categoryId);
this.initializeFilter(state.filter.currentFilter);
}
@@ -114,7 +114,7 @@
}
}
function toggleCategoryNodeSelection(event: INodeSelectedEvent, state: IApplicationState): void {
function toggleCategoryNodeSelection(event: INodeSelectedEvent, state: ICategoryCollectionState): void {
const categoryId = getCategoryId(event.node.id);
if (event.isSelected) {
state.selection.addOrUpdateAllInCategory(categoryId, false);
@@ -122,7 +122,7 @@
state.selection.removeAllInCategory(categoryId);
}
}
function toggleScriptNodeSelection(event: INodeSelectedEvent, state: IApplicationState): void {
function toggleScriptNodeSelection(event: INodeSelectedEvent, state: ICategoryCollectionState): void {
const scriptId = getScriptId(event.node.id);
const actualToggleState = state.selection.isSelected(scriptId);
const targetToggleState = event.isSelected;

View File

@@ -37,7 +37,7 @@
@Watch('node') public async onNodeChangedAsync(node: INode) {
const context = await this.getCurrentContextAsync();
this.handler = getReverter(node, context.app);
this.handler = getReverter(node, context.collection);
}
public async onRevertToggledAsync() {

View File

@@ -1,16 +1,16 @@
import { IReverter } from './IReverter';
import { getCategoryId } from '../../../ScriptNodeParser';
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
import { IApplication } from '@/domain/IApplication';
import { ScriptReverter } from './ScriptReverter';
import { IUserSelection } from '@/application/Context/State/Selection/IUserSelection';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export class CategoryReverter implements IReverter {
private readonly categoryId: number;
private readonly scriptReverters: ReadonlyArray<ScriptReverter>;
constructor(nodeId: string, app: IApplication) {
constructor(nodeId: string, collection: ICategoryCollection) {
this.categoryId = getCategoryId(nodeId);
this.scriptReverters = getAllSubScriptReverters(this.categoryId, app);
this.scriptReverters = getAllSubScriptReverters(this.categoryId, collection);
}
public getState(selectedScripts: ReadonlyArray<SelectedScript>): boolean {
return this.scriptReverters.every((script) => script.getState(selectedScripts));
@@ -20,8 +20,8 @@ export class CategoryReverter implements IReverter {
}
}
function getAllSubScriptReverters(categoryId: number, app: IApplication) {
const category = app.findCategory(categoryId);
function getAllSubScriptReverters(categoryId: number, collection: ICategoryCollection) {
const category = collection.findCategory(categoryId);
if (!category) {
throw new Error(`Category with id "${categoryId}" does not exist`);
}

View File

@@ -1,5 +1,5 @@
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
import { IUserSelection } from '@/application/Context/State/IApplicationState';
import { IUserSelection } from '@/application/Context/State/ICategoryCollectionState';
export interface IReverter {
getState(selectedScripts: ReadonlyArray<SelectedScript>): boolean;

View File

@@ -1,13 +1,13 @@
import { INode, NodeType } from '../INode';
import { IReverter } from './IReverter';
import { ScriptReverter } from './ScriptReverter';
import { IApplication } from '@/domain/IApplication';
import { CategoryReverter } from './CategoryReverter';
import { ICategoryCollection } from '@/domain/ICategoryCollection';
export function getReverter(node: INode, app: IApplication): IReverter {
export function getReverter(node: INode, collection: ICategoryCollection): IReverter {
switch (node.type) {
case NodeType.Category:
return new CategoryReverter(node.id, app);
return new CategoryReverter(node.id, collection);
case NodeType.Script:
return new ScriptReverter(node.id);
default:

View File

@@ -1,7 +1,7 @@
import { IReverter } from './IReverter';
import { getScriptId } from '../../../ScriptNodeParser';
import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript';
import { IUserSelection } from '@/application/Context/State/IApplicationState';
import { IUserSelection } from '@/application/Context/State/ICategoryCollectionState';
export class ScriptReverter implements IReverter {
private readonly scriptId: string;

View File

@@ -105,13 +105,13 @@ const selectors = new Map<SelectionState, ITypeSelector>([
[SelectionState.Standard, {
select: (context) =>
context.state.selection.selectOnly(
context.app.getScriptsByLevel(RecommendationLevel.Standard)),
context.collection.getScriptsByLevel(RecommendationLevel.Standard)),
isSelected: (context) =>
hasAllSelectedLevelOf(RecommendationLevel.Standard, context),
}],
[SelectionState.Strict, {
select: (context) =>
context.state.selection.selectOnly(context.app.getScriptsByLevel(RecommendationLevel.Strict)),
context.state.selection.selectOnly(context.collection.getScriptsByLevel(RecommendationLevel.Strict)),
isSelected: (context) =>
hasAllSelectedLevelOf(RecommendationLevel.Strict, context),
}],
@@ -119,7 +119,7 @@ const selectors = new Map<SelectionState, ITypeSelector>([
select: (context) =>
context.state.selection.selectAll(),
isSelected: (context) =>
context.state.selection.totalSelected === context.app.totalScripts,
context.state.selection.totalSelected === context.collection.totalScripts,
}],
]);
@@ -138,7 +138,7 @@ function getCurrentSelectionState(context: IApplicationContext): SelectionState
}
function hasAllSelectedLevelOf(level: RecommendationLevel, context: IApplicationContext) {
const scripts = context.app.getScriptsByLevel(level);
const scripts = context.collection.getScriptsByLevel(level);
const selectedScripts = context.state.selection.selectedScripts;
return areAllSelected(scripts, selectedScripts);
}

View File

@@ -74,7 +74,7 @@
public async mounted() {
const context = await this.getCurrentContextAsync();
this.repositoryUrl = context.app.info.repositoryWebUrl;
this.repositoryUrl = context.collection.info.repositoryWebUrl;
const filter = context.state.filter;
filter.filterRemoved.on(() => {
this.isSearching = false;

View File

@@ -40,7 +40,7 @@ export default class TheCodeArea extends StatefulVue {
public async mounted() {
const context = await this.getCurrentContextAsync();
this.editor = initializeEditor(this.theme, this.editorId, context.app.scripting.language);
this.editor = initializeEditor(this.theme, this.editorId, context.collection.scripting.language);
const appCode = context.state.code;
this.editor.setValue(appCode.current || NothingChosenCode, 1);
appCode.changed.on((code) => this.updateCode(code));

View File

@@ -21,7 +21,7 @@ import { SaveFileDialog, FileType } from '@/infrastructure/SaveFileDialog';
import { Clipboard } from '@/infrastructure/Clipboard';
import IconButton from './IconButton.vue';
import { Environment } from '@/application/Environment/Environment';
import { IApplicationCode } from '@/application/Context/State/IApplicationState';
import { IApplicationCode } from '@/application/Context/State/ICategoryCollectionState';
import { ScriptingLanguage } from '@/domain/ScriptingLanguage';
import { IApplicationContext } from '@/application/Context/IApplicationContext';
@@ -61,9 +61,9 @@ export default class TheCodeButtons extends StatefulVue {
}
function saveCode(context: IApplicationContext) {
const fileName = `privacy-script.${context.app.scripting.fileExtension}`;
const fileName = `privacy-script.${context.collection.scripting.fileExtension}`;
const content = context.state.code.current;
const type = getType(context.app.scripting.language);
const type = getType(context.collection.scripting.language);
SaveFileDialog.saveFile(content, fileName, type);
}

View File

@@ -39,7 +39,7 @@ export default class DownloadUrlListItem extends StatefulVue {
private async getDownloadUrlAsync(os: OperatingSystem): Promise<string> {
const context = await this.getCurrentContextAsync();
return context.app.info.getDownloadUrl(os);
return context.collection.info.getDownloadUrl(os);
}
}

View File

@@ -48,8 +48,8 @@ export default class TheFooter extends StatefulVue {
public async mounted() {
const context = await this.getCurrentContextAsync();
this.repositoryUrl = context.app.info.repositoryWebUrl;
this.feedbackUrl = context.app.info.feedbackUrl;
this.repositoryUrl = context.collection.info.repositoryWebUrl;
this.feedbackUrl = context.collection.info.feedbackUrl;
}
}
</script>

View File

@@ -74,8 +74,8 @@ export default class TheFooter extends StatefulVue {
}
public async mounted() {
const state = await this.getCurrentContextAsync();
const info = state.app.info;
const context = await this.getCurrentContextAsync();
const info = context.collection.info;
this.version = info.version;
this.homepageUrl = info.homepage;
this.repositoryUrl = info.repositoryWebUrl;

View File

@@ -16,7 +16,7 @@ export default class TheHeader extends StatefulVue {
public async mounted() {
const context = await this.getCurrentContextAsync();
this.title = context.app.info.name;
this.title = context.collection.info.name;
}
}
</script>

View File

@@ -13,7 +13,7 @@
import { Component, Watch } from 'vue-property-decorator';
import { StatefulVue } from './StatefulVue';
import { NonCollapsing } from '@/presentation/Scripts/Cards/NonCollapsingDirective';
import { IUserFilter } from '@/application/Context/State/IApplicationState';
import { IUserFilter } from '@/application/Context/State/ICategoryCollectionState';
@Component( {
directives: { NonCollapsing },
@@ -25,7 +25,7 @@ export default class TheSearchBar extends StatefulVue {
public async mounted() {
const context = await this.getCurrentContextAsync();
const totalScripts = context.app.totalScripts;
const totalScripts = context.collection.totalScripts;
this.searchPlaceHolder = `Search in ${totalScripts} scripts`;
this.beginReacting(context.state.filter);
}