create resources with _type as type

This commit is contained in:
Nancy Butler 2020-01-31 11:59:33 -07:00
parent 38f7b7a360
commit 1dea6553b2
4 changed files with 31 additions and 18 deletions

View File

@ -131,10 +131,11 @@ export const AGE = {
export const CREATED = {
name: 'created',
label: 'Created',
value: 'created',
value: 'metadata.creationTimestamp',
sort: ['created', 'name'],
search: false,
formatter: 'LiveDate',
align: 'right'
};
export const IMAGE = {

View File

@ -29,13 +29,17 @@ export default {
dockerRows() {
const auths = JSON.parse(this.dataRows[0].value).auths;
const rows = [];
const address = Object.keys(auths)[0];
const { username, url } = auths[address];
for (const address in auths) {
rows.push({
address,
username: auths[address].username,
password: auths[address].password
});
}
return [{
address, username, url
}];
return rows;
},
dockerHeaders() {
@ -53,14 +57,6 @@ export default {
}
];
if (this.dockerRows[0].url) {
headers.push({
name: 'url',
label: 'url(for artifactory/custom)',
value: 'url'
});
}
return headers;
},

View File

@ -1,6 +1,6 @@
<script>
import { DOCKER_JSON, OPAQUE, TLS } from '@/models/core.v1.secret';
import { base64Encode } from '@/utils/crypto';
import { base64Encode, base64Decode } from '@/utils/crypto';
import { get } from '@/utils/object';
import { ANNOTATION, NAMESPACE } from '@/config/types';
import CreateEditView from '@/mixins/create-edit-view';
@ -34,15 +34,30 @@ export default {
];
const isNamespaced = !!this.value.metadata.namespace;
let username;
let password;
let registryFQDN;
if (this.value._type === DOCKER_JSON) {
const json = base64Decode(this.value.data['.dockerconfigjson']);
const { auths } = JSON.parse(json);
registryFQDN = Object.keys(auths)[0];
username = auths[registryFQDN].username;
password = auths[registryFQDN].password;
}
return {
types,
isNamespaced,
registryAddresses,
newNS: false,
registryProvider: registryAddresses[0],
username: '',
password: '',
registryFQDN: null,
username,
password,
registryFQDN,
toUpload: null,
key: null,
cert: null

View File

@ -458,6 +458,7 @@ export default {
opt.headers['accept'] = 'application/json';
}
this.type = this._type;
opt.data = this;
const res = await this.$dispatch('request', opt);