Skip to content
Snippets Groups Projects
Select Git revision
  • 71814de06c280a6d649a4e9c215d0006fed7d2af
  • master default protected
  • gitkeep
  • dev protected
  • Issue/2449-GuidPidSlugToProjectSettings
  • Issue/2309-docs
  • Issue/2355-topLevelOrg
  • Issue/2328-noFailOnLog
  • Hotfix/2371-fixGitLabinRCV
  • Issue/2287-guestRole
  • Fix/xxxx-activateGitlab
  • Test/xxxx-enablingGitLab
  • Issue/2349-gitlabHttps
  • Issue/2259-updatePids
  • Issue/2101-gitLabResTypeUi
  • Hotfix/2202-fixNaNQuota
  • Issue/2246-quotaResoval
  • Issue/2221-projectDateCreated
  • Hotfix/2224-quotaSizeAnalytics
  • Fix/xxxx-resourceVisibility
  • Issue/2000-gitlabResourcesAPI
  • v4.4.3
  • v4.4.2
  • v4.4.1
  • v4.4.0
  • v4.3.4
  • v4.3.3
  • v4.3.2
  • v4.3.1
  • v4.3.0
  • v4.2.8
  • v4.2.7
  • v4.2.6
  • v4.2.5
  • v4.2.4
  • v4.2.3
  • v4.2.2
  • v4.2.1
  • v4.2.0
  • v4.1.1
  • v4.1.0
41 results

ProjectControllerTests.cs

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    ProjectModule.vue 2.06 KiB
    <template>
      <div>
        <router-view :loading="!moduleIsReady" />
      </div>
    </template>
    
    <script lang="ts">
    import { defineComponent } from "vue-demi";
    import { ProjectI18nMessages } from "./i18n";
    
    // import the store for current module
    import { useProjectStore } from "./store";
    // import the main store
    import { useMainStore } from "@/store/index";
    
    import type { ProjectObject } from "@coscine/api-client/dist/types/Coscine.Api.Project";
    import type { Route } from "vue-router";
    
    export default defineComponent({
      setup() {
        const mainStore = useMainStore();
        const projectStore = useProjectStore();
    
        return { mainStore, projectStore };
      },
      i18n: { messages: ProjectI18nMessages },
    
      created() {
        this.initialize();
      },
    
      computed: {
        project(): ProjectObject | null {
          return this.projectStore.currentProject;
        },
        moduleIsReady(): boolean {
          return (
            this.projectStore !== null &&
            this.projectStore.currentSlug !== null &&
            this.projectStore.currentProject !== null &&
            this.projectStore.currentResources !== null &&
            this.projectStore.currentSubProjects !== null
          );
        },
      },
    
      methods: {
        async initialize() {
          await this.apiFetch(this.$router.currentRoute);
        },
    
        async apiFetch(route: Route) {
          // Project may be unset (e.g. when entering from a direct link)
          await this.projectStore.handleUnsetProject(this.project, route);
          // Load Resources for the project if not present
          if (this.projectStore.currentResources === null) {
            this.projectStore.retrieveResources(this.project);
          }
          // Load Sub-Projects for the project if not present
          if (this.projectStore.currentSubProjects === null) {
            this.projectStore.retrieveSubProjects(this.project);
          }
          // Load Project Roles for the project if not present
          if (this.projectStore.currentProjectRoles === null) {
            this.projectStore.retrieveProjectRoles(this.project);
          }
        },
      },
    
      async beforeRouteUpdate(to, from, next) {
        await this.apiFetch(to);
        next();
      },
    });
    </script>