-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added terminal and Connectivity Node information (#402)
* Added terminal/connectivity node information * Removed console.log * Some refactoring * Small refactoring * fix(translations/de): add missing German translations Thank you very much for adding these nice wizards to translate! 👍 Co-authored-by: Rob Tjalma <rob@tjalma.com> Co-authored-by: Christian Dinkel <chhildeb@gmail.com>
- Loading branch information
1 parent
f101fa8
commit c10f405
Showing
8 changed files
with
209 additions
and
21 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import { html, TemplateResult } from 'lit-element'; | ||
import { get, translate } from 'lit-translate'; | ||
|
||
import { | ||
isPublic, | ||
Wizard, | ||
} from '../foundation.js'; | ||
|
||
function render( | ||
name: string | null, | ||
pathName: string | null, | ||
reservedNames: string[] | ||
): TemplateResult[] { | ||
return [ | ||
html`<wizard-textfield | ||
label="name" | ||
.maybeValue=${name} | ||
helper="${translate('connectivitynode.wizard.nameHelper')}" | ||
required | ||
validationMessage="${translate('textfield.required')}" | ||
dialogInitialFocus | ||
.reservedValues=${reservedNames} | ||
readonly | ||
></wizard-textfield>`, | ||
html`<wizard-textfield | ||
label="pathName" | ||
.maybeValue=${pathName} | ||
helper="${translate('connectivitynode.wizard.pathNameHelper')}" | ||
required | ||
validationMessage="${translate('textfield.required')}" | ||
readonly | ||
></wizard-textfield>`, | ||
]; | ||
} | ||
|
||
export function editConnectivityNodeWizard(element: Element): Wizard { | ||
const reservedNames = Array.from( | ||
element.parentNode!.querySelectorAll('ConnectivityNode') | ||
) | ||
.filter(isPublic) | ||
.map(cNode => cNode.getAttribute('name') ?? '') | ||
.filter(name => name !== element.getAttribute('name')); | ||
|
||
return [ | ||
{ | ||
title: get('connectivitynode.wizard.title.edit'), | ||
element, | ||
content: render( | ||
element.getAttribute('name'), | ||
element.getAttribute('pathName'), | ||
reservedNames | ||
), | ||
}, | ||
]; | ||
} |
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,65 @@ | ||
import { html, TemplateResult } from 'lit-element'; | ||
import { get, translate } from 'lit-translate'; | ||
|
||
import { | ||
isPublic, | ||
Wizard, | ||
} from '../foundation.js'; | ||
|
||
function render( | ||
name: string | null, | ||
connectivityNode: string | null, | ||
cNodeName: string | null, | ||
reservedNames: string[] | ||
): TemplateResult[] { | ||
return [ | ||
html`<wizard-textfield | ||
label="name" | ||
.maybeValue=${name} | ||
helper="${translate('terminal.wizard.nameHelper')}" | ||
required | ||
validationMessage="${translate('textfield.required')}" | ||
dialogInitialFocus | ||
.reservedValues=${reservedNames} | ||
readonly | ||
></wizard-textfield>`, | ||
html`<wizard-textfield | ||
label="connectivityNode" | ||
.maybeValue=${connectivityNode} | ||
helper="${translate('terminal.wizard.connectivityNodeHelper')}" | ||
required | ||
validationMessage="${translate('textfield.required')}" | ||
readonly | ||
></wizard-textfield>`, | ||
html`<wizard-textfield | ||
label="cNodeName" | ||
.maybeValue=${cNodeName} | ||
helper="${translate('terminal.wizard.cNodeNameHelper')}" | ||
required | ||
validationMessage="${translate('textfield.required')}" | ||
readonly | ||
></wizard-textfield>`, | ||
]; | ||
} | ||
|
||
export function editTerminalWizard(element: Element): Wizard { | ||
const reservedNames = Array.from( | ||
element.parentNode!.querySelectorAll('ConnectivityNode') | ||
) | ||
.filter(isPublic) | ||
.map(cNode => cNode.getAttribute('name') ?? '') | ||
.filter(name => name !== element.getAttribute('name')); | ||
|
||
return [ | ||
{ | ||
title: get('terminal.wizard.title.edit'), | ||
element, | ||
content: render( | ||
element.getAttribute('name'), | ||
element.getAttribute('connectivityNode'), | ||
element.getAttribute('cNodeName'), | ||
reservedNames | ||
), | ||
}, | ||
]; | ||
} |
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