-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adapt favorites to new apppools logic
- Loading branch information
1 parent
c7b1fad
commit 8c72111
Showing
1 changed file
with
82 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,15 +5,22 @@ | |
@{ | ||
} | ||
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | ||
|
||
<div class="container p-3"> | ||
<div class="row pt-4 align-items-center"> | ||
<div class="col-6"> | ||
<h2 class="text-primary">Favorites</h2> | ||
</div> | ||
<div class="col-6 text-end"> | ||
<a class="btn btn-outline-primary" asp-area="User" asp-page="/Favorites/Index"> | ||
<i class="bi bi-pencil-square"></i> Edit Favorites | ||
</a> | ||
<div class="d-flex justify-content-evenly"> | ||
<a class="btn btn-outline-primary" asp-area="User" asp-page="/Favorites/Index"> | ||
<i class="bi bi-pencil-square"></i> Edit Favorites | ||
</a> | ||
<span id="loadingSpinner" class="spinner-border" role="status" style="display: none;"> | ||
<span class="visually-hidden">Loading...</span> | ||
</span> | ||
</div> | ||
</div> | ||
</div> | ||
<br /> | ||
|
@@ -60,21 +67,73 @@ | |
@if (obj.AssetType.Equals(StaticDetails.AssetTypeAppPool)) | ||
{ | ||
<div class="d-flex justify-content-evenly"> | ||
<form method="post" asp-area="User" asp-page="/App_Pools/Index" asp-page-handler="Start" asp-route-id="@obj.AssetId.Split("_")[0]" asp-route-selected="@obj.AssetId.Split("_")[1]" asp-route-redirect="@("/Index")"> | ||
<button type="submit" class="btn btn-outline-success"> | ||
<i class="bi bi-play-btn"></i> Start | ||
</button> | ||
</form> | ||
<form method="post" asp-area="User" asp-page="/App_Pools/Index" asp-page-handler="Stop" asp-route-id="@obj.AssetId.Split("_")[0]" asp-route-selected="@obj.AssetId.Split("_")[1]" asp-route-redirect="@("/Index")"> | ||
<button type="submit" class="btn btn-outline-danger"> | ||
<i class="bi bi-stop-btn"></i> Stop | ||
</button> | ||
</form> | ||
<form method="post" asp-area="User" asp-page="/App_Pools/Index" asp-page-handler="Restart" asp-route-id="@obj.AssetId.Split("_")[0]" asp-route-selected="@obj.AssetId.Split("_")[1]" asp-route-redirect="@("/Index")"> | ||
<button type="submit" class="btn btn-outline-warning"> | ||
<i class="bi bi-repeat"></i> Restart | ||
</button> | ||
</form> | ||
<button type="button" class="btn btn-outline-success" id="[email protected]("_")[0][email protected]("_")[1]"> | ||
<i class="bi bi-play-btn"></i> Start | ||
</button> | ||
<button type="button" class="btn btn-outline-danger" id="[email protected]("_")[0][email protected]("_")[1]"> | ||
<i class="bi bi-stop-btn"></i> Stop | ||
</button> | ||
<button type="button" class="btn btn-outline-warning" id="[email protected]("_")[0][email protected]("_")[1]"> | ||
<i class="bi bi-repeat"></i> Restart | ||
</button> | ||
<script> | ||
$(document).ready(function () { | ||
$('#[email protected]("_")[0][email protected]("_")[1]').click(function () { | ||
var iisServerId = "@obj.AssetId.Split("_")[0]"; | ||
var loading = $('#loadingSpinner'); | ||
loading.show(); | ||
var selected = "@obj.AssetId.Split("_")[1]"; | ||
var antiForgeryToken = $('[name=__RequestVerificationToken]').val(); | ||
$.ajax({ | ||
type: "POST", | ||
url: '/User/App_Pools?id=' + iisServerId + '&selected=' + selected + '&handler=Start', | ||
data: { __RequestVerificationToken: antiForgeryToken }, | ||
success: function (results) { | ||
getUpdatedFavoritesData(); | ||
}, | ||
error: function (error) { | ||
getUpdatedFavoritesData(); | ||
} | ||
}); | ||
}); | ||
$('#[email protected]("_")[0][email protected]("_")[1]').click(function () { | ||
var iisServerId = "@obj.AssetId.Split("_")[0]"; | ||
var loading = $('#loadingSpinner'); | ||
loading.show(); | ||
var selected = "@obj.AssetId.Split("_")[1]"; | ||
var antiForgeryToken = $('[name=__RequestVerificationToken]').val(); | ||
$.ajax({ | ||
type: "POST", | ||
url: '/User/App_Pools?id=' + iisServerId + '&selected=' + selected + '&handler=Stop', | ||
data: { __RequestVerificationToken: antiForgeryToken }, | ||
success: function (results) { | ||
getUpdatedFavoritesData(); | ||
}, | ||
error: function (error) { | ||
getUpdatedFavoritesData(); | ||
} | ||
}); | ||
}); | ||
$('#[email protected]("_")[0][email protected]("_")[1]').click(function () { | ||
var iisServerId = "@obj.AssetId.Split("_")[0]"; | ||
var loading = $('#loadingSpinner'); | ||
loading.show(); | ||
var selected = "@obj.AssetId.Split("_")[1]"; | ||
var antiForgeryToken = $('[name=__RequestVerificationToken]').val(); | ||
$.ajax({ | ||
type: "POST", | ||
url: '/User/App_Pools?id=' + iisServerId + '&selected=' + selected + '&handler=Restart', | ||
data: { __RequestVerificationToken: antiForgeryToken }, | ||
success: function (results) { | ||
getUpdatedFavoritesData(); | ||
}, | ||
error: function (error) { | ||
getUpdatedFavoritesData(); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> | ||
</div> | ||
} | ||
</td> | ||
|
@@ -84,18 +143,21 @@ | |
</table> | ||
</div> | ||
|
||
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> | ||
<script> | ||
function getUpdatedFavoritesData() { | ||
var loading = $('#loadingSpinner'); | ||
loading.show(); | ||
$.ajax({ | ||
url: '/Index?handler=Favorites', | ||
type: 'GET', | ||
dataType: 'json', | ||
success: function (data) { | ||
updateStates(data); | ||
loading.hide(); | ||
}, | ||
error: function (xhr, status, error) { | ||
console.error('Error fetching updated data:', error); | ||
loading.hide(); | ||
} | ||
}); | ||
} | ||
|
@@ -110,6 +172,7 @@ | |
} else { | ||
stateCell.text(favorite.assetState); | ||
if (favorite.assetState === "Started") { | ||
stateCell.removeClass("text-danger"); | ||
stateCell.addClass("text-success"); | ||
} else if (favorite.assetState === "Stopped") { | ||
stateCell.addClass("text-danger"); | ||
|