forked from winery/winery
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add possibility to assign deployment techs and participants in EDMM m…
…ode (winery#569)
- Loading branch information
Showing
25 changed files
with
430 additions
and
65 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
52 changes: 52 additions & 0 deletions
52
...ery.frontends/app/topologymodeler/src/app/edmm/assign-deployment-technology.component.css
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,52 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
********************************************************************************/ | ||
table { | ||
width: 210px; | ||
table-layout: fixed; | ||
border: 1px solid #ddd; | ||
} | ||
|
||
th { | ||
background-color: #cfd8dc; | ||
color: #000; | ||
text-align: left; | ||
} | ||
|
||
th, | ||
td { | ||
border-top: 0; | ||
border-left: 0; | ||
border-right: 0; | ||
border-bottom: 1px solid #ddd; | ||
padding-left: 2px; | ||
} | ||
|
||
tr { | ||
cursor: pointer; | ||
} | ||
|
||
tr:nth-child(even) { | ||
background-color: #f2f2f2; | ||
} | ||
|
||
.table-td div { | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
position: relative; | ||
width: auto; | ||
max-width: 100%; | ||
-webkit-transition: max-width linear 1ms; | ||
transition: max-width linear 1ms; | ||
} |
45 changes: 45 additions & 0 deletions
45
...ry.frontends/app/topologymodeler/src/app/edmm/assign-deployment-technology.component.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,45 @@ | ||
<!-- | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
--> | ||
|
||
<div *ngIf="isEmpty()" style="color: dimgray; text-align: center"> | ||
<span>No deployment technologies available.</span> | ||
</div> | ||
|
||
<table> | ||
<thead> | ||
<tr> | ||
<th>Name</th> | ||
<th style="width: 60px">Use</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr *ngFor="let p of deploymentTechnologies"> | ||
<td class="table-td" | ||
[class.cell-with-comment]="isEllipsisActive(name)"> | ||
<div #name>{{ p.name }}</div> | ||
<span class="cell-comment">{{ p.name }}</span> | ||
</td> | ||
<td class="table-td"> | ||
<div style="margin-left: 2px; margin-top: 4px;"> | ||
<input type="radio" id="{{ node.id }}--{{ p.id }}" | ||
[name]="node.id" | ||
[value]="p.id" | ||
(change)="toggleMembership(p)" | ||
[checked]="isMember(p)"> | ||
<label for="{{ node.id }}--{{ p.id }}"></label> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> |
63 changes: 63 additions & 0 deletions
63
...nery.frontends/app/topologymodeler/src/app/edmm/assign-deployment-technology.component.ts
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,63 @@ | ||
/******************************************************************************** | ||
* Copyright (c) 2021 Contributors to the Eclipse Foundation | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 | ||
* which is available at https://www.apache.org/licenses/LICENSE-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 | ||
********************************************************************************/ | ||
|
||
import { Component, Input, OnInit } from '@angular/core'; | ||
import { NgRedux } from '@angular-redux/store'; | ||
import { TNodeTemplate } from '../models/ttopology-template'; | ||
import { IWineryState } from '../redux/store/winery.store'; | ||
import { WineryActions } from '../redux/actions/winery.actions'; | ||
import { BackendService } from '../services/backend.service'; | ||
import { DeploymentTechnology } from '../models/deployment-technology'; | ||
import { QName } from '../../../../shared/src/app/model/qName'; | ||
import { TOSCA_WINERY_EXTENSIONS_NAMESPACE } from '../models/namespaces'; | ||
|
||
@Component({ | ||
selector: 'winery-assign-deployment-technology', | ||
templateUrl: './assign-deployment-technology.component.html', | ||
styleUrls: ['./assign-deployment-technology.component.css'] | ||
}) | ||
export class AssignDeploymentTechnologyComponent implements OnInit { | ||
|
||
static QNAME_DEPLOYMENT_TECHNOLOGY = QName.create(TOSCA_WINERY_EXTENSIONS_NAMESPACE, 'deployment-technology').qName; | ||
|
||
@Input() readonly: boolean; | ||
@Input() deploymentTechnologies: DeploymentTechnology[]; | ||
@Input() node: TNodeTemplate; | ||
|
||
constructor(private ngRedux: NgRedux<IWineryState>, | ||
private ngActions: WineryActions, | ||
private backendService: BackendService) { | ||
} | ||
|
||
ngOnInit() { | ||
this.backendService.requestSupportedDeploymentTechnologies().subscribe(value => this.deploymentTechnologies = value); | ||
} | ||
|
||
isEllipsisActive(cell): boolean { | ||
return (cell.offsetWidth < cell.scrollWidth); | ||
} | ||
|
||
isMember(dt: DeploymentTechnology) { | ||
const value = this.node.otherAttributes[AssignDeploymentTechnologyComponent.QNAME_DEPLOYMENT_TECHNOLOGY]; | ||
return value && dt.id === value; | ||
} | ||
|
||
toggleMembership(dt: DeploymentTechnology) { | ||
this.ngRedux.dispatch(this.ngActions.assignDeploymentTechnology(this.node, dt.id)); | ||
} | ||
|
||
isEmpty(): boolean { | ||
return !this.deploymentTechnologies || this.deploymentTechnologies.length === 0; | ||
} | ||
} |
Oops, something went wrong.