Skip to content

Commit

Permalink
Implemented Functionality page
Browse files Browse the repository at this point in the history
  • Loading branch information
mlhaufe committed Jun 13, 2024
1 parent 5eba936 commit e23c5be
Show file tree
Hide file tree
Showing 17 changed files with 356 additions and 36 deletions.
48 changes: 25 additions & 23 deletions components/XDataTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,30 +111,32 @@ const onSort = (event: any) => {
</script>

<template>
<ConfirmDialog></ConfirmDialog>
<Toolbar>
<template #start>
<Button label="Create" severity="info" @click="onCreateEmpty" :disabled="createDisabled" />
</template>
</Toolbar>
<DataTable ref="dataTable" :value="props.datasource as unknown as any[]" dataKey="id" filterDisplay="row"
v-model:filters="filters as any" :globalFilterFields="Object.keys(filters)" editMode="row"
@row-edit-init="onRowEditInit" v-model:editingRows="editingRows" @row-edit-save="onRowEditSave"
@row-edit-cancel="onCancel" @sort="onSort" :sortField="sortField" :sortOrder="1">
<slot></slot>
<Column frozen align-frozen="right">
<template #body="{ data, editorInitCallback }">
<Button icon="pi pi-pencil" text rounded @click="editorInitCallback" />
<Button icon="pi pi-trash" text rounded severity="danger" @click="onDelete(data)" />
<section>
<ConfirmDialog></ConfirmDialog>
<Toolbar>
<template #start>
<Button label="Create" severity="info" @click="onCreateEmpty" :disabled="createDisabled" />
</template>
<template #editor="{ editorSaveCallback, editorCancelCallback }">
<Button icon="pi pi-check" text rounded @click="editorSaveCallback" />
<Button icon="pi pi-times" text rounded severity="danger" @click="editorCancelCallback" />
</template>
</Column>
<template #empty>No data found</template>
<template #loading>Loading data...</template>
</DataTable>
</Toolbar>
<DataTable ref="dataTable" :value="props.datasource as unknown as any[]" dataKey="id" filterDisplay="row"
v-model:filters="filters as any" :globalFilterFields="Object.keys(filters)" editMode="row"
@row-edit-init="onRowEditInit" v-model:editingRows="editingRows" @row-edit-save="onRowEditSave"
@row-edit-cancel="onCancel" @sort="onSort" :sortField="sortField" :sortOrder="1">
<slot></slot>
<Column frozen align-frozen="right">
<template #body="{ data, editorInitCallback }">
<Button icon="pi pi-pencil" text rounded @click="editorInitCallback" />
<Button icon="pi pi-trash" text rounded severity="danger" @click="onDelete(data)" />
</template>
<template #editor="{ editorSaveCallback, editorCancelCallback }">
<Button icon="pi pi-check" text rounded @click="editorSaveCallback" />
<Button icon="pi pi-times" text rounded severity="danger" @click="editorCancelCallback" />
</template>
</Column>
<template #empty>No data found</template>
<template #loading>Loading data...</template>
</DataTable>
</section>
</template>

<style scoped>
Expand Down
2 changes: 1 addition & 1 deletion domain/UseCase.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Example from "./Example";
import Example from "../modules/system/domain/Example";
import type { Properties } from "./Properties";
import type { Uuid } from "./Uuid";

Expand Down
2 changes: 1 addition & 1 deletion domain/UserStory.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Example from "./Example";
import Example from "../modules/system/domain/Example";

/**
* A User Storyspecifies the handling of a specific user need.
Expand Down
39 changes: 39 additions & 0 deletions modules/system/application/FunctionalRequirementInteractor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type Repository from "~/application/Repository";
import FunctionalRequirement from "../domain/FunctionalRequirement";
import type { Uuid } from "~/domain/Uuid";

export default class FunctionalRequirementInteractor {
constructor(
readonly repository: Repository<FunctionalRequirement>
) { }

async create({ parentId, name, statement }: Pick<FunctionalRequirement, 'parentId' | 'name' | 'statement'>): Promise<Uuid> {
return await this.repository.add(new FunctionalRequirement({
id: crypto.randomUUID(),
property: '',
parentId,
name,
statement
}))
}

async delete(id: Uuid): Promise<void> {
await this.repository.delete(id)
}

async getAll(parentId: Uuid): Promise<FunctionalRequirement[]> {
return await this.repository.getAll(
behavior => behavior.parentId === parentId
)
}

async update({ id, parentId, name, statement }: Pick<FunctionalRequirement, 'id' | 'parentId' | 'name' | 'statement'>): Promise<void> {
await this.repository.update(new FunctionalRequirement({
id,
property: '',
parentId,
name,
statement
}))
}
}
39 changes: 39 additions & 0 deletions modules/system/application/NonFunctionalRequirementInteractor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import type Repository from "~/application/Repository";
import NonFunctionalRequirement from "../domain/NonFunctionalRequirement";
import type { Uuid } from "~/domain/Uuid";

export default class NonFunctionalRequirementInteractor {
constructor(
readonly repository: Repository<NonFunctionalRequirement>
) { }

async create({ parentId, name, statement }: Pick<NonFunctionalRequirement, 'parentId' | 'name' | 'statement'>): Promise<Uuid> {
return await this.repository.add(new NonFunctionalRequirement({
id: crypto.randomUUID(),
property: '',
parentId,
name,
statement
}))
}

async delete(id: Uuid): Promise<void> {
await this.repository.delete(id)
}

async getAll(parentId: Uuid): Promise<NonFunctionalRequirement[]> {
return await this.repository.getAll(
behavior => behavior.parentId === parentId
)
}

async update({ id, parentId, name, statement }: Pick<NonFunctionalRequirement, 'id' | 'parentId' | 'name' | 'statement'>): Promise<void> {
await this.repository.update(new NonFunctionalRequirement({
id,
property: '',
parentId,
name,
statement
}))
}
}
16 changes: 16 additions & 0 deletions modules/system/data/FunctionalRequirementRepository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Properties } from "~/domain/Properties";
import StorageRepository from "~/data/StorageRepository";
import type FunctionalRequirement from "../domain/FunctionalRequirement";
import FunctionalRequirementToJsonMapper from "../mappers/FunctionalRequirementToJsonMapper";

const { serializationVersion } = useAppConfig()

export default class FunctionalRequirementRepository extends StorageRepository<FunctionalRequirement> {
constructor(properties: Properties<Omit<FunctionalRequirementRepository, 'storageKey' | 'mapper'>> = {}) {
super({
...properties,
storageKey: 'functionalRequirement',
mapper: new FunctionalRequirementToJsonMapper(serializationVersion)
})
}
}
16 changes: 16 additions & 0 deletions modules/system/data/NonFunctionalRequirementRepository.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Properties } from "~/domain/Properties";
import StorageRepository from "~/data/StorageRepository";
import FunctionalRequirementToJsonMapper from "../mappers/FunctionalRequirementToJsonMapper";
import type NonFunctionalRequirement from "../domain/NonFunctionalRequirement";

const { serializationVersion } = useAppConfig()

export default class NonFunctionalRequirementRepository extends StorageRepository<NonFunctionalRequirement> {
constructor(properties: Properties<Omit<NonFunctionalRequirementRepository, 'storageKey' | 'mapper'>> = {}) {
super({
...properties,
storageKey: 'nonFunctionalRequirement',
mapper: new FunctionalRequirementToJsonMapper(serializationVersion)
})
}
}
2 changes: 1 addition & 1 deletion domain/Behavior.ts → modules/system/domain/Behavior.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Requirement from "./Requirement";
import Requirement from "~/domain/Requirement";

/**
* Property of the operation of the system
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import Behavior from "./Behavior";

/**
* Property of how the system achieves an outcome
*/

export default class NonFunctionalRequirement extends Behavior { }
2 changes: 1 addition & 1 deletion modules/system/domain/System.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Uuid } from "~/domain/Uuid";
import PEGS from "../../../domain/PEGS";
import PEGS from "~/domain/PEGS";

/**
* A set of related artifacts
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions modules/system/mappers/FunctionalRequirementToJsonMapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { RequirementJson } from "~/mappers/RequirementToJsonMapper";
import FunctionalRequirement from "../domain/FunctionalRequirement";
import RequirementToJsonMapper from "~/mappers/RequirementToJsonMapper";

export interface FunctionalRequirementJson extends RequirementJson { }

export default class FunctionalRequirementToJsonMapper extends RequirementToJsonMapper {
override mapTo(source: FunctionalRequirement): FunctionalRequirementJson {
return {
...super.mapTo(source)
};
}

override mapFrom(target: FunctionalRequirementJson): FunctionalRequirement {
return new FunctionalRequirement({
...super.mapFrom(target)
});
}
}
19 changes: 19 additions & 0 deletions modules/system/mappers/NonFunctionalRequirementToJsonMapper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import type { RequirementJson } from "~/mappers/RequirementToJsonMapper";
import NonFunctionalRequirement from "../domain/NonFunctionalRequirement";
import RequirementToJsonMapper from "~/mappers/RequirementToJsonMapper";

export interface NonFunctionalRequirementJson extends RequirementJson { }

export default class NonFunctionalRequirementToJsonMapper extends RequirementToJsonMapper {
override mapTo(source: NonFunctionalRequirement): NonFunctionalRequirementJson {
return {
...super.mapTo(source)
};
}

override mapFrom(target: NonFunctionalRequirementJson): NonFunctionalRequirement {
return new NonFunctionalRequirement({
...super.mapFrom(target)
});
}
}
Loading

0 comments on commit e23c5be

Please sign in to comment.