-
-
Notifications
You must be signed in to change notification settings - Fork 217
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
109 additions
and
34 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
src/main/webapp/app/module/primary/module-properties/ModuleProperties.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { ModuleProperty } from '@/module/domain/ModuleProperty'; | ||
import { defineComponent, PropType } from 'vue'; | ||
|
||
export default defineComponent({ | ||
name: 'ModulePropertiesVue', | ||
props: { | ||
properties: { | ||
type: Array as PropType<Array<ModuleProperty>>, | ||
required: true, | ||
}, | ||
moduleSlug: { | ||
type: String, | ||
required: true, | ||
}, | ||
moduleProperties: { | ||
type: Map<string, string | number | boolean>, | ||
required: true, | ||
}, | ||
propertiesType: { | ||
type: String, | ||
required: true, | ||
}, | ||
}, | ||
setup(props) { | ||
const propertiesStats = (): string => { | ||
return `${settedPropertiesCount()} / ${props.properties.length}`; | ||
}; | ||
|
||
const settedPropertiesCount = (): number => { | ||
return props.properties.filter(property => notEmpty(props.moduleProperties.get(property.key))).length; | ||
}; | ||
|
||
return { | ||
propertiesStats, | ||
}; | ||
}, | ||
}); | ||
|
||
function notEmpty(value: string | number | boolean | undefined): boolean { | ||
if (value === undefined) { | ||
return false; | ||
} | ||
|
||
if (typeof value === 'string') { | ||
return value.trim().length !== 0; | ||
} | ||
|
||
return true; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/webapp/app/module/primary/module-properties/ModuleProperties.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="jhipster-module-properties" v-if="properties.length !== 0"> | ||
<div class="jhipster-module-properties--type"> | ||
{{ propertiesType }} | ||
<div :data-selector="`module-${moduleSlug}-${propertiesType}-properties-stats`">{{ propertiesStats() }}</div> | ||
</div> | ||
<div v-for="property in properties" class="jhipster-module-properties--property"> | ||
<div class="jhipster-module-properties--property-key">{{ property.key }}</div> | ||
<div class="jhipster-module-properties--property-value" :data-selector="`module-${moduleSlug}-${property.key}-property-value`"> | ||
{{ moduleProperties.get(property.key) }} | ||
</div> | ||
</div> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
src/main/webapp/app/module/primary/module-properties/ModuleProperties.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<template src="./ModuleProperties.html"></template> | ||
|
||
<script lang="ts" src="./ModuleProperties.component.ts"></script> | ||
|
||
<style> | ||
.jhipster-module-properties { | ||
display: flex; | ||
margin-bottom: 10px; | ||
} | ||
.jhipster-module-properties--type { | ||
width: 6em; | ||
} | ||
.jhipster-module-properties--property { | ||
margin-right: 15px; | ||
} | ||
.jhipster-module-properties--property-key { | ||
font-weight: bold; | ||
} | ||
.jhipster-module-properties--property-value { | ||
height: 1em; | ||
} | ||
</style> |
3 changes: 3 additions & 0 deletions
3
src/main/webapp/app/module/primary/module-properties/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import ModulePropertiesVue from './ModuleProperties.vue'; | ||
|
||
export { ModulePropertiesVue }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters