Skip to content

Commit

Permalink
Merge pull request primefaces#8 from Nanitor/jonbo-dev
Browse files Browse the repository at this point in the history
Jonbo dev
  • Loading branch information
blaropal authored Aug 21, 2017
2 parents df07b57 + b595ff2 commit 5610ea7
Show file tree
Hide file tree
Showing 47 changed files with 1,206 additions and 642 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@types/highcharts": "^4.2.47",
"@types/jquery": "^2.0.40",
"@types/underscore": "^1.7.36",
"angular2-infinite-scroll": "^0.3.1",
"angular2-infinite-scroll": "^0.3.5",
"file-saver": "^1.3.3",
"font-awesome": "^4.5.0",
"highcharts": "^5.0.7",
Expand All @@ -42,8 +42,8 @@
"@angular/router": "^4.1.3",
"clipboard": "^1.5.12",
"core-js": "^2.4.1",
"rxjs": "5.2.0",
"typescript": "2.4.0",
"rxjs": "^5.2.0",
"typescript": "^2.4.0",
"zone.js": "^0.8.4"
}
}
27 changes: 19 additions & 8 deletions src/account/account.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import {Injectable} from '@angular/core';
import {ResponseContentType, Http, Headers, Response} from '@angular/http';
import {Observable} from 'rxjs/Rx';
import {Router} from '@angular/router';
import {Location} from '@angular/common';
import {ProfileInfo, Organization} from './profile_info';
import {BasicResponse} from '../common/response';
import {FlashService} from '../common/flash/flash.service';
Expand All @@ -18,13 +16,12 @@ export class AccountService {

private navigationStack: Array<string>;

constructor(private http: Http, private router: Router, private location: Location, private flashService: FlashService) {
constructor(private http: Http, private flashService: FlashService) {
this.basicUrl = environment.UI_API_URL;
this.navigationStack = [];
}

signin(email: string, password: string) {
// return request;
let headers = new Headers();
headers.append('Content-Type', 'application/json');

Expand Down Expand Up @@ -122,9 +119,6 @@ export class AccountService {
this.removeToken();
this.clearOrganization();
this.profileInfo = null;

let nextUrl = "/";
this.router.navigate(['/account/signin'], { queryParams: { nextUrl: nextUrl }});
}

// Checks if we are signed in and makes sure profile info is set if this
Expand Down Expand Up @@ -285,12 +279,21 @@ export class AccountService {
isCurrentOrgAdmin() {
var organization = this.getCurrentOrganization();
if (organization == null) {
return null;
return false;
}

return organization.permission_name == 'admin';
}

isSysAdmin() {
var user = this.getUserInfo();
if (user == null) {
return false;
}

return user.is_admin;
}

isOrgLicenseValid(organization: Organization) {
if (organization == null) {
return false;
Expand Down Expand Up @@ -511,6 +514,14 @@ export class AccountService {
checkEmailAvailable(email: string) {
return this.executePost('/account/email_available', { email: email}, false);
}

setCacheRefresh(value: boolean) {
window["_nanitor_cache_refresh"] = value;
}

getCacheRefresh() {
return window["_nanitor_cache_refresh"];
}
}

export enum OrgCheckRet {
Expand Down
1 change: 1 addition & 0 deletions src/account/signin.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class SigninComponent {

this.accountService.getProfileInfo().subscribe(
data => {
this.accountService.setCacheRefresh(true);
let dataJson = data.json();
this.accountService.setProfileInfo(dataJson);
this.router.navigateByUrl(this.nextUrl);
Expand Down
12 changes: 9 additions & 3 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http';
import {RouterModule, RouterLink} from "@angular/router";
import {RouterModule, RouterLink, RouteReuseStrategy} from "@angular/router";
import {LocationStrategy, HashLocationStrategy} from '@angular/common';

import {AppComponent} from './app.component';
Expand All @@ -23,6 +23,8 @@ import {SpinnerService} from './common/spinner/spinner.service';
import {CreateOrganizationComponent} from './organization/create-organization.component';
import {OrgSelectorComponent} from './orgselector.component';
import {ToplevelComponent} from './toplevel.component';
import {CustomReuseStrategy} from './custom-reuse-strategy';
import {BreadCrumbsService} from './common/bread_crumbs/bread-crumbs.service';


@NgModule({
Expand All @@ -46,12 +48,16 @@ import {ToplevelComponent} from './toplevel.component';
],
providers: [
AuthGuard,
BreadCrumbsService,
AccountService,
BenchmarkFilterService,
FlashService,
SpinnerService
SpinnerService,
{provide: RouteReuseStrategy, useClass: CustomReuseStrategy}
],
bootstrap: [AppComponent]
bootstrap: [
AppComponent
]
})

export class AppModule {
Expand Down
7 changes: 4 additions & 3 deletions src/assets/less/custom-extra.less
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
background-image:none;
}*/
}
input[type="checkbox"].checkbox{
input[type="checkbox"].checkbox {
display:none;
&+label{
font-weight:normal;
Expand Down Expand Up @@ -66,6 +66,7 @@ input[type="radio"].radio-button{
display:none;
&+label{
font-weight:normal;
margin-right: 10px;

&::before{
content:"";
Expand All @@ -76,13 +77,13 @@ input[type="radio"].radio-button{
background:#f2f1f0;
position:relative;
top:7px;
margin-right:20px;
margin-right:10px;
border-radius:50%;
}
}
&:checked{
&+label::before{
border-color:#ffa800;
border-color:#4375e5;
}
}
}
Expand Down
111 changes: 105 additions & 6 deletions src/assets/less/custom.less
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,47 @@ nav.navbar .container-fluid{
margin-left: 0.5em;
}

.breadcrumb-nanitor {
display: flex;
padding: 8px 0px;
margin-top: 26px;
margin-left: 35px;
list-style: none;
background-color: #363738;

li {
display: inline-block;
font-size: 12px;
font-weight: 600;
letter-spacing: 0.11em;
text-transform: uppercase;

a {
color: #ffffff;

&:hover {
color: @nan-yellow;
text-decoration: none;
}
}

label {
color: #ffffff;
border-bottom: 1px solid #ffffff;
}
}

li:before {
content: "@{breadcrumb-separator}\00a0"; // Unicode space added since inline-block means non-collapsing white-space
padding: 0 5px;
color: @breadcrumb-color;
}

> .active {
color: @breadcrumb-active-color;
}
}

.container-fluid{
padding-right: @special-container-padding;
padding-left: @special-container-padding;
Expand All @@ -61,6 +102,31 @@ nav.navbar .container-fluid{

}

.container-fluid-details {
margin-right: @special-container-padding;
margin-left: @special-container-padding;
padding: 0;
background-color: #363738;
flex: 1;

.panel-default {
margin-bottom: 30px;
}

.white-wrapper {
margin-top: 30px;
}
}

.fixed {
.container-fluid-details {
.to-be-fixed {
top: 80px;
padding-right: 95px;
}
}
}

.full-width-selectbox {
.ui-listbox {
width: auto;
Expand Down Expand Up @@ -168,6 +234,8 @@ nav.navbar .container-fluid{
font-size: 12px;
color: rgba(255, 255, 255, 0.8);
white-space: nowrap;
max-height: 80%;
overflow-y: auto;

.filter-heading {
display: flex;
Expand Down Expand Up @@ -236,27 +304,48 @@ nav.navbar .container-fluid{
color: rgba(255, 255, 255, 0.8);
font-weight: 400;
margin-top: 5px;
padding-bottom: 5px;
}

input[type="text"] {
height: 35px;
margin-bottom: 10px;
}

.checkbox-container {
.input-container {
display: flex;
flex-direction: column;
margin-top: 5px;
margin-bottom: 5px;

.checkbox-container-heading {
.input-container-heading {
font-weight: 400;
margin-bottom: 0;
}

.input-container-subheading {
font-size: 10px;
}

label {
font-weight: 600;
}

.radio-container {
display: flex;

input[type="radio"] {
margin-top: 0;
}

label {
display: flex;
align-items: center;

&:before {
top: 0;
}
}
}
}

.drop-down-container {
Expand Down Expand Up @@ -583,19 +672,29 @@ a i.fa.fa-trash,a i.fa.fa-edit,a i.fa.fa-refresh{
border-right: 0;
padding: 19px 15px;

&.has-comments div >a{ position: relative; margin-right: 35px;
&.has-comments div >a{ position: relative;
&:after{
content: "\f298";
font: normal normal normal 14px/1 FontAwesome;
display: inline-block;
position: absolute;
right: -25px;
top: 1px;
color: @brand-primary;
margin-left: 5px;
}
}
}

.panel-heading-flex {
display: flex;
align-items: baseline;
justify-content: space-between;

.btn-primary, .btn-primary:active {
background-color: #333438;
border-color: #333438;
}
}

.report-wrapper{
min-width: 512px;
}
Expand Down
8 changes: 8 additions & 0 deletions src/common/bread_crumbs/bread-crumbs.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<ol class="breadcrumb-nanitor">
<li *ngFor="let breadcrumb of breadcrumbs">
<a [routerLink]="[breadcrumb.url]">{{ breadcrumb.label }}</a>
</li>
<li *ngIf="currentBreadcrumb != null">
<label>{{ currentBreadcrumb.label }}</label>
</li>
</ol>
44 changes: 44 additions & 0 deletions src/common/bread_crumbs/bread-crumbs.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { Component, OnInit, Input } from "@angular/core";
import { Router, ActivatedRoute, NavigationEnd, Params, PRIMARY_OUTLET } from "@angular/router";
import "rxjs/add/operator/filter";
import {BreadCrumbsService} from './bread-crumbs.service';
import {BreadCrumb} from './bread-crumbs.model';

@Component({
selector: "bread-crumbs",
templateUrl: 'bread-crumbs.component.html'
})

export class BreadcrumbsComponent implements OnInit {

private breadcrumbs: BreadCrumb[];
private currentBreadcrumb: BreadCrumb;

constructor(private activatedRoute: ActivatedRoute, private router: Router, private service: BreadCrumbsService) {
this.breadcrumbs = [];
this.currentBreadcrumb = null;
}

/**
* Let's go!
*
* @class DetailComponent
* @method ngOnInit
*/
ngOnInit() {
this.getBreadcrumbs();

this.service.listResponse$.subscribe(p => {
if(this.currentBreadcrumb != null) {
let newLabel = this.currentBreadcrumb.label.split(" ")[0];
newLabel += " " + p;
this.currentBreadcrumb.label = newLabel;
}
})
}

private getBreadcrumbs() {
this.breadcrumbs = this.service.getBreadCrumbs();
this.currentBreadcrumb = this.breadcrumbs.pop();
}
}
Loading

0 comments on commit 5610ea7

Please sign in to comment.