diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-24 12:10:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-24 12:10:01 +0300 |
commit | aab5db568e1090b5a9ae9cec6d788f88ac6faa4c (patch) | |
tree | f7b0790fef29dd522ec7f19a358d146a6bfec385 /app | |
parent | 3d1f123313fc350f217081c6ccf38169420bf92d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
7 files changed, 74 insertions, 18 deletions
diff --git a/app/assets/javascripts/environments/graphql/resolvers/kubernetes.js b/app/assets/javascripts/environments/graphql/resolvers/kubernetes.js index 06a55158152..9111dc9c86c 100644 --- a/app/assets/javascripts/environments/graphql/resolvers/kubernetes.js +++ b/app/assets/javascripts/environments/graphql/resolvers/kubernetes.js @@ -14,6 +14,7 @@ import { import { humanizeClusterErrors } from '../../helpers/k8s_integration_helper'; import k8sPodsQuery from '../queries/k8s_pods.query.graphql'; import k8sWorkloadsQuery from '../queries/k8s_workloads.query.graphql'; +import k8sServicesQuery from '../queries/k8s_services.query.graphql'; const mapWorkloadItems = (items, kind) => { return items.map((item) => { @@ -96,13 +97,53 @@ const watchWorkloadItems = ({ kind, apiVersion, configuration, namespace, client }); }; +const mapServicesItems = (items) => { + return items.map((item) => { + const { type, clusterIP, externalIP, ports } = item.spec; + return { + metadata: item.metadata, + spec: { + type, + clusterIP: clusterIP || '-', + externalIP: externalIP || '-', + ports, + }, + }; + }); +}; + +const watchServices = ({ configuration, namespace, client }) => { + const path = namespace ? `/api/v1/namespaces/${namespace}/services` : '/api/v1/services'; + const config = new Configuration(configuration); + const watcherApi = new WatchApi(config); + + watcherApi + .subscribeToStream(path, { watch: true }) + .then((watcher) => { + let result = []; + + watcher.on(EVENT_DATA, (data) => { + result = mapServicesItems(data); + + client.writeQuery({ + query: k8sServicesQuery, + variables: { configuration, namespace }, + data: { k8sServices: result }, + }); + }); + }) + .catch((err) => { + handleClusterError(err); + }); +}; + export default { k8sPods(_, { configuration, namespace }, { client }) { const query = k8sPodsQuery; const enableWatch = gon.features?.k8sWatchApi; return getK8sPods({ client, query, configuration, namespace, enableWatch }); }, - k8sServices(_, { configuration, namespace }) { + k8sServices(_, { configuration, namespace }, { client }) { const coreV1Api = new CoreV1Api(new Configuration(configuration)); const servicesApi = namespace ? coreV1Api.listCoreV1NamespacedService({ namespace }) @@ -111,18 +152,12 @@ export default { return servicesApi .then((res) => { const items = res?.items || []; - return items.map((item) => { - const { type, clusterIP, externalIP, ports } = item.spec; - return { - metadata: item.metadata, - spec: { - type, - clusterIP: clusterIP || '-', - externalIP: externalIP || '-', - ports, - }, - }; - }); + + if (gon.features?.k8sWatchApi) { + watchServices({ configuration, namespace, client }); + } + + return mapServicesItems(items); }) .catch(async (err) => { try { diff --git a/app/assets/javascripts/super_sidebar/components/extra_info.vue b/app/assets/javascripts/super_sidebar/components/extra_info.vue new file mode 100644 index 00000000000..23340f1190f --- /dev/null +++ b/app/assets/javascripts/super_sidebar/components/extra_info.vue @@ -0,0 +1,7 @@ +<script> +export default {}; +</script> +<template> + <!-- This is intentionally left blank --> + <div></div> +</template> diff --git a/app/assets/javascripts/super_sidebar/components/super_sidebar.vue b/app/assets/javascripts/super_sidebar/components/super_sidebar.vue index ebdc0026539..52015484cb5 100644 --- a/app/assets/javascripts/super_sidebar/components/super_sidebar.vue +++ b/app/assets/javascripts/super_sidebar/components/super_sidebar.vue @@ -1,6 +1,7 @@ <script> import { GlButton } from '@gitlab/ui'; import { GlBreakpointInstance, breakpoints } from '@gitlab/ui/dist/utils'; +import ExtraInfo from 'jh_else_ce/super_sidebar/components/extra_info.vue'; import { Mousetrap } from '~/lib/mousetrap'; import { TAB_KEY_CODE } from '~/lib/utils/keycodes'; import { keysFor, TOGGLE_SUPER_SIDEBAR } from '~/behaviors/shortcuts/keybindings'; @@ -27,6 +28,7 @@ export default { GlButton, UserBar, HelpCenter, + ExtraInfo, SidebarMenu, SidebarPeekBehavior, SidebarHoverPeekBehavior, @@ -233,6 +235,7 @@ export default { > {{ $options.i18n.adminArea }} </gl-button> + <extra-info /> </div> </div> </nav> diff --git a/app/assets/javascripts/work_items/components/work_item_detail.vue b/app/assets/javascripts/work_items/components/work_item_detail.vue index 5d8c41176d0..464889a6388 100644 --- a/app/assets/javascripts/work_items/components/work_item_detail.vue +++ b/app/assets/javascripts/work_items/components/work_item_detail.vue @@ -272,6 +272,12 @@ export default { 'gl-display-none gl-sm-display-block!': this.parentWorkItem, }; }, + headerWrapperClass() { + return { + 'flex-wrap': this.parentWorkItem, + 'gl-display-block gl-md-display-flex! gl-align-items-flex-start gl-flex-direction-column gl-md-flex-direction-row gl-gap-3 gl-pt-3': true, + }; + }, }, mounted() { if (this.modalWorkItemIid) { @@ -418,9 +424,7 @@ export default { @click="$emit('close')" /> </div> - <div - class="gl-display-block gl-md-display-flex! gl-align-items-flex-start gl-flex-direction-column gl-sm-flex-direction-row flex-wrap gl-gap-3 gl-pt-3" - > + <div :class="headerWrapperClass"> <work-item-ancestors v-if="parentWorkItem" :work-item="workItem" class="gl-mb-1" /> <div v-if="!error && !workItemLoading" diff --git a/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql b/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql index ad861a60d15..f25828e36de 100644 --- a/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql +++ b/app/assets/javascripts/work_items/graphql/update_work_item_task.mutation.graphql @@ -2,6 +2,7 @@ mutation workItemUpdateTask($input: WorkItemUpdateTaskInput!) { workItemUpdate: workItemUpdateTask(input: $input) { + errors workItem { id descriptionHtml diff --git a/app/views/projects/artifacts/external_file.html.haml b/app/views/projects/artifacts/external_file.html.haml index 67f6ccd5695..37faea3a86f 100644 --- a/app/views/projects/artifacts/external_file.html.haml +++ b/app/views/projects/artifacts/external_file.html.haml @@ -1,4 +1,7 @@ - external_url = @blob.external_url(@build) +- external_url_text = external_url +- if Gitlab.config.pages.namespace_in_path + - external_url_text = "#{external_url} (Experimental)" - page_title @path, _('Artifacts'), "#{@build.name} (##{@build.id})", _('Jobs') = render "projects/jobs/header" @@ -9,7 +12,7 @@ %h2= _("You are being redirected away from GitLab") %p= _("This page is hosted on GitLab pages but contains user-generated content and may contain malicious code. Do not accept unless you trust the author and source.") - = link_to external_url, + = link_to external_url_text, external_url, target: '_blank', title: _('Opens in a new window'), diff --git a/app/views/projects/pages/_access.html.haml b/app/views/projects/pages/_access.html.haml index 1e18e528665..53a4fb4389c 100644 --- a/app/views/projects/pages/_access.html.haml +++ b/app/views/projects/pages/_access.html.haml @@ -1,12 +1,15 @@ - if @project.pages_deployed? - pages_url = build_pages_url(@project, with_unique_domain: true) + - pages_url_text = pages_url + - if Gitlab.config.pages.namespace_in_path + - pages_url_text = "#{pages_url} (Experimental)" = render Pajamas::CardComponent.new(card_options: { class: 'gl-mb-5', data: { testid: 'access-page-container' } }, footer_options: { class: 'gl-alert-warning' }) do |c| - c.with_header do = s_('GitLabPages|Access pages') - c.with_body do %p - = external_link(pages_url, pages_url) + = external_link(pages_url_text, pages_url) - @project.pages_domains.each do |domain| %p |