-
Notifications
You must be signed in to change notification settings - Fork 8
Create a component for the topbar #462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
9e92766
Add top bar block in the template
martinRenou 9fd9714
Add application topbar widget
martinRenou 1feadc9
Merge branch 'move_frontend' into put_appname_and_close_btn_in_topbar
martinRenou 60a092b
Change CSS
martinRenou 4bc6e1c
ApplicationLable is now a dropdown menu with a close button
martinRenou 8e02b45
Handle stopping error in the ApplicationLabel component
martinRenou b7e30b6
Merge branch 'move_frontend' into put_appname_and_close_btn_in_topbar
martinRenou 2c75262
Fix jstest
martinRenou e60e6f9
Remove console.log
martinRenou 956e98e
Add tests for the stop button
martinRenou 4141510
Add test for current application label
martinRenou fb2133c
Remove console.log
martinRenou cb818be
Add tests for the stopping error dialog
martinRenou edcaf7a
Fix selenium tests
martinRenou b8611ba
Fixes #461
martinRenou 5007e4a
Merge branch 'master' into put_appname_and_close_btn_in_topbar
martinRenou 2c08e68
Fix jstests
martinRenou 6e3eb04
Merge branch 'fix_el_issue' into put_appname_and_close_btn_in_topbar
martinRenou d5a8463
Merge branch 'fix_el_issue' into put_appname_and_close_btn_in_topbar
martinRenou 909b302
Merge branch 'master' into put_appname_and_close_btn_in_topbar
martinRenou 9052430
Merge branch 'master' into put_appname_and_close_btn_in_topbar
martinRenou bdc8569
ApplicationLabel now uses the errorDialog component
martinRenou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| var Vue = require("vuejs"); | ||
| var ApplicationListModel = require("user/ApplicationListModel"); | ||
| var ApplicationLabel = require("user/vue-components/ApplicationLabel"); | ||
| var $ = require("jquery"); | ||
| require("filters"); | ||
|
|
||
| QUnit.module("user.app_label"); | ||
| QUnit.test("application name", function(assert) { | ||
| var done = assert.async(); | ||
|
|
||
| var model = new ApplicationListModel(); | ||
| var appLabel = new ApplicationLabel({ | ||
| data: function() { return { model: model }; } | ||
| }).$mount(); | ||
|
|
||
| model.update().done(function() { | ||
| Vue.nextTick(function() { | ||
| assert.equal( | ||
| appLabel.$el.querySelector('li > a > span').innerHTML, | ||
| model.appList[0].appData.image.ui_name | ||
| ); | ||
|
|
||
| // Simulate changing currentApp | ||
| model.selectedIndex = 1; | ||
|
|
||
| Vue.nextTick(function() { | ||
| assert.equal( | ||
| appLabel.$el.querySelector('li > a > span').innerHTML, | ||
| model.appList[1].appData.image.ui_name | ||
| ); | ||
|
|
||
| done(); | ||
| }); | ||
| }) | ||
| }); | ||
| }); | ||
|
|
||
| QUnit.test("rendering stop button", function (assert) { | ||
| var done = assert.async(); | ||
|
|
||
| var model = new ApplicationListModel(); | ||
| var appLabel = new ApplicationLabel({ | ||
| data: function() { return { model: model }; } | ||
| }).$mount(); | ||
|
|
||
| model.update().done(function() { | ||
| // Simulate application stopped | ||
| model.appList[0].status = 'STOPPED'; | ||
|
|
||
| Vue.nextTick(function() { | ||
| assert.equal( | ||
| appLabel.$el.querySelector('li > a > span').innerHTML, | ||
| model.appList[0].appData.image.ui_name | ||
| ); | ||
|
|
||
| // Test stop button disabled | ||
| assert.ok( | ||
| appLabel.$el.querySelector('#stop-button').classList.contains('disabled') | ||
| ); | ||
|
|
||
| // Simulate application running | ||
| model.appList[0].status = 'RUNNING'; | ||
|
|
||
| // Test stop button enabled | ||
| Vue.nextTick(function() { | ||
| assert.notOk( | ||
| appLabel.$el.querySelector('#stop-button').classList.contains('disabled') | ||
| ); | ||
|
|
||
| done(); | ||
| }); | ||
| }) | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <template> | ||
| <ul v-if="currentApp !== null" class="nav navbar-nav"> | ||
| <li class="dropdown"> | ||
| <a href="#" class="dropdown-toggle cust-padding" data-toggle="dropdown" aria-expanded="false"> | ||
| <img class="app-icon" | ||
| :src="currentApp.appData.image.icon_128 | iconSrc"> | ||
|
|
||
| <span>{{ currentApp.appData.image | appName }}</span> | ||
| </a> | ||
|
|
||
| <ul class="dropdown-menu" role="menu"> | ||
| <li class="disabled"> | ||
| <a href="#">Application settings</a> | ||
| </li> | ||
| <li role="separator" class="divider"></li> | ||
| <li | ||
| id="stop-button" | ||
| :class="{ disabled: !currentApp.isRunning() }" | ||
| @click="stopApplication()"> | ||
| <a href="#"> | ||
| <i class="fa fa-times text-danger"></i> | ||
| Stop Application | ||
| </a> | ||
| <!-- Put other settings here --> | ||
| </li> | ||
| </ul> | ||
| </li> | ||
| </ul> | ||
| </template> | ||
|
|
||
| <script> | ||
| let Vue = require("vuejs"); | ||
| require('toolkit'); | ||
|
|
||
| module.exports = Vue.extend({ | ||
| computed: { | ||
| currentApp: function() { | ||
| return this.model.appList[this.model.selectedIndex] || null; | ||
| } | ||
| }, | ||
|
|
||
| methods: { | ||
| stopApplication: function() { | ||
| let stoppingAppName = this.$options.filters.appName( | ||
| this.currentApp.appData.image); | ||
| this.model.stopApplication(this.model.selectedIndex).fail((error) => { | ||
| this.$emit('error', { | ||
| title: 'Error when stopping ' + stoppingAppName, | ||
| code: error.code, | ||
| message: error.message | ||
| }); | ||
| }); | ||
| } | ||
| }, | ||
| }); | ||
| </script> | ||
|
|
||
| <style scoped> | ||
| .cust-padding { | ||
| padding: 9px; | ||
| } | ||
|
|
||
| .app-icon { | ||
| width: 32px; | ||
| height: 32px; | ||
| border-radius: 20%; | ||
| border: 1px solid #d2d6de; | ||
| } | ||
| </style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we report this now? I can't remember what we settled on.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now it's in
ApplicationLabel.vue, and I had some tests for it in the corresponding test file.The reason is that it's now the application label which have the stop button so it deals with a possible stopping error.
What I don't like with it is that the modal dialog is now inside a
<ul>element in the ApplicationLabel template (which is weird because the modal dialog is not a<li>), I don't know how bad this is. It works, but it's weird.A possible fix for that would be to send an event with the error message and an other view will deal with displaying this error, same for starting error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed #467