Browse Source
Merge pull request #13682 from deaflynx/fix/dashboard-duplicate-state-same-id
Fix rewrite of dashboard duplicate state with same id
pull/13737/head
Igor Kulikov
1 year ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
6 additions and
1 deletions
-
ui-ngx/src/app/modules/home/components/dashboard-page/states/manage-dashboard-states-dialog.component.ts
|
|
|
@ -261,11 +261,16 @@ export class ManageDashboardStatesDialogComponent |
|
|
|
const originalState = state; |
|
|
|
const newStateName = this.getNextDuplicatedName(state.name); |
|
|
|
if (newStateName) { |
|
|
|
const newStateId = newStateName.toLowerCase().replace(/\W/g, '_'); |
|
|
|
if (this.states[newStateId]) { |
|
|
|
this.stateNames.add(newStateName); |
|
|
|
this.duplicateState(null, state); |
|
|
|
} |
|
|
|
const duplicatedStates = deepClone(originalState); |
|
|
|
const duplicatedWidgets = deepClone(this.widgets); |
|
|
|
const mainWidgets = {}; |
|
|
|
const rightWidgets = {}; |
|
|
|
duplicatedStates.id = newStateName.toLowerCase().replace(/\W/g, '_'); |
|
|
|
duplicatedStates.id = newStateId; |
|
|
|
duplicatedStates.name = newStateName; |
|
|
|
duplicatedStates.root = false; |
|
|
|
this.stateNames.add(duplicatedStates.name); |
|
|
|
|