add default platform versions

This commit is contained in:
Jake Potrebic 2020-09-29 10:52:07 -07:00
parent 018e23a2be
commit 63f6355c08
No known key found for this signature in database
GPG Key ID: 7C58557EC9C421F8
4 changed files with 26 additions and 4 deletions

View File

@ -261,6 +261,6 @@ export default {
}
}
#relevanceBox {
margin-right: 5px;
margin-right: 5px;
}
</style>

View File

@ -128,9 +128,11 @@ export default {
},
created() {
this.update();
apiV2Request('permissions', 'GET', { author: window.PROJECT_OWNER, slug: window.PROJECT_SLUG }).then(response => {
this.canUpload = response.permissions.includes('create_version');
});
apiV2Request('permissions', 'GET', { author: window.PROJECT_OWNER, slug: window.PROJECT_SLUG }).then(
response => {
this.canUpload = response.permissions.includes('create_version');
}
);
this.$watch(
() => this.page,
() => {

View File

@ -1,4 +1,7 @@
import { createApp } from 'vue';
import $ from 'jquery';
import VersionList from '@/VersionList';
$.ajaxSetup(window.ajaxSettings);
createApp(VersionList).mount('#version-list');

View File

@ -81,6 +81,11 @@ public class ApplicationController extends HangarController {
private final HttpServletRequest request;
// TODO remove
private final List<String> paperVersions = List.of("1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16");
private final List<String> waterfallVersions = List.of("1.11", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16");
private final List<String> velocityVersions = List.of("1.0", "1.1");
@Autowired
public ApplicationController(HangarDao<PlatformVersionsDao> platformVersionsDao, UserService userService, ProjectService projectService, OrgService orgService, VersionService versionService, FlagService flagService, UserActionLogService userActionLogService, JobService jobService, SitemapService sitemapService, StatsService statsService, StatusZ statusZ, ObjectMapper mapper, HangarConfig hangarConfig, HttpServletRequest request) {
this.platformVersionsDao = platformVersionsDao;
@ -97,6 +102,18 @@ public class ApplicationController extends HangarController {
this.hangarConfig = hangarConfig;
this.request = request;
this.statsService = statsService;
initPlatformVersions();
}
// TODO remove
private void initPlatformVersions() {
Map<Platform, List<String>> platformVersions = platformVersionsDao.get().getVersions();
if (platformVersions.isEmpty()) {
platformVersionsDao.get().insert(paperVersions.stream().map(v -> new PlatformVersionsTable(Platform.PAPER, v)).collect(Collectors.toList()));
platformVersionsDao.get().insert(velocityVersions.stream().map(v -> new PlatformVersionsTable(Platform.VELOCITY, v)).collect(Collectors.toList()));
platformVersionsDao.get().insert(waterfallVersions.stream().map(v -> new PlatformVersionsTable(Platform.WATERFALL, v)).collect(Collectors.toList()));
}
}
@GetMapping("/")