Skip to content

Commit a442b10

Browse files
committed
improve UI and add session expire time info
1 parent a51c520 commit a442b10

8 files changed

Lines changed: 36 additions & 9 deletions

File tree

.DS_Store

0 Bytes
Binary file not shown.

src/angular/src/app/app.component.scss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@
1717
z-index: 100;
1818
}
1919

20+
app-api {
21+
height: 100%;
22+
display: flex;
23+
flex-direction: column;
24+
justify-content: space-between;
25+
}
26+
2027
//
2128
.app-container {
2229
height: 450px;

src/angular/src/app/pages/account/account.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ <h2 class="title-cloud" (click)="openTab(session.domain)">
88
</h2>
99
</div>
1010
</div>
11-
<div class="text-cloud">Logged in as <b>{{session.email}}</b></div>
11+
<div class="text-cloud first">Logged in as <b>{{session.email}}</b></div>
12+
<div class="text-cloud last">Session expires at <b>{{(session.expires_at * 1000) | date:'yyyy-MM-dd HH:mm:ss' }}</b></div>
1213
<div>
1314
<button class="cloud" (click)="openManageTokens(session.domain)">Manage Tokens</button>
1415
<button class="cloud" (click)="openCreateToken(session.domain)">Create New Token</button>

src/angular/src/app/pages/account/account.component.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
top: 50px;
1212
left: 0;
1313
height: 453px;
14-
width: 375px;
14+
width: 100%;
1515
display: flex;
1616
flex-direction: column;
1717
align-items: stretch;
@@ -81,10 +81,18 @@
8181
}
8282

8383
.text-cloud {
84-
margin: 1em auto 2em;
84+
margin: 0.2em auto;
8585
font-weight: 200;
8686
}
8787

88+
.text-cloud.first {
89+
margin-top: 1.5em;
90+
}
91+
92+
.text-cloud.last {
93+
margin-bottom: 2em;
94+
}
95+
8896
.cloud {
8997
width: 50%;
9098
transition: background-color 0.2s ease-in-out;

src/angular/src/app/pages/account/account.component.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export interface SessionElement {
88
csrftoken: string;
99
email: string;
1010
has_sessionid: boolean;
11+
expires_at: number;
1112
}
1213

1314
@Component({
@@ -73,10 +74,12 @@ export class AccountComponent implements OnInit {
7374
if (i > -1) {
7475
if (cookie.name.startsWith("csrftoken")) this.sessions[i].csrftoken = cookie.value;
7576
else if (cookie.name.startsWith("sessionid")) this.sessions[i].has_sessionid = true;
77+
// if the current cookie has a shorter lifetime than the previous one, use its expirationDate instead
78+
if (this.sessions[i].expires_at > cookie.expirationDate) this.sessions[i].expires_at = cookie.expirationDate
7679
// otherwise, add a new entry in the list
7780
} else {
78-
if (cookie.name.startsWith("csrftoken")) this.sessions.push({ domain: cookie.domain, email: null, csrftoken: cookie.value, has_sessionid: false });
79-
else if (cookie.name.startsWith("sessionid")) this.sessions.push({ domain: cookie.domain, email: null, csrftoken: null, has_sessionid: true });
81+
if (cookie.name.startsWith("csrftoken")) this.sessions.push({ domain: cookie.domain, email: null, csrftoken: cookie.value, has_sessionid: false, expires_at: cookie.expirationDate });
82+
else if (cookie.name.startsWith("sessionid")) this.sessions.push({ domain: cookie.domain, email: null, csrftoken: null, has_sessionid: true, expires_at: cookie.expirationDate });
8083
}
8184
}
8285
}

src/angular/src/app/pages/api/api.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
<div class="content">
1+
<div class="content no-grow">
22
<div class="box-apitab">
33
<button  class="apitab" [disabled]="!api_url_obj" (click)="openApiTab(api_url_obj)">GET API</button>
44
<button  class="apitab" [disabled]="!api_url_stats_obj" (click)="openApiTab(api_url_stats_obj)">GET STATS
55
API</button>
66
</div>
77
</div>
8-
<div class="content">
8+
<div class="content grow">
99
<h2>Page Info</h2>
1010
<div *ngIf="!org_id" class="not_mist">
1111
Information only available on Mist Cloud pages...
@@ -47,7 +47,7 @@ <h2>Page Info</h2>
4747
</div>
4848
</div>
4949

50-
<div class="content">
50+
<div class="content no-grow">
5151
<h2>Documentation</h2>
5252
<div class="box-links">
5353
<button class="links"  (click)="openTab('postman')">Postman</button>

src/angular/src/app/pages/api/api.component.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
flex-direction: column;
77
}
88

9+
.content.no-grow {
10+
flex-grow: 0;
11+
}
12+
13+
.content.grow {
14+
flex-grow: 1;
15+
}
16+
917
// TITLES
1018
h2 {
1119
font-weight: 200;

src/angular/src/styles.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* You can add global styles to this file, and also import other style files */
22

33
body {
4-
width: 375px !important;
4+
width: 350px !important;
55
margin: 0 !important;
66
}

0 commit comments

Comments
 (0)