mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-12-09 06:32:43 +08:00
remove old activity stuff (and some stuff I totally forgot to remove)
This commit is contained in:
parent
7dc5adf2a8
commit
15eee40823
@ -151,18 +151,12 @@ export default class AuthorSettingsApiKeysPage extends HangarForm {
|
||||
};
|
||||
}
|
||||
|
||||
created() {
|
||||
console.log('created ran');
|
||||
}
|
||||
|
||||
async asyncData({ $api, $util, params }: Context) {
|
||||
console.log('async start');
|
||||
const data = await Promise.all([
|
||||
$api.requestInternal<IPermission[]>(`api-keys/possible-perms/${params.user}`),
|
||||
$api.requestInternal<ApiKey[]>(`api-keys/existing-keys/${params.user}`),
|
||||
]).catch<any>($util.handlePageRequestError);
|
||||
if (typeof data === 'undefined') return;
|
||||
console.log('async end');
|
||||
return { possiblePerms: data[0], apiKeys: data[1] };
|
||||
}
|
||||
}
|
||||
|
@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
{{ testArr.join(', ') }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component } from 'nuxt-property-decorator';
|
||||
import { HangarComponent } from '~/components/mixins';
|
||||
|
||||
@Component
|
||||
export default class Testing extends HangarComponent {
|
||||
testArr!: number[];
|
||||
|
||||
created() {
|
||||
console.log('created');
|
||||
}
|
||||
|
||||
async asyncData() {
|
||||
console.log('async start');
|
||||
await new Promise<void>((resolve) => {
|
||||
setTimeout(() => {
|
||||
resolve();
|
||||
}, 300);
|
||||
});
|
||||
console.log('async end');
|
||||
return Promise.resolve({ testArr: [5, 4, 3, 2, 1], t: 't' });
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped></style>
|
@ -56,15 +56,9 @@ export default class AuthorsPage extends UserListPage {
|
||||
return 'authors';
|
||||
}
|
||||
|
||||
created() {
|
||||
console.log('created');
|
||||
}
|
||||
|
||||
async asyncData({ $api, $util }: Context) {
|
||||
console.log('async start');
|
||||
const users = await $api.request<PaginatedResult<User>>('authors', false).catch<any>($util.handlePageRequestError);
|
||||
console.log('async end');
|
||||
return { users, test: 'value' };
|
||||
return { users };
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -10,7 +10,6 @@ import io.papermc.hangar.model.common.NamedPermission;
|
||||
import io.papermc.hangar.model.common.Permission;
|
||||
import io.papermc.hangar.model.internal.logs.HangarLoggedAction;
|
||||
import io.papermc.hangar.modelold.Role;
|
||||
import io.papermc.hangar.modelold.viewhelpers.Activity;
|
||||
import io.papermc.hangar.modelold.viewhelpers.OrganizationData;
|
||||
import io.papermc.hangar.modelold.viewhelpers.UserData;
|
||||
import io.papermc.hangar.securityold.annotations.GlobalPermission;
|
||||
@ -34,7 +33,6 @@ import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.server.ResponseStatusException;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@ -61,20 +59,6 @@ public class ApplicationController extends HangarController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GlobalPermission(NamedPermission.REVIEWER)
|
||||
@Secured("ROLE_USER")
|
||||
@GetMapping("/admin/activities/{user}")
|
||||
public ModelAndView showActivities(@PathVariable String user) {
|
||||
ModelAndView mv = new ModelAndView("users/admin/activity");
|
||||
mv.addObject("username", user);
|
||||
List<Activity> activities = new ArrayList<>();
|
||||
activities.addAll(userService.getFlagActivity(user));
|
||||
activities.addAll(userService.getReviewActivity(user));
|
||||
mv.addObject("activities", activities);
|
||||
return fillModel(mv);
|
||||
}
|
||||
|
||||
@GlobalPermission(NamedPermission.VIEW_LOGS)
|
||||
@Secured("ROLE_USER")
|
||||
@GetMapping("/admin/log")
|
||||
|
@ -1,8 +1,6 @@
|
||||
package io.papermc.hangar.db.daoold;
|
||||
|
||||
import io.papermc.hangar.db.modelold.UsersTable;
|
||||
import io.papermc.hangar.modelold.viewhelpers.FlagActivity;
|
||||
import io.papermc.hangar.modelold.viewhelpers.ReviewActivity;
|
||||
import org.jdbi.v3.sqlobject.config.RegisterBeanMapper;
|
||||
import org.jdbi.v3.sqlobject.customizer.BindBean;
|
||||
import org.jdbi.v3.sqlobject.statement.GetGeneratedKeys;
|
||||
@ -32,25 +30,4 @@ public interface UserDao {
|
||||
|
||||
@SqlQuery("SELECT u.* FROM project_stars ps JOIN users u ON ps.user_id = u.id WHERE project_id = :projectId OFFSET :offset LIMIT :limit")
|
||||
List<UsersTable> getProjectStargazers(long projectId, int offset, Integer limit);
|
||||
|
||||
|
||||
@SqlQuery("SELECT pvr.ended_at, pv.version_string, pv.version_string || '.' || pv.id AS version_string_url, p.owner_name \"owner\", p.slug" +
|
||||
" FROM users u" +
|
||||
" JOIN project_version_reviews pvr ON u.id = pvr.user_id" +
|
||||
" JOIN project_versions pv ON pvr.version_id = pv.id" +
|
||||
" JOIN projects p ON pv.project_id = p.id" +
|
||||
" WHERE u.name = :username" +
|
||||
" LIMIT 20")
|
||||
@RegisterBeanMapper(ReviewActivity.class)
|
||||
List<ReviewActivity> getReviewActivity(String usernafme);
|
||||
|
||||
@SqlQuery("SELECT pf.resolved_at, p.owner_name, p.slug" +
|
||||
" FROM users u" +
|
||||
" JOIN project_flags pf ON u.id = pf.user_id" +
|
||||
" JOIN projects p ON pf.project_id = p.id" +
|
||||
" WHERE u.name = :username" +
|
||||
" LIMIT 20")
|
||||
@RegisterBeanMapper(FlagActivity.class)
|
||||
List<FlagActivity> getFlagActivity(String username);
|
||||
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
package io.papermc.hangar.modelold.viewhelpers;
|
||||
|
||||
import io.papermc.hangar.modelold.generated.ProjectNamespace;
|
||||
import org.jdbi.v3.core.mapper.Nested;
|
||||
|
||||
public abstract class Activity {
|
||||
|
||||
private ProjectNamespace project;
|
||||
|
||||
public ProjectNamespace getProject() {
|
||||
return project;
|
||||
}
|
||||
|
||||
@Nested
|
||||
public void setProject(ProjectNamespace project) {
|
||||
this.project = project;
|
||||
}
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package io.papermc.hangar.modelold.viewhelpers;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
public class FlagActivity extends Activity {
|
||||
|
||||
private OffsetDateTime resolvedAt;
|
||||
|
||||
public OffsetDateTime getResolvedAt() {
|
||||
return resolvedAt;
|
||||
}
|
||||
|
||||
public void setResolvedAt(OffsetDateTime resolvedAt) {
|
||||
this.resolvedAt = resolvedAt;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package io.papermc.hangar.modelold.viewhelpers;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
|
||||
public class ReviewActivity extends Activity {
|
||||
|
||||
private OffsetDateTime endedAt;
|
||||
public String versionString;
|
||||
private String versionStringUrl;
|
||||
|
||||
public OffsetDateTime getEndedAt() {
|
||||
return endedAt;
|
||||
}
|
||||
|
||||
public void setEndedAt(OffsetDateTime endedAt) {
|
||||
this.endedAt = endedAt;
|
||||
}
|
||||
|
||||
public String getVersionString() {
|
||||
return versionString;
|
||||
}
|
||||
|
||||
public void setVersionString(String versionString) {
|
||||
this.versionString = versionString;
|
||||
}
|
||||
|
||||
public String getVersionStringUrl() {
|
||||
return versionStringUrl;
|
||||
}
|
||||
|
||||
public void setVersionStringUrl(String versionStringUrl) {
|
||||
this.versionStringUrl = versionStringUrl;
|
||||
}
|
||||
}
|
@ -10,10 +10,8 @@ import io.papermc.hangar.db.modelold.UserOrganizationRolesTable;
|
||||
import io.papermc.hangar.db.modelold.UsersTable;
|
||||
import io.papermc.hangar.model.common.Permission;
|
||||
import io.papermc.hangar.modelold.Role;
|
||||
import io.papermc.hangar.modelold.viewhelpers.FlagActivity;
|
||||
import io.papermc.hangar.modelold.viewhelpers.HeaderData;
|
||||
import io.papermc.hangar.modelold.viewhelpers.OrganizationData;
|
||||
import io.papermc.hangar.modelold.viewhelpers.ReviewActivity;
|
||||
import io.papermc.hangar.modelold.viewhelpers.UserData;
|
||||
import io.papermc.hangar.modelold.viewhelpers.UserRole;
|
||||
import io.papermc.hangar.security.authentication.HangarAuthenticationToken;
|
||||
@ -149,12 +147,4 @@ public class UserService extends HangarService {
|
||||
return userDao.get().getById(userId);
|
||||
}
|
||||
|
||||
public List<ReviewActivity> getReviewActivity(String username) {
|
||||
return userDao.get().getReviewActivity(username);
|
||||
}
|
||||
|
||||
public List<FlagActivity> getFlagActivity(String username) {
|
||||
return userDao.get().getFlagActivity(username);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
<#import "/spring.ftl" as spring />
|
||||
<#import "*/utils/hangar.ftlh" as hangar />
|
||||
<#import "*/layout/base.ftlh" as base />
|
||||
|
||||
<#assign message><@spring.message "activity.title" /></#assign>
|
||||
<@base.base title=("${message} ${username}")>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 header-flags">
|
||||
<div class="clearfix">
|
||||
<h1 class="float-left"><@spring.message "activity.title" /> <i>${username}</i></h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h4 class="card-title float-left"><@spring.message "activity.title" /></h4>
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
<table class="table table-sm setting-no-border table-review-log">
|
||||
<tbody>
|
||||
<#if !activities?has_content>
|
||||
<tr><td>No activities founds</td></tr>
|
||||
</#if>
|
||||
<#assign OffsetDateTime=@helper["java.time.OffsetDateTime"]>
|
||||
<#list activities as activity>
|
||||
<#if activity.class.simpleName == "ReviewActivity">
|
||||
<#-- @ftlvariable name="activity" type="io.papermc.hangar.modelold.viewhelpers.ReviewActivity" -->
|
||||
<tr>
|
||||
<td>Review approved</td>
|
||||
<td>${utils.prettifyDateTime(activity.endedAt!OffsetDateTime.MIN)}</td>
|
||||
<td>for:
|
||||
<a href="${Routes.REVIEWS_SHOW_REVIEWS.getRouteUrl(activity.getProject().getOwner(), activity.getProject().getSlug(), activity.versionStringUrl)}" title="Go to reviews...">
|
||||
${activity.getProject().getOwner()} / ${activity.getProject().getSlug()} / ${activity.versionString}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<#elseif activity.class.simpleName = "FlagActivity">
|
||||
<#-- @ftlvariable name="activity" type="io.papermc.hangar.modelold.viewhelpers.FlagActivity" -->
|
||||
<tr>
|
||||
<td>Flag resolved</td>
|
||||
<td>${utils.prettifyDateTime(activity.resolvedAt!OffsetDateTime.MIN)}</td> <#--TODO: activity end datetime needs to be moved to abstract Activity-->
|
||||
<td>for:
|
||||
<a href="${Routes.PROJECTS_SHOW.getRouteUrl(activity.getProject().getSlug(), activity.getProject().getSlug())}">
|
||||
${activity.getProject().getOwner()} / ${activity.getProject().getSlug()}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#if>
|
||||
</#list>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</@base.base>
|
Loading…
Reference in New Issue
Block a user