Skip to content

Commit

Permalink
Add channel flag to de-select by default on versions page
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker authored and MiniDigger committed May 4, 2024
1 parent 0d8aa07 commit 5c07353
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ To get the project running locally, you need to follow a few steps:

### Notes

* The Spring Boot configuration file that is used by this environment is located at `Hangar/src/main/resources/application.yml`.
* The Spring Boot configuration file that is used by this environment is located at `backend/src/main/resources/application.yml`.
* You can view the emails hangar sends on http://localhost:4436/
* On staging/prod Hangar uses object storage, if you want to test that you can install minio and change the storage type to `object` in the `application.yml`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public enum ChannelFlag {
UNSTABLE(true, false),
PINNED(true, true),
SENDS_NOTIFICATIONS(true, false),
HIDE_BY_DEFAULT(true, true),
;

public static final Set<ChannelFlag> EDITABLE = Arrays.stream(values()).filter(ChannelFlag::isEditable).collect(Collectors.toUnmodifiableSet());
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/components/modals/ChannelModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const i18n = useI18n();
const v = useVuelidate({ $stopPropagation: true });
const frozen = props.channel && props.channel.flags.includes(ChannelFlag.FROZEN);
const possibleFlags = frozen ? [ChannelFlag.PINNED] : [ChannelFlag.UNSTABLE, ChannelFlag.PINNED, ChannelFlag.SENDS_NOTIFICATIONS];
const possibleFlags = frozen ? [ChannelFlag.PINNED] : [ChannelFlag.UNSTABLE, ChannelFlag.PINNED, ChannelFlag.SENDS_NOTIFICATIONS, ChannelFlag.HIDE_BY_DEFAULT];
const form = reactive<ProjectChannel>({
name: "",
Expand Down Expand Up @@ -135,6 +135,7 @@ reset();
<IconMdiAlertOutline v-if="f === ChannelFlag.UNSTABLE" />
<IconMdiPinOutline v-else-if="f === ChannelFlag.PINNED" />
<IconMdiBellOutline v-else-if="f === ChannelFlag.SENDS_NOTIFICATIONS" />
<IconMdiHideOutline v-else-if="f === ChannelFlag.HIDE_BY_DEFAULT" />
</span>
{{ i18n.t("channel.modal.flags." + f.toLowerCase()) }}
</template>
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/i18n/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,9 @@
"flags": {
"unstable": "Versions are to be considered unstable",
"pinned": "Latest version is pinned on main project page",
"sends_notifications": "New versions in this channel send notifications to watching users"
"sends_notifications": "New versions in this channel send notifications to watching users",
"pinned": "Latest version is pinned on main project page",
"hide_by_default": "De-select this channel on the versions page"
},
"error": {
"invalidName": "Invalid channel name",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/pages/[user]/[project]/versions/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { NamedPermission, Visibility } from "~/types/backend";
import { NamedPermission, Visibility, ChannelFlag } from "~/types/backend";
import type { Platform, HangarProject, Version } from "~/types/backend";
const i18n = useI18n();
Expand Down Expand Up @@ -34,7 +34,7 @@ const requestParams = computed(() => {
const results = await Promise.all([useProjectChannels(route.params.project), useProjectVersions(route.params.project, requestParams.value)]);
const channels = results[0].data;
const versions = results[1];
filter.channels.push(...channels.value.map((c) => c.name));
filter.channels.push(...channels.value.filter((c) => !c.flags.includes(ChannelFlag.HIDE_BY_DEFAULT)).map((c) => c.name));
filter.platforms.push(...platforms.value.map((p) => p.enumName));
useHead(useSeo("Versions | " + props.project.name, props.project.description, route, props.project.avatarUrl));
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types/backend/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ export enum ChannelFlag {
UNSTABLE = "UNSTABLE",
PINNED = "PINNED",
SENDS_NOTIFICATIONS = "SENDS_NOTIFICATIONS",
HIDE_BY_DEFAULT = "HIDE_BY_DEFAULT",
}

export enum Color {
Expand Down

0 comments on commit 5c07353

Please sign in to comment.