Uplift airshipctl reference in airshipui

Bring airship UI's airshipctl reference up to date to pull in
recent changes.

Still TODO:
- Refactor phase.go on the backend to take advantage of
  caching and lazy loading to try to offset performance hit
  from ctl's calls to docker
- Introduce a few more loading indicators in phase viewer
  since load times are longer

Change-Id: I121191674508e2d5c8524747696f17ea073ab8da
This commit is contained in:
Matthew Fuller 2020-11-12 23:06:04 +00:00
parent b20f7feba4
commit 1de746fa77
8 changed files with 46 additions and 89 deletions

View File

@ -4,7 +4,6 @@
<mat-card class="phase-tree-card">
<mat-card-header>
<mat-card-title>Phases</mat-card-title>
<mat-card-subtitle>Target: {{targetPath}}</mat-card-subtitle>
</mat-card-header>
<mat-progress-bar *ngIf="loading" mode="indeterminate"></mat-progress-bar>
<mat-card-content class="phase-card-content">

View File

@ -43,7 +43,6 @@ export class PhaseComponent implements WsReceiver {
component = WsConstants.PHASE;
activeLink = 'overview';
targetPath: string;
phaseTree: KustomNode[] = [];
treeControl = new NestedTreeControl<KustomNode>(node => node.children);
@ -56,7 +55,6 @@ export class PhaseComponent implements WsReceiver {
editorOptions = {language: 'yaml', automaticLayout: true, value: '', theme: 'airshipTheme'};
code: string;
editorTitle: string;
editorSubtitle: string;
hasChild = (_: number, node: KustomNode) => !!node.children && node.children.length > 0;
@ -68,7 +66,6 @@ export class PhaseComponent implements WsReceiver {
constructor(private websocketService: WsService, public dialog: MatDialog) {
this.websocketService.registerFunctions(this);
this.getTarget();
this.getPhaseTree(); // load the source first
}
@ -81,9 +78,6 @@ export class PhaseComponent implements WsReceiver {
}
} else {
switch (message.subComponent) {
case WsConstants.GET_TARGET:
this.targetPath = message.message;
break;
case WsConstants.GET_PHASE_TREE:
this.handleGetPhaseTree(message.data);
break;
@ -152,7 +146,7 @@ export class PhaseComponent implements WsReceiver {
this.phaseViewerRef.componentInstance.yaml = atob(message.yaml);
} else {
this.changeEditorContents((message.yaml));
this.setTitle(message.name);
this.editorTitle = message.name;
this.showEditor = true;
this.currentDocId = message.id;
}
@ -160,17 +154,11 @@ export class PhaseComponent implements WsReceiver {
handleYamlWrite(message: WsMessage): void {
this.changeEditorContents((message.yaml));
this.setTitle(message.name);
this.editorTitle = message.name;
this.currentDocId = message.id;
this.websocketService.printIfToast(message);
}
setTitle(name: string): void {
this.editorSubtitle = name;
const str = name.split('/');
this.editorTitle = str[str.length - 1];
}
changeEditorContents(yaml: string): void {
this.code = atob(yaml);
}
@ -245,7 +233,7 @@ export class PhaseComponent implements WsReceiver {
}
getExecutorDoc(id: object): void {
const msg = this.newMessage(WsConstants.GET_DOCUMENT_BY_SELECTOR);
const msg = this.newMessage(WsConstants.GET_EXECUTOR_DOC);
msg.id = JSON.stringify(id);
this.websocketService.sendMessage(msg);
}
@ -255,11 +243,6 @@ export class PhaseComponent implements WsReceiver {
this.showEditor = false;
}
getTarget(): void {
const websocketMessage = this.newMessage(WsConstants.GET_TARGET);
this.websocketService.sendMessage(websocketMessage);
}
// TODO(mfuller): we'll probably want to run / check phase validation
// before actually running the phase
runPhase(node: KustomNode, opts: RunOptions): void {

2
go.mod
View File

@ -10,7 +10,7 @@ require (
github.com/pkg/errors v0.9.1
github.com/spf13/cobra v1.0.0
github.com/stretchr/testify v1.6.1
opendev.org/airship/airshipctl v0.0.0-20201021221027-46a0a79066d3
opendev.org/airship/airshipctl v0.0.0-20201111150845-f2e305a56df7
sigs.k8s.io/cli-utils v0.20.6
sigs.k8s.io/kustomize/api v0.5.1
)

16
go.sum
View File

@ -294,6 +294,7 @@ github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJA
github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d h1:3PaI8p3seN09VjbTYC/QWlUZdZ1qS1zGjy7LH2Wt07I=
github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
@ -355,6 +356,7 @@ github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+u
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
@ -432,6 +434,7 @@ github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22
github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.8 h1:QiWkFLKq0T7mpzwOTu6BzNDbfTE8OLrYhVKYMLF46Ok=
github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@ -798,6 +801,7 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrS
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@ -858,6 +862,7 @@ golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 h1:SvFZT6jyqRaOeXpc5h/JSfZenJ2O330aBsf7JfSUXmQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqGHIWVuyCkGJLwGh9JJFs=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@ -911,6 +916,7 @@ google.golang.org/api v0.9.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEn
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.6.1 h1:QzqyMA1tlu6CgqCDUtU9V+ZKhLFT2dkJuANu5QaxI3I=
google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0=
google.golang.org/appengine v1.6.6 h1:lMO5rYAqUxkmaj76jAkRUvt5JZgFymx/+Q5Mzfivuhc=
google.golang.org/appengine v1.6.6/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc=
@ -986,6 +992,7 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt
k8s.io/api v0.0.0-20190918155943-95b840bb6a1f/go.mod h1:uWuOHnjmNrtQomJrvEBg0c0HRNyQ+8KTEERVsK0PW48=
k8s.io/api v0.0.0-20191214185829-ca1d04f8b0d3/go.mod h1:itOjKREfmUTvcjantxOsyYU5mbFsU7qUnyUuRfF5+5M=
k8s.io/api v0.17.0/go.mod h1:npsyOePkeP0CPwyGfXDHxvypiYMJxBWAMpQxCaJ4ZxI=
k8s.io/api v0.17.2 h1:NF1UFXcKN7/OOv1uxdRz3qfra8AHsPav5M93hlV9+Dc=
k8s.io/api v0.17.2/go.mod h1:BS9fjjLc4CMuqfSO8vgbHPKMt5+SF0ET6u/RVDihTo4=
k8s.io/api v0.17.4 h1:HbwOhDapkguO8lTAE8OX3hdF2qp8GtpC9CW/MQATXXo=
k8s.io/api v0.17.4/go.mod h1:5qxx6vjmwUVG2nHQTKGlLts8Tbok8PzHl4vHtVFuZCA=
@ -999,6 +1006,7 @@ k8s.io/apimachinery v0.0.0-20190913080033-27d36303b655/go.mod h1:nL6pwRT8NgfF8TT
k8s.io/apimachinery v0.0.0-20191214185652-442f8fb2f03a/go.mod h1:Ng1IY8TS7sC44KJxT/WUR6qFRfWwahYYYpNXyYRKOCY=
k8s.io/apimachinery v0.0.0-20191216025728-0ee8b4573e3a/go.mod h1:Ng1IY8TS7sC44KJxT/WUR6qFRfWwahYYYpNXyYRKOCY=
k8s.io/apimachinery v0.17.0/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
k8s.io/apimachinery v0.17.2 h1:hwDQQFbdRlpnnsR64Asdi55GyCaIP/3WQpMmbNBeWr4=
k8s.io/apimachinery v0.17.2/go.mod h1:b9qmWdKlLuU9EBh+06BtLcSf/Mu89rWL33naRxs1uZg=
k8s.io/apimachinery v0.17.4 h1:UzM+38cPUJnzqSQ+E1PY4YxMHIzQyCg29LOoGfo79Zw=
k8s.io/apimachinery v0.17.4/go.mod h1:gxLnyZcGNdZTCLnq3fgzyg2A5BVCHTNDFrw8AmuJ+0g=
@ -1008,6 +1016,7 @@ k8s.io/apiserver v0.0.0-20190918160949-bfa5e2e684ad/go.mod h1:XPCXEwhjaFN29a8Nld
k8s.io/apiserver v0.17.2/go.mod h1:lBmw/TtQdtxvrTk0e2cgtOxHizXI+d0mmGQURIHQZlo=
k8s.io/apiserver v0.17.9/go.mod h1:Qaxd3EbeoPRBHVMtFyuKNAObqP6VAkzIMyWYz8KuE2k=
k8s.io/cli-runtime v0.0.0-20191214191754-e6dc6d5c8724/go.mod h1:wzlq80lvjgHW9if6MlE4OIGC86MDKsy5jtl9nxz/IYY=
k8s.io/cli-runtime v0.17.2 h1:YH4txSplyGudvxjhAJeHEtXc7Tr/16clKGfN076ydGk=
k8s.io/cli-runtime v0.17.2/go.mod h1:aa8t9ziyQdbkuizkNLAw3qe3srSyWh9zlSB7zTqRNPI=
k8s.io/cli-runtime v0.17.4 h1:ZIJdxpBEszZqUhydrCoiI5rLXS2J/1AF5xFok2QJ9bc=
k8s.io/cli-runtime v0.17.4/go.mod h1:IVW4zrKKx/8gBgNNkhiUIc7nZbVVNhc1+HcQh+PiNHc=
@ -1015,6 +1024,7 @@ k8s.io/client-go v0.0.0-20190918160344-1fbdaa4c8d90/go.mod h1:J69/JveO6XESwVgG53
k8s.io/client-go v0.0.0-20191214190045-a32a6f7a3052/go.mod h1:tAaoc/sYuIL0+njJefSAmE28CIcxyaFV4kbIujBlY2s=
k8s.io/client-go v0.0.0-20191219150334-0b8da7416048/go.mod h1:ZEe8ZASDUAuqVGJ+UN0ka0PfaR+b6a6E1PGsSNZRui8=
k8s.io/client-go v0.17.0/go.mod h1:TYgR6EUHs6k45hb6KWjVD6jFZvJV4gHDikv/It0xz+k=
k8s.io/client-go v0.17.2 h1:ndIfkfXEGrNhLIgkr0+qhRguSD3u6DCmonepn1O6NYc=
k8s.io/client-go v0.17.2/go.mod h1:QAzRgsa0C2xl4/eVpeVAZMvikCn8Nm81yqVx3Kk9XYI=
k8s.io/client-go v0.17.4/go.mod h1:ouF6o5pz3is8qU0/qYL2RnoxOPqgfuidYLowytyLJmc=
k8s.io/client-go v0.17.9 h1:qUPhohX4bUBx0L7pfye02aPnu3PQ0t+B8dqHfGvt++k=
@ -1040,6 +1050,7 @@ k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
k8s.io/klog/v2 v2.0.0 h1:Foj74zO6RbjjP4hBEKjnYtjjAhGg4jNynUdYF6fJrok=
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
k8s.io/kube-openapi v0.0.0-20190816220812-743ec37842bf/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a h1:UcxjrRMyNx/i/y8G7kPvLyy7rfbeuf1PYyBf973pgyU=
k8s.io/kube-openapi v0.0.0-20191107075043-30be4d16710a/go.mod h1:1TqjTSzOxsLGIKfj0lK8EeCP7K1iUG65v09OM0/WG5E=
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29 h1:NeQXVJ2XFSkRoPzRo8AId01ZER+j8oV4SZADT4iBOXQ=
k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29/go.mod h1:F+5wygcW0wmRTnM3cOgIqGivxkwSWIWT5YdsDbeAOaU=
@ -1047,6 +1058,7 @@ k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd h1:nZX5+wEqTu/EBIYjrZlFOA63z4+
k8s.io/kubectl v0.0.0-20191219154910-1528d4eea6dd/go.mod h1:9ehGcuUGjXVZh0qbYSB0vvofQw2JQe6c6cO0k4wu/Oo=
k8s.io/metrics v0.0.0-20191214191643-6b1944c9f765/go.mod h1:5V7rewilItwK0cz4nomU0b3XCcees2Ka5EBYWS1HBeM=
k8s.io/utils v0.0.0-20190801114015-581e00157fb1/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f h1:GiPwtSzdP43eI1hpPCbROQCCIgCuiMMNF8YUVLF3vJo=
k8s.io/utils v0.0.0-20191114184206-e782cd3c129f/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew=
k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19 h1:7Nu2dTj82c6IaWvL7hImJzcXoTPz1MsSCH7r+0m6rfo=
k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
@ -1058,8 +1070,8 @@ modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=
mvdan.cc/unparam v0.0.0-20190720180237-d51796306d8f/go.mod h1:4G1h5nDURzA3bwVMZIVpwbkw+04kSxk3rAtzlimaUJw=
opendev.org/airship/airshipctl v0.0.0-20201021221027-46a0a79066d3 h1:aqscOCgADezXB7gwOhtKfn8v1mas4vAxzrHwfcptFxA=
opendev.org/airship/airshipctl v0.0.0-20201021221027-46a0a79066d3/go.mod h1:qnuSTEEmInUS+zk7fMvNeDEloiTqlHlRsEmWFXlT+pU=
opendev.org/airship/airshipctl v0.0.0-20201111150845-f2e305a56df7 h1:dcznVahv2IeR+VF88zRfgz6VTiUlDMIx+jVKEUvIVYE=
opendev.org/airship/airshipctl v0.0.0-20201111150845-f2e305a56df7/go.mod h1:qnuSTEEmInUS+zk7fMvNeDEloiTqlHlRsEmWFXlT+pU=
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a h1:4ggAMTwpfu/w3ZXOIJ9tfYF37JIYn+eNCA4O10NduZ0=
opendev.org/airship/go-redfish v0.0.0-20200318103738-db034d1d753a/go.mod h1:FEjYcb3bYBWGpQIqtvVM0NrT5eyjlCOCj5JNf4lI+6s=
opendev.org/airship/go-redfish/client v0.0.0-20200318103738-db034d1d753a h1:S1dmsP5Cc6OQjAd6OgIKMcNPBiGjh5TDbijVjNE/VGU=

View File

@ -178,7 +178,6 @@ const (
GetYaml WsSubComponentType = "getYaml"
GetRendered WsSubComponentType = "getRendered"
GetPhaseTree WsSubComponentType = "getPhaseTree"
GetTarget WsSubComponentType = "getTarget"
GetPhaseSourceFiles WsSubComponentType = "getPhaseSource"
GetDocumentsBySelector WsSubComponentType = "getDocumentsBySelector"
GetPhase WsSubComponentType = "getPhase"

View File

@ -15,6 +15,7 @@
package ctl
import (
"context"
"errors"
"fmt"
"strings"
@ -230,15 +231,18 @@ func actionHelper(user *string, target string, phase string, request configs.WsM
}
host := m.Hosts[0]
ctx := context.Background()
switch action {
case configs.EjectMedia:
err = host.EjectVirtualMedia(host.Context)
err = host.EjectVirtualMedia(ctx)
case configs.PowerOff:
err = host.SystemPowerOff(host.Context)
err = host.SystemPowerOff(ctx)
case configs.PowerOn:
err = host.SystemPowerOn(host.Context)
err = host.SystemPowerOn(ctx)
case configs.Reboot:
err = host.RebootSystem(host.Context)
err = host.RebootSystem(ctx)
}
if err != nil {

View File

@ -85,8 +85,6 @@ func HandlePhaseRequest(user *string, request configs.WsMessage) configs.WsMessa
case configs.GetDocumentsBySelector:
message = request.Message
response.Data, err = GetDocumentsBySelector(request.ID, *message)
case configs.GetTarget:
message = client.getTarget()
case configs.GetExecutorDoc:
s := "rendered"
message = &s
@ -144,18 +142,6 @@ func (c *Client) GetExecutorDoc(id string) (string, string, error) {
return title, base64.StdEncoding.EncodeToString(bytes), nil
}
func (c *Client) getTarget() *string {
var s string
m, err := c.Config.CurrentContextManifest()
if err != nil {
s = "unknown"
return &s
}
s = filepath.Join(m.TargetPath, m.SubPath)
return &s
}
func (c *Client) getPhaseDetails(id ifc.ID) (string, error) {
helper, err := getHelper()
if err != nil {
@ -205,23 +191,7 @@ func (c *Client) getFileYaml(id string) (string, string, error) {
return "", "", fmt.Errorf("file with ID '%s' not found", id)
}
ccm, err := c.Config.CurrentContextManifest()
if err != nil {
return "", "", err
}
// this is making the assumption that the site definition
// will always found at: targetPath/subPath
sitePath := filepath.Join(ccm.TargetPath, ccm.SubPath)
// TODO(mfuller): will this be true in treasuremap or
// other external repos?
manifestsDir := filepath.Join(sitePath, "..", "..")
title, err := filepath.Rel(manifestsDir, path)
if err != nil {
return "", "", err
}
_, title := filepath.Split(path)
file, err := os.Open(path)
if err != nil {

View File

@ -317,43 +317,33 @@ func makeResMap(kfile string) (map[string][]string, error) {
basedir := filepath.Dir(kfile)
if len(k.Resources) > 0 {
for _, p := range k.Resources {
path := filepath.Join(basedir, p)
resMap["Resources"] = append(resMap["Resources"], path)
for _, p := range k.Resources {
path := filepath.Join(basedir, p)
resMap["Resources"] = append(resMap["Resources"], path)
}
for _, p := range k.ConfigMapGenerator {
for _, s := range p.FileSources {
path := filepath.Join(basedir, s)
resMap["ConfigMapGenerator"] = append(resMap["ConfigMapGenerator"], path)
}
}
if len(k.ConfigMapGenerator) > 0 {
for _, p := range k.ConfigMapGenerator {
for _, s := range p.FileSources {
path := filepath.Join(basedir, s)
resMap["ConfigMapGenerator"] = append(resMap["ConfigMapGenerator"], path)
}
for _, p := range k.SecretGenerator {
for _, s := range p.FileSources {
path := filepath.Join(basedir, s)
resMap["SecretGenerator"] = append(resMap["SecretGenerator"], path)
}
}
if len(k.SecretGenerator) > 0 {
for _, p := range k.SecretGenerator {
for _, s := range p.FileSources {
path := filepath.Join(basedir, s)
resMap["SecretGenerator"] = append(resMap["SecretGenerator"], path)
}
}
for _, p := range k.Generators {
path := filepath.Join(basedir, p)
resMap["Generators"] = append(resMap["Generators"], path)
}
if len(k.Generators) > 0 {
for _, p := range k.Generators {
path := filepath.Join(basedir, p)
resMap["Generators"] = append(resMap["Generators"], path)
}
}
if len(k.Transformers) > 0 {
for _, p := range k.Transformers {
path := filepath.Join(basedir, p)
resMap["Transformers"] = append(resMap["Transformers"], path)
}
for _, p := range k.Transformers {
path := filepath.Join(basedir, p)
resMap["Transformers"] = append(resMap["Transformers"], path)
}
return resMap, nil