scottyaslan commented on code in PR #11193: URL: https://github.com/apache/nifi/pull/11193#discussion_r3184328540
########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> Review Comment: ```suggestion <div class="flex flex-col items-center justify-center gap-3"> ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> Review Comment: ```suggestion <i class="fa fa-cloud-upload" aria-hidden="true"></i> ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.scss: ########## @@ -0,0 +1,78 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.asset-upload-container { + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + * { + pointer-events: none; + } + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + * { + pointer-events: none; + } + } + + &.disabled { + opacity: 0.6; + cursor: not-allowed; + } + + &.has-error { + border: 1px solid var(--mat-sys-error); + + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + } + } +} + +.asset-item-missing-content { + border-color: var(--nf-caution-default); + background-color: color-mix(in srgb, var(--nf-caution-default) 12%, transparent); Review Comment: Not sure if this will work in all scenarios. In dark mode especially we have to be careful applying opacity on surfaces. Try applying the ` .caution-color-background` class to the element in the template. ```suggestion ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> + <span class="tertiary-color">Drag and drop a file here</span> + </div> + <button + mat-stroked-button + type="button" + [disabled]="disabled" + (click)="openFileBrowser()" + data-qa="browse-files-button"> + Browse + </button> + </div> + } + + @if (assets.length > 0 || uploadProgress.length > 0) { + <div class="flex flex-col gap-4"> + @for (asset of assets; track trackByAssetId($index, asset)) { + @if (asset.missingContent) { + <div + class="asset-item asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset-missing-content"> + <div class="flex items-start gap-2 min-w-0 flex-1"> + <i + class="fa fa-warning asset-missing-icon shrink-0" + aria-hidden="true" + data-qa="asset-missing-warning-icon"></i> + <div class="text-sm asset-missing-hint min-w-0">Asset content is missing</div> + </div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } @else { + <div + class="asset-item flex items-center justify-between px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset"> + <div class="truncate" ellipsisTooltip>{{ asset.name }}</div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } + } + + @for (progress of uploadProgress; track trackByFilename($index, progress)) { + <div + class="progress-item flex items-center justify-between gap-4 px-3 py-2 rounded-md border min-h-[44px]" Review Comment: ```suggestion class="flex items-center justify-between gap-4 px-3 py-2 rounded-md border min-h-[44px]" ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> + <span class="tertiary-color">Drag and drop a file here</span> + </div> + <button + mat-stroked-button + type="button" + [disabled]="disabled" + (click)="openFileBrowser()" + data-qa="browse-files-button"> + Browse + </button> + </div> + } + + @if (assets.length > 0 || uploadProgress.length > 0) { + <div class="flex flex-col gap-4"> + @for (asset of assets; track trackByAssetId($index, asset)) { + @if (asset.missingContent) { + <div + class="asset-item asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset-missing-content"> + <div class="flex items-start gap-2 min-w-0 flex-1"> + <i + class="fa fa-warning asset-missing-icon shrink-0" + aria-hidden="true" + data-qa="asset-missing-warning-icon"></i> + <div class="text-sm asset-missing-hint min-w-0">Asset content is missing</div> + </div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } @else { + <div + class="asset-item flex items-center justify-between px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset"> + <div class="truncate" ellipsisTooltip>{{ asset.name }}</div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } + } + + @for (progress of uploadProgress; track trackByFilename($index, progress)) { + <div + class="progress-item flex items-center justify-between gap-4 px-3 py-2 rounded-md border min-h-[44px]" + [class.error]="progress.status === 'error'" + data-qa="upload-progress"> + <div class="truncate min-w-0"> + <span class="progress-filename">{{ progress.filename }}</span> + </div> + <div class="flex flex-row items-center gap-2 shrink-0 w-40"> + <mat-progress-bar + mode="determinate" + [value]="progress.status === 'error' ? 100 : progress.percentComplete" + [class.progress-bar-critical]="progress.status === 'error'"> Review Comment: Please use the color input for this component. ```suggestion ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> + <span class="tertiary-color">Drag and drop a file here</span> + </div> + <button + mat-stroked-button + type="button" + [disabled]="disabled" + (click)="openFileBrowser()" + data-qa="browse-files-button"> + Browse + </button> + </div> + } + + @if (assets.length > 0 || uploadProgress.length > 0) { + <div class="flex flex-col gap-4"> + @for (asset of assets; track trackByAssetId($index, asset)) { + @if (asset.missingContent) { + <div + class="asset-item asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset-missing-content"> + <div class="flex items-start gap-2 min-w-0 flex-1"> + <i + class="fa fa-warning asset-missing-icon shrink-0" + aria-hidden="true" + data-qa="asset-missing-warning-icon"></i> + <div class="text-sm asset-missing-hint min-w-0">Asset content is missing</div> + </div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } @else { + <div + class="asset-item flex items-center justify-between px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset"> + <div class="truncate" ellipsisTooltip>{{ asset.name }}</div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } + } + + @for (progress of uploadProgress; track trackByFilename($index, progress)) { + <div + class="progress-item flex items-center justify-between gap-4 px-3 py-2 rounded-md border min-h-[44px]" + [class.error]="progress.status === 'error'" + data-qa="upload-progress"> + <div class="truncate min-w-0"> + <span class="progress-filename">{{ progress.filename }}</span> Review Comment: Is it used? ```suggestion <span>{{ progress.filename }}</span> ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.scss: ########## @@ -0,0 +1,78 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.asset-upload-container { + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + * { + pointer-events: none; + } + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + * { + pointer-events: none; + } + } + + &.disabled { + opacity: 0.6; + cursor: not-allowed; + } + + &.has-error { + border: 1px solid var(--mat-sys-error); + + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + } + } +} + +.asset-item-missing-content { + border-color: var(--nf-caution-default); + background-color: color-mix(in srgb, var(--nf-caution-default) 12%, transparent); +} + +.asset-missing-icon { + color: var(--nf-caution-default); + font-size: 16px; + line-height: 1; +} + +.asset-missing-hint { + color: var(--nf-caution-default); +} + +.upload-icon { + color: var(--mat-sys-on-surface-variant); + font-size: 18px; + line-height: 1; +} Review Comment: ```suggestion ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.scss: ########## @@ -0,0 +1,78 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.asset-upload-container { + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + * { + pointer-events: none; + } + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + * { + pointer-events: none; + } + } + + &.disabled { + opacity: 0.6; + cursor: not-allowed; + } + + &.has-error { + border: 1px solid var(--mat-sys-error); + + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + } + } +} + +.asset-item-missing-content { + border-color: var(--nf-caution-default); + background-color: color-mix(in srgb, var(--nf-caution-default) 12%, transparent); +} + +.asset-missing-icon { + color: var(--nf-caution-default); + font-size: 16px; + line-height: 1; +} + +.asset-missing-hint { + color: var(--nf-caution-default); +} Review Comment: Please use the `.caution-color` class in the template instead. ```suggestion ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.scss: ########## @@ -0,0 +1,78 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.asset-upload-container { + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + * { + pointer-events: none; + } + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + * { + pointer-events: none; + } + } + + &.disabled { + opacity: 0.6; + cursor: not-allowed; + } + + &.has-error { + border: 1px solid var(--mat-sys-error); + + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + } + } +} + +.asset-item-missing-content { + border-color: var(--nf-caution-default); + background-color: color-mix(in srgb, var(--nf-caution-default) 12%, transparent); +} + +.asset-missing-icon { + color: var(--nf-caution-default); + font-size: 16px; + line-height: 1; +} + +.asset-missing-hint { + color: var(--nf-caution-default); +} + +.upload-icon { + color: var(--mat-sys-on-surface-variant); + font-size: 18px; + line-height: 1; +} + +.progress-item.error { + border-color: var(--mat-sys-error); +} + +.mat-mdc-progress-bar.progress-bar-critical { + --mdc-linear-progress-active-indicator-color: var(--mat-sys-error); +} Review Comment: Please use mat-progress-bar color input instead. ```suggestion ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.scss: ########## @@ -0,0 +1,78 @@ +/*! + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +.asset-upload-container { + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + * { + pointer-events: none; + } + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + * { + pointer-events: none; + } + } + + &.disabled { + opacity: 0.6; + cursor: not-allowed; + } + + &.has-error { + border: 1px solid var(--mat-sys-error); + + &.drop-allowed { + border: 1px dashed var(--mat-sys-primary); + } + + &.drop-invalid { + border: 1px dashed var(--mat-sys-error); + } + } +} + +.asset-item-missing-content { + border-color: var(--nf-caution-default); + background-color: color-mix(in srgb, var(--nf-caution-default) 12%, transparent); +} + +.asset-missing-icon { + color: var(--nf-caution-default); + font-size: 16px; + line-height: 1; +} Review Comment: You should be able to just apply the `.caution-color` class here. ```suggestion ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> + <span class="tertiary-color">Drag and drop a file here</span> + </div> + <button + mat-stroked-button + type="button" + [disabled]="disabled" + (click)="openFileBrowser()" + data-qa="browse-files-button"> + Browse + </button> + </div> + } + + @if (assets.length > 0 || uploadProgress.length > 0) { + <div class="flex flex-col gap-4"> + @for (asset of assets; track trackByAssetId($index, asset)) { + @if (asset.missingContent) { + <div + class="asset-item asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset-missing-content"> + <div class="flex items-start gap-2 min-w-0 flex-1"> + <i + class="fa fa-warning asset-missing-icon shrink-0" + aria-hidden="true" + data-qa="asset-missing-warning-icon"></i> + <div class="text-sm asset-missing-hint min-w-0">Asset content is missing</div> + </div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } @else { + <div + class="asset-item flex items-center justify-between px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset"> + <div class="truncate" ellipsisTooltip>{{ asset.name }}</div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } + } + + @for (progress of uploadProgress; track trackByFilename($index, progress)) { + <div + class="progress-item flex items-center justify-between gap-4 px-3 py-2 rounded-md border min-h-[44px]" + [class.error]="progress.status === 'error'" + data-qa="upload-progress"> + <div class="truncate min-w-0"> + <span class="progress-filename">{{ progress.filename }}</span> + </div> + <div class="flex flex-row items-center gap-2 shrink-0 w-40"> + <mat-progress-bar + mode="determinate" + [value]="progress.status === 'error' ? 100 : progress.percentComplete" + [class.progress-bar-critical]="progress.status === 'error'"> + </mat-progress-bar> + @if (progress.status === 'active') { + <span class="text-sm mr-2 whitespace-nowrap">{{ progress.percentComplete }}%</span> Review Comment: Please check the other mat-progress-bar usages throughout nifi: ```suggestion <span class="tertiary-color font-medium">{{ progress.percentComplete }}%</span> ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> + <span class="tertiary-color">Drag and drop a file here</span> + </div> + <button + mat-stroked-button + type="button" + [disabled]="disabled" + (click)="openFileBrowser()" + data-qa="browse-files-button"> + Browse + </button> + </div> + } + + @if (assets.length > 0 || uploadProgress.length > 0) { + <div class="flex flex-col gap-4"> + @for (asset of assets; track trackByAssetId($index, asset)) { + @if (asset.missingContent) { + <div + class="asset-item asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" Review Comment: ```suggestion class="asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" ``` ########## nifi-frontend/src/main/frontend/libs/shared/src/components/asset-upload/asset-upload.component.html: ########## @@ -0,0 +1,149 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one or more + ~ contributor license agreements. See the NOTICE file distributed with + ~ this work for additional information regarding copyright ownership. + ~ The ASF licenses this file to You under the Apache License, Version 2.0 + ~ (the "License"); you may not use this file except in compliance with + ~ the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, software + ~ distributed under the License is distributed on an "AS IS" BASIS, + ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + ~ See the License for the specific language governing permissions and + ~ limitations under the License. + --> +<mat-card + appearance="outlined" + class="asset-upload-container flex flex-col gap-3 p-4 min-h-[100px] rounded-lg" + [class.disabled]="disabled" + [class.has-error]="hasError" + [class.has-content]="assets.length > 0 || uploadProgress.length > 0" + dragAndDrop + [allowMultipleFiles]="multiple" + [allowedFileTypes]="allowedFileTypes" + [maxFileSize]="maxFileSize" + (filesDropped)="onFilesDropped($event)" + (invalidDrop)="onInvalidDrop($event)" + data-qa="asset-drop-zone"> + @if (assets.length === 0 && uploadProgress.length === 0) { + <div class="flex flex-col items-center justify-center gap-3 p-2"> + <div class="flex items-center gap-2"> + <i class="fa fa-cloud-upload upload-icon" aria-hidden="true"></i> + <span class="tertiary-color">Drag and drop a file here</span> + </div> + <button + mat-stroked-button + type="button" + [disabled]="disabled" + (click)="openFileBrowser()" + data-qa="browse-files-button"> + Browse + </button> + </div> + } + + @if (assets.length > 0 || uploadProgress.length > 0) { + <div class="flex flex-col gap-4"> + @for (asset of assets; track trackByAssetId($index, asset)) { + @if (asset.missingContent) { + <div + class="asset-item asset-item-missing-content flex items-center justify-between gap-3 px-3 py-2 border rounded-md min-h-[44px]" + data-qa="uploaded-asset-missing-content"> + <div class="flex items-start gap-2 min-w-0 flex-1"> + <i + class="fa fa-warning asset-missing-icon shrink-0" + aria-hidden="true" + data-qa="asset-missing-warning-icon"></i> + <div class="text-sm asset-missing-hint min-w-0">Asset content is missing</div> + </div> + <button + mat-icon-button + type="button" + class="primary-icon-button shrink-0" + [disabled]="disabled" + matTooltip="Delete" + aria-label="Delete asset" + (click)="onDeleteAsset(asset, $event)" + data-qa="delete-asset-button"> + <i class="fa fa-trash" aria-hidden="true"></i> + </button> + </div> + } @else { + <div + class="asset-item flex items-center justify-between px-3 py-2 border rounded-md min-h-[44px]" Review Comment: ```suggestion class="flex items-center justify-between px-3 py-2 border rounded-md min-h-[44px]" ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
