kunwp1 commented on code in PR #9376:
URL: https://github.com/apache/texera/pull/9376#discussion_r4516187396
##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-version-creator/user-dataset-version-creator.component.ts:
##########
@@ -38,7 +38,7 @@ import { contributorFieldGroup } from
"../user-dataset-contributor-editor/contri
@UntilDestroy()
@Component({
selector: "texera-user-dataset-version-creator",
- templateUrl: "./user-dataset-version-creator.component.html",
+ templateUrl: "../../../resource-creator/resource-creator-form.html",
Review Comment:
Pointing two components at one template file in another folder works, but
nothing else in the frontend shares a template this way. The template also
depends on eight members that each component has to provide, with no type tying
them together. Dataset and model detail already share UI through small child
components (`texera-versions-files-browser`, `texera-markdown-description`). A
`<texera-resource-creator-form>` with inputs for the form, model and flags and
outputs for the toggles and buttons would make that contract explicit and keep
the styles next to the template. Feel free to leave this for a follow-up. If
you keep the shared file, the next comment trims the adapter.
##########
frontend/src/app/dashboard/component/user/user-dataset/user-dataset-explorer/user-dataset-version-creator/user-dataset-version-creator.component.ts:
##########
@@ -70,6 +70,15 @@ export class UserDatasetVersionCreatorComponent implements
OnInit {
// boolean to control if is uploading
isCreating: boolean = false;
+ readonly creatorForm = {
+ formClass: "texera-user-dataset-creator-form",
+ togglesClass: "dataset-toggles",
+ model: () => this.model,
+ showToggles: () => !this.isCreatingVersion,
+ publicStatus: () => this.isDatasetPublic,
+ downloadableStatus: () => this.isDatasetDownloadable,
+ };
Review Comment:
This adapter only bridges names. If both components used the same names
(`formModel`, `isPublic`, `isDownloadable`, plus a `showToggles` getter here
and a field set to `true` in the model creator), the template could bind them
directly. Only two spec lines reference the old names.
`formClass` and `togglesClass` only keep per-component class names that
nothing else uses: no spec, e2e test or global style references them. Each
component's styles are already scoped to it, so one static class in the
template works for both.
##########
frontend/src/app/dashboard/component/user/_resource-form-shared.scss:
##########
@@ -0,0 +1,75 @@
+// 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.
+
+@mixin editor-layout($form-selector, $primary-selector, $cancel-margin-top,
$primary-hover: darken(#007bff, 10%)) {
Review Comment:
`darken()` is deprecated in Dart Sass, and the build already warns about it.
Since this partial is new, `color.adjust($color, $lightness: -10%)` with `@use
"sass:color"` would avoid carrying the warning forward. It compiles to the same
colors.
##########
frontend/src/app/dashboard/component/user/user-model/user-model-creator/user-model-creator.component.scss:
##########
@@ -16,60 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-// Forked from user-dataset-version-creator.component.scss, dropping the
uploader selectors.
-// Convergence with the dataset creator is tracked under #6494.
-
-.texera-user-model-creator-form {
- width: 80%;
- margin: auto;
-}
-.create-btn {
- background-color: #ffffff;
- color: #007bff;
- border: 1px solid lightgray;
- padding: 5px 20px;
- cursor: pointer;
- margin-left: 15%;
- margin-right: 5%;
- width: 30%;
- text-align: center;
- &:hover {
- background-color: #0069d9;
- color: #ffffff;
- }
-}
+@use "../../resource-form-shared" as resource-form;
-.cancel-btn {
- background-color: #ffffff;
- color: #ff0000;
- border: 1px solid lightgray;
- padding: 5px 20px;
- cursor: pointer;
- margin-right: 15%;
- margin-left: 5%;
- margin-top: 10%;
- width: 30%;
- text-align: center;
- &:hover {
- background-color: #cc0000;
- color: #ffffff;
- }
-}
-
-.model-toggles {
- margin-top: 16px;
- margin-bottom: 16px;
-}
+// Forked from user-dataset-version-creator.component.scss, dropping the
uploader selectors.
+// Convergence with the dataset creator is tracked under #6494.
Review Comment:
This comment is out of date now: the file no longer holds a fork, and #6494
is the closed ML-models umbrella issue. It can go.
##########
frontend/src/app/dashboard/component/user/resource-creator/resource-creator-form.html:
##########
@@ -23,27 +23,27 @@
nzSize="large"
nzTip="Creating...">
<div
- class="texera-user-dataset-creator-form"
+ [class]="creatorForm.formClass"
[ngClass]="{'disabled-backdrop': isCreating}">
Review Comment:
No stylesheet in the frontend defines `disabled-backdrop`, so this binding
does nothing. It and the `NgClass` imports could go now that the template is
being consolidated.
--
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]