Api Key view
This commit is contained in:
@ -19,5 +19,7 @@ namespace isn.Data.ApiKeys
|
||||
public int ValidityPeriodInDays{ get; set; }
|
||||
|
||||
public DateTime CreationDate { get; set; }
|
||||
|
||||
public bool IsValid => CreationDate.AddDays(ValidityPeriodInDays) > DateTime.Now;
|
||||
}
|
||||
}
|
@ -37,9 +37,21 @@
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ProtectedValue)
|
||||
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ProtectedValue)
|
||||
<code>
|
||||
<input id="key" value="@Model.ProtectedValue" readonly/></code>
|
||||
<button type="button"
|
||||
class="btn btn-success" autocomplete="off"
|
||||
onclick="$('#key').select();document.execCommand('copy');"
|
||||
>Copy</button>
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.IsValid)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.IsValid)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
@ -30,7 +30,11 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.ApiKey) {
|
||||
<tr>
|
||||
var rcsscl = item.IsValid ?
|
||||
item.CreationDate.AddDays(item.ValidityPeriodInDays-30) > DateTime.Now ?
|
||||
"ok" : "nomoretam" : "expired";
|
||||
|
||||
<tr class="@rcsscl">
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.User.Id)
|
||||
</td>
|
||||
|
@ -22,3 +22,31 @@
|
||||
height: 100px; }
|
||||
.grants-page .card label {
|
||||
font-weight: bold; }
|
||||
|
||||
.expired {
|
||||
color: white;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.ok {
|
||||
font-weight: bolder;
|
||||
color: white;
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
|
||||
.nomoretam {
|
||||
font-weight: bolder;
|
||||
color: black;
|
||||
background-color: orange;
|
||||
}
|
||||
|
||||
.ok a {
|
||||
color: rgb(47, 228, 228);
|
||||
background-color: black;
|
||||
}
|
||||
|
||||
.ok a:hover {
|
||||
color: rgb(119, 255, 255);
|
||||
background-color: black;
|
||||
}
|
Reference in New Issue
Block a user