Commit 825c9bcb authored by Paul Slaughter's avatar Paul Slaughter

Merge branch '11326_01-node-name-on-card' into 'master'

Refactor Geo Node Card

Closes #11326

See merge request gitlab-org/gitlab!21876
parents be8259c5 01885160
...@@ -70,7 +70,7 @@ export default { ...@@ -70,7 +70,7 @@ export default {
<div class="row"> <div class="row">
<div class="col-md-8 clearfix"> <div class="col-md-8 clearfix">
<span class="d-flex align-items-center float-left append-right-10"> <span class="d-flex align-items-center float-left append-right-10">
<strong class="node-url"> {{ node.url }} </strong> <strong>{{ node.name }}</strong>
<gl-loading-icon <gl-loading-icon
v-if="nodeDetailsLoading || node.nodeActionActive" v-if="nodeDetailsLoading || node.nodeActionActive"
class="node-details-loading prepend-left-10 inline" class="node-details-loading prepend-left-10 inline"
......
...@@ -48,14 +48,20 @@ export default { ...@@ -48,14 +48,20 @@ export default {
<template> <template>
<div class="row-fluid clearfix py-3 primary-section"> <div class="row-fluid clearfix py-3 primary-section">
<div class="col-md-8"> <div class="col-md-8">
<div> <div class="d-flex flex-column">
<div class="text-secondary-700 node-detail-title">{{ s__('GeoNodes|GitLab version') }}</div> <span class="text-secondary-700 js-node-url-title">{{ s__('GeoNodes|Node URL') }}</span>
<div <span class="mt-1 font-weight-bold js-node-url-value">{{ node.url }}</span>
</div>
<div class="d-flex flex-column mt-2">
<span class="text-secondary-700 js-node-version-title">{{
s__('GeoNodes|GitLab version')
}}</span>
<span
:class="{ 'text-danger-500': versionMismatch }" :class="{ 'text-danger-500': versionMismatch }"
class="mt-1 font-weight-bold node-detail-value" class="mt-1 font-weight-bold js-node-version-value"
> >
{{ nodeVersion }} {{ nodeVersion }}
</div> </span>
</div> </div>
<geo-node-health-status :status="nodeHealthStatus" /> <geo-node-health-status :status="nodeHealthStatus" />
</div> </div>
......
...@@ -41,9 +41,10 @@ export default class GeoNodesStore { ...@@ -41,9 +41,10 @@ export default class GeoNodesStore {
} }
static formatNode(rawNode) { static formatNode(rawNode) {
const { id, url, primary, current, enabled } = rawNode; const { id, name, url, primary, current, enabled } = rawNode;
return { return {
id, id,
name,
url, url,
primary, primary,
current, current,
......
---
title: Show Geo node's name in admin page
merge_request: 21876
author:
type: changed
...@@ -92,4 +92,10 @@ describe('GeoNodeHeader', () => { ...@@ -92,4 +92,10 @@ describe('GeoNodeHeader', () => {
}); });
}); });
}); });
describe('template', () => {
it('renders node name element', () => {
expect(vm.$el.innerText).toContain(vm.node.name);
});
});
}); });
...@@ -4,6 +4,8 @@ import NodeDetailsSectionMainComponent from 'ee/geo_nodes/components/node_detail ...@@ -4,6 +4,8 @@ import NodeDetailsSectionMainComponent from 'ee/geo_nodes/components/node_detail
import mountComponent from 'spec/helpers/vue_mount_component_helper'; import mountComponent from 'spec/helpers/vue_mount_component_helper';
import { mockNode, mockNodeDetails } from 'ee_spec/geo_nodes/mock_data'; import { mockNode, mockNodeDetails } from 'ee_spec/geo_nodes/mock_data';
const MOCK_VERSION_TEXT = `${mockNodeDetails.version} (${mockNodeDetails.revision})`;
const createComponent = ({ const createComponent = ({
node = Object.assign({}, mockNode), node = Object.assign({}, mockNode),
nodeDetails = Object.assign({}, mockNodeDetails), nodeDetails = Object.assign({}, mockNodeDetails),
...@@ -47,7 +49,7 @@ describe('NodeDetailsSectionMain', () => { ...@@ -47,7 +49,7 @@ describe('NodeDetailsSectionMain', () => {
}); });
it('returns version string', () => { it('returns version string', () => {
expect(vm.nodeVersion).toBe('10.4.0-pre (b93c51849b)'); expect(vm.nodeVersion).toBe(MOCK_VERSION_TEXT);
}); });
}); });
...@@ -74,10 +76,18 @@ describe('NodeDetailsSectionMain', () => { ...@@ -74,10 +76,18 @@ describe('NodeDetailsSectionMain', () => {
expect(vm.$el.classList.contains('primary-section')).toBe(true); expect(vm.$el.classList.contains('primary-section')).toBe(true);
}); });
it('renders node url element', () => {
expect(vm.$el.querySelector('.js-node-url-title').innerText.trim()).toBe('Node URL');
expect(vm.$el.querySelector('.js-node-url-value').innerText.trim()).toBe(vm.node.url);
});
it('renders node version element', () => { it('renders node version element', () => {
expect(vm.$el.querySelector('.node-detail-title').innerText.trim()).toBe('GitLab version'); expect(vm.$el.querySelector('.js-node-version-title').innerText.trim()).toBe(
expect(vm.$el.querySelector('.node-detail-value').innerText.trim()).toBe( 'GitLab version',
'10.4.0-pre (b93c51849b)', );
expect(vm.$el.querySelector('.js-node-version-value').innerText.trim()).toBe(
MOCK_VERSION_TEXT,
); );
}); });
}); });
......
...@@ -8,6 +8,7 @@ export const NODE_DETAILS_PATH = '/admin/geo/nodes'; ...@@ -8,6 +8,7 @@ export const NODE_DETAILS_PATH = '/admin/geo/nodes';
export const mockNodes = [ export const mockNodes = [
{ {
id: 1, id: 1,
name: 'Test Node 1',
url: 'http://127.0.0.1:3001/', url: 'http://127.0.0.1:3001/',
primary: true, primary: true,
enabled: true, enabled: true,
...@@ -26,6 +27,7 @@ export const mockNodes = [ ...@@ -26,6 +27,7 @@ export const mockNodes = [
}, },
{ {
id: 2, id: 2,
name: 'Test Node 2',
url: 'http://127.0.0.1:3002/', url: 'http://127.0.0.1:3002/',
primary: false, primary: false,
enabled: true, enabled: true,
...@@ -47,6 +49,7 @@ export const mockNodes = [ ...@@ -47,6 +49,7 @@ export const mockNodes = [
export const mockNode = { export const mockNode = {
id: 1, id: 1,
name: 'Test Node',
url: 'http://127.0.0.1:3001/', url: 'http://127.0.0.1:3001/',
internalUrl: 'http://127.0.0.1:3001/', internalUrl: 'http://127.0.0.1:3001/',
primary: true, primary: true,
......
...@@ -8288,6 +8288,9 @@ msgstr "" ...@@ -8288,6 +8288,9 @@ msgstr ""
msgid "GeoNodes|Node Authentication was successfully repaired." msgid "GeoNodes|Node Authentication was successfully repaired."
msgstr "" msgstr ""
msgid "GeoNodes|Node URL"
msgstr ""
msgid "GeoNodes|Node was successfully removed." msgid "GeoNodes|Node was successfully removed."
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment