-
Notifications
You must be signed in to change notification settings - Fork 3
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
129 changed files
with
3,314 additions
and
2,543 deletions.
There are no files selected for viewing
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
2 changes: 1 addition & 1 deletion
2
_backup/patcher-languages/tenant_add_to_user/user-management.json.cjs
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
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
20 changes: 0 additions & 20 deletions
20
...ngular/patcher-entities/hide-tenant-if-exists-on-account/entity-detail.component.html.cjs
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
...angular/patcher-entities/hide-tenant-if-exists-on-account/entity-detail.component.html.js
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,24 @@ | ||
import { getNode } from '../../../tenantview/support/utils.js'; | ||
|
||
const file = data => `${data.srcMainWebapp}app/entities/${data.entityFolderName}/detail/${data.entityFileName}-detail.component.html`; | ||
|
||
const tmpls = [ | ||
{ | ||
// Hide tenant if is defined | ||
editFile: data => content => { | ||
const label = getNode( | ||
content, | ||
`[jhiTranslate=${data.frontendAppName}.${data.entityTranslationKey}.${data.tenantRelationshipName}]`, | ||
'parentNode', | ||
); | ||
const [init] = label.range; | ||
const end = label.nextElementSibling.range[1]; | ||
return content.slice(0, init) + ' @if (showTenant()) { ' + content.slice(init, end) + '}' + content.slice(end); | ||
}, | ||
}, | ||
]; | ||
|
||
export default { | ||
file, | ||
tmpls, | ||
}; |
28 changes: 28 additions & 0 deletions
28
...s/angular/patcher-entities/hide-tenant-if-exists-on-account/entity-detail.component.ts.js
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,28 @@ | ||
const file = data => `${data.srcMainWebapp}app/entities/${data.entityFolderName}/detail/${data.entityFileName}-detail.component.ts`; | ||
|
||
const tmpls = [ | ||
{ | ||
// Add tenant getter to account | ||
type: 'rewriteFile', | ||
target: "from '@angular/router';", | ||
tmpl: data => `import { inject } from '@angular/core';`, | ||
}, | ||
{ | ||
// Add imports account | ||
type: 'rewriteFile', | ||
target: "import SharedModule from 'app/shared/shared.module';", | ||
tmpl: "import { AccountService } from 'app/core/auth/account.service';", | ||
}, | ||
{ | ||
// Add currentAccount field | ||
type: 'replaceContent', | ||
regex: true, | ||
target: /(export class .* {\n(\s*))/, | ||
tmpl: '$1$2showTenant = inject(AccountService).trackShowTenant();\n$2', | ||
}, | ||
]; | ||
|
||
export default { | ||
file, | ||
tmpls, | ||
}; |
19 changes: 0 additions & 19 deletions
19
...ngular/patcher-entities/hide-tenant-if-exists-on-account/entity-update.component.html.cjs
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
...angular/patcher-entities/hide-tenant-if-exists-on-account/entity-update.component.html.js
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,18 @@ | ||
import { getNode } from '../../../tenantview/support/utils.js'; | ||
|
||
const file = data => `${data.srcMainWebapp}app/entities/${data.entityFolderName}/update/${data.entityFileName}-update.component.html`; | ||
|
||
const tmpls = [ | ||
{ | ||
// Hide the tenant if the current account is from a tenant (field) | ||
editFile: data => content => { | ||
const [init, end] = getNode(content, `[for=field_${data.tenantRelationshipName}]`, 'parentNode.range'); | ||
return content.slice(0, init) + ' @if (showTenant()) { ' + content.slice(init, end) + '}' + content.slice(end); | ||
}, | ||
}, | ||
]; | ||
|
||
export default { | ||
file, | ||
tmpls, | ||
}; |
58 changes: 0 additions & 58 deletions
58
.../angular/patcher-entities/hide-tenant-if-exists-on-account/entity-update.component.ts.cjs
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...s/angular/patcher-entities/hide-tenant-if-exists-on-account/entity-update.component.ts.js
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,22 @@ | ||
const file = data => `${data.srcMainWebapp}app/entities/${data.entityFolderName}/update/${data.entityFileName}-update.component.ts`; | ||
|
||
const tmpls = [ | ||
{ | ||
// Add imports account | ||
type: 'rewriteFile', | ||
target: "import SharedModule from 'app/shared/shared.module';", | ||
tmpl: "import { AccountService } from 'app/core/auth/account.service';", | ||
}, | ||
{ | ||
// Add currentAccount field | ||
type: 'replaceContent', | ||
regex: true, | ||
target: /(export class .* {\n(\s*))/, | ||
tmpl: '$1$2showTenant = inject(AccountService).trackShowTenant();\n$2', | ||
}, | ||
]; | ||
|
||
export default { | ||
file, | ||
tmpls, | ||
}; |
23 changes: 0 additions & 23 deletions
23
...ators/angular/patcher-entities/hide-tenant-if-exists-on-account/entity.component.html.cjs
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
...rators/angular/patcher-entities/hide-tenant-if-exists-on-account/entity.component.html.js
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,38 @@ | ||
import { parse } from 'node-html-parser'; | ||
import { getNode } from '../../../tenantview/support/utils.js'; | ||
|
||
const file = data => `${data.srcMainWebapp}app/entities/${data.entityFolderName}/list/${data.entityFileName}.component.html`; | ||
|
||
const tmpls = [ | ||
{ | ||
// Hide if currentAccount has a tenant | ||
editFile: data => content => { | ||
const root = parse(content); | ||
const [thInit, thEnd] = getNode( | ||
root, | ||
`[jhiTranslate=${data.frontendAppName}.${data.entityTranslationKey}.${data.tenantRelationshipName}]`, | ||
'parentNode.parentNode.range', | ||
); | ||
const [tdInit, tdEnd] = getNode( | ||
root, | ||
`[\\[routerLink\\]="['/${data.tenantEntity.entityUrl}', ${data.entityInstance}.${data.tenantRelationshipName}.${data.tenantEntity.primaryKey.name}, 'view']"]`, | ||
'parentNode.parentNode.range', | ||
); | ||
|
||
return `${content.slice(0, thInit)} | ||
@if (showTenant()) { | ||
${content.slice(thInit, thEnd)} | ||
} | ||
${content.slice(thEnd, tdInit)} | ||
@if (showTenant()) { | ||
${content.slice(tdInit, tdEnd)} | ||
} | ||
${content.slice(tdEnd)}`; | ||
}, | ||
}, | ||
]; | ||
export default { | ||
condition: data => data.tenantAware, | ||
file, | ||
tmpls, | ||
}; |
Oops, something went wrong.