mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-07-06 21:57:57 +02:00
add: create toast notifications in the dashboard
This commit is contained in:
@@ -79,6 +79,36 @@
|
|||||||
<body keypress-events class="d-flex flex-column">
|
<body keypress-events class="d-flex flex-column">
|
||||||
<ng-include src="'partials/header.htm'"></ng-include>
|
<ng-include src="'partials/header.htm'"></ng-include>
|
||||||
<ng-view class="align-items-stretch h-100 w-100 overflow-auto"></ng-view>
|
<ng-view class="align-items-stretch h-100 w-100 overflow-auto"></ng-view>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="position-fixed bottom-0 right-0 p-3"
|
||||||
|
style="z-index: 5; right: 0; bottom: 0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
id="liveToast"
|
||||||
|
class="toast show"
|
||||||
|
role="alert"
|
||||||
|
aria-live="assertive"
|
||||||
|
aria-atomic="true"
|
||||||
|
data-delay="2000"
|
||||||
|
ng-repeat="toast in toasts"
|
||||||
|
>
|
||||||
|
<div class="toast-header">
|
||||||
|
<strong class="mr-auto" ng-bind="toast.title"></strong>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="ml-2 mb-1 close"
|
||||||
|
data-dismiss="toast"
|
||||||
|
aria-label="Close"
|
||||||
|
ng-click="removeToast(toast);"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true">×</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="toast-body" ng-bind="toast.body"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
|
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
|
||||||
<script>
|
<script>
|
||||||
kofiWidgetOverlay.draw("tdurieux", {
|
kofiWidgetOverlay.draw("tdurieux", {
|
||||||
|
|||||||
@@ -211,8 +211,7 @@
|
|||||||
ng-bind="repo.source.commit.substring(0, 8)"
|
ng-bind="repo.source.commit.substring(0, 8)"
|
||||||
></a>
|
></a>
|
||||||
</span>
|
</span>
|
||||||
anonymized
|
anonymized {{repo.anonymizeDate | humanTime}}
|
||||||
{{repo.anonymizeDate | humanTime}}
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="color-text-secondary mt-2">
|
<div class="color-text-secondary mt-2">
|
||||||
|
|||||||
+25
-1
@@ -359,6 +359,13 @@ angular
|
|||||||
$scope.user = { status: "connection" };
|
$scope.user = { status: "connection" };
|
||||||
$scope.site_options;
|
$scope.site_options;
|
||||||
|
|
||||||
|
$scope.toasts = [];
|
||||||
|
|
||||||
|
$scope.removeToast = function (toast) {
|
||||||
|
const index = $scope.toasts.indexOf(toast);
|
||||||
|
$scope.toasts = $scope.toasts.splice(index, index);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.path = $location.url();
|
$scope.path = $location.url();
|
||||||
$scope.paths = $location.path().substring(1).split("/");
|
$scope.paths = $location.path().substring(1).split("/");
|
||||||
|
|
||||||
@@ -591,15 +598,32 @@ angular
|
|||||||
`Are you sure that you want to remove the repository ${repo.repoId}?`
|
`Are you sure that you want to remove the repository ${repo.repoId}?`
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
const toast = {
|
||||||
|
title: `Removing ${repo.repoId}...`,
|
||||||
|
date: new Date(),
|
||||||
|
body: `The repository ${repo.repoId} is going to be removed.`,
|
||||||
|
};
|
||||||
|
$scope.toasts.push(toast);
|
||||||
$http.delete(`/api/repo/${repo.repoId}`).then(() => {
|
$http.delete(`/api/repo/${repo.repoId}`).then(() => {
|
||||||
|
toast.title = `${repo.repoId} is removed.`;
|
||||||
|
toast.body = `The repository ${repo.repoId} is removed.`;
|
||||||
getRepositories();
|
getRepositories();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.updateRepository = (repo) => {
|
$scope.updateRepository = (repo) => {
|
||||||
|
const toast = {
|
||||||
|
title: `Refreshing ${repo.repoId}...`,
|
||||||
|
date: new Date(),
|
||||||
|
body: `The repository ${repo.repoId} is going to be removed.`,
|
||||||
|
};
|
||||||
|
$scope.toasts.push(toast);
|
||||||
|
|
||||||
$http.post(`/api/repo/${repo.repoId}/refresh`).then(() => {
|
$http.post(`/api/repo/${repo.repoId}/refresh`).then(() => {
|
||||||
alert(`${repo.repoId} is refreshed.`);
|
toast.title = `${repo.repoId} is refreshed.`;
|
||||||
|
toast.body = `The repository ${repo.repoId} is refreshed.`;
|
||||||
|
|
||||||
getRepositories();
|
getRepositories();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user