-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(dedicated): add tags column and pop up
ref: MANAGER-15572 Signed-off-by: Sachin Ramesh <[email protected]>
- Loading branch information
1 parent
f53dea5
commit 88a8c9c
Showing
14 changed files
with
228 additions
and
3 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...er/apps/dedicated/client/app/dedicated/dedicated-server/clusters/nodes/nodes.component.js
This file contains 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 |
---|---|---|
@@ -1,9 +1,11 @@ | ||
import template from './nodes.html'; | ||
import controller from './nodes.controller.js'; | ||
|
||
export default { | ||
bindings: { | ||
nodes: '<', | ||
getNodeDashboardLink: '<', | ||
}, | ||
template, | ||
controller, | ||
}; |
37 changes: 37 additions & 0 deletions
37
...r/apps/dedicated/client/app/dedicated/dedicated-server/clusters/nodes/nodes.controller.js
This file contains 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,37 @@ | ||
import { | ||
CONTROLLER_NAME as DISPLAY_TAG_POPUP_CONTROLLER, | ||
TEMPLATE_CACHE_KEY as DISPLAY_TAG_POPUP_TEMPLATE, | ||
} from '../../display-tags/display-tags.constants'; | ||
|
||
export default class ServersCtrl { | ||
/* @ngInject */ | ||
constructor($uibModal) { | ||
this.$uibModal = $uibModal; | ||
} | ||
|
||
getTags(tags) { | ||
if (tags) { | ||
this.tags = Object.keys(tags) | ||
.filter((key) => !key.startsWith('ovh:')) | ||
.map((key) => `${key}:${tags[key]}`); | ||
} | ||
return this.tags; | ||
} | ||
|
||
goToTagsModal(iamDetails) { | ||
this.server_name = iamDetails.displayName; | ||
this.server_tags = this.getTags(iamDetails.tags); | ||
this.$uibModal.open({ | ||
templateUrl: DISPLAY_TAG_POPUP_TEMPLATE, | ||
controller: DISPLAY_TAG_POPUP_CONTROLLER, | ||
controllerAs: '$ctrl', | ||
resolve: { | ||
hasDefaultMeansOfPayment: () => this.hasDefaultMeansOfPayment, | ||
itemName: () => this.servicePackToOrder?.displayName, | ||
itemRef: () => this.servicePackToOrder?.name, | ||
serverName: () => this.server_name, | ||
serverTags: () => this.server_tags, | ||
}, | ||
}); | ||
} | ||
} |
This file contains 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 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 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
7 changes: 7 additions & 0 deletions
7
...ps/dedicated/client/app/dedicated/dedicated-server/display-tags/display-tags.constants.js
This file contains 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,7 @@ | ||
export const CONTROLLER_NAME = 'ovhManagerDedicatedServerDisplayTags'; | ||
export const TEMPLATE_CACHE_KEY = 'ovhManagerDedicatedServerDisplayTags.html'; | ||
|
||
export default { | ||
CONTROLLER_NAME, | ||
TEMPLATE_CACHE_KEY, | ||
}; |
31 changes: 31 additions & 0 deletions
31
...s/dedicated/client/app/dedicated/dedicated-server/display-tags/display-tags.controller.js
This file contains 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,31 @@ | ||
export default class { | ||
/* @ngInject */ | ||
constructor($uibModalInstance, serverName, serverTags) { | ||
this.$uibModalInstance = $uibModalInstance; | ||
this.serverName = serverName; | ||
this.serverTags = serverTags; | ||
} | ||
|
||
$onInit() { | ||
this.serverTagList = this.serverTags; | ||
} | ||
|
||
onEditTags() { | ||
this.$uibModalInstance.close(); | ||
this.$state.go('app.dedicated-server.server.tags'); | ||
} | ||
|
||
onSearchServerTags(value) { | ||
this.serverTagList = this.serverTags.filter((tag) => | ||
tag.toLowerCase().includes(value.toLowerCase()), | ||
); | ||
} | ||
|
||
onSearchReset() { | ||
this.serverTagList = [...this.serverTags]; | ||
} | ||
|
||
back() { | ||
this.$uibModalInstance.dismiss(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/manager/apps/dedicated/client/app/dedicated/dedicated-server/display-tags/index.js
This file contains 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,18 @@ | ||
import controller from './display-tags.controller'; | ||
import template from './template.html'; | ||
|
||
import { CONTROLLER_NAME, TEMPLATE_CACHE_KEY } from './display-tags.constants'; | ||
|
||
const moduleName = 'ovhManagerDedicatedServerDisplayTags'; | ||
|
||
angular | ||
.module(moduleName, []) | ||
.controller(CONTROLLER_NAME, controller) | ||
.run(/* @ngTranslationsInject:json ./translations */) | ||
.run( | ||
/* @ngInject */ ($templateCache) => { | ||
$templateCache.put(TEMPLATE_CACHE_KEY, template); | ||
}, | ||
); | ||
|
||
export default moduleName; |
21 changes: 21 additions & 0 deletions
21
...s/manager/apps/dedicated/client/app/dedicated/dedicated-server/display-tags/template.html
This file contains 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,21 @@ | ||
<oui-modal | ||
data-on-dismiss="$ctrl.$uibModalInstance.dismiss()" | ||
data-primary-action="$ctrl.onEditTags()" | ||
data-primary-label="{{:: 'display_tags_popup_edit' | translate }}" | ||
data-secondary-action="$ctrl.back()" | ||
data-secondary-label="{{:: 'display_tags_popup_back' | translate }}" | ||
data-heading="{{:: 'display_tags_popup_title' | translate:{ 'serverName': $ctrl.serverName } }}" | ||
> | ||
<div class="mb-4"> | ||
<oui-search | ||
model="$ctrl.searchTag" | ||
on-change="$ctrl.onSearchServerTags(modelValue)" | ||
on-reset="$ctrl.onSearchReset()" | ||
placeholder="{{ ::'display_tags_popup_search'| translate}}" | ||
> | ||
</oui-search> | ||
</div> | ||
<span data-ng-repeat="tag in $ctrl.serverTagList"> | ||
<span class="oui-badge oui-badge_info" data-ng-bind="tag"> </span> | ||
</span> | ||
</oui-modal> |
6 changes: 6 additions & 0 deletions
6
...cated/client/app/dedicated/dedicated-server/display-tags/translations/Messages_fr_FR.json
This file contains 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,6 @@ | ||
{ | ||
"display_tags_popup_edit": "Modifier les balises", | ||
"display_tags_popup_back": "Retour", | ||
"display_tags_popup_search": "Rechercher", | ||
"display_tags_popup_title": "Tags:" | ||
} |
This file contains 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 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 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 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