You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@submarine.apache.org by GitBox <gi...@apache.org> on 2021/10/23 07:36:40 UTC

[GitHub] [submarine] KUAN-HSUN-LI commented on a change in pull request #784: SUBMARINE-1056. Model management UI home page upgrade

KUAN-HSUN-LI commented on a change in pull request #784:
URL: https://github.com/apache/submarine/pull/784#discussion_r734922899



##########
File path: submarine-workbench/workbench-web/src/app/pages/workbench/model/model-home/model-cards/model-card/model-card.component.scss
##########
@@ -17,5 +17,5 @@
  * under the License.
  */
 p {
-  margin: 0;
+  margin: 2px;

Review comment:
       Use the relative unit "rem" or "em".

##########
File path: submarine-workbench/workbench-web/src/app/pages/workbench/model/model-home/model-cards/model-cards.component.ts
##########
@@ -26,9 +26,29 @@ import { ModelInfo } from '@submarine/interfaces/model-info';
 })
 export class ModelCardsComponent implements OnInit {
   @Input() modelCards: ModelInfo[];
+  nowPage: number;
+  totalPages: number;
+  onPageModelCards: ModelInfo[];
+  pageUnit = 4;

Review comment:
       The `pageUnit` is not enough, it is suitable for at least 8 on one page.

##########
File path: submarine-workbench/workbench-web/src/app/pages/workbench/model/model-home/model-cards/model-card/model-tag/model-tag.component.ts
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.
+ */
+
+import { Component, Input, OnInit } from '@angular/core';
+
+@Component({
+  selector: 'submarine-model-tag',
+  templateUrl: './model-tag.component.html',
+  styleUrls: ['./model-tag.component.scss'],
+})
+export class ModelTagComponent implements OnInit {
+  @Input() tag: string;
+  @Input() cssType: string;
+  textColor: string;
+  backgroundColor: string;
+  borderColor: string;
+  margin: string;
+  closable: boolean;
+
+  constructor() {}
+  
+  ngOnInit() {
+    this.textColor = this.stringToColour(this.tag, "text");
+    this.backgroundColor = this.stringToColour(this.tag, "background");
+    this.borderColor = this.stringToColour(this.tag, "border");
+    this.margin = this.cssType == "selection" ? "0px -20px 0px -10px" : "0 3px 0 3px";

Review comment:
       Use the relative unit "rem" or "em".

##########
File path: submarine-workbench/workbench-web/src/app/pages/workbench/model/model-home/model-cards/model-card/model-tag/model-tag.component.scss
##########
@@ -0,0 +1,43 @@
+/*!
+ * 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.
+ */
+span {
+  border: 1.2px solid;
+  border-radius: 3px;
+  background-color: #fafafa;
+  padding: 0px 5px 1px 5px;
+}
+
+i {
+  color: rgba($color: #000000, $alpha: 0.0);
+}
+
+::ng-deep .ant-select-selection--multiple .ant-select-selection__choice {
+  position: relative;
+  float: left;
+  max-width: 99%;
+  margin-right: 4px;
+  padding: 0 20px 0 10px;
+  overflow: hidden;
+  color: rgba(0, 0, 0, 0.65);
+  background-color: #fafafa;
+  border: 0px solid #e8e8e8;
+  border-radius: 2px;

Review comment:
       Use the relative unit "rem" or "em".

##########
File path: submarine-workbench/workbench-web/src/app/pages/workbench/model/model-home/model-cards/model-cards.component.ts
##########
@@ -26,9 +26,29 @@ import { ModelInfo } from '@submarine/interfaces/model-info';
 })
 export class ModelCardsComponent implements OnInit {
   @Input() modelCards: ModelInfo[];
+  nowPage: number;
+  totalPages: number;
+  onPageModelCards: ModelInfo[];
+  pageUnit = 4;
 
   constructor() {}
 
   ngOnInit() {
+    this.loadPage();
+  }
+
+  ngOnChanges() {
+    this.loadPage();
+  }
+
+  loadPage() {
+    this.nowPage = 1;
+    this.totalPages = this.modelCards.length;
+    this.loadOnPageModelCards(this.nowPage);
+  }
+
+  loadOnPageModelCards = (newPage: number) => {
+    let start = this.pageUnit * (newPage - 1);
+    this.onPageModelCards = this.modelCards.filter((_, index) => index < start + this.pageUnit && index >= start);

Review comment:
       the `loadPage` and `this.nowPage` are redundant code. Just use `loadOnPageModelCards(1)` in init.




-- 
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: commits-unsubscribe@submarine.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org