Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add channel flag to de-select by default on versions page #1255

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion e2e/tests/pages/NewOrganizationPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature("New Org Page");
Scenario("Test New Org", async ({ I, util, IndexPage }) => {
await util.login();
util.openHangarPage("/neworganization");
const name = "E2EOrg-" + Math.floor(Math.random() * 10000);
const name = "E2EOrg-" + util.randomNumber(10000);
I.fillField("input[name='name']", name);
I.wait(1);
I.click("button[title='Create Org']");
Expand Down
2 changes: 1 addition & 1 deletion e2e/tests/pages/NewProjectPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Scenario("Test New Project", async ({ I, util, IndexPage }) => {
util.openHangarPage("/new");
I.click("Agree");

const name = "E2E-" + Math.floor(Math.random() * 10000);
const name = "E2E-" + util.randomNumber(10000);
I.fillField("input[name='name']", name);
I.fillField("input[name='description']", "E2E Test Project");
I.selectOption("select[name='category']", "Games");
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
Loading