Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3a8b9fbf
Commit
3a8b9fbf
authored
Apr 05, 2018
by
Kushal Pandya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GeoNode NodeDetailsSectionOther Component
parent
23247b4d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
158 additions
and
0 deletions
+158
-0
ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_other.vue
...nents/node_detail_sections/node_details_section_other.vue
+66
-0
spec/javascripts/geo_nodes/components/node_detail_sections/node_details_section_other_spec.js
...s/node_detail_sections/node_details_section_other_spec.js
+92
-0
No files found.
ee/app/assets/javascripts/geo_nodes/components/node_detail_sections/node_details_section_other.vue
0 → 100644
View file @
3a8b9fbf
<
script
>
import
{
s__
,
__
}
from
'
~/locale
'
;
import
{
VALUE_TYPE
}
from
'
../../constants
'
;
import
GeoNodeDetailItem
from
'
../geo_node_detail_item.vue
'
;
import
SectionRevealButton
from
'
./section_reveal_button.vue
'
;
export
default
{
valueType
:
VALUE_TYPE
,
components
:
{
SectionRevealButton
,
GeoNodeDetailItem
,
},
props
:
{
nodeDetails
:
{
type
:
Object
,
required
:
true
,
},
},
data
()
{
return
{
showSectionItems
:
false
,
};
},
computed
:
{
storageShardsStatus
()
{
if
(
this
.
nodeDetails
.
storageShardsMatch
==
null
)
{
return
__
(
'
Unknown
'
);
}
return
this
.
nodeDetails
.
storageShardsMatch
?
__
(
'
OK
'
)
:
s__
(
'
GeoNodes|Does not match the primary storage configuration
'
);
},
storageShardsCssClass
()
{
const
cssClass
=
'
node-detail-value-bold
'
;
return
!
this
.
nodeDetails
.
storageShardsMatch
?
`
${
cssClass
}
node-detail-value-error`
:
cssClass
;
},
},
methods
:
{
handleSectionToggle
(
toggleState
)
{
this
.
showSectionItems
=
toggleState
;
},
},
};
</
script
>
<
template
>
<div
class=
"row-fluid clearfix node-detail-section other-section"
>
<div
class=
"col-md-12"
>
<section-reveal-button
:button-title=
"__('Other information')"
@
toggleButton=
"handleSectionToggle"
/>
</div>
<div
v-show=
"showSectionItems"
class=
"col-md-6 prepend-left-15 prepend-top-10 section-items-container"
>
<geo-node-detail-item
:item-title=
"s__('GeoNodes|Storage config:')"
:item-value=
"storageShardsStatus"
:item-value-type=
"$options.valueType.PLAIN"
:css-class=
"storageShardsCssClass"
/>
</div>
</div>
</
template
>
spec/javascripts/geo_nodes/components/node_detail_sections/node_details_section_other_spec.js
0 → 100644
View file @
3a8b9fbf
import
Vue
from
'
vue
'
;
import
NodeDetailsSectionOtherComponent
from
'
ee/geo_nodes/components/node_detail_sections/node_details_section_other.vue
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
mockNodeDetails
}
from
'
../../mock_data
'
;
const
createComponent
=
(
nodeDetails
=
Object
.
assign
({},
mockNodeDetails
),
)
=>
{
const
Component
=
Vue
.
extend
(
NodeDetailsSectionOtherComponent
);
return
mountComponent
(
Component
,
{
nodeDetails
,
});
};
describe
(
'
NodeDetailsSectionOther
'
,
()
=>
{
let
vm
;
beforeEach
(()
=>
{
vm
=
createComponent
();
});
afterEach
(()
=>
{
vm
.
$destroy
();
});
describe
(
'
data
'
,
()
=>
{
it
(
'
returns default data props
'
,
()
=>
{
expect
(
vm
.
showSectionItems
).
toBe
(
false
);
});
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
storageShardsStatus
'
,
()
=>
{
it
(
'
returns `Unknown` when `nodeDetails.storageShardsMatch` is null
'
,
(
done
)
=>
{
vm
.
nodeDetails
.
storageShardsMatch
=
null
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
storageShardsStatus
).
toBe
(
'
Unknown
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
returns `OK` when `nodeDetails.storageShardsMatch` is true
'
,
(
done
)
=>
{
vm
.
nodeDetails
.
storageShardsMatch
=
true
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
storageShardsStatus
).
toBe
(
'
OK
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
returns storage shard status string when `nodeDetails.storageShardsMatch` is false
'
,
()
=>
{
expect
(
vm
.
storageShardsStatus
).
toBe
(
'
Does not match the primary storage configuration
'
);
});
});
describe
(
'
storageShardsCssClass
'
,
()
=>
{
it
(
'
returns CSS class `node-detail-value-bold` when `nodeDetails.storageShardsMatch` is true
'
,
(
done
)
=>
{
vm
.
nodeDetails
.
storageShardsMatch
=
true
;
Vue
.
nextTick
()
.
then
(()
=>
{
expect
(
vm
.
storageShardsCssClass
).
toBe
(
'
node-detail-value-bold
'
);
})
.
then
(
done
)
.
catch
(
done
.
fail
);
});
it
(
'
returns CSS class `node-detail-value-bold node-detail-value-error` when `nodeDetails.storageShardsMatch` is false
'
,
()
=>
{
expect
(
vm
.
storageShardsCssClass
).
toBe
(
'
node-detail-value-bold node-detail-value-error
'
);
});
});
});
describe
(
'
template
'
,
()
=>
{
it
(
'
renders component container element
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
other-section
'
)).
toBe
(
true
);
});
it
(
'
renders show section button element
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.btn-show-section
'
)).
not
.
toBeNull
();
expect
(
vm
.
$el
.
querySelector
(
'
.btn-show-section > span
'
).
innerText
.
trim
()).
toBe
(
'
Other information
'
);
});
it
(
'
renders section items container element
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.section-items-container
'
)).
not
.
toBeNull
();
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment