-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import/Export Profiles in TPv2 (#7532)
* import-export profile * testing and code fixes for pr * test case added for import profile * optional removed, version changed * revert to old code * proper fileutilservice import * removed editable textarea * removed seperate export attachment service * profile export fnction added with test * comments addresed * lint fixes * lint issue fixes * comment changes * review comments addressed * ui issue fix * comments fixed * comment addressed * comment updated * Add component storage of file list * rework existing methods to utilize stored file * Grammar, linking, spelling etc. updates in comments and user messages Also made things that aren't meant to be changed readonly * Eliminate unused button * rework DOM structure includes changing an element reference and an ID, also now sets accept from controller property instead of duplicating values * Bind files to input * Use hidden instead of ngIf Less jumping around of the page elements when conditions change that way. I also made the conditional bindings a bit more sensible, both in target and condition. * Accessibility best practices changes * Rework styling to be compliant with WCAG ... and also to look better, more like it used to before I changed anything. * Fix button type * added cursor --------- Co-authored-by: ocket8888 <ocket8888@apache.org>
- Loading branch information
1 parent
878cd26
commit c1e70b7
Showing
13 changed files
with
510 additions
and
17 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
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
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
47 changes: 47 additions & 0 deletions
47
experimental/traffic-portal/src/app/shared/import-json-txt/import-json-txt.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,47 @@ | ||
<!-- | ||
Licensed 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. | ||
--> | ||
|
||
<h2 mat-dialog-title>{{data.title}}</h2> | ||
<mat-dialog-content id="import-content" [ngClass]="{'active':dragOn}"> | ||
<div class="dropzone"> | ||
<label #inputLabel | ||
for="profile-upload" | ||
tabindex="0" | ||
(keydown.enter)="inputLabel.click()" | ||
(keydown.space)="inputLabel.click()" | ||
>Click or Drop your file here to upload</label> | ||
<input | ||
type="file" | ||
id="profile-upload" | ||
[accept]="allowedType.join(', ')" | ||
[files]="files" | ||
(change)="uploadFile($event)" | ||
hidden | ||
aria-describedby="file-name json-txt" | ||
/> | ||
<small class="hint">{{mimeAlertMsg}}</small> | ||
</div> | ||
|
||
<ul [hidden]="!fileData"> | ||
<li id="file-name">{{fileData}}</li> | ||
</ul> | ||
|
||
<div id="json-txt" [hidden]="files.length !== 1"> | ||
<pre>{{inputTxt | json}}</pre> | ||
</div> | ||
</mat-dialog-content> | ||
<mat-dialog-actions align="end"> | ||
<button mat-raised-button type="button" mat-dialog-close color="warn">Cancel</button> | ||
<button mat-raised-button type="button" [mat-dialog-close]="inputTxt" [disabled]="!file">Submit</button> | ||
</mat-dialog-actions> |
42 changes: 42 additions & 0 deletions
42
experimental/traffic-portal/src/app/shared/import-json-txt/import-json-txt.component.scss
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,42 @@ | ||
/* | ||
* Licensed 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. | ||
*/ | ||
|
||
$backgroundColor: #fafaec; | ||
|
||
.dropzone { | ||
max-width: 80vw; | ||
padding: 2rem; | ||
margin: 1rem auto; | ||
background-color: $backgroundColor; | ||
border: solid 1px rgb(231, 230, 230); | ||
text-align: center; | ||
color: black; | ||
border-radius: 5px; | ||
box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); | ||
cursor: pointer; | ||
|
||
label { | ||
display: block; | ||
} | ||
.hint { | ||
opacity: 0.87; | ||
display: block; | ||
} | ||
} | ||
|
||
#import-content { | ||
&.active { | ||
background: $backgroundColor; | ||
} | ||
} |
Oops, something went wrong.