debian-mirror-gitlab/app/assets/javascripts/google_cloud/components/app.vue

64 lines
1.7 KiB
Vue
Raw Normal View History

2021-12-11 22:18:48 +05:30
<script>
2022-01-26 12:08:38 +05:30
import { __ } from '~/locale';
import Home from './home.vue';
2021-12-11 22:18:48 +05:30
import IncubationBanner from './incubation_banner.vue';
2022-01-26 12:08:38 +05:30
import ServiceAccountsForm from './service_accounts_form.vue';
2022-05-07 20:08:51 +05:30
import GcpRegionsForm from './gcp_regions_form.vue';
2022-01-26 12:08:38 +05:30
import NoGcpProjects from './errors/no_gcp_projects.vue';
import GcpError from './errors/gcp_error.vue';
const SCREEN_GCP_ERROR = 'gcp_error';
const SCREEN_HOME = 'home';
const SCREEN_NO_GCP_PROJECTS = 'no_gcp_projects';
const SCREEN_SERVICE_ACCOUNTS_FORM = 'service_accounts_form';
2022-05-07 20:08:51 +05:30
const SCREEN_GCP_REGIONS_FORM = 'gcp_regions_form';
2021-12-11 22:18:48 +05:30
export default {
2022-01-26 12:08:38 +05:30
components: {
IncubationBanner,
},
inheritAttrs: false,
2021-12-11 22:18:48 +05:30
props: {
2022-01-26 12:08:38 +05:30
screen: {
2021-12-11 22:18:48 +05:30
required: true,
type: String,
},
2022-01-26 12:08:38 +05:30
},
computed: {
mainComponent() {
switch (this.screen) {
case SCREEN_HOME:
return Home;
case SCREEN_GCP_ERROR:
return GcpError;
case SCREEN_NO_GCP_PROJECTS:
return NoGcpProjects;
case SCREEN_SERVICE_ACCOUNTS_FORM:
return ServiceAccountsForm;
2022-05-07 20:08:51 +05:30
case SCREEN_GCP_REGIONS_FORM:
return GcpRegionsForm;
2022-01-26 12:08:38 +05:30
default:
throw new Error(__('Unknown screen'));
}
2021-12-11 22:18:48 +05:30
},
},
methods: {
feedbackUrl(template) {
return `https://gitlab.com/gitlab-org/incubation-engineering/five-minute-production/meta/-/issues/new?issuable_template=${template}`;
},
},
};
</script>
<template>
<div>
<incubation-banner
:share-feedback-url="feedbackUrl('general_feedback')"
:report-bug-url="feedbackUrl('report_bug')"
:feature-request-url="feedbackUrl('feature_request')"
/>
2022-01-26 12:08:38 +05:30
<component :is="mainComponent" v-bind="$attrs" />
2021-12-11 22:18:48 +05:30
</div>
</template>