Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating front end code have repeat content #16040

Closed
1 task done
ghdefe opened this issue Aug 23, 2021 · 1 comment
Closed
1 task done

Generating front end code have repeat content #16040

ghdefe opened this issue Aug 23, 2021 · 1 comment

Comments

@ghdefe
Copy link

ghdefe commented Aug 23, 2021

Overview of the issue

I generate entity code with JDL command(jhipster jdl ./my-jdl-file.jdl), it will generate normally. And Again, generate with the similar jdl-file, which contain some entity the first JDL file has. At this time, In the filesrc/main/webapp/app/core/jhi-navbar/jhi-navbar.vue, the generated code will added to the location after <!-- jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here -->, instead of replaced the code generated before. So the label </b-dropdown-item> containe the button of old entity code and the btn of new.

For example, the following code has two location and instance...etc

src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue

        <b-nav-item-dropdown right id="entity-menu" v-if="authenticated" active-class="active" class="pointer" data-cy="entity">
          <span slot="button-content" class="navbar-dropdown-menu">
            <font-awesome-icon icon="th-list" />
            <span class="no-bold" v-text="$t('global.menu.entities.main')">Entities</span>
          </span>
          <b-dropdown-item to="/schema-info">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.schemaInfo')">Schema Info</span>
          </b-dropdown-item>
          <b-dropdown-item to="/table-info">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.tableInfo')">Table Info</span>
          </b-dropdown-item>
          <b-dropdown-item to="/column-info">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.columnInfo')">Column Info</span>
          </b-dropdown-item>
          <b-dropdown-item to="/bussiness-system">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.bussinessSystem')">Bussiness System</span>
          </b-dropdown-item>
          <b-dropdown-item to="/location">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.location')">Location</span>
          </b-dropdown-item>
          <b-dropdown-item to="/instance">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.instance')">Instance</span>
          </b-dropdown-item>
          <b-dropdown-item to="/scan-job">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.scanJob')">Scan Job</span>
          </b-dropdown-item>
          <b-dropdown-item to="/schema-info">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.schemaInfo')">Schema Info</span>
          </b-dropdown-item>
          <b-dropdown-item to="/table-info">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.tableInfo')">Table Info</span>
          </b-dropdown-item>
          <b-dropdown-item to="/column-info">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.columnInfo')">Column Info</span>
          </b-dropdown-item>
          <b-dropdown-item to="/bussiness-system">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.bussinessSystem')">Bussiness System</span>
          </b-dropdown-item>
          <b-dropdown-item to="/location">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.location')">Location</span>
          </b-dropdown-item>
          <b-dropdown-item to="/instance">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.instance')">Instance</span>
          </b-dropdown-item>
          <b-dropdown-item to="/scan-job">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.scanJob')">Scan Job</span>
          </b-dropdown-item>
          <b-dropdown-item to="/schedule">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.schedule')">Schedule</span>
          </b-dropdown-item>
          <b-dropdown-item to="/schema-name">
            <font-awesome-icon icon="asterisk" />
            <span v-text="$t('global.menu.entities.schemaName')">Schema Name</span>
          </b-dropdown-item>
          <!-- jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here -->
        </b-nav-item-dropdown>
Motivation for or Use Case

when I generate entity code, the repeat code need to deleted manually.

Reproduce the error
  1. generate jhipster Monomer application with font end by VUE.
  2. generate entity with JDL( jhipster jdl ./...).
  3. generate entity with JDL again.
Related issues
Suggest a Fix

Find the label of same name have been generated, and replace it.

JHipster Version(s)

INFO! Using JHipster version installed globally
7.1.0

JHipster configuration
JDL definitions

// 扫描任务

entity ScanJob {
name String,
comment String,
}

// 扫描的信息
entity BussinessSystem {
name String,
remark String,
platform String,
}

entity Location {
name String,
code Long
}

entity Instance {
name String,
type Integer,
remark String,
host String,
port Integer,
username String,
password String,
}

// 一次调度记录
entity Schedule {
startTime LocalDate,
endTime LocalDate,
}

entity Schema {
name String
}

entity SchemaInfo {
catalogName String,
schemaName String,
defaultCharacterSetName String,
defaultCollationName String,
sqlPath String,
defaultEncryption String
}

entity TableInfo {
tableSchemaId Long,
tableName String,
tableType String,
engine String,
version Integer,
rowFormat String,
tableRows Long,
avgRowLength Long,
dataLength Long,
maxDataLength Long,
indexLength Long,
dataFree Long,
autoIncrement Long,
createTime LocalDate,
updateTime LocalDate,
checkTime LocalDate,
tableCollation String,
checksum Long,
createOptions String,
tableComment String
}

entity ColumnInfo {
tableId Long,
tableCatalog String,
columnName String,
ordinalPosition Integer,
columnDefault String,
isNullable String,
dataType String,
characterMaximumLength Long,
characterOctetLength Long,
numericPrecision Long,
numericScale Long,
datetimePrecision Integer,
characterSetName String,
collationName String,
columnType String,
columnKey String,
extra String,
privileges String,
columnComment String,
generationExpression String,
srsId Integer
}

relationship OneToMany {
SchemaInfo{tableInfo(tableSchemaId)} to TableInfo{schemaInfo},
TableInfo{columnInfo(tableId)} to ColumnInfo{tableInfo},
ScanJob to Schedule,
Schedule to SchemaInfo,
Schedule to TableInfo,
Schedule to ColumnInfo,
BussinessSystem to Schema,
Location to Schema,
Instance to Schema,
Schema to SchemaInfo,
}

relationship ManyToMany {
ScanJob to BussinessSystem,
ScanJob to Location,
}

paginate * with pagination

service * with serviceClass

dto * with mapstruct

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
  • Checking this box is mandatory (this is just to show you read everything)
@mshima
Copy link
Member

mshima commented Aug 25, 2021

Should be fixed in main branch by #15819.

@ghdefe ghdefe closed this as completed Aug 30, 2021
@pascalgrimaud pascalgrimaud added this to the 7.2.0 milestone Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants