Unverified Commit e689e27d authored by liuzheng712's avatar liuzheng712

Merge branch 'dev' into test

parents 4e193d1e 54e9ae8a
......@@ -31,6 +31,8 @@
"../node_modules/jquery-sparkline/jquery.sparkline.js",
"../node_modules/tether/dist/js/tether.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
"assets/inspinia/inspinia.js",
"assets/slimscroll/jquery.slimscroll.min.js",
"../node_modules/xterm/dist/xterm.js"
],
"environmentSource": "environments/environment.ts",
......
/**
* Created by liuzheng on 7/17/16.
*/
var server = {};
var http = require('http');
var express = require('express');
var io = require('socket.io');
var pty = require('pty.js');
// var terminal = require('term.js');
var socket;
var term;
var buff = [];
server.run = function (options) {
// create shell process
term = pty.fork(
process.env.SHELL || 'sh',
[],
{
name: require('fs').existsSync('/usr/share/terminfo/x/xterm-256color')
? 'xterm-256color'
: 'xterm',
cols: 80,
rows: 24,
cwd: process.env.HOME
}
);
//
// // store term's output into buffer or emit through socket
term.on('data', function (data) {
return !socket ? buff.push(data) : socket.emit('data', data);
});
// console.log('Created shell with pty master/slave pair (master: %d, pid: %d)', term.fd, term.pid);
var app = express();
var server = http.createServer(app);
var apis = express.Router();
app.use("/", express.static(__dirname + '/dist/')); // 创建服务端
// app.use("/socket.io/", express.static(__dirname + '/api/')); // 创建服务端
// let term.js handle req/res
// app.use(terminal.middleware());
apis.route('/browser')
.post(function (req, res) {
// console.log(req);
// res.string('');
res.json({verified: true, csrf: "liuzheng"})
});
apis.route('/checklogin')
.post(function (req, res) {
res.json({logined: true, id: 1, username: "liuzheng", name: "liuzheng"})
})
.get(function (req, res) {
res.json({logined: true})
});
apis.route('/nav')
.get(function (req, res) {
res.json([{
"id": "File",
"name": "Server",
"children": [
{
"id": "NewConnection",
"href": "Aaaa",
"name": "New connection",
"disable": true
},
{
"id": "Connect",
"href": "Aaaa",
"name": "Connect",
"disable": true
},
{
"id": "Disconnect",
"click": "Disconnect",
"name": "Disconnect"
},
{
"id": "DisconnectAll",
"click": "DisconnectAll",
"name": "Disconnect all"
},
{
"id": "Duplicate",
"href": "Aaaa",
"name": "Duplicate",
"disable": true
},
{
"id": "Upload",
"href": "Aaaa",
"name": "Upload",
"disable": true
},
{
"id": "Download",
"href": "Aaaa",
"name": "Download",
"disable": true
},
{
"id": " Search",
"href": "Aaaa",
"name": "Search",
"disable": true
},
{
"id": "Reload",
"click": "ReloadLeftbar",
"name": "Reload"
}
]
}, {
"id": "View",
"name": "View",
"children": [
{
"id": "HindLeftManager",
"click": "HideLeft",
"name": "Hind left manager"
},
{
"id": "SplitVertical",
"href": "Aaaa",
"name": "Split vertical",
"disable": true
},
{
"id": "CommandBar",
"href": "Aaaa",
"name": "Command bar",
"disable": true
},
{
"id": "ShareSession",
"href": "Aaaa",
"name": "Share session (read/write)",
"disable": true
},
{
"id": "Language",
"href": "Aaaa",
"name": "Language",
"disable": true
}]
}, {
"id": "Help",
"name": "Help",
"children": [
{
"id": "EnterLicense",
"click": "EnterLicense",
"name": "Enter License"
},
{
"id": "Website",
"click": "Website",
"name": "Website"
},
{
"id": "BBS",
"click": "BBS",
"name": "BBS"
}]
}])
});
apis.route('/replay')
.get(function (req, res) {
res.json({
"type": "json"
})
});
apis.route('/perms/v1/user/my/asset-groups-assets/')
.get(function (req, res) {
res.json([
{
"id": 0,
"name": "ungrouped",
"assets": []
},
{
"id": 1,
"name": "Default",
"comment": "Default asset group",
"assets": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system": "windows",
"system_users": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": true
}
]
},
{
"id": 4,
"hostname": "testserver123",
"ip": "123.57.183.135",
"port": 8022,
"system": "linux",
"system_users": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": true
}
]
}
]
},
{
"id": 4,
"name": "java",
"comment": "",
"assets": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system_users": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": true
}
]
}
]
},
{
"id": 3,
"name": "数据库",
"comment": "",
"assets": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system_users": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": true
}
]
}
]
},
{
"id": 2,
"name": "运维组",
"comment": "",
"assets": [
{
"id": 2,
"hostname": "192.168.1.6",
"ip": "192.168.2.6",
"port": 22,
"system_users": [
{
"id": 1,
"name": "web",
"username": "web",
"protocol": "ssh",
"auth_method": "P",
"auto_push": true
}
]
}
]
}
])
});
app.use("/api", apis);
// let server listen on the port
options = options || {};
server.listen(options.port || 3000);
// let socket.io handle sockets
io = io.listen(server, {log: false});
io.sockets.on('connection', function (s) {
// when connect, store the socket
socket = s;
// handme incoming data (client -> server)
socket.on('data', function (data) {
term.write(data);
});
socket.on('resize', function (data) {
term.resize(data[0], data[1]);
console.log(data)
});
// handle connection lost
socket.on('disconnect', function () {
socket = null;
});
// send buffer data to client
while (buff.length) {
socket.emit('data', buff.shift());
}
});
};
server.run({port: 3000});
console.log('Please open your browser with http://127.0.0.1:3000');
{
"reset": "重置",
"submit": "提交",
"email subject prefix": "邮件主题前缀",
"basic setting": "基本设置",
"email setting": "邮件设置",
"ldap setting": "LDAP设置",
"terminal setting": "终端设置",
"current site url": "当前站点URL",
"user guide url": "用户向导URL",
"user first login update profile done redirect to it": "用户第一次登录,修改profile后重定向到地址",
"server": "服务器",
"view": "视图",
"help": "帮助",
"hide left manager": "隐藏左边栏",
"show left manager": "显示左边栏",
"disconnect all": "断开所有链接",
"disconnect": "断开链接",
"website": "我们的网站",
"search": "搜索",
"settings": "系统设置",
"job center": "作业中心",
"sessions": "会话管理",
"perms": "权限管理",
"assets": "资产管理",
"users": "用户管理",
"dashboard": "仪表盘",
"task": "任务",
"session online": "在线会话",
"session offline": "离线会话",
"commands": "命令记录",
"terminal": "终端管理",
"asset perminssion": "资产授权",
"asset": "资产",
"asset group": "资产组",
"cluster": "集群",
"admin user": "管理用户",
"system user": "系统用户",
"labels": "标签管理",
"user": "用户",
"user group": "用户组",
"login logs": "登陆日志"
}
#!/usr/bin/env python3
from flask import Flask, send_from_directory, render_template, request, jsonify, redirect, url_for
from flask import Flask, send_from_directory, render_template, request, jsonify, redirect, send_file
from flask_socketio import SocketIO, Namespace, emit, join_room, leave_room
import paramiko
import uuid
......@@ -85,7 +85,7 @@ class SSHws(Namespace):
join_room(room)
def on_token(self, token):
print(token)
self.on_host(token)
def on_disconnect(self):
print("disconnect")
......@@ -115,7 +115,7 @@ def index():
return render_template('index.html')
@app.route('/api/perms/v1/user/my/asset-groups-assets/')
@app.route('/api/perms/v1/user/nodes-assets/')
def asset_groups_assets():
assets = [
{
......@@ -233,6 +233,16 @@ def replay():
return redirect("http://jps.ilz.me/media/2017-12-24/ec87a486-0344-4f12-b27a-620321944f7f.gz")
@app.route('/i18n/<i18n>')
def i18n(i18n):
return send_file('./i18n/' + i18n + '.json')
def read_file(filename, charset='utf-8'):
with open(filename, 'r') as f:
return f.read().decode(charset)
if __name__ == '__main__':
socketio = SocketIO(app)
socketio.on_namespace(SSHws('/ssh'))
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -13,7 +13,7 @@
"private": true,
"dependencies": {
"@angular/animations": "^5.2.0",
"@angular/cdk": "^5.1.1",
"@angular/cdk": "^5.2.0",
"@angular/common": "5.2.0",
"@angular/compiler": "5.2.0",
"@angular/core": "5.2.0",
......@@ -23,6 +23,7 @@
"@angular/platform-browser": "5.2.0",
"@angular/platform-browser-dynamic": "5.2.0",
"@angular/router": "5.2.0",
"@swimlane/ngx-datatable": "^11.1.7",
"animate.css": "^3.5.2",
"body-parser": "^1.18.2",
"bootstrap": "^4.0.0-beta.3",
......@@ -39,18 +40,18 @@
"jquery-slimscroll": "^1.3.8",
"jquery-sparkline": "^2.4.0",
"jvectormap": "1.2.2",
"lodash": "^4.17.5",
"material-design-icons": "^3.0.1",
"materialize-css": "^0.100.2",
"metismenu": "^2.5.0",
"mstsc.js": "^0.2.4",
"ng2-charts": "^1.5.0",
"ng2-cookies": "^1.0.12",
"ngx-bootstrap": "^1.6.6",
"ngx-cookie-service": "^1.0.10",
"ngx-layer": "0.0.4",
"ngx-logger": "^1.1.2",
"ngx-perfect-scrollbar": "5.2.0",
"ngx-progressbar": "^2.1.1",
"node": "^9.3.0",
"npm": "^5.6.0",
"npm-font-open-sans": "^1.1.0",
"peity": "^3.2.1",
"popper.js": "1.12.9",
......@@ -70,12 +71,10 @@
"@angular-devkit/core": "0.0.28",
"@angular-devkit/schematics": "0.0.42",
"@angular/cli": "^1.6.5",
"@types/jasminewd2": "~2.0.2",
"node-sass": "^4.7.2",
"@angular/compiler-cli": "5.2.0",
"@angular/language-service": "5.2.0",
"@types/jasmine": "2.8.4",
"@types/node": "9.3.0",
"@types/jasminewd2": "~2.0.2",
"codelyzer": "4.0.2",
"jasmine-core": "2.8.0",
"jasmine-spec-reporter": "4.2.1",
......@@ -85,6 +84,7 @@
"karma-coverage-istanbul-reporter": "1.3.3",
"karma-jasmine": "1.1.1",
"karma-jasmine-html-reporter": "0.2.2",
"node-sass": "^4.7.2",
"protractor": "5.2.2",
"ts-node": "3.3.0",
"tslint": "5.9.1",
......
......@@ -3,6 +3,10 @@
"target": "http://127.0.0.1:5000",
"secure": false
},
"/i18n": {
"target": "http://127.0.0.1:5000",
"secure": false
},
"/socket.io/": {
"target": "http://127.0.0.1:5000",
"secure": false
......
......@@ -78,3 +78,10 @@ label {
.fa.fa-undefined:before {
content: "\f26c";
}
.overflow {
height: 100%;
overflow-y: scroll;
position: absolute;
width: 100%;
}
......@@ -4,19 +4,23 @@
title="Search"
type="text" tabindex="1" spellcheck="false" autofocus [(ngModel)]="q" (keyup.enter)="Search(q)">
</div>
<ul class="filetree">
<li *ngFor="let hostGroup of HostGroups | SearchFilter: q; let i = index ">
<input type="checkbox" id="hostgroup-{{i}}">
<label for="hostgroup-{{i}}" matTooltip="{{hostGroup.name}}" [matTooltipPosition]="TooltipPosition">{{hostGroup.name}}</label>
<ul [ngClass]="{'insearch': q }">
<li *ngFor="let host of hostGroup.assets_granted | SearchFilter: q" (click)="Connect(host)"
(contextmenu)="onRightClick($event)" matTooltip="{{host.hostname}}" [matTooltipPosition]="TooltipPosition">
<i class="fa" [ngClass]="'fa-'+(host.platform||'undefined').toLowerCase()" id="fa-{{i}}"></i>
{{host.hostname}}
</li>
</ul>
</li>
</ul>
<div class="overflow">
<ul class="filetree">
<li *ngFor="let hostGroup of HostGroups | SearchFilter: q; let i = index ">
<input type="checkbox" id="hostgroup-{{i}}">
<label for="hostgroup-{{i}}" matTooltip="{{hostGroup.name}}" [matTooltipPosition]="TooltipPosition">{{hostGroup.name}}</label>
<ul [ngClass]="{'insearch': q }">
<li *ngFor="let host of hostGroup.assets_granted | SearchFilter: q" (click)="Connect(host)"
(contextmenu)="onRightClick($event)" matTooltip="{{host.hostname}}"
[matTooltipPosition]="TooltipPosition">
<i class="fa" [ngClass]="'fa-'+(host.platform||'undefined').toLowerCase()" id="fa-{{i}}"></i>
{{host.hostname}}
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="footer">
Version <strong>{{version}}</strong>
......
......@@ -12,13 +12,11 @@ import {AppService, HttpService, LogService} from '../../app.service';
import {SearchComponent} from '../search/search.component';
import {DataStore} from '../../globals';
import {version} from '../../../environments/environment';
import * as jQuery from 'jquery/dist/jquery.min.js';
import {ElementServerMenuComponent} from '../../elements/server-menu/server-menu.component';
import {NavList, View} from '../control/control.component';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material';
import {logger} from 'codelyzer/util/logger';
import {selector} from 'rxjs/operator/publish';
import {FormControl, Validators} from '@angular/forms';
import {DialogService} from '../../elements/dialog/dialog.service';
export interface HostGroup {
......@@ -56,7 +54,7 @@ export class CleftbarComponent implements OnInit {
DataStore.leftbarshow = false;
DataStore.Nav.map(function (value, i) {
value['children'].forEach((v, key) => {
if (DataStore.Nav[i]['children'][key]['id'] === 'HindLeftManager') {
if (DataStore.Nav[i]['children'][key]['id'] === 'HideLeftManager') {
DataStore.Nav[i]['children'][key] = {
'id': 'ShowLeftManager',
'click': 'ShowLeft',
......@@ -73,9 +71,9 @@ export class CleftbarComponent implements OnInit {
value['children'].forEach((v, key) => {
if (DataStore.Nav[i]['children'][key]['id'] === 'ShowLeftManager') {
DataStore.Nav[i]['children'][key] = {
'id': 'HindLeftManager',
'id': 'HideLeftManager',
'click': 'HideLeft',
'name': 'Hind left manager'
'name': 'Hide left manager'
};
}
});
......@@ -87,7 +85,8 @@ export class CleftbarComponent implements OnInit {
private _search: SearchComponent,
private _logger: LogService,
private _menu: ElementServerMenuComponent,
public _dialog: MatDialog) {
public _dialog: MatDialog,
private _layer: DialogService) {
this._logger.log('nav.ts:NavComponent');
// this._appService.getnav()
}
......@@ -96,25 +95,43 @@ export class CleftbarComponent implements OnInit {
this._http.get_my_asset_groups_assets()
.subscribe(response => {
this.HostGroups = response;
this.autologin();
if (!DataStore.autologin) {
this.autologin();
}
});
}
autologin() {
const id = this._appService.getQueryString('id');
if (id) {
const asset_id = this._appService.getQueryString('asset_id');
const user_id = this._appService.getQueryString('user_id');
let tag = false;
if (asset_id) {
for (let g of this.HostGroups) {
if (g['assets_granted']) {
g['assets_granted'].forEach((v, k) => {
if (v.id.toSource() === id.toString()) {
this.Connect(v);
return;
for (let host of g['assets_granted']) {
if (host.id.toString() === asset_id) {
if (user_id) {
host['system_users_granted'].forEach((user, kk) => {
if (user.id.toString() === user_id.toString()) {
this.login(host, user);
tag = true;
return;
}
});
} else {
this.Connect(host);
tag = true;
return;
}
}
});
}
}
}
if (!tag) {
this._layer.alert('Maybe you do not have permission on that host');
}
}
DataStore.autologin = true;
}
Connect(host) {
......@@ -125,7 +142,7 @@ export class CleftbarComponent implements OnInit {
if (user) {
this.login(host, user);
} else {
const dialogRef = this._dialog.open(CleftbarComponentDialog, {
const dialogRef = this._dialog.open(CleftbarDialogComponent, {
height: '200px',
width: '300px',
data: {users: host.system_users_granted}
......@@ -169,7 +186,7 @@ export class CleftbarComponent implements OnInit {
}
checkPriority(sysUsers) {
let priority: number = -1;
let priority = -1;
let user: any;
for (const u of sysUsers) {
if (u.priority > priority) {
......@@ -199,11 +216,11 @@ export class CleftbarComponent implements OnInit {
selector: 'app-cleftbar-dialog',
templateUrl: 'dialog.html',
})
export class CleftbarComponentDialog implements OnInit {
export class CleftbarDialogComponent implements OnInit {
UserSelectControl = new FormControl('', [Validators.required]);
selected: any;
constructor(public dialogRef: MatDialogRef<CleftbarComponentDialog>,
constructor(public dialogRef: MatDialogRef<CleftbarDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private _logger: LogService) {
}
......
......@@ -19,6 +19,7 @@ import {TermPageComponent} from './term-page/term-page.component';
import {ElementServerMenuComponent} from './elements/server-menu/server-menu.component';
import {BlankPageComponent} from './blank-page/blank-page.component';
import {TestPageComponent} from './test-page/test-page.component';
import {SettingPageComponent} from './setting-page/setting-page.component';
const appRoutes: Routes = [
// {path: 'users/login', component: LoginComponent},
......@@ -27,6 +28,7 @@ const appRoutes: Routes = [
{path: 'replay/:token', component: ReplayPageComponent},
{path: 'monitor/:token', component: MonitorPageComponent},
{path: 'test', component: TestPageComponent},
{path: 'setting', component: SettingPageComponent},
{path: 'undefined', component: BlankPageComponent},
{path: '', component: ControlPageComponent},
{path: '**', component: NotFoundComponent}
......
......@@ -6,14 +6,12 @@
* @author liuzheng <liuzheng712@gmail.com>
*/
import {Component} from '@angular/core';
import {AppService, HttpService} from './app.service';
import {DataStore} from './globals';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
// directives: [LeftbarComponent, TermComponent]
})
export class AppComponent {
......
......@@ -17,8 +17,8 @@ import {AppComponent} from './app.component';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
// service
import {AppService, HttpService, LogService, UUIDService} from './app.service';
import {DialogService} from './elements/dialog/dialog.service';
import {AppService, HttpService, LocalStorageService, LogService, UUIDService} from './app.service';
import {DialogService, ElementDialogAlertComponent} from './elements/dialog/dialog.service';
// Elements
import {ElementFooterComponent} from './elements/footer/footer.component';
......@@ -33,7 +33,7 @@ import {ElementIframeComponent} from './elements/iframe/iframe.component';
import {LoginComponent} from './BasicPage/login/login.component';
import {IleftbarComponent} from './IndexPage/ileftbar/ileftbar.component';
import {SearchComponent, SearchFilter} from './ControlPage/search/search.component';
import {CleftbarComponent, CleftbarComponentDialog} from './ControlPage/cleftbar/cleftbar.component';
import {CleftbarComponent, CleftbarDialogComponent} from './ControlPage/cleftbar/cleftbar.component';
import {ControlComponent} from './ControlPage/control/control.component';
import {ControlnavComponent} from './ControlPage/control/controlnav/controlnav.component';
import {ControlPageComponent} from './ControlPage/controlpage.component';
......@@ -49,9 +49,22 @@ import {MonitorPageComponent} from './monitor-page/monitor-page.component';
import {LinuxComponent} from './monitor-page/linux/linux.component';
import {WindowsComponent} from './monitor-page/windows/windows.component';
import {NgProgressModule} from 'ngx-progressbar';
import {TestPageComponent, TestPageComponentDialog} from './test-page/test-page.component';
import {TestPageComponent} from './test-page/test-page.component';
import {BlankPageComponent} from './blank-page/blank-page.component';
import {MaterialModule} from './MaterialModule.component';
import {CookieService} from 'ngx-cookie-service';
import {NgxDatatableModule} from '@swimlane/ngx-datatable';
import {ElementTableComponent} from './elements/table/table.component';
import {SettingPageComponent} from './setting-page/setting-page.component';
import {ElementLeftbarComponent} from './elements/leftbar/leftbar.component';
import {ElementOfooterComponent} from './elements/ofooter/ofooter.component';
import {SettingPageBasicComponent} from './setting-page/basic/basic.component';
import {SettingPageEmailComponent} from './setting-page/email/email.component';
import {SettingPageLdapComponent} from './setting-page/ldap/ldap.component';
import {SettingPageTerminalComponent} from './setting-page/terminal/terminal.component';
import {SettingPageS3Component} from './setting-page/s3/s3.component';
import {TransPipe} from './trans.pipe';
import {MAT_LABEL_GLOBAL_OPTIONS} from '@angular/material';
@NgModule({
imports: [
......@@ -64,7 +77,7 @@ import {MaterialModule} from './MaterialModule.component';
ReactiveFormsModule,
MaterialModule,
LoggerModule.forRoot({serverLoggingUrl: '/api/logs', level: NgxLoggerLevel.DEBUG, serverLogLevel: NgxLoggerLevel.ERROR}),
// NgxLayerModule
NgxDatatableModule
],
declarations: [
AppComponent,
......@@ -76,11 +89,15 @@ import {MaterialModule} from './MaterialModule.component';
ElementRdpComponent,
ElementServerMenuComponent,
ElementIframeComponent,
ElementDialogAlertComponent,
ElementTableComponent,
ElementLeftbarComponent,
ElementOfooterComponent,
LoginComponent,
SearchComponent,
SearchFilter,
IleftbarComponent,
CleftbarComponent, CleftbarComponentDialog,
CleftbarComponent, CleftbarDialogComponent,
ControlComponent,
ControlnavComponent,
ControlPageComponent,
......@@ -95,12 +112,19 @@ import {MaterialModule} from './MaterialModule.component';
MonitorPageComponent,
LinuxComponent,
WindowsComponent,
TestPageComponent, TestPageComponentDialog,
TestPageComponent,
BlankPageComponent,
SettingPageComponent,
SettingPageBasicComponent,
SettingPageEmailComponent,
SettingPageLdapComponent,
SettingPageTerminalComponent,
SettingPageS3Component,
TransPipe,
],
entryComponents: [
CleftbarComponentDialog,
TestPageComponentDialog
CleftbarDialogComponent,
ElementDialogAlertComponent,
],
bootstrap: [AppComponent],
providers: [
......@@ -110,8 +134,12 @@ import {MaterialModule} from './MaterialModule.component';
HttpService,
LogService,
UUIDService,
LocalStorageService,
DialogService,
NGXLogger
CookieService,
NGXLogger,
{provide: MAT_LABEL_GLOBAL_OPTIONS, useValue: {float: 'always'}}
]
})
export class AppModule {
......
......@@ -7,10 +7,10 @@
*/
import {Injectable, OnInit} from '@angular/core';
import {Router} from '@angular/router';
// import {Cookie} from 'ng2-cookies/ng2-cookies';
import {CookieService} from 'ngx-cookie-service';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
import {DataStore, User, Browser} from './globals';
import {DataStore, User, Browser, i18n} from './globals';
import {environment} from '../environments/environment';
import {HttpClient, HttpHeaders, HttpParams} from '@angular/common/http';
import {NGXLogger} from 'ngx-logger';
......@@ -67,7 +67,7 @@ export class HttpService {
}
get_my_asset_groups_assets() {
return this.http.get<Array<HostGroup>>('/api/perms/v1/user/my/asset-groups-assets/');
return this.http.get<Array<HostGroup>>('/api/perms/v1/user/nodes-assets/');
}
get_guacamole_token(username: string, assetID: string, systemUserID: string) {
......@@ -76,7 +76,9 @@ export class HttpService {
.set('password', 'jumpserver')
.set('asset_id', assetID)
.set('system_user_id', systemUserID);
return this.http.post('/guacamole/api/tokens', body.toString(), {headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')});
return this.http.post('/guacamole/api/tokens',
body.toString(),
{headers: new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')});
}
search(q: string) {
......@@ -135,37 +137,76 @@ export class LogService {
}
@Injectable()
export class LocalStorageService {
constructor() {
}
get(key: string): string {
return localStorage.getItem(key);
}
set(key: string, value: any) {
return localStorage.setItem(key, value);
}
}
@Injectable()
export class AppService implements OnInit {
// user:User = user ;
lang: string;
constructor(private _http: HttpService,
private _router: Router,
private _logger: LogService) {
// if (Cookie.get('loglevel')) {
// // 0.- Level.OFF
// // 1.- Level.ERROR
// // 2.- Level.WARN
// // 3.- Level.INFO
// // 4.- Level.DEBUG
// // 5.- Level.LOG
// this._logger.level = parseInt(Cookie.get('loglevel'), 10);
// // this._logger.debug('Your debug stuff');
// // this._logger.info('An info');
// // this._logger.warn('Take care ');
// // this._logger.error('Too late !');
// // this._logger.log('log !');
// } else {
// Cookie.set('loglevel', '0', 99, '/', document.domain);
// // this._logger.level = parseInt(Cookie.getCookie('loglevel'));
// this._logger.level = 0;
// }
private _logger: LogService,
private _cookie: CookieService,
private _localStorage: LocalStorageService) {
if (this._cookie.get('loglevel')) {
// 0.- Level.OFF
// 1.- Level.ERROR
// 2.- Level.WARN
// 3.- Level.INFO
// 4.- Level.DEBUG
// 5.- Level.LOG
this._logger.level = parseInt(this._cookie.get('loglevel'), 10);
// this._logger.debug('Your debug stuff');
// this._logger.info('An info');
// this._logger.warn('Take care ');
// this._logger.error('Too late !');
// this._logger.log('log !');
} else {
this._cookie.set('loglevel', '0', 99, '/', document.domain);
// this._logger.level = parseInt(Cookie.getCookie('loglevel'));
this._logger.level = 0;
}
if (environment.production) {
this._logger.level = 2;
this.checklogin();
}
// this._logger
// .debug(this._http.get_user_profile());
if (this._cookie.get('lang')) {
this.lang = this._cookie.get('lang');
} else {
this.lang = window.navigator.languages ? window.navigator.languages[0] : 'cn';
this._cookie.set('lang', this.lang);
}
if (this.lang !== 'en') {
this._http.get('/i18n/' + this.lang).subscribe(
data => {
this._localStorage.set('lang', JSON.stringify(data));
}
);
}
const l = this._localStorage.get('lang');
if (l) {
const data = JSON.parse(l);
Object.keys(data).forEach((k, _) => {
i18n.set(k, data[k]);
});
}
}
ngOnInit() {
......@@ -252,7 +293,7 @@ export class AppService implements OnInit {
//
// DataStore.Nav.map(function (value, i) {
// for (var ii in value['children']) {
// if (DataStore.Nav[i]['children'][ii]['id'] === 'HindLeftManager') {
// if (DataStore.Nav[i]['children'][ii]['id'] === 'HideLeftManager') {
// DataStore.Nav[i]['children'][ii] = {
// 'id': 'ShowLeftManager',
// 'click': 'ShowLeft',
......@@ -271,9 +312,9 @@ export class AppService implements OnInit {
// for (var ii in value['children']) {
// if (DataStore.Nav[i]['children'][ii]['id'] === 'ShowLeftManager') {
// DataStore.Nav[i]['children'][ii] = {
// 'id': 'HindLeftManager',
// 'id': 'HideLeftManager',
// 'click': 'HideLeft',
// 'name': 'Hind left manager'
// 'name': 'Hide left manager'
// };
// }
// }
......@@ -374,3 +415,4 @@ export class UUIDService {
return UUID.create()['hex'];
}
}
<div class="alert">
<h1 mat-dialog-title>Alert</h1>
<p>{{data.msg}}</p>
<button mat-raised-button (click)="onNoClick()">Close</button>
</div>
h1 {
border-bottom: 1px solid #eee;
width: 100%;
}
button {
float: right;
bottom: 0;
}
.alert {
height: 100%;
}
import {Injectable} from '@angular/core';
import {Component, Inject, Injectable, OnInit} from '@angular/core';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material';
import {LogService} from '../../app.service';
import {FormControl, Validators} from '@angular/forms';
// import * as layer from 'layui-layer/src/layer.js';
@Injectable()
export class DialogService {
constructor() {
constructor(public _dialog: MatDialog) {
}
open(options: any) {
......@@ -24,11 +28,33 @@ export class DialogService {
loading() {
}
alert() {
// alert('sss');
alert(msg: string) {
this._dialog.open(ElementDialogAlertComponent, {
height: '200px',
width: '300px',
data: {msg: msg}
});
}
close(index: any) {
// layer.close(index);
}
}
@Component({
selector: 'app-alert',
templateUrl: 'alert.html',
styleUrls: ['./alert.scss']
})
export class ElementDialogAlertComponent {
constructor(public dialogRef: MatDialogRef<ElementDialogAlertComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
private _logger: LogService) {
}
onNoClick(): void {
this.dialogRef.close();
}
}
/**
@Name:layer v3.1.0 Web弹层组件
@Author:贤心
@Site:http://layer.layui.com
@License:MIT
*/
;!function(window, undefined){
"use strict";
var isLayui = window.layui && layui.define, $, win, ready = {
getPath: function(){
var js = document.scripts, script = js[js.length - 1], jsPath = script.src;
if(script.getAttribute('merge')) return;
return jsPath.substring(0, jsPath.lastIndexOf("/") + 1);
}(),
config: {}, end: {}, minIndex: 0, minLeft: [],
btn: ['&#x786E;&#x5B9A;', '&#x53D6;&#x6D88;'],
//五种原始层模式
type: ['dialog', 'page', 'iframe', 'loading', 'tips'],
//获取节点的style属性值
getStyle: function(node, name){
var style = node.currentStyle ? node.currentStyle : window.getComputedStyle(node, null);
return style[style.getPropertyValue ? 'getPropertyValue' : 'getAttribute'](name);
},
//载入CSS配件
link: function(href, fn, cssname){
//未设置路径,则不主动加载css
if(!layer.path) return;
var head = document.getElementsByTagName("head")[0], link = document.createElement('link');
if(typeof fn === 'string') cssname = fn;
var app = (cssname || href).replace(/\.|\//g, '');
var id = 'layuicss-'+ app, timeout = 0;
link.rel = 'stylesheet';
link.href = layer.path + href;
link.id = id;
if(!document.getElementById(id)){
head.appendChild(link);
}
if(typeof fn !== 'function') return;
//轮询css是否加载完毕
(function poll() {
if(++timeout > 8 * 1000 / 100){
return window.console && console.error('layer.css: Invalid');
};
parseInt(ready.getStyle(document.getElementById(id), 'width')) === 1989 ? fn() : setTimeout(poll, 100);
}());
}
};
//默认内置方法。
var layer = {
v: '3.1.0',
ie: function(){ //ie版本
var agent = navigator.userAgent.toLowerCase();
return (!!window.ActiveXObject || "ActiveXObject" in window) ? (
(agent.match(/msie\s(\d+)/) || [])[1] || '11' //由于ie11并没有msie的标识
) : false;
}(),
index: (window.layer && window.layer.v) ? 100000 : 0,
path: ready.getPath,
config: function(options, fn){
options = options || {};
layer.cache = ready.config = $.extend({}, ready.config, options);
layer.path = ready.config.path || layer.path;
typeof options.extend === 'string' && (options.extend = [options.extend]);
if(ready.config.path) layer.ready();
if(!options.extend) return this;
isLayui
? layui.addcss('modules/layer/' + options.extend)
: ready.link('theme/' + options.extend);
return this;
},
//主体CSS等待事件
ready: function(callback){
var cssname = 'layer', ver = ''
,path = (isLayui ? 'modules/layer/' : 'theme/') + 'default/layer.css?v='+ layer.v + ver;
isLayui ? layui.addcss(path, callback, cssname) : ready.link(path, callback, cssname);
return this;
},
//各种快捷引用
alert: function(content, options, yes){
var type = typeof options === 'function';
if(type) yes = options;
return layer.open($.extend({
content: content,
yes: yes
}, type ? {} : options));
},
confirm: function(content, options, yes, cancel){
var type = typeof options === 'function';
if(type){
cancel = yes;
yes = options;
}
return layer.open($.extend({
content: content,
btn: ready.btn,
yes: yes,
btn2: cancel
}, type ? {} : options));
},
msg: function(content, options, end){ //最常用提示层
var type = typeof options === 'function', rskin = ready.config.skin;
var skin = (rskin ? rskin + ' ' + rskin + '-msg' : '')||'layui-layer-msg';
var anim = doms.anim.length - 1;
if(type) end = options;
return layer.open($.extend({
content: content,
time: 3000,
shade: false,
skin: skin,
title: false,
closeBtn: false,
btn: false,
resize: false,
end: end
}, (type && !ready.config.skin) ? {
skin: skin + ' layui-layer-hui',
anim: anim
} : function(){
options = options || {};
if(options.icon === -1 || options.icon === undefined && !ready.config.skin){
options.skin = skin + ' ' + (options.skin||'layui-layer-hui');
}
return options;
}()));
},
load: function(icon, options){
return layer.open($.extend({
type: 3,
icon: icon || 0,
resize: false,
shade: 0.01
}, options));
},
tips: function(content, follow, options){
return layer.open($.extend({
type: 4,
content: [content, follow],
closeBtn: false,
time: 3000,
shade: false,
resize: false,
fixed: false,
maxWidth: 210
}, options));
}
};
var Class = function(setings){
var that = this;
that.index = ++layer.index;
that.config = $.extend({}, that.config, ready.config, setings);
document.body ? that.creat() : setTimeout(function(){
that.creat();
}, 30);
};
Class.pt = Class.prototype;
//缓存常用字符
var doms = ['layui-layer', '.layui-layer-title', '.layui-layer-main', '.layui-layer-dialog', 'layui-layer-iframe', 'layui-layer-content', 'layui-layer-btn', 'layui-layer-close'];
doms.anim = ['layer-anim-00', 'layer-anim-01', 'layer-anim-02', 'layer-anim-03', 'layer-anim-04', 'layer-anim-05', 'layer-anim-06'];
//默认配置
Class.pt.config = {
type: 0,
shade: 0.3,
fixed: true,
move: doms[1],
title: '&#x4FE1;&#x606F;',
offset: 'auto',
area: 'auto',
closeBtn: 1,
time: 0, //0表示不自动关闭
zIndex: 19891014,
maxWidth: 360,
anim: 0,
isOutAnim: true,
icon: -1,
moveType: 1,
resize: true,
scrollbar: true, //是否允许浏览器滚动条
tips: 2
};
//容器
Class.pt.vessel = function(conType, callback){
var that = this, times = that.index, config = that.config;
var zIndex = config.zIndex + times, titype = typeof config.title === 'object';
var ismax = config.maxmin && (config.type === 1 || config.type === 2);
var titleHTML = (config.title ? '<div class="layui-layer-title" style="'+ (titype ? config.title[1] : '') +'">'
+ (titype ? config.title[0] : config.title)
+ '</div>' : '');
config.zIndex = zIndex;
callback([
//遮罩
config.shade ? ('<div class="layui-layer-shade" id="layui-layer-shade'+ times +'" times="'+ times +'" style="'+ ('z-index:'+ (zIndex-1) +'; ') +'"></div>') : '',
//主体
'<div class="'+ doms[0] + (' layui-layer-'+ready.type[config.type]) + (((config.type == 0 || config.type == 2) && !config.shade) ? ' layui-layer-border' : '') + ' ' + (config.skin||'') +'" id="'+ doms[0] + times +'" type="'+ ready.type[config.type] +'" times="'+ times +'" showtime="'+ config.time +'" conType="'+ (conType ? 'object' : 'string') +'" style="z-index: '+ zIndex +'; width:'+ config.area[0] + ';height:' + config.area[1] + (config.fixed ? '' : ';position:absolute;') +'">'
+ (conType && config.type != 2 ? '' : titleHTML)
+ '<div id="'+ (config.id||'') +'" class="layui-layer-content'+ ((config.type == 0 && config.icon !== -1) ? ' layui-layer-padding' :'') + (config.type == 3 ? ' layui-layer-loading'+config.icon : '') +'">'
+ (config.type == 0 && config.icon !== -1 ? '<i class="layui-layer-ico layui-layer-ico'+ config.icon +'"></i>' : '')
+ (config.type == 1 && conType ? '' : (config.content||''))
+ '</div>'
+ '<span class="layui-layer-setwin">'+ function(){
var closebtn = ismax ? '<a class="layui-layer-min" href="javascript:;"><cite></cite></a><a class="layui-layer-ico layui-layer-max" href="javascript:;"></a>' : '';
config.closeBtn && (closebtn += '<a class="layui-layer-ico '+ doms[7] +' '+ doms[7] + (config.title ? config.closeBtn : (config.type == 4 ? '1' : '2')) +'" href="javascript:;"></a>');
return closebtn;
}() + '</span>'
+ (config.btn ? function(){
var button = '';
typeof config.btn === 'string' && (config.btn = [config.btn]);
for(var i = 0, len = config.btn.length; i < len; i++){
button += '<a class="'+ doms[6] +''+ i +'">'+ config.btn[i] +'</a>'
}
return '<div class="'+ doms[6] +' layui-layer-btn-'+ (config.btnAlign||'') +'">'+ button +'</div>'
}() : '')
+ (config.resize ? '<span class="layui-layer-resize"></span>' : '')
+ '</div>'
], titleHTML, $('<div class="layui-layer-move"></div>'));
return that;
};
//创建骨架
Class.pt.creat = function(){
var that = this
,config = that.config
,times = that.index, nodeIndex
,content = config.content
,conType = typeof content === 'object'
,body = $('body');
if(config.id && $('#'+config.id)[0]) return;
if(typeof config.area === 'string'){
config.area = config.area === 'auto' ? ['', ''] : [config.area, ''];
}
//anim兼容旧版shift
if(config.shift){
config.anim = config.shift;
}
if(layer.ie == 6){
config.fixed = false;
}
switch(config.type){
case 0:
config.btn = ('btn' in config) ? config.btn : ready.btn[0];
layer.closeAll('dialog');
break;
case 2:
var content = config.content = conType ? config.content : [config.content||'http://layer.layui.com', 'auto'];
config.content = '<iframe scrolling="'+ (config.content[1]||'auto') +'" allowtransparency="true" id="'+ doms[4] +''+ times +'" name="'+ doms[4] +''+ times +'" onload="this.className=\'\';" class="layui-layer-load" frameborder="0" src="' + config.content[0] + '"></iframe>';
break;
case 3:
delete config.title;
delete config.closeBtn;
config.icon === -1 && (config.icon === 0);
layer.closeAll('loading');
break;
case 4:
conType || (config.content = [config.content, 'body']);
config.follow = config.content[1];
config.content = config.content[0] + '<i class="layui-layer-TipsG"></i>';
delete config.title;
config.tips = typeof config.tips === 'object' ? config.tips : [config.tips, true];
config.tipsMore || layer.closeAll('tips');
break;
}
//建立容器
that.vessel(conType, function(html, titleHTML, moveElem){
body.append(html[0]);
conType ? function(){
(config.type == 2 || config.type == 4) ? function(){
$('body').append(html[1]);
}() : function(){
if(!content.parents('.'+doms[0])[0]){
content.data('display', content.css('display')).show().addClass('layui-layer-wrap').wrap(html[1]);
$('#'+ doms[0] + times).find('.'+doms[5]).before(titleHTML);
}
}();
}() : body.append(html[1]);
$('.layui-layer-move')[0] || body.append(ready.moveElem = moveElem);
that.layero = $('#'+ doms[0] + times);
config.scrollbar || doms.html.css('overflow', 'hidden').attr('layer-full', times);
}).auto(times);
//遮罩
$('#layui-layer-shade'+ that.index).css({
'background-color': config.shade[1] || '#000'
,'opacity': config.shade[0]||config.shade
});
config.type == 2 && layer.ie == 6 && that.layero.find('iframe').attr('src', content[0]);
//坐标自适应浏览器窗口尺寸
config.type == 4 ? that.tips() : that.offset();
if(config.fixed){
win.on('resize', function(){
that.offset();
(/^\d+%$/.test(config.area[0]) || /^\d+%$/.test(config.area[1])) && that.auto(times);
config.type == 4 && that.tips();
});
}
config.time <= 0 || setTimeout(function(){
layer.close(that.index)
}, config.time);
that.move().callback();
//为兼容jQuery3.0的css动画影响元素尺寸计算
if(doms.anim[config.anim]){
var animClass = 'layer-anim '+ doms.anim[config.anim];
that.layero.addClass(animClass).one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){
$(this).removeClass(animClass);
});
};
//记录关闭动画
if(config.isOutAnim){
that.layero.data('isOutAnim', true);
}
};
//自适应
Class.pt.auto = function(index){
var that = this, config = that.config, layero = $('#'+ doms[0] + index);
if(config.area[0] === '' && config.maxWidth > 0){
//为了修复IE7下一个让人难以理解的bug
if(layer.ie && layer.ie < 8 && config.btn){
layero.width(layero.innerWidth());
}
layero.outerWidth() > config.maxWidth && layero.width(config.maxWidth);
}
var area = [layero.innerWidth(), layero.innerHeight()]
,titHeight = layero.find(doms[1]).outerHeight() || 0
,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
,setHeight = function(elem){
elem = layero.find(elem);
elem.height(area[1] - titHeight - btnHeight - 2*(parseFloat(elem.css('padding-top'))|0));
};
switch(config.type){
case 2:
setHeight('iframe');
break;
default:
if(config.area[1] === ''){
if(config.maxHeight > 0 && layero.outerHeight() > config.maxHeight){
area[1] = config.maxHeight;
setHeight('.'+doms[5]);
} else if(config.fixed && area[1] >= win.height()){
area[1] = win.height();
setHeight('.'+doms[5]);
}
} else {
setHeight('.'+doms[5]);
}
break;
};
return that;
};
//计算坐标
Class.pt.offset = function(){
var that = this, config = that.config, layero = that.layero;
var area = [layero.outerWidth(), layero.outerHeight()];
var type = typeof config.offset === 'object';
that.offsetTop = (win.height() - area[1])/2;
that.offsetLeft = (win.width() - area[0])/2;
if(type){
that.offsetTop = config.offset[0];
that.offsetLeft = config.offset[1]||that.offsetLeft;
} else if(config.offset !== 'auto'){
if(config.offset === 't'){ //上
that.offsetTop = 0;
} else if(config.offset === 'r'){ //右
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'b'){ //下
that.offsetTop = win.height() - area[1];
} else if(config.offset === 'l'){ //左
that.offsetLeft = 0;
} else if(config.offset === 'lt'){ //左上角
that.offsetTop = 0;
that.offsetLeft = 0;
} else if(config.offset === 'lb'){ //左下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = 0;
} else if(config.offset === 'rt'){ //右上角
that.offsetTop = 0;
that.offsetLeft = win.width() - area[0];
} else if(config.offset === 'rb'){ //右下角
that.offsetTop = win.height() - area[1];
that.offsetLeft = win.width() - area[0];
} else {
that.offsetTop = config.offset;
}
}
if(!config.fixed){
that.offsetTop = /%$/.test(that.offsetTop) ?
win.height()*parseFloat(that.offsetTop)/100
: parseFloat(that.offsetTop);
that.offsetLeft = /%$/.test(that.offsetLeft) ?
win.width()*parseFloat(that.offsetLeft)/100
: parseFloat(that.offsetLeft);
that.offsetTop += win.scrollTop();
that.offsetLeft += win.scrollLeft();
}
if(layero.attr('minLeft')){
that.offsetTop = win.height() - (layero.find(doms[1]).outerHeight() || 0);
that.offsetLeft = layero.css('left');
}
layero.css({top: that.offsetTop, left: that.offsetLeft});
};
//Tips
Class.pt.tips = function(){
var that = this, config = that.config, layero = that.layero;
var layArea = [layero.outerWidth(), layero.outerHeight()], follow = $(config.follow);
if(!follow[0]) follow = $('body');
var goal = {
width: follow.outerWidth(),
height: follow.outerHeight(),
top: follow.offset().top,
left: follow.offset().left
}, tipsG = layero.find('.layui-layer-TipsG');
var guide = config.tips[0];
config.tips[1] || tipsG.remove();
goal.autoLeft = function(){
if(goal.left + layArea[0] - win.width() > 0){
goal.tipLeft = goal.left + goal.width - layArea[0];
tipsG.css({right: 12, left: 'auto'});
} else {
goal.tipLeft = goal.left;
};
};
//辨别tips的方位
goal.where = [function(){ //上
goal.autoLeft();
goal.tipTop = goal.top - layArea[1] - 10;
tipsG.removeClass('layui-layer-TipsB').addClass('layui-layer-TipsT').css('border-right-color', config.tips[1]);
}, function(){ //右
goal.tipLeft = goal.left + goal.width + 10;
goal.tipTop = goal.top;
tipsG.removeClass('layui-layer-TipsL').addClass('layui-layer-TipsR').css('border-bottom-color', config.tips[1]);
}, function(){ //下
goal.autoLeft();
goal.tipTop = goal.top + goal.height + 10;
tipsG.removeClass('layui-layer-TipsT').addClass('layui-layer-TipsB').css('border-right-color', config.tips[1]);
}, function(){ //左
goal.tipLeft = goal.left - layArea[0] - 10;
goal.tipTop = goal.top;
tipsG.removeClass('layui-layer-TipsR').addClass('layui-layer-TipsL').css('border-bottom-color', config.tips[1]);
}];
goal.where[guide-1]();
/* 8*2为小三角形占据的空间 */
if(guide === 1){
goal.top - (win.scrollTop() + layArea[1] + 8*2) < 0 && goal.where[2]();
} else if(guide === 2){
win.width() - (goal.left + goal.width + layArea[0] + 8*2) > 0 || goal.where[3]()
} else if(guide === 3){
(goal.top - win.scrollTop() + goal.height + layArea[1] + 8*2) - win.height() > 0 && goal.where[0]();
} else if(guide === 4){
layArea[0] + 8*2 - goal.left > 0 && goal.where[1]()
}
layero.find('.'+doms[5]).css({
'background-color': config.tips[1],
'padding-right': (config.closeBtn ? '30px' : '')
});
layero.css({
left: goal.tipLeft - (config.fixed ? win.scrollLeft() : 0),
top: goal.tipTop - (config.fixed ? win.scrollTop() : 0)
});
}
//拖拽层
Class.pt.move = function(){
var that = this
,config = that.config
,_DOC = $(document)
,layero = that.layero
,moveElem = layero.find(config.move)
,resizeElem = layero.find('.layui-layer-resize')
,dict = {};
if(config.move){
moveElem.css('cursor', 'move');
}
moveElem.on('mousedown', function(e){
e.preventDefault();
if(config.move){
dict.moveStart = true;
dict.offset = [
e.clientX - parseFloat(layero.css('left'))
,e.clientY - parseFloat(layero.css('top'))
];
ready.moveElem.css('cursor', 'move').show();
}
});
resizeElem.on('mousedown', function(e){
e.preventDefault();
dict.resizeStart = true;
dict.offset = [e.clientX, e.clientY];
dict.area = [
layero.outerWidth()
,layero.outerHeight()
];
ready.moveElem.css('cursor', 'se-resize').show();
});
_DOC.on('mousemove', function(e){
//拖拽移动
if(dict.moveStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1]
,fixed = layero.css('position') === 'fixed';
e.preventDefault();
dict.stX = fixed ? 0 : win.scrollLeft();
dict.stY = fixed ? 0 : win.scrollTop();
//控制元素不被拖出窗口外
if(!config.moveOut){
var setRig = win.width() - layero.outerWidth() + dict.stX
,setBot = win.height() - layero.outerHeight() + dict.stY;
X < dict.stX && (X = dict.stX);
X > setRig && (X = setRig);
Y < dict.stY && (Y = dict.stY);
Y > setBot && (Y = setBot);
}
layero.css({
left: X
,top: Y
});
}
//Resize
if(config.resize && dict.resizeStart){
var X = e.clientX - dict.offset[0]
,Y = e.clientY - dict.offset[1];
e.preventDefault();
layer.style(that.index, {
width: dict.area[0] + X
,height: dict.area[1] + Y
})
dict.isResize = true;
config.resizing && config.resizing(layero);
}
}).on('mouseup', function(e){
if(dict.moveStart){
delete dict.moveStart;
ready.moveElem.hide();
config.moveEnd && config.moveEnd(layero);
}
if(dict.resizeStart){
delete dict.resizeStart;
ready.moveElem.hide();
}
});
return that;
};
Class.pt.callback = function(){
var that = this, layero = that.layero, config = that.config;
that.openLayer();
if(config.success){
if(config.type == 2){
layero.find('iframe').on('load', function(){
config.success(layero, that.index);
});
} else {
config.success(layero, that.index);
}
}
layer.ie == 6 && that.IE6(layero);
//按钮
layero.find('.'+ doms[6]).children('a').on('click', function(){
var index = $(this).index();
if(index === 0){
if(config.yes){
config.yes(that.index, layero)
} else if(config['btn1']){
config['btn1'](that.index, layero)
} else {
layer.close(that.index);
}
} else {
var close = config['btn'+(index+1)] && config['btn'+(index+1)](that.index, layero);
close === false || layer.close(that.index);
}
});
//取消
function cancel(){
var close = config.cancel && config.cancel(that.index, layero);
close === false || layer.close(that.index);
}
//右上角关闭回调
layero.find('.'+ doms[7]).on('click', cancel);
//点遮罩关闭
if(config.shadeClose){
$('#layui-layer-shade'+ that.index).on('click', function(){
layer.close(that.index);
});
}
//最小化
layero.find('.layui-layer-min').on('click', function(){
var min = config.min && config.min(layero);
min === false || layer.min(that.index, config);
});
//全屏/还原
layero.find('.layui-layer-max').on('click', function(){
if($(this).hasClass('layui-layer-maxmin')){
layer.restore(that.index);
config.restore && config.restore(layero);
} else {
layer.full(that.index, config);
setTimeout(function(){
config.full && config.full(layero);
}, 100);
}
});
config.end && (ready.end[that.index] = config.end);
};
//for ie6 恢复select
ready.reselect = function(){
$.each($('select'), function(index , value){
var sthis = $(this);
if(!sthis.parents('.'+doms[0])[0]){
(sthis.attr('layer') == 1 && $('.'+doms[0]).length < 1) && sthis.removeAttr('layer').show();
}
sthis = null;
});
};
Class.pt.IE6 = function(layero){
//隐藏select
$('select').each(function(index , value){
var sthis = $(this);
if(!sthis.parents('.'+doms[0])[0]){
sthis.css('display') === 'none' || sthis.attr({'layer' : '1'}).hide();
}
sthis = null;
});
};
//需依赖原型的对外方法
Class.pt.openLayer = function(){
var that = this;
//置顶当前窗口
layer.zIndex = that.config.zIndex;
layer.setTop = function(layero){
var setZindex = function(){
layer.zIndex++;
layero.css('z-index', layer.zIndex + 1);
};
layer.zIndex = parseInt(layero[0].style.zIndex);
layero.on('mousedown', setZindex);
return layer.zIndex;
};
};
ready.record = function(layero){
var area = [
layero.width(),
layero.height(),
layero.position().top,
layero.position().left + parseFloat(layero.css('margin-left'))
];
layero.find('.layui-layer-max').addClass('layui-layer-maxmin');
layero.attr({area: area});
};
ready.rescollbar = function(index){
if(doms.html.attr('layer-full') == index){
if(doms.html[0].style.removeProperty){
doms.html[0].style.removeProperty('overflow');
} else {
doms.html[0].style.removeAttribute('overflow');
}
doms.html.removeAttr('layer-full');
}
};
/** 内置成员 */
window.layer = layer;
//获取子iframe的DOM
layer.getChildFrame = function(selector, index){
index = index || $('.'+doms[4]).attr('times');
return $('#'+ doms[0] + index).find('iframe').contents().find(selector);
};
//得到当前iframe层的索引,子iframe时使用
layer.getFrameIndex = function(name){
return $('#'+ name).parents('.'+doms[4]).attr('times');
};
//iframe层自适应宽高
layer.iframeAuto = function(index){
if(!index) return;
var heg = layer.getChildFrame('html', index).outerHeight();
var layero = $('#'+ doms[0] + index);
var titHeight = layero.find(doms[1]).outerHeight() || 0;
var btnHeight = layero.find('.'+doms[6]).outerHeight() || 0;
layero.css({height: heg + titHeight + btnHeight});
layero.find('iframe').css({height: heg});
};
//重置iframe url
layer.iframeSrc = function(index, url){
$('#'+ doms[0] + index).find('iframe').attr('src', url);
};
//设定层的样式
layer.style = function(index, options, limit){
var layero = $('#'+ doms[0] + index)
,contElem = layero.find('.layui-layer-content')
,type = layero.attr('type')
,titHeight = layero.find(doms[1]).outerHeight() || 0
,btnHeight = layero.find('.'+doms[6]).outerHeight() || 0
,minLeft = layero.attr('minLeft');
if(type === ready.type[3] || type === ready.type[4]){
return;
}
if(!limit){
if(parseFloat(options.width) <= 260){
options.width = 260;
};
if(parseFloat(options.height) - titHeight - btnHeight <= 64){
options.height = 64 + titHeight + btnHeight;
};
}
layero.css(options);
btnHeight = layero.find('.'+doms[6]).outerHeight();
if(type === ready.type[2]){
layero.find('iframe').css({
height: parseFloat(options.height) - titHeight - btnHeight
});
} else {
contElem.css({
height: parseFloat(options.height) - titHeight - btnHeight
- parseFloat(contElem.css('padding-top'))
- parseFloat(contElem.css('padding-bottom'))
})
}
};
//最小化
layer.min = function(index, options){
var layero = $('#'+ doms[0] + index)
,titHeight = layero.find(doms[1]).outerHeight() || 0
,left = layero.attr('minLeft') || (181*ready.minIndex)+'px'
,position = layero.css('position');
ready.record(layero);
if(ready.minLeft[0]){
left = ready.minLeft[0];
ready.minLeft.shift();
}
layero.attr('position', position);
layer.style(index, {
width: 180
,height: titHeight
,left: left
,top: win.height() - titHeight
,position: 'fixed'
,overflow: 'hidden'
}, true);
layero.find('.layui-layer-min').hide();
layero.attr('type') === 'page' && layero.find(doms[4]).hide();
ready.rescollbar(index);
if(!layero.attr('minLeft')){
ready.minIndex++;
}
layero.attr('minLeft', left);
};
//还原
layer.restore = function(index){
var layero = $('#'+ doms[0] + index), area = layero.attr('area').split(',');
var type = layero.attr('type');
layer.style(index, {
width: parseFloat(area[0]),
height: parseFloat(area[1]),
top: parseFloat(area[2]),
left: parseFloat(area[3]),
position: layero.attr('position'),
overflow: 'visible'
}, true);
layero.find('.layui-layer-max').removeClass('layui-layer-maxmin');
layero.find('.layui-layer-min').show();
layero.attr('type') === 'page' && layero.find(doms[4]).show();
ready.rescollbar(index);
};
//全屏
layer.full = function(index){
var layero = $('#'+ doms[0] + index), timer;
ready.record(layero);
if(!doms.html.attr('layer-full')){
doms.html.css('overflow','hidden').attr('layer-full', index);
}
clearTimeout(timer);
timer = setTimeout(function(){
var isfix = layero.css('position') === 'fixed';
layer.style(index, {
top: isfix ? 0 : win.scrollTop(),
left: isfix ? 0 : win.scrollLeft(),
width: win.width(),
height: win.height()
}, true);
layero.find('.layui-layer-min').hide();
}, 100);
};
//改变title
layer.title = function(name, index){
var title = $('#'+ doms[0] + (index||layer.index)).find(doms[1]);
title.html(name);
};
//关闭layer总方法
layer.close = function(index){
var layero = $('#'+ doms[0] + index), type = layero.attr('type'), closeAnim = 'layer-anim-close';
if(!layero[0]) return;
var WRAP = 'layui-layer-wrap', remove = function(){
if(type === ready.type[1] && layero.attr('conType') === 'object'){
layero.children(':not(.'+ doms[5] +')').remove();
var wrap = layero.find('.'+WRAP);
for(var i = 0; i < 2; i++){
wrap.unwrap();
}
wrap.css('display', wrap.data('display')).removeClass(WRAP);
} else {
//低版本IE 回收 iframe
if(type === ready.type[2]){
try {
var iframe = $('#'+doms[4]+index)[0];
iframe.contentWindow.document.write('');
iframe.contentWindow.close();
layero.find('.'+doms[5])[0].removeChild(iframe);
} catch(e){}
}
layero[0].innerHTML = '';
layero.remove();
}
typeof ready.end[index] === 'function' && ready.end[index]();
delete ready.end[index];
};
if(layero.data('isOutAnim')){
layero.addClass('layer-anim '+ closeAnim);
}
$('#layui-layer-moves, #layui-layer-shade' + index).remove();
layer.ie == 6 && ready.reselect();
ready.rescollbar(index);
if(layero.attr('minLeft')){
ready.minIndex--;
ready.minLeft.push(layero.attr('minLeft'));
}
if((layer.ie && layer.ie < 10) || !layero.data('isOutAnim')){
remove()
} else {
setTimeout(function(){
remove();
}, 200);
}
};
//关闭所有层
layer.closeAll = function(type){
$.each($('.'+doms[0]), function(){
var othis = $(this);
var is = type ? (othis.attr('type') === type) : 1;
is && layer.close(othis.attr('times'));
is = null;
});
};
/**
拓展模块,layui开始合并在一起
*/
var cache = layer.cache||{}, skin = function(type){
return (cache.skin ? (' ' + cache.skin + ' ' + cache.skin + '-'+type) : '');
};
//仿系统prompt
layer.prompt = function(options, yes){
var style = '';
options = options || {};
if(typeof options === 'function') yes = options;
if(options.area){
var area = options.area;
style = 'style="width: '+ area[0] +'; height: '+ area[1] + ';"';
delete options.area;
}
var prompt, content = options.formType == 2 ? '<textarea class="layui-layer-input"' + style +'>' + (options.value||'') +'</textarea>' : function(){
return '<input type="'+ (options.formType == 1 ? 'password' : 'text') +'" class="layui-layer-input" value="'+ (options.value||'') +'">';
}();
var success = options.success;
delete options.success;
return layer.open($.extend({
type: 1
,btn: ['&#x786E;&#x5B9A;','&#x53D6;&#x6D88;']
,content: content
,skin: 'layui-layer-prompt' + skin('prompt')
,maxWidth: win.width()
,success: function(layero){
prompt = layero.find('.layui-layer-input');
prompt.focus();
typeof success === 'function' && success(layero);
}
,resize: false
,yes: function(index){
var value = prompt.val();
if(value === ''){
prompt.focus();
} else if(value.length > (options.maxlength||500)) {
layer.tips('&#x6700;&#x591A;&#x8F93;&#x5165;'+ (options.maxlength || 500) +'&#x4E2A;&#x5B57;&#x6570;', prompt, {tips: 1});
} else {
yes && yes(value, index, prompt);
}
}
}, options));
};
//tab层
layer.tab = function(options){
options = options || {};
var tab = options.tab || {}
,THIS = 'layui-this'
,success = options.success;
delete options.success;
return layer.open($.extend({
type: 1,
skin: 'layui-layer-tab' + skin('tab'),
resize: false,
title: function(){
var len = tab.length, ii = 1, str = '';
if(len > 0){
str = '<span class="'+ THIS +'">'+ tab[0].title +'</span>';
for(; ii < len; ii++){
str += '<span>'+ tab[ii].title +'</span>';
}
}
return str;
}(),
content: '<ul class="layui-layer-tabmain">'+ function(){
var len = tab.length, ii = 1, str = '';
if(len > 0){
str = '<li class="layui-layer-tabli '+ THIS +'">'+ (tab[0].content || 'no content') +'</li>';
for(; ii < len; ii++){
str += '<li class="layui-layer-tabli">'+ (tab[ii].content || 'no content') +'</li>';
}
}
return str;
}() +'</ul>',
success: function(layero){
var btn = layero.find('.layui-layer-title').children();
var main = layero.find('.layui-layer-tabmain').children();
btn.on('mousedown', function(e){
e.stopPropagation ? e.stopPropagation() : e.cancelBubble = true;
var othis = $(this), index = othis.index();
othis.addClass(THIS).siblings().removeClass(THIS);
main.eq(index).show().siblings().hide();
typeof options.change === 'function' && options.change(index);
});
typeof success === 'function' && success(layero);
}
}, options));
};
//相册层
layer.photos = function(options, loop, key){
var dict = {};
options = options || {};
if(!options.photos) return;
var type = options.photos.constructor === Object;
var photos = type ? options.photos : {}, data = photos.data || [];
var start = photos.start || 0;
dict.imgIndex = (start|0) + 1;
options.img = options.img || 'img';
var success = options.success;
delete options.success;
if(!type){ //页面直接获取
var parent = $(options.photos), pushData = function(){
data = [];
parent.find(options.img).each(function(index){
var othis = $(this);
othis.attr('layer-index', index);
data.push({
alt: othis.attr('alt'),
pid: othis.attr('layer-pid'),
src: othis.attr('layer-src') || othis.attr('src'),
thumb: othis.attr('src')
});
})
};
pushData();
if (data.length === 0) return;
loop || parent.on('click', options.img, function(){
var othis = $(this), index = othis.attr('layer-index');
layer.photos($.extend(options, {
photos: {
start: index,
data: data,
tab: options.tab
},
full: options.full
}), true);
pushData();
})
//不直接弹出
if(!loop) return;
} else if (data.length === 0){
return layer.msg('&#x6CA1;&#x6709;&#x56FE;&#x7247;');
}
//上一张
dict.imgprev = function(key){
dict.imgIndex--;
if(dict.imgIndex < 1){
dict.imgIndex = data.length;
}
dict.tabimg(key);
};
//下一张
dict.imgnext = function(key,errorMsg){
dict.imgIndex++;
if(dict.imgIndex > data.length){
dict.imgIndex = 1;
if (errorMsg) {return};
}
dict.tabimg(key)
};
//方向键
dict.keyup = function(event){
if(!dict.end){
var code = event.keyCode;
event.preventDefault();
if(code === 37){
dict.imgprev(true);
} else if(code === 39) {
dict.imgnext(true);
} else if(code === 27) {
layer.close(dict.index);
}
}
}
//切换
dict.tabimg = function(key){
if(data.length <= 1) return;
photos.start = dict.imgIndex - 1;
layer.close(dict.index);
return layer.photos(options, true, key);
setTimeout(function(){
layer.photos(options, true, key);
}, 200);
}
//一些动作
dict.event = function(){
dict.bigimg.hover(function(){
dict.imgsee.show();
}, function(){
dict.imgsee.hide();
});
dict.bigimg.find('.layui-layer-imgprev').on('click', function(event){
event.preventDefault();
dict.imgprev();
});
dict.bigimg.find('.layui-layer-imgnext').on('click', function(event){
event.preventDefault();
dict.imgnext();
});
$(document).on('keyup', dict.keyup);
};
//图片预加载
function loadImage(url, callback, error) {
var img = new Image();
img.src = url;
if(img.complete){
return callback(img);
}
img.onload = function(){
img.onload = null;
callback(img);
};
img.onerror = function(e){
img.onerror = null;
error(e);
};
};
dict.loadi = layer.load(1, {
shade: 'shade' in options ? false : 0.9,
scrollbar: false
});
loadImage(data[start].src, function(img){
layer.close(dict.loadi);
dict.index = layer.open($.extend({
type: 1,
id: 'layui-layer-photos',
area: function(){
var imgarea = [img.width, img.height];
var winarea = [$(window).width() - 100, $(window).height() - 100];
//如果 实际图片的宽或者高比 屏幕大(那么进行缩放)
if(!options.full && (imgarea[0]>winarea[0]||imgarea[1]>winarea[1])){
var wh = [imgarea[0]/winarea[0],imgarea[1]/winarea[1]];//取宽度缩放比例、高度缩放比例
if(wh[0] > wh[1]){//取缩放比例最大的进行缩放
imgarea[0] = imgarea[0]/wh[0];
imgarea[1] = imgarea[1]/wh[0];
} else if(wh[0] < wh[1]){
imgarea[0] = imgarea[0]/wh[1];
imgarea[1] = imgarea[1]/wh[1];
}
}
return [imgarea[0]+'px', imgarea[1]+'px'];
}(),
title: false,
shade: 0.9,
shadeClose: true,
closeBtn: false,
move: '.layui-layer-phimg img',
moveType: 1,
scrollbar: false,
moveOut: true,
//anim: Math.random()*5|0,
isOutAnim: false,
skin: 'layui-layer-photos' + skin('photos'),
content: '<div class="layui-layer-phimg">'
+'<img src="'+ data[start].src +'" alt="'+ (data[start].alt||'') +'" layer-pid="'+ data[start].pid +'">'
+'<div class="layui-layer-imgsee">'
+(data.length > 1 ? '<span class="layui-layer-imguide"><a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev"></a><a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext"></a></span>' : '')
+'<div class="layui-layer-imgbar" style="display:'+ (key ? 'block' : '') +'"><span class="layui-layer-imgtit"><a href="javascript:;">'+ (data[start].alt||'') +'</a><em>'+ dict.imgIndex +'/'+ data.length +'</em></span></div>'
+'</div>'
+'</div>',
success: function(layero, index){
dict.bigimg = layero.find('.layui-layer-phimg');
dict.imgsee = layero.find('.layui-layer-imguide,.layui-layer-imgbar');
dict.event(layero);
options.tab && options.tab(data[start], layero);
typeof success === 'function' && success(layero);
}, end: function(){
dict.end = true;
$(document).off('keyup', dict.keyup);
}
}, options));
}, function(){
layer.close(dict.loadi);
layer.msg('&#x5F53;&#x524D;&#x56FE;&#x7247;&#x5730;&#x5740;&#x5F02;&#x5E38;<br>&#x662F;&#x5426;&#x7EE7;&#x7EED;&#x67E5;&#x770B;&#x4E0B;&#x4E00;&#x5F20;&#xFF1F;', {
time: 30000,
btn: ['&#x4E0B;&#x4E00;&#x5F20;', '&#x4E0D;&#x770B;&#x4E86;'],
yes: function(){
data.length > 1 && dict.imgnext(true,true);
}
});
});
};
//主入口
ready.run = function(_$){
$ = _$;
win = $(window);
doms.html = $('html');
layer.open = function(deliver){
var o = new Class(deliver);
return o.index;
};
};
//加载方式
window.layui && layui.define ? (
layer.ready()
,layui.define('jquery', function(exports){ //layui加载
layer.path = layui.cache.dir;
ready.run(layui.$);
//暴露模块
window.layer = layer;
exports('layer', layer);
})
) : (
(typeof define === 'function' && define.amd) ? define(['jquery'], function(){ //requirejs加载
ready.run(window.jQuery);
return layer;
}) : function(){ //普通script标签加载
ready.run(window.jQuery);
layer.ready();
}()
);
}(window);
<mat-sidenav-container>
<mat-sidenav #sidenav mode="side" opened="true" class="example-sidenav"
[fixedInViewport]="options.value.fixed" [fixedTopGap]="options.value.top"
[fixedBottomGap]="options.value.bottom">
<nav>
<div class="header">
<a href="http://www.jumpserver.org" target="_blank">
<img alt="image" height="55" src="/static/imgs/logo-text.png" style="margin-left: 10px">
</a>
</div>
<div class="body">
<ul class="nav metismenu nav-frist-level">
<li *ngFor="let bar of leftbar;let i = index" [ngClass]="{'active':i==active}">
<a (click)="gotoLink(bar.link,i,-1)">
<i class="{{bar.class}}"></i>
<span class="nav-label">{{bar.name|trans}}</span>
<span class="{{bar.label}}"></span>
</a>
<ul class="nav nav-second-level collapse">
<li *ngFor="let child of bar.child;let ii = index" [ngClass]="{'active':ii==active2}">
<a (click)="gotoLink(child.link,i,ii)">{{child.name|trans}}</a>
</li>
</ul>
</li>
</ul>
</div>
</nav>
</mat-sidenav>
<div class="navbar-header">
<button class="navbar-minimalize minimalize-styl-2 btn btn-primary " (click)="sidenav.toggle()"><i
class="fa fa-bars"></i></button>
</div>
</mat-sidenav-container>
li a {
background-color: rgba(0, 0, 0, 0);
box-sizing: border-box;
color: rgb(167, 177, 194);
cursor: pointer;
display: block;
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
font-weight: 600;
height: 46px;
line-height: 18.5714px;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
padding-bottom: 14px;
padding-left: 25px;
padding-right: 20px;
padding-top: 14px;
position: relative;
text-align: left;
text-decoration-color: rgb(167, 177, 194);
text-decoration-line: none;
text-decoration-style: solid;
text-size-adjust: 100%;
width: 220px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
li.active > a {
width: 216px;
color: white;
}
li.active ul.nav.nav-second-level li {;
border-bottom-style: none;
border-bottom-width: 0px;
box-sizing: border-box;
color: rgb(103, 106, 108);
display: block;
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
height: 32px;
line-height: 18.5714px;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
position: relative;
text-align: left;
text-size-adjust: 100%;
visibility: visible;
width: 216px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
li.active ul.nav.nav-second-level {
box-sizing: border-box;
color: rgb(103, 106, 108);
display: block;
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 18.5714px;
list-style-image: none;
list-style-position: outside;
list-style-type: none;
margin-bottom: 0px;
margin-top: 0px;
padding-left: 0px;
text-align: left;
text-size-adjust: 100%;
visibility: visible;
width: 216px;
-webkit-margin-after: 0px;
-webkit-margin-before: 0px;
-webkit-margin-end: 0px;
-webkit-margin-start: 0px;
-webkit-padding-start: 0px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
mat-sidenav {
background-color: #2f4050;
}
nav {
width: 220px;
font-family: "open sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
}
div.header {
background-color: #202c37;
}
div.body {
background-color: #2f4050;
height: 100%;
}
li:hover {
color: white !important;
}
.nav-second-level li a {
padding: 7px 10px 7px 52px;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ElementLeftbarComponent } from './leftbar.component';
describe('ElementLeftbarComponent', () => {
let component: ElementLeftbarComponent;
let fixture: ComponentFixture<ElementLeftbarComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ElementLeftbarComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ElementLeftbarComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup} from '@angular/forms';
import {Router} from '@angular/router';
@Component({
selector: 'app-element-leftbar',
templateUrl: './leftbar.component.html',
styleUrls: ['./leftbar.component.scss']
})
export class ElementLeftbarComponent implements OnInit {
leftbar = [
{
'name': 'Dashboard',
'class': 'fa fa-dashboard',
'label': '',
'link': '/'
},
{
'name': 'Users',
'class': 'fa fa-group',
'label': 'fa arrow',
'child': [
{
'name': 'User',
}, {
'name': 'User group',
}, {
'name': 'Login logs',
}
]
},
{
'name': 'Assets',
'class': 'fa fa-inbox',
'label': 'fa arrow',
'child': [
{
'name': 'Asset',
}, {
'name': 'Asset group',
}, {
'name': 'Cluster',
}, {
'name': 'Admin user',
}, {
'name': 'System user',
}, {
'name': 'Labels',
}
]
},
{
'name': 'Perms',
'class': 'fa fa-edit',
'label': 'fa arrow',
'child': [{'name': 'Asset permission'}]
},
{
'name': 'Sessions',
'class': 'fa fa-rocket',
'label': 'fa arrow',
'child': [
{
'name': 'Session online'
},
{
'name': 'Session offline'
},
{
'name': 'Commands'
},
{
'name': 'Terminal'
},
]
},
{
'name': 'Job Center',
'class': 'fa fa-coffee',
'label': 'fa arrow',
'child': [
{
'name': 'Task',
'link': '/task'
},
]
},
{
'name': 'Settings',
'class': 'fa fa-gears',
'label': '',
'link': '/luna/setting'
},
];
options: FormGroup;
active: number;
active2: number;
constructor(fb: FormBuilder,
private _router: Router) {
this.options = fb.group({
'fixed': true,
'top': 0,
'bottom': 0,
});
}
ngOnInit() {
this.active = 6;
this.active2 = 0;
}
gotoLink(link: string, index: number, index2: number) {
if (link) {
if (link === '/luna/setting') {
this._router.navigate(['setting']);
} else {
window.location.href = link;
}
}
this.active = index;
this.active2 = index2;
}
}
<script src="../../trans.pipe.spec.ts"></script>
<div class="nav">
<ul>
<li><a [routerLink]="['']"><img src="static/imgs/logo.png" height="26px"/></a>
</li>
<li *ngFor="let v of DataStore.Nav" [ngClass]="{'dropdown': v.children}">
<a>{{v.name}}</a>
<a>{{v.name | trans}}</a>
<ul [ngClass]="{'dropdown-content': v.children}">
<li *ngFor="let vv of v.children" [ngClass]="{'disabled': vv.disable}">
<a *ngIf="vv.href" [routerLink]="[vv.href]">{{vv.name}}</a>
<a id="{{vv.id}}" *ngIf="vv.click" (click)="click(vv.click)">{{vv.name}}</a>
<a *ngIf="vv.href" [routerLink]="[vv.href]">{{vv.name|trans}}</a>
<a id="{{vv.id}}" *ngIf="vv.click" (click)="click(vv.click)">{{vv.name|trans}}</a>
</li>
</ul>
</li>
......
......@@ -181,9 +181,9 @@ export class ElementNavComponent implements OnInit {
'name': 'View',
'children': [
{
'id': 'HindLeftManager',
'id': 'HideLeftManager',
'click': 'HideLeft',
'name': 'Hind left manager'
'name': 'Hide left manager'
},
{
'id': 'SplitVertical',
......
<div class="footer fixed">
<div class="pull-right">
Version <strong>{{version}}</strong> GPLv2.
<img style="display: none" src="http://www.jumpserver.org/img/evaluate_avatar1.jpg">
</div>
<div>
<strong>Copyright</strong> 北京堆栈科技有限公司 &copy; 2014-2018
</div>
</div>
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ElementOfooterComponent } from './ofooter.component';
describe('ElementOfooterComponent', () => {
let component: ElementOfooterComponent;
let fixture: ComponentFixture<ElementOfooterComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ElementOfooterComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ElementOfooterComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit} from '@angular/core';
import {version} from '../../../environments/environment';
import {DataStore} from '../../globals';
@Component({
selector: 'app-element-ofooter',
templateUrl: './ofooter.component.html',
styleUrls: ['./ofooter.component.scss']
})
export class ElementOfooterComponent implements OnInit {
version = version;
constructor() {
DataStore.NavShow = false;
}
ngOnInit() {
}
}
......@@ -29,7 +29,7 @@ export class ElementServerMenuComponent implements OnInit {
m.type = 'lll';
line.type = 'line';
this.MenuList = [m, m, line, m, m];
this._dialog.alert();
this._dialog.alert('sss');
}
public contextmenu(top: number, left: number) {
......
<div>
<input
type='text'
placeholder='Type to filter the name column...'
(keyup)='updateFilter($event)'
*ngIf="config.search"/>
<ngx-datatable
#table
class="material"
[rows]="rows"
[columns]="columns"
[limit]="config.limit"
[columnMode]="config.columnMode"
[headerHeight]="config.headerHeight"
[footerHeight]="config.footerHeight"
[rowHeight]="config.rowHeight"
[scrollbarV]="config.scrollbarV"
[scrollbarH]="config.scrollbarH"
></ngx-datatable>
<mat-paginator #paginator
[pageSize]="config.pageSize"
[pageSizeOptions]="config.pageSizeOptions"
(click)="test()">
</mat-paginator>
</div>
<button (click)="test()">ssss</button>
input {
padding: 8px;
margin: 15px auto;
width: 30%;
}
.material {
box-shadow: 0 3px 5px -3px rgba(0, 0, 0, 0.2);
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ElementTableComponent } from './table.component';
describe('ElementTableComponent', () => {
let component: ElementTableComponent;
let fixture: ComponentFixture<ElementTableComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ ElementTableComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ElementTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, Input, OnInit, ViewChild} from '@angular/core';
import {DatatableComponent} from '@swimlane/ngx-datatable';
import {MatPaginator} from '@angular/material';
import {LogService} from '../../app.service';
export let Config: {
search: boolean,
scrollbarV: boolean,
scrollbarH: boolean,
rowHeight: number,
footerHeight: number,
headerHeight: number,
limit: number,
columnMode: string,
pageSize: number,
pageSizeOptions: Array<number>,
} = {
search: false,
scrollbarV: false,
scrollbarH: false,
rowHeight: 50,
footerHeight: 50,
headerHeight: 50,
limit: 10,
columnMode: 'force',
pageSize: 10,
pageSizeOptions: [5, 10, 20],
};
@Component({
selector: 'app-element-table',
templateUrl: './table.component.html',
styleUrls: ['./table.component.scss']
})
export class ElementTableComponent implements OnInit {
@Input() rows: Array<any>;
@Input() columns: Array<any>;
@Input() config: any;
temp = [];
@ViewChild(DatatableComponent) table: DatatableComponent;
@ViewChild(MatPaginator) paginator: MatPaginator;
constructor(private _logger: LogService) {
}
ngOnInit() {
Config = this.config;
this.paginator.length = this.rows.length;
}
updateFilter(event) {
const val = event.target.value.toLowerCase();
// filter our data
const temp = this.temp.filter(function (d) {
return d.name.toLowerCase().indexOf(val) !== -1 || !val;
});
// update the rows
this.rows = temp;
// Whenever the filter changes, always go back to the first page
this.table.offset = 0;
}
test() {
console.log(this.paginator._pageIndex);
console.log(this.paginator._pageIndex * this.paginator.pageSize + 1);
this.table.limit = this.paginator.pageSize;
}
}
import {AfterViewInit, Component, Input, OnInit, ViewChild} from '@angular/core';
import {ElementRef} from '@angular/core';
import {term, Terminal, TermWS} from '../../globals';
import {Cookie} from 'ng2-cookies/ng2-cookies';
import {NavList} from '../../ControlPage/control/control.component';
import * as jQuery from 'jquery/dist/jquery.min.js';
import {UUIDService} from '../../app.service';
import {CookieService} from 'ngx-cookie-service';
@Component({
selector: 'app-element-term',
......@@ -22,7 +22,8 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
secret: string;
term: any;
constructor(private _uuid: UUIDService) {
constructor(private _uuid: UUIDService,
private _cookie: CookieService) {
}
ngOnInit() {
......@@ -38,11 +39,11 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
ngAfterViewInit() {
if (this.host || this.token) {
if (Cookie.get('cols')) {
term.col = parseInt(Cookie.get('cols'), 10);
if (this._cookie.get('cols')) {
term.col = parseInt(this._cookie.get('cols'), 10);
}
if (Cookie.get('rows')) {
term.row = parseInt(Cookie.get('rows'), 10);
if (this._cookie.get('rows')) {
term.row = parseInt(this._cookie.get('rows'), 10);
}
} else {
term.col = Math.floor(jQuery(this.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3;
......@@ -62,8 +63,8 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
}
that.term.resize(term.col, term.row);
if (that.host) {
Cookie.set('cols', term.col.toString(), 99, '/', document.domain);
Cookie.set('rows', term.row.toString(), 99, '/', document.domain);
that._cookie.set('cols', term.col.toString(), 99, '/', document.domain);
that._cookie.set('rows', term.row.toString(), 99, '/', document.domain);
TermWS.emit('resize', {'cols': term.col, 'rows': term.row});
}
};
......
......@@ -103,6 +103,7 @@ export let DataStore: {
loglevel: number;
leftbarshow: boolean;
windowsize: Array<number>;
autologin: boolean;
} = {
socket: io.connect(),
Nav: [{}],
......@@ -113,6 +114,7 @@ export let DataStore: {
loglevel: 0,
leftbarshow: true,
windowsize: [],
autologin: false,
};
export let CSRF = '';
......@@ -142,3 +144,6 @@ export let wsEvent: {
event: string;
data: any;
};
export const i18n = new Map();
......@@ -9,7 +9,6 @@ import {Video, DataStore} from '../globals';
styleUrls: ['./replay-page.component.css']
})
export class ReplayPageComponent implements OnInit {
Video = Video;
constructor(private activatedRoute: ActivatedRoute,
private _http: HttpService,
......
<div class="basic-form">
<br/>
<mat-form-field hintLabel="http://jumpserver.abc.com:8080">
<input matInput #input maxlength="10" placeholder="{{'Current SITE URL'|trans}}">
</mat-form-field>
<br/>
<mat-form-field hintLabel="{{'User first login update profile done redirect to it'|trans}}">
<input matInput #input maxlength="10" placeholder="{{'User Guide URL'|trans}}">
</mat-form-field>
<br/>
<mat-form-field hintLabel="">
<input matInput #input maxlength="10" placeholder="{{'Email Subject Prefix'|trans}}">
</mat-form-field>
<br/>
<div class="button-row">
<button mat-raised-button>{{ 'Reset' | trans }}</button>
<button mat-raised-button color="primary">{{ 'Submit' | trans }}</button>
</div>
<br/>
</div>
.basic-form {
height: 100%;
display: flex;
flex-direction: column;
max-width: 400px;
margin: auto;
font-size: 14pt;
}
.basic-form > * {
width: 100%;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingPageBasicComponent } from './basic.component';
describe('SettingPageBasicComponent', () => {
let component: SettingPageBasicComponent;
let fixture: ComponentFixture<SettingPageBasicComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingPageBasicComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingPageBasicComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-sp-basic',
templateUrl: './basic.component.html',
styleUrls: ['./basic.component.scss']
})
export class SettingPageBasicComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<div class="email-form">
<mat-form-field hintLabel="">
<input matInput #input maxlength="10" placeholder="{{'SMTP host'|trans}}">
</mat-form-field>
<mat-form-field hintLabel="">
<input matInput #input maxlength="10" placeholder="{{'SMTP port'|trans}}">
</mat-form-field>
<mat-form-field hintLabel="">
<input matInput #input maxlength="10"
[formControl]="emailFormControl"
[errorStateMatcher]="matcher"
placeholder="{{'SMTP user'|trans}}">
<mat-error *ngIf="emailFormControl.hasError('email') && !emailFormControl.hasError('required')">
{{'Please enter a valid email address'|trans}}
</mat-error>
<mat-error *ngIf="emailFormControl.hasError('required')">
<strong>{{'Email is required'|trans}}</strong>
</mat-error>
</mat-form-field>
<mat-form-field hintLabel="{{'Some provider use token except password'|trans}}">
<input matInput #input maxlength="10"
[type]="hide ? 'password' : 'text'"
placeholder="{{'SMTP password'|trans}}">
<mat-icon matSuffix (click)="hide = !hide">{{hide ? 'visibility' : 'visibility_off'}}</mat-icon>
</mat-form-field>
<mat-form-field
[hideRequiredMarker]="options.value.hideRequired"
[floatLabel]="options.value.floatLabel">
<mat-select required>
<mat-option value="yes">{{'Yes'|trans}}</mat-option>
<mat-option value="no">{{'No'|trans}}</mat-option>
</mat-select>
<mat-placeholder>
<b>{{'Use SSL'|trans}}</b>
</mat-placeholder>
<mat-hint>{{'If SMTP port is 465, may be select'|trans}}</mat-hint>
</mat-form-field>
<mat-form-field
[hideRequiredMarker]="options.value.hideRequired"
[floatLabel]="options.value.floatLabel">
<mat-select required>
<mat-option value="yes">{{'Yes'|trans}}</mat-option>
<mat-option value="no">{{'No'|trans}}</mat-option>
</mat-select>
<mat-placeholder>
<b>{{'Use TLS'|trans}}</b>
</mat-placeholder>
<mat-hint>{{'If SMTP port is 587, may be select'|trans}}</mat-hint>
</mat-form-field>
<br>
<div class="button-row">
<button mat-raised-button>{{ 'Test connection' | trans }}</button>
<button mat-raised-button>{{ 'Reset' | trans }}</button>
<button mat-raised-button color="primary">{{ 'Submit' | trans }}</button>
</div>
<br/>
</div>
.email-form {
height: 100%;
display: flex;
flex-direction: column;
max-width: 400px;
margin: auto;
font-size: 14pt;
}
.email-form > * {
width: 100%;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingPageEmailComponent } from './email.component';
describe('SettingPageEmailComponent', () => {
let component: SettingPageEmailComponent;
let fixture: ComponentFixture<SettingPageEmailComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingPageEmailComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingPageEmailComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormControl, FormGroup, FormGroupDirective, NgForm, Validators} from '@angular/forms';
import {ErrorStateMatcher} from '@angular/material/core';
/** Error when invalid control is dirty, touched, or submitted. */
export class MyErrorStateMatcher implements ErrorStateMatcher {
isErrorState(control: FormControl | null, form: FormGroupDirective | NgForm | null): boolean {
const isSubmitted = form && form.submitted;
return !!(control && control.invalid && (control.dirty || control.touched || isSubmitted));
}
}
@Component({
selector: 'app-sp-email',
templateUrl: './email.component.html',
styleUrls: ['./email.component.scss']
})
export class SettingPageEmailComponent implements OnInit {
emailFormControl = new FormControl('', [
Validators.required,
Validators.email,
]);
matcher = new MyErrorStateMatcher();
hide = true;
options: FormGroup;
constructor(fb: FormBuilder) {
this.options = fb.group({
hideRequired: false,
floatLabel: 'auto',
});
}
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingPageLdapComponent } from './ldap.component';
describe('SettingPageLdapComponent', () => {
let component: SettingPageLdapComponent;
let fixture: ComponentFixture<SettingPageLdapComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingPageLdapComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingPageLdapComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-sp-ldap',
templateUrl: './ldap.component.html',
styleUrls: ['./ldap.component.scss']
})
export class SettingPageLdapComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingPageS3Component } from './s3.component';
describe('SettingPageS3Component', () => {
let component: SettingPageS3Component;
let fixture: ComponentFixture<SettingPageS3Component>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingPageS3Component ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingPageS3Component);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-sp-s3',
templateUrl: './s3.component.html',
styleUrls: ['./s3.component.scss']
})
export class SettingPageS3Component implements OnInit {
constructor() { }
ngOnInit() {
}
}
<div class="pace-done">
<app-element-leftbar></app-element-leftbar>
<mat-card class="content">
<mat-tab-group>
<mat-tab label="{{'Basic setting'|trans}}">
<app-sp-basic></app-sp-basic>
</mat-tab>
<mat-tab label="{{'Email setting'|trans}}">
<app-sp-email></app-sp-email>
</mat-tab>
<mat-tab label="{{'LDAP setting'|trans}}">
<app-sp-ldap></app-sp-ldap>
</mat-tab>
<mat-tab label="{{'Terminal setting'|trans}}">
<app-sp-terminal></app-sp-terminal>
</mat-tab>
</mat-tab-group>
</mat-card>
<app-element-ofooter></app-element-ofooter>
</div>
.pace-done {
width: 100%;
height: 100%;
padding: 0;
}
.content {
margin-left: 220px;
height: 100%;
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingPageComponent } from './setting-page.component';
describe('SettingPageComponent', () => {
let component: SettingPageComponent;
let fixture: ComponentFixture<SettingPageComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingPageComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingPageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-setting-page',
templateUrl: './setting-page.component.html',
styleUrls: ['./setting-page.component.scss']
})
export class SettingPageComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { SettingPageTerminalComponent } from './terminal.component';
describe('SettingPageTerminalComponent', () => {
let component: SettingPageTerminalComponent;
let fixture: ComponentFixture<SettingPageTerminalComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SettingPageTerminalComponent ]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(SettingPageTerminalComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-sp-terminal',
templateUrl: './terminal.component.html',
styleUrls: ['./terminal.component.scss']
})
export class SettingPageTerminalComponent implements OnInit {
constructor() { }
ngOnInit() {
}
}
<app-element-term
[token]="token"
[index]="0">
[index]="0">
</app-element-term>
......@@ -2,6 +2,7 @@ import {Component, OnInit} from '@angular/core';
import {DataStore} from '../globals';
import {ActivatedRoute, Params} from '@angular/router';
import * as jQuery from 'jquery/dist/jquery.min.js';
import {LogService} from '../app.service';
@Component({
selector: 'app-term-page',
......@@ -11,8 +12,10 @@ import * as jQuery from 'jquery/dist/jquery.min.js';
export class TermPageComponent implements OnInit {
token: string;
constructor(private activatedRoute: ActivatedRoute) {
constructor(private activatedRoute: ActivatedRoute,
private _logger: LogService) {
DataStore.NavShow = false;
this._logger.debug('TermPageComponent');
}
ngOnInit() {
......
<h2 mat-dialog-title>Delete all</h2>
<mat-dialog-content>Are you sure?</mat-dialog-content>
<mat-dialog-actions>
<button mat-button mat-dialog-close>No</button>
<!-- The mat-dialog-close directive optionally accepts a value as a result for the dialog. -->
<button mat-button [mat-dialog-close]="true">Yes</button>
</mat-dialog-actions>
<mat-checkbox>Check me!</mat-checkbox>
<button mat-raised-button (click)="openDialog()">Pick one</button>
<!--<app-element-table-->
<!--[rows]="rows"-->
<!--[columns]="columns"-->
<!--[config]="config"-->
<!--&gt;</app-element-table>-->
<!--<button mat-raised-button (click)="test()">Test</button>-->
<app-element-leftbar></app-element-leftbar>
import {Component, Inject, OnInit} from '@angular/core';
import {Component, OnInit} from '@angular/core';
import {DataStore} from '../globals';
import {Config} from '../elements/table/table.component';
import {DialogService} from '../elements/dialog/dialog.service';
import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material';
// import {Mats, MatDialogRef, MAT_DIALOG_DATA} from '@angular/material';
......@@ -11,41 +11,42 @@ import {MAT_DIALOG_DATA, MatDialog, MatDialogRef} from '@angular/material';
styleUrls: ['./test-page.component.scss']
})
export class TestPageComponent implements OnInit {
name: string;
constructor(private _dialog: MatDialog) {
rows = [
{name: 'Austin', gender: 'Male', company: 'Swimlane'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
{name: 'Dany', gender: 'Male', company: 'KFC'},
{name: 'Molly', gender: 'Female', company: 'Burger King'},
];
columns = [
{prop: 'name'},
{name: 'Gender'},
{name: 'Company'}
];
config = Config;
constructor(private _layer: DialogService) {
DataStore.NavShow = false;
this.config.search = true;
this.config.scrollbarH = true;
}
ngOnInit() {
this.name = 'ssss';
}
openDialog(): void {
const dialogRef = this._dialog.open(TestPageComponentDialog, {
width: '251px',
data: {name: this.name}
});
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed', result);
// this.animal = result;
});
test() {
this._layer.alert('sss');
}
}
@Component({
selector: 'app-test-page-dialog',
templateUrl: 'dialog.html',
})
export class TestPageComponentDialog {
constructor(public dialogRef: MatDialogRef<TestPageComponentDialog>,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
onNoClick(): void {
this.dialogRef.close();
}
}
import { TransPipe } from './trans.pipe';
describe('TransPipe', () => {
it('create an instance', () => {
const pipe = new TransPipe();
expect(pipe).toBeTruthy();
});
});
import {Pipe, PipeTransform} from '@angular/core';
import {i18n} from './globals';
@Pipe({
name: 'trans'
})
export class TransPipe implements PipeTransform {
transform(value: any, args?: any): any {
if (i18n.has(value.toLowerCase())) {
return i18n.get(value.toLowerCase());
} else {
return value;
}
}
}
/*
*
* INSPINIA - Responsive Admin Theme
* version 2.7.1
*
*/
$(document).ready(function () {
// Add body-small class if window less than 768px
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
// MetisMenu
$('#side-menu').metisMenu();
// Collapse ibox function
$('.collapse-link').on('click', function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
var content = ibox.children('.ibox-content');
content.slideToggle(200);
button.toggleClass('fa-chevron-up').toggleClass('fa-chevron-down');
ibox.toggleClass('').toggleClass('border-bottom');
setTimeout(function () {
ibox.resize();
ibox.find('[id^=map-]').resize();
}, 50);
});
// Close ibox function
$('.close-link').on('click', function () {
var content = $(this).closest('div.ibox');
content.remove();
});
// Fullscreen ibox function
$('.fullscreen-link').on('click', function () {
var ibox = $(this).closest('div.ibox');
var button = $(this).find('i');
$('body').toggleClass('fullscreen-ibox-mode');
button.toggleClass('fa-expand').toggleClass('fa-compress');
ibox.toggleClass('fullscreen');
setTimeout(function () {
$(window).trigger('resize');
}, 100);
});
// Close menu in canvas mode
$('.close-canvas-menu').on('click', function () {
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Run menu of canvas
$('body.canvas-menu .sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
// Open close right sidebar
$('.right-sidebar-toggle').on('click', function () {
$('#right-sidebar').toggleClass('sidebar-open');
});
// Initialize slimscroll for right sidebar
$('.sidebar-container').slimScroll({
height: '100%',
railOpacity: 0.4,
wheelStep: 10
});
// Open close small chat
$('.open-small-chat').on('click', function () {
$(this).children().toggleClass('fa-comments').toggleClass('fa-remove');
$('.small-chat-box').toggleClass('active');
});
// Initialize slimscroll for small chat
$('.small-chat-box .content').slimScroll({
height: '234px',
railOpacity: 0.4
});
// Small todo handler
$('.check-link').on('click', function () {
var button = $(this).find('i');
var label = $(this).next('span');
button.toggleClass('fa-check-square').toggleClass('fa-square-o');
label.toggleClass('todo-completed');
return false;
});
// Append config box / Only for demo purpose
// Uncomment on server mode to enable XHR calls
//$.get("skin-config.html", function (data) {
// if (!$('body').hasClass('no-skin-config'))
// $('body').append(data);
//});
// Minimalize menu
$('.navbar-minimalize').on('click', function (event) {
event.preventDefault();
$("body").toggleClass("mini-navbar");
SmoothlyMenu();
});
// Tooltips demo
$('.tooltip-demo').tooltip({
selector: "[data-toggle=tooltip]",
container: "body"
});
// Full height of sidebar
function fix_height() {
var heightWithoutNavbar = $("body > #wrapper").height() - 61;
$(".sidebar-panel").css("min-height", heightWithoutNavbar + "px");
var navbarheight = $('nav.navbar-default').height();
var wrapperHeight = $('#page-wrapper').height();
if (navbarheight > wrapperHeight) {
$('#page-wrapper').css("min-height", navbarheight + "px");
}
if (navbarheight < wrapperHeight) {
$('#page-wrapper').css("min-height", $(window).height() + "px");
}
if ($('body').hasClass('fixed-nav')) {
if (navbarheight > wrapperHeight) {
$('#page-wrapper').css("min-height", navbarheight + "px");
} else {
$('#page-wrapper').css("min-height", $(window).height() - 60 + "px");
}
}
}
fix_height();
// Fixed Sidebar
$(window).bind("load", function () {
if ($("body").hasClass('fixed-sidebar')) {
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
});
// Move right sidebar top after scroll
$(window).scroll(function () {
if ($(window).scrollTop() > 0 && !$('body').hasClass('fixed-nav')) {
$('#right-sidebar').addClass('sidebar-top');
} else {
$('#right-sidebar').removeClass('sidebar-top');
}
});
$(window).bind("load resize scroll", function () {
if (!$("body").hasClass('body-small')) {
fix_height();
}
});
$("[data-toggle=popover]")
.popover();
// Add slimscroll to element
$('.full-height-scroll').slimscroll({
height: '100%'
})
});
// Minimalize menu when screen is less than 768px
$(window).bind("resize", function () {
if ($(this).width() < 769) {
$('body').addClass('body-small')
} else {
$('body').removeClass('body-small')
}
});
// Local Storage functions
// Set proper body class and plugins based on user configuration
$(document).ready(function () {
if (localStorageSupport()) {
var collapse = localStorage.getItem("collapse_menu");
var fixedsidebar = localStorage.getItem("fixedsidebar");
var fixednavbar = localStorage.getItem("fixednavbar");
var boxedlayout = localStorage.getItem("boxedlayout");
var fixedfooter = localStorage.getItem("fixedfooter");
var body = $('body');
if (fixedsidebar == 'on') {
body.addClass('fixed-sidebar');
$('.sidebar-collapse').slimScroll({
height: '100%',
railOpacity: 0.9
});
}
if (collapse == 'on') {
if (body.hasClass('fixed-sidebar')) {
if (!body.hasClass('body-small')) {
body.addClass('mini-navbar');
}
} else {
if (!body.hasClass('body-small')) {
body.addClass('mini-navbar');
}
}
}
if (fixednavbar == 'on') {
$(".navbar-static-top").removeClass('navbar-static-top').addClass('navbar-fixed-top');
body.addClass('fixed-nav');
}
if (boxedlayout == 'on') {
body.addClass('boxed-layout');
}
if (fixedfooter == 'on') {
$(".footer").addClass('fixed');
}
}
});
// check if browser support HTML5 local storage
function localStorageSupport() {
return (('localStorage' in window) && window['localStorage'] !== null)
}
// For demo purpose - animation css script
function animationHover(element, animation) {
element = $(element);
element.hover(
function () {
element.addClass('animated ' + animation);
},
function () {
//wait for animation to finish before removing classes
window.setTimeout(function () {
element.removeClass('animated ' + animation);
}, 2000);
});
}
function SmoothlyMenu() {
if (!$('body').hasClass('mini-navbar') || $('body').hasClass('body-small')) {
// Hide menu in order to smoothly turn on when maximize menu
$('#side-menu').hide();
// For smoothly turn on menu
setTimeout(
function () {
$('#side-menu').fadeIn(400);
}, 200);
} else if ($('body').hasClass('fixed-sidebar')) {
$('#side-menu').hide();
setTimeout(
function () {
$('#side-menu').fadeIn(400);
}, 100);
} else {
// Remove all inline style from jquery fadeIn function to reset menu state
$('#side-menu').removeAttr('style');
}
}
// Dragable panels
function WinMove() {
var element = "[class*=col]";
var handle = ".ibox-title";
var connect = "[class*=col]";
$(element).sortable(
{
handle: handle,
connectWith: connect,
tolerance: 'pointer',
forcePlaceholderSize: true,
opacity: 0.8
})
.disableSelection();
}
......@@ -25,7 +25,7 @@
@import "imports/spinners";
// Landing page styles
@import "imports/landing";
//@import "imports/landing";
// RTL Support
@import "imports/rtl";
......
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.6
*
*/
(function($) {
$.fn.extend({
slimScroll: function(options) {
var defaults = {
// width in pixels of the visible scroll area
width : 'auto',
// height in pixels of the visible scroll area
height : '250px',
// width in pixels of the scrollbar and rail
size : '7px',
// scrollbar color, accepts any hex/color value
color: '#000',
// scrollbar position - left/right
position : 'right',
// distance in pixels between the side edge and the scrollbar
distance : '1px',
// default scroll position on load - top / bottom / $('selector')
start : 'top',
// sets scrollbar opacity
opacity : .4,
// enables always-on mode for the scrollbar
alwaysVisible : false,
// check if we should hide the scrollbar when user is hovering over
disableFadeOut : false,
// sets visibility of the rail
railVisible : false,
// sets rail color
railColor : '#333',
// sets rail opacity
railOpacity : .2,
// whether we should use jQuery UI Draggable to enable bar dragging
railDraggable : true,
// defautlt CSS class of the slimscroll rail
railClass : 'slimScrollRail',
// defautlt CSS class of the slimscroll bar
barClass : 'slimScrollBar',
// defautlt CSS class of the slimscroll wrapper
wrapperClass : 'slimScrollDiv',
// check if mousewheel should scroll the window if we reach top/bottom
allowPageScroll : false,
// scroll amount applied to each mouse wheel step
wheelStep : 20,
// scroll amount applied when user is using gestures
touchScrollStep : 200,
// sets border radius
borderRadius: '7px',
// sets border radius of the rail
railBorderRadius : '7px'
};
var o = $.extend(defaults, options);
// do it for every element that matches selector
this.each(function(){
var isOverPanel, isOverBar, isDragg, queueHide, touchDif,
barHeight, percentScroll, lastScroll,
divS = '<div></div>',
minBarHeight = 30,
releaseScroll = false;
// used in event handlers and for better minification
var me = $(this);
// ensure we are not binding it again
if (me.parent().hasClass(o.wrapperClass))
{
// start from last bar position
var offset = me.scrollTop();
// find bar and rail
bar = me.closest('.' + o.barClass);
rail = me.closest('.' + o.railClass);
getBarHeight();
// check if we should scroll existing instance
if ($.isPlainObject(options))
{
// Pass height: auto to an existing slimscroll object to force a resize after contents have changed
if ( 'height' in options && options.height == 'auto' ) {
me.parent().css('height', 'auto');
me.css('height', 'auto');
var height = me.parent().parent().height();
me.parent().css('height', height);
me.css('height', height);
}
if ('scrollTo' in options)
{
// jump to a static point
offset = parseInt(o.scrollTo);
}
else if ('scrollBy' in options)
{
// jump by value pixels
offset += parseInt(o.scrollBy);
}
else if ('destroy' in options)
{
// remove slimscroll elements
bar.remove();
rail.remove();
me.unwrap();
return;
}
// scroll content by the given offset
scrollContent(offset, false, true);
}
return;
}
else if ($.isPlainObject(options))
{
if ('destroy' in options)
{
return;
}
}
// optionally set height to the parent's height
o.height = (o.height == 'auto') ? me.parent().height() : o.height;
// wrap content
var wrapper = $(divS)
.addClass(o.wrapperClass)
.css({
position: 'relative',
overflow: 'hidden',
width: o.width,
height: o.height
});
// update style for the div
me.css({
overflow: 'hidden',
width: o.width,
height: o.height
});
// create scrollbar rail
var rail = $(divS)
.addClass(o.railClass)
.css({
width: o.size,
height: '100%',
position: 'absolute',
top: 0,
display: (o.alwaysVisible && o.railVisible) ? 'block' : 'none',
'border-radius': o.railBorderRadius,
background: o.railColor,
opacity: o.railOpacity,
zIndex: 90
});
// create scrollbar
var bar = $(divS)
.addClass(o.barClass)
.css({
background: o.color,
width: o.size,
position: 'absolute',
top: 0,
opacity: o.opacity,
display: o.alwaysVisible ? 'block' : 'none',
'border-radius' : o.borderRadius,
BorderRadius: o.borderRadius,
MozBorderRadius: o.borderRadius,
WebkitBorderRadius: o.borderRadius,
zIndex: 99
});
// set position
var posCss = (o.position == 'right') ? { right: o.distance } : { left: o.distance };
rail.css(posCss);
bar.css(posCss);
// wrap it
me.wrap(wrapper);
// append to parent div
me.parent().append(bar);
me.parent().append(rail);
// make it draggable and no longer dependent on the jqueryUI
if (o.railDraggable){
bar.bind("mousedown", function(e) {
var $doc = $(document);
isDragg = true;
t = parseFloat(bar.css('top'));
pageY = e.pageY;
$doc.bind("mousemove.slimscroll", function(e){
currTop = t + e.pageY - pageY;
bar.css('top', currTop);
scrollContent(0, bar.position().top, false);// scroll content
});
$doc.bind("mouseup.slimscroll", function(e) {
isDragg = false;hideBar();
$doc.unbind('.slimscroll');
});
return false;
}).bind("selectstart.slimscroll", function(e){
e.stopPropagation();
e.preventDefault();
return false;
});
}
// on rail over
rail.hover(function(){
showBar();
}, function(){
hideBar();
});
// on bar over
bar.hover(function(){
isOverBar = true;
}, function(){
isOverBar = false;
});
// show on parent mouseover
me.hover(function(){
isOverPanel = true;
showBar();
hideBar();
}, function(){
isOverPanel = false;
hideBar();
});
// support for mobile
me.bind('touchstart', function(e,b){
if (e.originalEvent.touches.length)
{
// record where touch started
touchDif = e.originalEvent.touches[0].pageY;
}
});
me.bind('touchmove', function(e){
// prevent scrolling the page if necessary
if(!releaseScroll)
{
e.originalEvent.preventDefault();
}
if (e.originalEvent.touches.length)
{
// see how far user swiped
var diff = (touchDif - e.originalEvent.touches[0].pageY) / o.touchScrollStep;
// scroll content
scrollContent(diff, true);
touchDif = e.originalEvent.touches[0].pageY;
}
});
// set up initial height
getBarHeight();
// check start position
if (o.start === 'bottom')
{
// scroll content to bottom
bar.css({ top: me.outerHeight() - bar.outerHeight() });
scrollContent(0, true);
}
else if (o.start !== 'top')
{
// assume jQuery selector
scrollContent($(o.start).position().top, null, true);
// make sure bar stays hidden
if (!o.alwaysVisible) { bar.hide(); }
}
// attach scroll events
attachWheel(this);
function _onWheel(e)
{
// use mouse wheel only when mouse is over
if (!isOverPanel) { return; }
var e = e || window.event;
var delta = 0;
if (e.wheelDelta) { delta = -e.wheelDelta/120; }
if (e.detail) { delta = e.detail / 3; }
var target = e.target || e.srcTarget || e.srcElement;
if ($(target).closest('.' + o.wrapperClass).is(me.parent())) {
// scroll content
scrollContent(delta, true);
}
// stop window scroll
if (e.preventDefault && !releaseScroll) { e.preventDefault(); }
if (!releaseScroll) { e.returnValue = false; }
}
function scrollContent(y, isWheel, isJump)
{
releaseScroll = false;
var delta = y;
var maxTop = me.outerHeight() - bar.outerHeight();
if (isWheel)
{
// move bar with mouse wheel
delta = parseInt(bar.css('top')) + y * parseInt(o.wheelStep) / 100 * bar.outerHeight();
// move bar, make sure it doesn't go out
delta = Math.min(Math.max(delta, 0), maxTop);
// if scrolling down, make sure a fractional change to the
// scroll position isn't rounded away when the scrollbar's CSS is set
// this flooring of delta would happened automatically when
// bar.css is set below, but we floor here for clarity
delta = (y > 0) ? Math.ceil(delta) : Math.floor(delta);
// scroll the scrollbar
bar.css({ top: delta + 'px' });
}
// calculate actual scroll amount
percentScroll = parseInt(bar.css('top')) / (me.outerHeight() - bar.outerHeight());
delta = percentScroll * (me[0].scrollHeight - me.outerHeight());
if (isJump)
{
delta = y;
var offsetTop = delta / me[0].scrollHeight * me.outerHeight();
offsetTop = Math.min(Math.max(offsetTop, 0), maxTop);
bar.css({ top: offsetTop + 'px' });
}
// scroll content
me.scrollTop(delta);
// fire scrolling event
me.trigger('slimscrolling', ~~delta);
// ensure bar is visible
showBar();
// trigger hide when scroll is stopped
hideBar();
}
function attachWheel(target)
{
if (window.addEventListener)
{
target.addEventListener('DOMMouseScroll', _onWheel, false );
target.addEventListener('mousewheel', _onWheel, false );
}
else
{
document.attachEvent("onmousewheel", _onWheel)
}
}
function getBarHeight()
{
// calculate scrollbar height and make sure it is not too small
barHeight = Math.max((me.outerHeight() / me[0].scrollHeight) * me.outerHeight(), minBarHeight);
bar.css({ height: barHeight + 'px' });
// hide scrollbar if content is not long enough
var display = barHeight == me.outerHeight() ? 'none' : 'block';
bar.css({ display: display });
}
function showBar()
{
// recalculate bar height
getBarHeight();
clearTimeout(queueHide);
// when bar reached top or bottom
if (percentScroll == ~~percentScroll)
{
//release wheel
releaseScroll = o.allowPageScroll;
// publish approporiate event
if (lastScroll != percentScroll)
{
var msg = (~~percentScroll == 0) ? 'top' : 'bottom';
me.trigger('slimscroll', msg);
}
}
else
{
releaseScroll = false;
}
lastScroll = percentScroll;
// show only when required
if(barHeight >= me.outerHeight()) {
//allow window scroll
releaseScroll = true;
return;
}
bar.stop(true,true).fadeIn('fast');
if (o.railVisible) { rail.stop(true,true).fadeIn('fast'); }
}
function hideBar()
{
// only hide when options allow it
if (!o.alwaysVisible)
{
queueHide = setTimeout(function(){
if (!(o.disableFadeOut && isOverPanel) && !isOverBar && !isDragg)
{
bar.fadeOut('slow');
rail.fadeOut('slow');
}
}, 1000);
}
}
});
// maintain chainability
return this;
}
});
$.fn.extend({
slimscroll: $.fn.slimScroll
});
})(jQuery);
\ No newline at end of file
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.3.6
*
*/
(function(e){e.fn.extend({slimScroll:function(g){var a=e.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},g);this.each(function(){function v(d){if(r){d=d||window.event;
var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);e(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,e,g){k=!1;var f=d,h=b.outerHeight()-c.outerHeight();e&&(f=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),f=Math.min(Math.max(f,0),h),f=0<d?Math.ceil(f):Math.floor(f),c.css({top:f+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());
f=l*(b[0].scrollHeight-b.outerHeight());g&&(f=d,d=f/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),h),c.css({top:d+"px"}));b.scrollTop(f);b.trigger("slimscrolling",~~f);w();p()}function x(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),30);c.css({height:u+"px"});var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function w(){x();clearTimeout(B);l==~~l?(k=a.allowPageScroll,C!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;C=l;u>=b.outerHeight()?k=!0:(c.stop(!0,
!0).fadeIn("fast"),a.railVisible&&h.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(B=setTimeout(function(){a.disableFadeOut&&r||y||z||(c.fadeOut("slow"),h.fadeOut("slow"))},1E3))}var r,y,z,B,A,u,l,C,k=!1,b=e(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),c=b.closest("."+a.barClass),h=b.closest("."+a.railClass);x();if(e.isPlainObject(g)){if("height"in g&&"auto"==g.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",
q);b.css("height",q)}if("scrollTo"in g)n=parseInt(a.scrollTo);else if("scrollBy"in g)n+=parseInt(a.scrollBy);else if("destroy"in g){c.remove();h.remove();b.unwrap();return}m(n,!1,!0)}}else if(!(e.isPlainObject(g)&&"destroy"in g)){a.height="auto"==a.height?b.parent().height():a.height;n=e("<div></div>").addClass(a.wrapperClass).css({position:"relative",overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var h=e("<div></div>").addClass(a.railClass).css({width:a.size,
height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=e("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?
{right:a.distance}:{left:a.distance};h.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(h);a.railDraggable&&c.bind("mousedown",function(a){var b=e(document);z=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});b.bind("mouseup.slimscroll",function(a){z=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});
h.hover(function(){w()},function(){p()});c.hover(function(){y=!0},function(){y=!1});b.hover(function(){r=!0;w();p()},function(){r=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(A=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&(m((A-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),A=b.originalEvent.touches[0].pageY)});x();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),
m(0,!0)):"top"!==a.start&&(m(e(a.start).position().top,null,!0),a.alwaysVisible||c.hide());window.addEventListener?(this.addEventListener("DOMMouseScroll",v,!1),this.addEventListener("mousewheel",v,!1)):document.attachEvent("onmousewheel",v)}});return this}});e.fn.extend({slimscroll:e.fn.slimScroll})})(jQuery);
\ No newline at end of file
.red-fonts {
color: #ed5565;
}
.form-group.required .control-label:after {
content: " *";
color: red;
}
.n-invalid {border: 1px solid #f00;}
.primary-panel .ibox-title {
color: #ffffff;
background-color: #1AB394;
}
.primary-panel .ibox-content {
border: 1px solid #1AB394;
}
.info-panel .ibox-title {
color: #ffffff;
background-color: #23c6c8;
}
.info-panel .ibox-content {
border: 1px solid #23c6c8;;
}
th a {
color: #676a6c;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #d2d2d2 !important;
color: #333 !important;
}
.select2-selection--single,
.select2-selection--multiple {
border: 1px solid #e5e6e7 !important;
cursor: text !important;
}
.select2-container--forcus {
border: 1px solid #1AB394 !important;
}
.select2-selection__choice,
.chosen-container-multi .chosen-choices li.search-choice {
background: #f1f1f1 !important;
border: 1px solid #e5e6e7 !important;
/*border: 1px solid #ededed;*/
border-radius: 2px !important;
box-shadow: none !important;
color: #333333 !important;
cursor: default !important;
line-height: 13px !important;
/*margin: 3px 0 3px 5px !important;*/
padding: 3px 20px 3px 5px !important;
position: relative !important;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: 1px solid #1ab394 !important;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3) !important;
}
.passwordBox2 {
max-width: 660px;
margin: 0 auto;
padding: 100px 20px 20px 20px;
}
.no-borders-tr td {
border-top: none !important;
}
table.dataTable tbody > tr.selected, table.dataTable tbody > tr > .selected {
background-color: #1ab394 !important;
}
table.dataTable tbody tr.selected a,
table.dataTable tbody th.selected a,
table.dataTable tbody td.selected a,
table.dataTable tbody tr.selected td i.text-navy,
table.dataTable tbody th.selected td i.text-navy,
table.dataTable tbody td.selected td i.text-navy
{
color: white !important;
}
.m-0 {
margin: 0px !important;
}
.m-t-0 {
margin-top: 0px !important;
}
.m-b-0 {
margin-bottom: 0px !important;
}
.m-l-0 {
margin-left: 0px !important;
}
.m-r-0 {
margin-right: 0px !important;
}
.m-5 {
margin: 5px !important;
}
.m-t-5 {
margin-top: 5px !important;
}
.m-b-5 {
margin-bottom: 5px !important;
}
.m-l-5 {
margin-left: 5px !important;
}
.m-r-5 {
margin-right: 5px !important;
}
.m-10 {
margin: 10px !important;
}
.m-t-10 {
margin-top: 10px !important;
}
.m-b-10 {
margin-bottom: 10px !important;
}
.m-l-10 {
margin-left: 10px !important;
}
.m-r-10 {
margin-right: 10px !important;
}
.m-15 {
margin: 15px !important;
}
.m-t-15 {
margin-top: 15px !important;
}
.m-b-15 {
margin-bottom: 15px !important;
}
.m-l-15 {
margin-left: 15px !important;
}
.m-r-15 {
margin-right: 15px !important;
}
.m-20 {
margin: 20px !important;
}
.m-t-20 {
margin-top: 20px !important;
}
.m-b-20 {
margin-bottom: 20px !important;
}
.m-l-20 {
margin-left: 20px !important;
}
.m-r-20 {
margin-right: 20px !important;
}
.m-25 {
margin: 25px !important;
}
.m-t-25 {
margin-top: 25px !important;
}
.m-b-25 {
margin-bottom: 25px !important;
}
.m-l-25 {
margin-left: 25px !important;
}
.m-r-25 {
margin-right: 25px !important;
}
.m-30 {
margin: 30px !important;
}
.m-t-30 {
margin-top: 30px !important;
}
.m-b-30 {
margin-bottom: 30px !important;
}
.m-l-30 {
margin-left: 30px !important;
}
.m-r-30 {
margin-right: 30px !important;
}
.ydxbd {
font-size: 12px;
width: 100%;
overflow: hidden;
padding-top: 15px;
margin-bottom: 15px;
display: block;
background: #f4f4f4;
padding-left: 10px;
padding-bottom: 15px;
}
.mar {
margin-left: 2px;
line-height: 0px;
}
.mar-j {
margin-left: 3px;
margin-right: 3px;
}
.form-asset-on p{
margin-bottom:0px;
}
.form-asset-on button{
background: #f1f1f1;
margin-right: 2px;
}
.form-asset-on{
border: 1px solid #e5e6e7;
padding-top:5px;
padding-bottom: 0px;
padding-left: 5px;
padding-right: 5px;
min-height:34px;
height: 100%;
}
.mgl-5 {
margin-left: 5px;
font-size: 12px;
}
.c02 {
color: #999;
}
.tagBtnList {
font-size: 12px;
line-height: 32px;
margin: -5px 0 0 0;
padding-left: 0px;
}
.tagBtn2 {
margin: 0 5px 5px 0;
font-size: 12px;
vertical-align: middle;
}
div.dataTables_wrapper div.dataTables_filter,
.dataTables_length {
float: right !important;
}
div.dataTables_wrapper div.dataTables_filter {
margin-left: 15px;
}
.simple-tag {
background-color: #f3f3f4;
border: 1px solid #e7eaec;
border-radius: 2px;
color: inherit;
display: inline-block;
font-size: 10px;
margin-right: 5px;
margin-top: 5px;
padding: 5px 12px;
}
#op.col-md-6{
padding-left: 0;
}
.help-message {
padding-left: 10px;
font-size: 12px;
line-height: 18px;
margin-bottom:0;
margin-left: 10px;
margin-right: 10px
}
.navbar-default {
background-color: #2f4050;
border-color: #2f4050;
}
.nav-header, body.mini-navbar .nav-header {
padding: 0;
background: #202c37;
}
.profile-element div:first-child {
line-height: 60px;
/*width: 70px;*/
float: left;
text-align: center;
}
.profile-element div:last-child a {
line-height: 60px;
width: 150px;
float: left;
font-size: 22px;
color: #1ab394;
}
.logo-element {
padding: 10px 0;
}
.welcome-message img {
margin: -11px 0;
}
.nav.nav-tabs li.active {
background-color: #FFF;
}
.ibox-title {
border-top: none;
}
.nav.nav-tabs li > a {
max-height: 38px;
}
.nav.nav-tabs li.active a {
border: none;
}
.popover{
max-width: 100%; /* Max Width of the popover (depending on the container!) */
padding-left: 20px;
padding-right: 20px;
}
......@@ -17,56 +17,10 @@ $roboto-font-path: "~roboto-fontface/fonts";
*
*/
$asset-path: '../static/imgs/inspinia';
// Variables, Mixins
@import "../assets/inspinia/imports/variables";
@import "../assets/inspinia/imports/mixins";
// INSPINIA Theme Elements
@import "../assets/inspinia/imports/typography";
@import "../assets/inspinia/imports/navigation";
@import "../assets/inspinia/imports/top_navigation";
@import "../assets/inspinia/imports/buttons";
@import "../assets/inspinia/imports/badges_labels";
@import "../assets/inspinia/imports/elements";
@import "../assets/inspinia/imports/sidebar";
@import "../assets/inspinia/imports/base";
@import "../assets/inspinia/imports/pages";
@import "../assets/inspinia/imports/chat";
@import "../assets/inspinia/imports/metismenu";
@import "../assets/inspinia/imports/spinners";
// Landing page styles
//@import "../assets/inspinia/imports/landing";
// RTL Support
@import "../assets/inspinia/imports/rtl";
// For demo only - config box style
@import "../assets/inspinia/imports/theme-config";
// INSPINIA Skins
@import "../assets/inspinia/imports/skins";
@import "../assets/inspinia/imports/md-skin";
// Media query style
@import "../assets/inspinia/imports/media";
// Custom style
// Your custom style to override base style
@import "../assets/inspinia/imports/custom";
// Clear layout on print mode
@media print {
nav.navbar-static-side {
display: none;
}
body { overflow: visible !important; }
#page-wrapper {
margin: 0;
}
}
@import "../assets/inspinia/style";
@import '~@angular/material/prebuilt-themes/deeppurple-amber.css';
@import '~@swimlane/ngx-datatable/release/index.css';
@import '~@swimlane/ngx-datatable/release/themes/material.css';
@import '~@swimlane/ngx-datatable/release/assets/icons.css';
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment