Skip to content

Commit 6c4b579

Browse files
authored
Block protected b label from configs (#303)
* Block protected b label from configs * Change default to false
1 parent 2878060 commit 6c4b579

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

frontend/jupyter/src/app/pages/form/form-new/form-configurations/form-configurations.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { JWABackendService } from 'src/app/services/backend.service';
1313
export class FormConfigurationsComponent implements OnInit, OnDestroy {
1414
podDefaults: PodDefault[];
1515
subscriptions = new Subscription();
16-
isVisible = true;
16+
isVisible = false; //Hidding the configuration by default
1717
@Input() parentForm: FormGroup;
1818

1919
constructor(public ns: NamespaceService, public backend: JWABackendService) {}
@@ -24,6 +24,8 @@ export class FormConfigurationsComponent implements OnInit, OnDestroy {
2424
// Get the PodDefaults of the new Namespace
2525
this.backend.getPodDefaults(namespace).subscribe(pds => {
2626
this.podDefaults = pds;
27+
// If a poddefault exists, display configuration
28+
// Note: poddefault.go handles removing protected B from the list
2729
this.isVisible = this.podDefaults.length > 0;
2830
});
2931
});

poddefaults.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,16 @@ func (s *server) GetPodDefaults(w http.ResponseWriter, r *http.Request) {
4848
desc = pd.Name
4949
}
5050

51-
resp.PodDefaults = append(resp.PodDefaults, poddefaultresponse{
52-
PodDefault: *pd,
53-
Label: reflect.ValueOf(pd.Spec.Selector.MatchLabels).MapKeys()[0].String(),
54-
Description: desc,
55-
})
51+
// Ignore the protected-b poddefault
52+
labelMapped := reflect.ValueOf(pd.Spec.Selector.MatchLabels).MapKeys()[0].String()
53+
54+
if labelMapped != "notebook.statcan.gc.ca/protected-b" {
55+
resp.PodDefaults = append(resp.PodDefaults, poddefaultresponse{
56+
PodDefault: *pd,
57+
Label: labelMapped,
58+
Description: desc,
59+
})
60+
}
5661
}
5762

5863
s.respond(w, r, resp)

0 commit comments

Comments
 (0)