Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
330 changes: 330 additions & 0 deletions frontend/src/app/dashboard/component/user/_resource-detail-shared.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
// 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 version-storage {
.version-storage {
padding: 0 15px;
margin-bottom: 25px;
}

.version-storage nz-select {
width: 100%;
margin: 0;
}
}

@mixin browser-pane {
.right-sider {
height: 100%;
overflow-y: auto;
position: relative;
z-index: 0;
}

.sider-resize-line {
display: flex;
align-items: center;
justify-content: center;
height: 100%;
width: 5px;
border-right: 1px solid #e8e8e8;
}

.sider-resize-handle {
background: #fff;
border: 1px solid #ddd;
text-align: center;
font-size: 12px;
height: 20px;
line-height: 20px;
}

.file-renderer {
width: 95%;
height: 80%;
margin: auto;
}
}

@mixin browser-toolbar($include-select: true) {
.select-and-button-container {
display: flex;
align-items: stretch;
gap: 10px;
}

.spaced-button {
flex-shrink: 0;
width: 30px;
height: 24px;
}

@if $include-select {
nz-select {
flex-grow: 1;
}
}
}

@mixin version-list($include-status-row: true) {
.file-size,
.version-size,
.version-date {
font-size: 12px;
color: #8c8c8c;
display: inline-flex;
align-items: center;
gap: 4px;
}

.version-date {
display: flex;
}

.version-size {
margin-top: 8px;
}

.icon-database,
.icon-file {
font-size: 14px;
}

.empty-version-indicator {
margin-top: 15%;
}

@if $include-status-row {
.status-tag-row {
margin-top: 16px;
display: flex;
align-items: center;
gap: 5px;
}
}
}

@mixin status-tags {
.status-tag {
padding: 3px 10px 3px 3px;
font-size: 13px;
display: inline-flex;
align-items: center;
gap: 5px;
background: #fff;
border-radius: 5px;

i {
width: 22px;
height: 22px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 4px;
background: #f0f0f0;
}
}

.tag-public i {
color: #3b82f6;
background: #eff6ff;
}

.tag-downloadable i {
color: #22c55e;
background: #f0fdf4;
}
}

@mixin like-states {
.like-tag {
cursor: pointer;
}

.like-tag.liked {
i {
color: #ef4444;
background: #fef2f2;
}
}

.like-tag.disabled {
cursor: not-allowed;
opacity: 0.55;
}
}

@mixin file-path-title {
.file-title {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
margin-bottom: 0;
}

.file-title-main {
display: inline-flex;
align-items: center;
gap: 6px;
min-width: 0;
}

.copy-path-btn {
padding: 0 4px;
height: auto;
line-height: 1;
display: inline-flex;
align-items: center;
justify-content: center;
}
}

@mixin tab-bar {
nz-tabs {
margin-top: 6px;
}

::ng-deep .ant-tabs-nav {
padding-left: 16px;
}
}

@mixin data-card {
// Two side-by-side cards filling the full tab width: a wide description card
// and a narrower stats card. The flex grow ratio is the single source of
// truth for their proportions (basis 0), so no width/max-width competes.
.data-card-columns {
display: flex;
align-items: flex-start;
gap: 20px;
margin-top: 24px;
width: 100%;
// Match the tab bar's left inset (.ant-tabs-nav padding-left) so the cards
// line up with the tab labels above, not the page's outer edge.
padding-left: 16px;
}

.data-card {
border-radius: 8px;
border: 1px solid #d9d9d9;
// Let each card shrink to its flex share regardless of content width; without
// this the default min-width:auto keeps them from shrinking, skewing the
// ratio and leaving odd empty gaps.
min-width: 0;
}

// Left card takes ~3/4 of the row, stats card ~1/4 — grow ratio with basis 0
// so the split is exact and content-independent.
.data-card-main {
flex: 3 1 0;
}

.data-card-details {
flex: 1 1 0;
}

// Stack the two cards full-width on narrow viewports.
@media (max-width: 768px) {
.data-card-columns {
flex-direction: column;
align-items: stretch;
}
}

// Matches the app's standard card-section heading convention (e.g. the
// Settings tab's "General" card title): bold, dark, slightly larger than
// body text, with a clear gap before the content below.
.data-card-heading {
font-size: 18px;
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
margin: 0 0 20px;
}

// Plain text, no box/border styling — larger size keeps it readable as prose.
.data-card-description {
font-size: 16px;
line-height: 1.6;
margin-bottom: 32px;
}

// Empty state: muted grey italic so it reads as "nothing here yet", not broken.
.empty-description {
color: rgba(0, 0, 0, 0.4);
font-style: italic;
}

// Stats as a full-width vertical list, one fact per row, avoiding the awkward
// wrapping of the previous cramped horizontal layout.
.data-card-stats {
display: flex;
flex-direction: column;
}

.stat-row {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 16px;
padding: 12px 0;
border-bottom: 1px solid #f0f0f0;

&:last-child {
border-bottom: none;
}
}

.stat-label {
font-size: 13px;
font-weight: 600;
color: rgba(0, 0, 0, 0.85);
flex-shrink: 0;
}

.stat-value {
font-weight: 400;
color: rgba(0, 0, 0, 0.45);
text-align: right;
word-break: break-word;
}
}

@mixin header($kind) {
.#{$kind}-header {
display: flex;
gap: 24px;
}

.#{$kind}-header-meta {
flex: 1;
}

.#{$kind}-cover-image {
width: 280px;
height: 120px;
object-fit: cover;
border-radius: 8px;
margin-right: 80px;
}
}

@mixin scrollable-tab {
height: 100%;
overflow-y: auto;
padding-bottom: 24px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
* 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, Type } from "@angular/core";
import { ComponentFixture, TestBed, TestModuleMetadata } from "@angular/core/testing";
import { ReactiveFormsModule } from "@angular/forms";
import { BrowserAnimationsModule } from "@angular/platform-browser/animations";
import { FieldType, FieldTypeConfig, FormlyModule } from "@ngx-formly/core";
import { NzModalRef } from "ng-zorro-antd/modal";
import { commonTestProviders } from "../../../common/testing/test-utils";

// Formly still creates real controls and attaches the declared validators.
@Component({ template: "", standalone: true })
class StubFormlyFieldComponent extends FieldType<FieldTypeConfig> {}

/** Creates a TestBed component fixture with stubbed Formly field types and an NzModalRef close spy. */
export async function createFormlyModalFixture<T>(
component: Type<T>,
fieldNames: readonly string[],
close: ReturnType<typeof vi.fn>,
{ imports = [], providers = [] }: Pick<TestModuleMetadata, "imports" | "providers"> = {}
): Promise<ComponentFixture<T>> {
await TestBed.configureTestingModule({
imports: [
component,
BrowserAnimationsModule,
ReactiveFormsModule,
FormlyModule.forRoot({ types: fieldNames.map(name => ({ name, component: StubFormlyFieldComponent })) }),
...imports,
],
providers: [{ provide: NzModalRef, useValue: { close } }, ...providers, ...commonTestProviders],
}).compileComponents();

return TestBed.createComponent(component);
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ import { NzButtonComponent } from "ng-zorro-antd/button";
import { NzWaveDirective } from "ng-zorro-antd/core/wave";
import { ɵNzTransitionPatchDirective } from "ng-zorro-antd/core/transition-patch";

/** Builds fresh required `name` and optional `description` Formly configs for resource creator modals. */
export function resourceNameAndDescriptionFields(): FormlyFieldConfig[] {
return [
{ key: "name", type: "input", templateOptions: { label: "Name", required: true } },
{ key: "description", type: "input", defaultValue: "", templateOptions: { label: "Description" } },
];
}

/**
* The creation form shared by the dataset and model creators: the Formly fields, the visibility
* and downloadability switches, and the Create and Cancel buttons. The parent keeps the state and
Expand Down
Loading
Loading