mirror of https://github.com/rancher/ui.git
68 lines
1.7 KiB
JavaScript
68 lines
1.7 KiB
JavaScript
const DEFAULT_REGISTRY = 'index.docker.io';
|
|
|
|
export function analyzeImageRepo (images) {
|
|
if(!images){
|
|
return '';
|
|
}
|
|
let output = {
|
|
registry: DEFAULT_REGISTRY,
|
|
repository: '',
|
|
tag: ''
|
|
};
|
|
var splited = images.split('/');
|
|
if(splited.length < 2){
|
|
output.registry = DEFAULT_REGISTRY;
|
|
let repoAndTag = splited[0].split(':');
|
|
output.repository = repoAndTag[0];
|
|
output.tag = repoAndTag[1]||'latest';
|
|
}
|
|
else {
|
|
if(splited[0].indexOf('.')!==-1){
|
|
output.registry = splited[0]
|
|
}
|
|
let repoAndTag = splited[splited.length-1].split(':');
|
|
let repo = '';
|
|
for (var i = 0; i < splited.length-1; i++) {
|
|
let item = splited[i];
|
|
if(item.indexOf('.')===-1){
|
|
repo += item + '/';
|
|
}
|
|
}
|
|
repo+=repoAndTag[0];
|
|
output.repository = repo;
|
|
output.tag = repoAndTag[1]||'latest';
|
|
}
|
|
|
|
return output;
|
|
}
|
|
|
|
export const environmentTypes = [{
|
|
label: 'C',
|
|
value: 'gcc:latest',
|
|
shell: 'make',
|
|
version: [{value:'1.1',label:'1.1'}, {value:'latest',label:'latest'}]
|
|
}, {
|
|
label: 'PHP',
|
|
value: 'php:latest',
|
|
shell: 'phpunit —configuration phpunit_conf.xml —coverage-text',
|
|
version: [{value:'1.1',label:'1.1'}, {value:'latest',label:'latest'}]
|
|
}, {
|
|
label: 'Go',
|
|
value: 'golang:latest',
|
|
shell: 'go test',
|
|
version: [{value:'1.1',label:'1.1'}, {value:'latest',label:'latest'}]
|
|
}, {
|
|
label: 'Java',
|
|
value: 'java:latest',
|
|
shell: 'javac',
|
|
version: [{value:'1.1',label:'1.1'}, {value:'latest',label:'latest'}]
|
|
}, {
|
|
label: 'NodeJs',
|
|
value: 'node:latest',
|
|
shell: 'npm install',
|
|
version: [{value:'1.1',label:'1.1'}, {value:'latest',label:'latest'}]
|
|
},{
|
|
label: 'custom',
|
|
value: '',
|
|
shell: '',
|
|
}]; |