Skip to content
Snippets Groups Projects
Commit 62cfac6f authored by Hanna Führ's avatar Hanna Führ Committed by Sandra Westerhoff
Browse files

Update: Provide meta information gitlab resource

parent 4186a11a
No related branches found
No related tags found
2 merge requests!143Release: Sprint/2022 22 :robot:,!142Update: Provide meta information gitlab resource
......@@ -152,6 +152,18 @@
<b>{{ `${$t("page.resource.usageRights")}: ` }}</b>
{{ resource.usageRights }}
</li>
<li v-if="resource.resourceTypeOption.RepoUrl">
<b>{{ `${$t("resourceType.gitlab.domainLabel")} ` }}</b>
{{ resource.resourceTypeOption.RepoUrl }}
</li>
<li v-if="resource.resourceTypeOption.ProjectId">
<b>{{ `${$t("resourceType.gitlab.projectLabel")} ` }}</b>
{{ gitlabInformation.project ? gitlabInformation.project.name : "" }}
</li>
<li v-if="resource.resourceTypeOption.Branch">
<b>{{ `${$t("resourceType.gitlab.referenceLabel")} ` }}</b>
{{ resource.resourceTypeOption.Branch }}
</li>
</ul>
</b-popover>
</b-row>
......@@ -173,8 +185,12 @@ import type {
ProjectQuotaReturnObject,
UserObject,
} from "@coscine/api-client/dist/types/Coscine.Api.Project";
import type { ResourceTypeInformation } from "@coscine/api-client/dist/types/Coscine.Api.Resources";
import type {
Project,
ResourceTypeInformation,
} from "@coscine/api-client/dist/types/Coscine.Api.Resources";
import type { VisitedResourceObject } from "../../types";
import type { GitlabInformation } from "@/modules/resource/types";
export default defineComponent({
name: "FilesViewHeader",
......@@ -185,6 +201,7 @@ export default defineComponent({
type: String,
},
},
setup() {
const resourceStore = useResourceStore();
const projectStore = useProjectStore();
......@@ -193,6 +210,18 @@ export default defineComponent({
return { resourceStore, projectStore, userStore };
},
data() {
return {
gitlabInformation: {
domain: "",
accessToken: "",
project: null,
reference: null,
} as GitlabInformation,
gitlabProjects: [] as Project[] | null,
};
},
computed: {
isOwner(): boolean | undefined {
return this.projectStore.currentUserRoleIsOwner;
......@@ -247,7 +276,24 @@ export default defineComponent({
return undefined;
},
},
async mounted() {
await this.getGitlabProjectName();
},
methods: {
async getGitlabProjectName() {
this.gitlabProjects = await this.resourceStore.getGitlabAllProjects(
this.resource?.resourceTypeOption.RepoUrl,
this.resource?.resourceTypeOption.AccessToken
);
if (this.gitlabProjects) {
this.gitlabInformation.project =
this.gitlabProjects.find(
(p) => p.id === this.resource?.resourceTypeOption.ProjectId
) ?? null;
}
},
edit() {
if (
this.resource &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment