Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
2 changes: 1 addition & 1 deletion src/api/api/labelService.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ export class LabelServiceService {
responseType = 'text';
}

return this.httpClient.get<GetLabelsResponse>(`${this.configuration.basePath}/apis/v1beta1/labels/${encodeURIComponent(String(namespace))}/${encodeURIComponent(String(resource))}/labels`,
return this.httpClient.get<GetLabelsResponse>(`${this.configuration.basePath}/apis/v1beta1/${encodeURIComponent(String(namespace))}/${encodeURIComponent(String(resource))}/labels`,
{
params: queryParameters,
responseType: <any>responseType,
Expand Down
16 changes: 6 additions & 10 deletions src/app/parameters/models.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
import { Parameter } from "../../api";
import { Parameter } from '../../api';

export class ParameterUtils {
/**
* Goes through the template of a Parameter, which includes display name, options, etc, and the actual
* used value of a parameter, which includes name and value, and combines them into a parameter with all of the information.
*
* @param values
* @param templates
*/
public static combineValueAndTemplate(values: Parameter[], templates: Parameter[]): Parameter[]
{
let result = new Array<Parameter>();
public static combineValueAndTemplate(values: Parameter[], templates: Parameter[]): Parameter[] {
const result = new Array<Parameter>();

for(const template of templates) {
let resultParameter = template;
for (const template of templates) {
const resultParameter = template;
const valueParameter = values.find((val: Parameter) => val.name === template.name);
if(valueParameter) {
if (valueParameter) {
resultParameter.value = valueParameter.value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class WorkflowTemplateSelectComponent implements OnInit {
name: 'Model training',
manifest: `arguments:
parameters:

# following are a list of parameters that might change based on user response.
# some of these parameters are prefixed with cvat- to denote that they are special parameters and will be automatically populated by CVAT.
# you can change the names, but changing names of special parameters might break the workflow.
Expand Down Expand Up @@ -233,7 +233,7 @@ volumeClaimTemplates:
name: 'Ensemble inference',
manifest: `arguments:
parameters:

# Following are a list of parameters that might change based on user response.
# some of these parameters are prefixed with cvat- to denote that they are special parameters and will be automatically populated by CVAT.
# you can change the names, but changing names of special parameters might break the workflow.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ export class WorkflowTemplateCreateComponent implements OnInit, OnDestroy, CanCo
this.manifestChanged = false;

this.state = 'creating';
const manifestText = this.manifestDagEditor.manifestTextCurrent;
const manifestText = this.manifestDagEditor.rawManifest;

this.workflowTemplateServiceService
.createWorkflowTemplate(this.namespace, {
name: templateName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export class WorkflowTemplateEditComponent implements OnInit, CanComponentDeacti
return;
}

const manifestText = this.manifestDagEditor.manifestTextCurrent;
const manifestText = this.manifestDagEditor.rawManifest;

this.saving = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { CronWorkflowFormatter } from '../../cron-workflow/models';
import * as yaml from 'js-yaml';
import { Alert } from '../../alert/alert';
import { AppRouter } from '../../router/app-router.service';
import { ParameterUtils } from '../../parameters/models';

export interface WorkflowExecuteDialogData {
namespace: string;
Expand All @@ -24,16 +25,6 @@ type WorkflowExecutionState = 'loading' | 'ready' | 'creating';
styleUrls: ['./workflow-execute-dialog.component.scss']
})
export class WorkflowExecuteDialogComponent implements OnInit, OnDestroy {
state: WorkflowExecutionState = 'loading';

alert: Alert;
namespace = '';
workflowTemplates: WorkflowTemplate[] = [];

selectedWorkflowTemplateUid = '';

// tslint:disable-next-line:variable-name
private _selectedTemplate: WorkflowTemplate;
set selectedTemplate(value: WorkflowTemplate) {
this.selectedWorkflowTemplateUid = value.uid;
this._selectedTemplate = value;
Expand All @@ -44,18 +35,10 @@ export class WorkflowExecuteDialogComponent implements OnInit, OnDestroy {
this.parameters = [];
}
}

get selectedTemplate(): WorkflowTemplate {
return this._selectedTemplate;
}

@ViewChild(FormComponent, {static: false}) form: FormComponent;

showCron = false;
parameters: Array<Parameter> = [];
labels = new Array<KeyValue>();
schedulingText: string = CronWorkflowFormatter.toYamlString({}, true);

constructor(
private appRouter: AppRouter,
private workflowTemplateSerivce: WorkflowTemplateServiceService,
Expand All @@ -81,9 +64,26 @@ export class WorkflowExecuteDialogComponent implements OnInit, OnDestroy {

// Parameters are set after setting workflow template to override any parameters it has
if (data.parameters) {
this.parameters = data.parameters;
this.updateParameterValues(data.parameters);
}
}
state: WorkflowExecutionState = 'loading';

alert: Alert;
namespace = '';
workflowTemplates: WorkflowTemplate[] = [];

selectedWorkflowTemplateUid = '';

@ViewChild(FormComponent, {static: false}) form: FormComponent;

showCron = false;
parameters: Array<Parameter> = [];
labels = new Array<KeyValue>();
schedulingText: string = CronWorkflowFormatter.toYamlString({}, true);

// tslint:disable-next-line:variable-name
private _selectedTemplate: WorkflowTemplate;

public static pluckParameters(manifest) {
const res = yaml.safeLoad(manifest);
Expand All @@ -100,6 +100,10 @@ export class WorkflowExecuteDialogComponent implements OnInit, OnDestroy {
return parameters;
}

updateParameterValues(parameters: Parameter[]) {
this.parameters = ParameterUtils.combineValueAndTemplate(parameters, this.parameters);
}

ngOnInit() {
}

Expand Down