RSS Git Download  Clone
Raw Blame History 20kB 347 lines
HTML rendered
<md-dialog class="fullscreen-dialog">
    <form novalidate name="p3xrConnectionForm" ng-submit="submit()">
        <md-toolbar md-theme="{{ $root.p3xr.state.themeLayout }}" class="md-hue-3">
            <div class="md-toolbar-tools">
                <h2 flex md-truncate>{{ $root.p3xr.state.cfg.readonlyConnections ?
                    $root.p3xr.strings.label.connectiondView : options.type === 'new' ?
                    $root.p3xr.strings.label.connectiondAdd : $root.p3xr.strings.label.connectiondEdit }}</h2>
                <md-button class="md-icon-button" ng-click="cancel()">
                    <md-icon>close</md-icon>
                </md-button>
            </div>
        </md-toolbar>
        <md-dialog-content md-theme="{{ $root.p3xr.state.theme }}" >
            <md-content>
                <div class="p3xr-padding">
                    <span ng-if="model.id">
                        <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                            <label>{{ $root.p3xr.strings.label.id.id }}</label>
                            <input required name="id" ng-model="model.id" disabled>
                        </md-input-container>
                        <div class="p3xr-md-input-container-bottom-info">
                           {{ $root.p3xr.strings.label.id.info}}
                        </div>         
                    </span>

                    <md-input-container class="md-block">
                        <label>{{ $root.p3xr.strings.form.connection.label.name }}</label>
                        <input required name="name" ng-model="model.name"
                               ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                        <div ng-messages="p3xrConnectionForm.name.$error">
                            <div ng-message="required">{{ $root.p3xr.strings.form.error.required }}</div>
                        </div>
                    </md-input-container>


                    <span ng-if="$root.p3xr.state.donated">
                        <md-switch ng-model="model.ssh" name="ssh" aria-label="" style="margin: 0;"
                        ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                            {{ model.ssh ? $root.p3xr.strings.label.ssh.on : $root.p3xr.strings.label.ssh.off }}
                        </md-switch>    

                        <fieldset ng-if="model.ssh">
                            <md-input-container class="md-block">
                                <label>{{ $root.p3xr.strings.label.ssh.sshHost }}</label>
                                <input required name="sshHost" ng-model="model.sshHost"
                                       ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                <div ng-messages="p3xrConnectionForm.sshHost.$error">
                                    <div ng-message="required">{{ $root.p3xr.strings.form.error.required }}</div>
                                </div>
                            </md-input-container>
        
                            <md-input-container class="md-block">
                                <label>{{ $root.p3xr.strings.label.ssh.sshPort }}</label>
                                <input required name="sshPort" type="number" min="1" max="65535"  ng-model="model.sshPort"
                                       ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                <div ng-messages="p3xrConnectionForm.sshPort.$error">
                                    <div ng-message="required">{{ $root.p3xr.strings.form.error.required }}</div>
                                </div>
                            </md-input-container>
        
                            <md-input-container class="md-block">
                                <label>{{ $root.p3xr.strings.label.ssh.sshUsername }}</label>
                                <input required name="sshUsername" ng-model="model.sshUsername"
                                       ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                <div ng-messages="p3xrConnectionForm.sshPort.$error">
                                    <div ng-message="required">{{ $root.p3xr.strings.form.error.required }}</div>
                                </div>                                                                       
                            </md-input-container>
        
                            <md-input-container md-no-float class="md-block p3xr-md-input-container-no-bottom">
                                <label>{{ $root.p3xr.strings.label.ssh.sshPassword }}</label>
                                <input name="sshPassword" type="{{ !sshPasswordType ? 'password' : 'text'}}" ng-model="model.sshPassword"
                                       ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off">
                                <md-icon ng-click="sshPasswordType = !sshPasswordType ">
                                    {{!sshPasswordType ? 'visibility' : 'visibility_off'}}
                                </md-icon>
                            </md-input-container>
                            <div class="p3xr-md-input-container-bottom-info">
                                {{ $root.p3xr.strings.label.passwordSecure }}
                            </div>    
        
                            <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                                <label>{{ $root.p3xr.strings.label.ssh.sshPrivateKey }}</label>
                                <textarea name="sshPrivateKey" ng-model="model.sshPrivateKey"
                                        ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off"></textarea>
                            </md-input-container>
                            <div class="p3xr-md-input-container-bottom-info">
                                {{ $root.p3xr.strings.label.secureFeature }}
                            </div>
                            <br/>
                        </fieldset>
                    </span>                                 

                    <br/>

                    <fieldset>
                        <md-input-container class="md-block">
                            <label>{{ $root.p3xr.strings.form.connection.label.host }}</label>
                            <input name="host" ng-model="model.host" ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                        </md-input-container>


                        <md-input-container class="md-block">
                            <label>{{ $root.p3xr.strings.form.connection.label.port }}</label>
                            <input name="port" type="number" min="1" max="65535" ng-model="model.port"
                                ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                            <div ng-messages="p3xrConnectionForm.port.$error">
                                <div ng-message-exp="['min', 'max']">
                                    {{ $root.p3xr.strings.form.error.port }}
                                </div>
                            </div>
                        </md-input-container>

                        <md-switch ng-model="model.askAuth" name="askAuth" aria-label=""
                        ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                            {{ $root.p3xr.strings.label.askAuth }}
                        </md-switch>


                        <span>
                            <md-input-container class="md-block">
                                <label>{{ $root.p3xr.strings.form.connection.label.username }}</label>
                                <input name="username" type="text" ng-model="model.username"
                                    ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off">
                            </md-input-container>
        
                            <md-input-container md-no-float class="md-block p3xr-md-input-container-no-bottom">
                                <label>{{ $root.p3xr.strings.form.connection.label.password }}</label>
                                <input name="password" type="{{ !passwordType ? 'password' : 'text'}}" ng-model="model.password"
                                    ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off">
                                <md-icon ng-click="passwordType = !passwordType ">
                                    {{!passwordType ? 'visibility' : 'visibility_off'}}
                                </md-icon>
                            </md-input-container>
                            <div class="p3xr-md-input-container-bottom-info">
                                {{ $root.p3xr.strings.label.passwordSecure }}
                            </div>    
                            <br/>
                        </span>
                    </fieldset> 

                    <br/>
                    <span ng-if="$root.p3xr.state.donated">
                        <md-switch ng-model="model.readonly" name="readonly" aria-label="" style="margin: 0;"
                                   ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                            {{ model.readonly ? $root.p3xr.strings.label.readonly.on : $root.p3xr.strings.label.readonly.off }}
                        </md-switch>
                            
    
                    </span>
    
                    <br/>
                        
                    <div layout="row" layout-align="start center">
                        <div>
                            <md-switch ng-model="model.cluster" name="cluster" aria-label="" style="margin: 0;"
                                        ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                {{ model.cluster ? $root.p3xr.strings.label.cluster.on : $root.p3xr.strings.label.cluster.off }}
                            </md-switch>
                        </div>

                        <div style="margin-left: 15px;">                            
                            <md-switch ng-model="model.sentinel" name="sentinel" aria-label="" style="margin: 0;"
                                        ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                {{ model.sentinel ? $root.p3xr.strings.label.sentinel.on : $root.p3xr.strings.label.sentinel.off }}
                            </md-switch>
                        </div>
                        <span flex></span>
                        <div ng-if="(model.cluster === true || model.sentinel === true) && !$root.p3xr.state.cfg.readonlyConnections" ng-click="addNode()">
                            {{ $root.p3xr.strings.label.addNode }}
                            <md-button class="md-fab md-primary md-mini">
                                <md-icon>add</md-icon>
                            </md-button>                           
                        </div>
                    </div>


                    <span ng-if="model.sentinel === true">
                        <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                            <label>{{ $root.p3xr.strings.label.sentinel.name }}</label>
                            <input required name="sentinelName" ng-model="model.sentinelName"
                                   ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                <div ng-messages="p3xrConnectionForm.sentinelName.$error">
                                    <div ng-message="required">{{ $root.p3xr.strings.form.error.required }}</div>
                                </div>                                     
                        </md-input-container>
                    </span>

                    
                    <div ng-if="(model.cluster === true || model.sentinel === true)">

                        <div ng-repeat="node in model.nodes">
                            <fieldset>
                                <legend>Node {{$index + 2}}</legend>
                                <div style="float: right;" ng-if="!$root.p3xr.state.cfg.readonlyConnections">
                                    <md-button class="md-fab md-warn md-mini" ng-click="removeNode($event, $index)">
                                        <md-tooltip>{{ $root.p3xr.strings.confirm.deleteConnectionText }}</md-tooltip>
                                        <md-icon>delete</md-icon>
                                    </md-button>
                                    <md-button class="md-fab md-primary md-mini" ng-click="addNode($index)">
                                        <md-tooltip>{{ $root.p3xr.strings.label.addNode }}</md-tooltip>
                                        <md-icon>add</md-icon>
                                    </md-button>
                                </div>
                                <br/>

                                <span ng-if="node.id">
                                    <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                                        <label>{{ $root.p3xr.strings.label.id.nodeId }}</label>
                                        <input ng-model="node.id" disabled>
                                    </md-input-container>
                                         
                                </span>

                                <md-input-container class="md-block">
                                    <label>{{ $root.p3xr.strings.form.connection.label.host }}</label>
                                    <input name="host{{$index}}" ng-model="node.host"
                                           ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                </md-input-container>


                                <md-input-container class="md-block">
                                    <label>{{ $root.p3xr.strings.form.connection.label.port }}</label>
                                    <input required name="port{{$index}}" type="number" min="1" max="65535"
                                           ng-model="node.port" ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                    <div ng-messages="p3xrConnectionForm['port' +  $index].$error">
                                        <div ng-message-exp="['min', 'max']">
                                            {{ $root.p3xr.strings.form.error.port }}
                                        </div>
                                        <div ng-message="required">{{ $root.p3xr.strings.form.error.required }}</div>
                                    </div>
                                </md-input-container>


                                <md-input-container class="md-block">
                                    <label>{{ $root.p3xr.strings.form.connection.label.username }}</label>
                                    <input name="username{{$index}}" type="text" ng-model="node.username"
                                           ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off">
                                </md-input-container>


                                <md-input-container md-no-float class="md-block p3xr-md-input-container-no-bottom">
                                    <label>{{ $root.p3xr.strings.form.connection.label.password }}</label>
                                    <input name="password{{$index}}" type="{{ !$scope['password' + $index] ? 'password' : 'text'}}" ng-model="node.password"
                                           ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                                    <md-icon ng-click="$scope['password' + $index] = !$scope['password' + $index] ">
                                    {{!$scope['password' + $index] ? 'visibility' : 'visibility_off'}}
                                </md-icon>
                                </md-input-container>

                                <div class="p3xr-md-input-container-bottom-info">
                                    {{ $root.p3xr.strings.label.passwordSecure }}
                                </div>

                            </fieldset>
                            <div ng-if="$last !== true" style="margin-bottom: 16px;">
                                &nbsp;
                            </div>
                            <div style="clear: both;"></div>
                        </div>
                    </div>                    


                    <md-switch ng-model="model.tlsWithoutCert" name="tlsWithoutCert" aria-label=""
                               ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                        {{ $root.p3xr.strings.label.tlsWithoutCert }}
                    </md-switch>

                    <md-switch ng-model="model.tlsRejectUnauthorized" name="tlsRejectUnauthorized" aria-label=""
                               ng-disabled="$root.p3xr.state.cfg.readonlyConnections">
                        {{ $root.p3xr.strings.label.tlsRejectUnauthorized }}
                    </md-switch>

                    <div ng-if="model.tlsWithoutCert !== true" style="padding-top: 4px;">

                        <fieldset>
                            <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                                <label>TLS (redis.crt)</label>
                                <textarea name="tlsCrt" ng-model="model.tlsCrt"
                                          ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off"></textarea>
                            </md-input-container>
                            <div class="p3xr-md-input-container-bottom-info">
                                {{ $root.p3xr.strings.label.tlsSecure }}
                            </div>
                            <br/>
        
                            <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                                <label>TLS (redis.key)</label>
                                <textarea name="tlsKey" ng-model="model.tlsKey"
                                          ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off"></textarea>
                            </md-input-container>
                            <div class="p3xr-md-input-container-bottom-info">
                                {{ $root.p3xr.strings.label.tlsSecure }}
                            </div>
                            <br/>
        
                            <md-input-container class="md-block p3xr-md-input-container-no-bottom">
                                <label>TLS (ca.crt)</label>
                                <textarea name="tlsCa" ng-model="model.tlsCa"
                                          ng-disabled="$root.p3xr.state.cfg.readonlyConnections" autocomplete="off"></textarea>
                            </md-input-container>
                            <div class="p3xr-md-input-container-bottom-info">
                                {{ $root.p3xr.strings.label.tlsSecure }}
                            </div>
    
                            <br/>
                        </fieldset>
                    </div>



  
                </div>

            </md-content>
        </md-dialog-content>

        <!--
        <md-dialog-actions layout="row" layout-align="end end" md-theme="{{ $root.p3xr.state.theme }}">
        -->
        <md-dialog-actions  md-theme="{{ $root.p3xr.state.theme }}" class="p3xr-dialog-connection-actions">

            <md-button class="md-raised md-warn" ng-click="cancel()" md-autofocus>
                <md-icon>cancel</md-icon>
                <span ng-if="$root.$mdMedia('(min-width: 699px)')">{{ $root.p3xr.strings.intention.cancel }}</span>
                <md-tooltip ng-if="$root.$mdMedia('(max-width: 699px)')" md-direction="top">{{
                    $root.p3xr.strings.intention.cancel }}
                </md-tooltip>
            </md-button>

            <span md-theme="{{ $root.p3xr.state.themeCommon }}">
                <md-button class="md-raised md-primary" ng-click="testConnection($event)">
                    <i class="fas fa-plug"></i>
                    {{ $root.p3xr.strings.intention.testConnection }}
                </md-button>
            </span>

            <md-button class="md-raised md-primary" type="submit" ng-if="!$root.p3xr.state.cfg.readonlyConnections">
                <md-icon>{{ options.type === 'new' ? 'add' : 'save' }}</md-icon>
                {{ options.type === 'new' ? $root.p3xr.strings.intention.add : $root.p3xr.strings.intention.save }}
            </md-button>


        </md-dialog-actions>
    </form>
</md-dialog>